summaryrefslogtreecommitdiffstats
path: root/knetworkmanager-0.8/src
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-10-17 17:38:53 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-10-17 17:38:53 +0000
commit1e0dd58661c9097fb41218ee7e3515f2d8ba8dac (patch)
treea263b4ad0c1f7fba6013f5d9854db4cb4962df82 /knetworkmanager-0.8/src
downloadknetworkmanager8-1e0dd58661c9097fb41218ee7e3515f2d8ba8dac.tar.gz
knetworkmanager8-1e0dd58661c9097fb41218ee7e3515f2d8ba8dac.zip
Add dead-ended knetworkmanager 0.8 source
Add copy of same for knetworkmanager 0.9 starting point git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knetworkmanager8@1259314 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'knetworkmanager-0.8/src')
-rw-r--r--knetworkmanager-0.8/src/CMakeLists.txt93
-rw-r--r--knetworkmanager-0.8/src/Makefile.am220
-rw-r--r--knetworkmanager-0.8/src/connection_editor.ui123
-rw-r--r--knetworkmanager-0.8/src/connection_setting_cdma.ui131
-rw-r--r--knetworkmanager-0.8/src/connection_setting_gsm.ui294
-rw-r--r--knetworkmanager-0.8/src/connection_setting_info.ui71
-rw-r--r--knetworkmanager-0.8/src/connection_setting_ipv4.ui116
-rw-r--r--knetworkmanager-0.8/src/connection_setting_ppp.ui320
-rw-r--r--knetworkmanager-0.8/src/connection_setting_serial.ui185
-rw-r--r--knetworkmanager-0.8/src/connection_setting_vpn.ui51
-rw-r--r--knetworkmanager-0.8/src/connection_setting_wireless.ui140
-rw-r--r--knetworkmanager-0.8/src/connection_setting_wireless_security.ui87
-rw-r--r--knetworkmanager-0.8/src/connection_setting_wireless_security_auth.ui51
-rw-r--r--knetworkmanager-0.8/src/connection_setting_wireless_security_eap.ui163
-rw-r--r--knetworkmanager-0.8/src/connection_setting_wireless_security_phase2.ui54
-rw-r--r--knetworkmanager-0.8/src/connection_setting_wireless_security_wep.ui146
-rw-r--r--knetworkmanager-0.8/src/connection_setting_wireless_security_wepencryption.ui46
-rw-r--r--knetworkmanager-0.8/src/connection_setting_wireless_security_wpacipher.ui128
-rw-r--r--knetworkmanager-0.8/src/connection_setting_wireless_security_wpapsk.ui46
-rw-r--r--knetworkmanager-0.8/src/connection_setting_wireless_security_wpaversion.ui80
-rw-r--r--knetworkmanager-0.8/src/connection_settings.ui137
-rw-r--r--knetworkmanager-0.8/src/dbus/CMakeLists.txt88
-rw-r--r--knetworkmanager-0.8/src/dbus/Makefile.am129
-rw-r--r--knetworkmanager-0.8/src/devicetraycomponent.cpp133
-rw-r--r--knetworkmanager-0.8/src/devicetraycomponent.h63
-rw-r--r--knetworkmanager-0.8/src/eventsrc315
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-accesspoint.cpp222
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-accesspoint.h75
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-cdma_connection.cpp61
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-cdma_connection.h50
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-cdma_device.cpp67
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-cdma_device.h51
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-cellular_device.cpp37
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-cellular_device.h40
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-cellular_device_tray.cpp184
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-cellular_device_tray.h55
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection.cpp299
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection.h133
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_dbus.cpp200
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_dbus.h77
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_editor.cpp250
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_editor.h67
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_secrets_dbus.cpp230
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_secrets_dbus.h76
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting.cpp106
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting.h94
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_8021x.cpp380
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_8021x.h195
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_cdma.cpp138
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_cdma.h75
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_cdma_widget.cpp89
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_cdma_widget.h67
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_gsm.cpp251
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_gsm.h99
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_gsm_widget.cpp108
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_gsm_widget.h67
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_info.cpp163
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_info.h79
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_info_widget.cpp79
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_info_widget.h65
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_ipv4.cpp318
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_ipv4.h112
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_ipv4_widget.cpp175
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_ipv4_widget.h65
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_ppp.cpp376
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_ppp.h136
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_ppp_widget.cpp130
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_ppp_widget.h65
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_serial.cpp168
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_serial.h89
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_serial_widget.cpp97
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_serial_widget.h65
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_vpn.cpp206
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_vpn.h83
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_vpn_widget.cpp206
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_vpn_widget.h69
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_widget_interface.cpp37
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_widget_interface.h47
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_wired.cpp99
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_wired.h62
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless.cpp220
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless.h97
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_security.cpp451
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_security.h156
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_security_widget.cpp999
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_security_widget.h238
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_widget.cpp231
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_widget.h71
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_settings_dialog.cpp530
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_settings_dialog.h86
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_store.cpp191
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-connection_store.h88
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-device.cpp166
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-device.h74
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-device_tray.cpp337
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-device_tray.h90
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-devicestore.cpp220
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-devicestore.h65
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-generic_connection.cpp91
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-generic_connection.h58
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-gsm_connection.cpp60
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-gsm_connection.h50
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-gsm_device.cpp67
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-gsm_device.h51
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-hal_device_proxy.cpp126
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-hal_device_proxy.h65
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-menu_subhead.cpp76
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-menu_subhead.h56
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-menuitem.cpp140
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-menuitem.h54
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-nm_proxy.cpp329
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-nm_proxy.h62
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-nm_vpn_proxy.cpp81
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-nm_vpn_proxy.h52
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-nmsettings.cpp162
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-nmsettings.h77
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-plugin.cpp38
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-plugin.h39
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-pluginmanager.cpp184
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-pluginmanager.h67
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-ppp_connection.cpp54
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-ppp_connection.h51
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-storage.cpp634
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-storage.h101
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-tray.cpp1127
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-tray.h140
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-vpn_connection.cpp85
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-vpn_connection.h54
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-vpn_device.cpp75
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-vpn_device.h53
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-vpn_plugin.cpp132
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-vpn_plugin.h62
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-vpnauthenticationdialog.cpp179
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-vpnauthenticationdialog.h69
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-vpnmanager.cpp107
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-vpnmanager.h53
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-vpnplugin.cpp128
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-vpnplugin.h79
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-vpnservice.cpp123
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-vpnservice.h63
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wired_connection.cpp84
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wired_connection.h55
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wired_device.cpp86
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wired_device.h55
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wired_device_tray.cpp162
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wired_device_tray.h57
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wireless_connection.cpp94
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wireless_connection.h59
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wireless_device.cpp207
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wireless_device.h70
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wireless_device_tray.cpp391
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wireless_device_tray.h82
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wireless_manager.cpp179
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wireless_manager.h62
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wireless_menuitem.cpp238
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wireless_menuitem.h88
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wireless_network.cpp179
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager-wireless_network.h96
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager.cpp142
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager.desktop47
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager.h57
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager.la.cpp2
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager_dummy.cpp3
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager_plugin.desktop31
-rw-r--r--knetworkmanager-0.8/src/knetworkmanager_vpnplugin.desktop33
-rw-r--r--knetworkmanager-0.8/src/main.cpp64
-rw-r--r--knetworkmanager-0.8/src/md5.cpp292
-rw-r--r--knetworkmanager-0.8/src/md5.h22
-rw-r--r--knetworkmanager-0.8/src/qbidirectionalmap.h47
-rw-r--r--knetworkmanager-0.8/src/secret_storage_plugin.cpp54
-rw-r--r--knetworkmanager-0.8/src/secret_storage_plugin.h53
-rw-r--r--knetworkmanager-0.8/src/settings.kcfgc6
-rw-r--r--knetworkmanager-0.8/src/sha1.cpp684
-rw-r--r--knetworkmanager-0.8/src/sha1.h34
-rw-r--r--knetworkmanager-0.8/src/traycomponent.cpp46
-rw-r--r--knetworkmanager-0.8/src/traycomponent.h49
-rw-r--r--knetworkmanager-0.8/src/vpn_tray_component.cpp150
-rw-r--r--knetworkmanager-0.8/src/vpn_tray_component.h50
-rw-r--r--knetworkmanager-0.8/src/vpnauthentication.ui149
-rw-r--r--knetworkmanager-0.8/src/xmlmarshaller.cpp1109
-rw-r--r--knetworkmanager-0.8/src/xmlmarshaller.h42
181 files changed, 25318 insertions, 0 deletions
diff --git a/knetworkmanager-0.8/src/CMakeLists.txt b/knetworkmanager-0.8/src/CMakeLists.txt
new file mode 100644
index 0000000..ec1d648
--- /dev/null
+++ b/knetworkmanager-0.8/src/CMakeLists.txt
@@ -0,0 +1,93 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+add_subdirectory( dbus )
+
+add_definitions( -UQT_NO_ASCII_CAST )
+
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}
+ ${TDE_INCLUDE_DIR}
+ ${TQT_INCLUDE_DIRS}
+ ${DBUS_TQT_INCLUDE_DIRS}
+ ${NM_UTIL_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### headers ###################################
+
+install( FILES
+ knetworkmanager-plugin.h knetworkmanager-vpnplugin.h
+ DESTINATION ${INCLUDE_INSTALL_DIR} )
+
+
+##### other data ################################
+
+install( FILES knetworkmanager.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
+install( FILES eventsrc DESTINATION ${DATA_INSTALL_DIR}/knetworkmanager )
+install( FILES knetworkmanager_plugin.desktop knetworkmanager_vpnplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
+
+
+##### knetworkmanager (kdeinit) #################
+
+tde_add_kdeinit_executable( knetworkmanager AUTOMOC
+ SOURCES
+ connection_setting_info.ui connection_setting_wireless_security_wep.ui connection_setting_gsm.ui
+ connection_setting_cdma.ui connection_setting_ipv4.ui connection_setting_ppp.ui
+ connection_setting_serial.ui connection_setting_wireless_security_wpacipher.ui
+ connection_setting_wireless_security_eap.ui connection_setting_wireless_security_wpapsk.ui
+ connection_setting_wireless_security_phase2.ui connection_setting_wireless_security_wpaversion.ui
+ connection_setting_wireless_security.ui connection_setting_wireless.ui
+ connection_setting_wireless_security_wepencryption.ui connection_settings.ui
+ connection_setting_wireless_security_auth.ui connection_setting_vpn.ui connection_editor.ui
+ vpnauthentication.ui main.cpp knetworkmanager.cpp knetworkmanager-tray.cpp
+ knetworkmanager-hal_device_proxy.cpp knetworkmanager-nm_proxy.cpp knetworkmanager-device.cpp
+ knetworkmanager-cdma_device.cpp knetworkmanager-cellular_device.cpp knetworkmanager-gsm_device.cpp
+ knetworkmanager-wired_device.cpp knetworkmanager-vpn_device.cpp knetworkmanager-vpn_plugin.cpp
+ knetworkmanager-wireless_device.cpp knetworkmanager-devicestore.cpp
+ knetworkmanager-cellular_device_tray.cpp knetworkmanager-device_tray.cpp
+ knetworkmanager-wired_device_tray.cpp knetworkmanager-wireless_device_tray.cpp
+ knetworkmanager-accesspoint.cpp knetworkmanager-wireless_menuitem.cpp knetworkmanager-menuitem.cpp
+ knetworkmanager-menu_subhead.cpp knetworkmanager-connection_setting.cpp
+ knetworkmanager-connection_setting_info.cpp knetworkmanager-connection_setting_ipv4.cpp
+ knetworkmanager-connection_setting_wired.cpp knetworkmanager-connection_setting_wireless.cpp
+ knetworkmanager-connection_setting_wireless_security.cpp
+ knetworkmanager-connection_setting_8021x.cpp knetworkmanager-connection_setting_vpn.cpp
+ knetworkmanager-connection_setting_serial.cpp knetworkmanager-connection_setting_cdma.cpp
+ knetworkmanager-connection_setting_gsm.cpp knetworkmanager-connection_setting_ppp.cpp
+ knetworkmanager-connection_dbus.cpp knetworkmanager-connection_secrets_dbus.cpp
+ knetworkmanager-connection.cpp knetworkmanager-generic_connection.cpp
+ knetworkmanager-cdma_connection.cpp knetworkmanager-gsm_connection.cpp
+ knetworkmanager-ppp_connection.cpp knetworkmanager-wireless_connection.cpp
+ knetworkmanager-wired_connection.cpp knetworkmanager-vpn_connection.cpp
+ knetworkmanager-connection_store.cpp knetworkmanager-connection_setting_cdma_widget.cpp
+ knetworkmanager-connection_setting_gsm_widget.cpp
+ knetworkmanager-connection_setting_info_widget.cpp
+ knetworkmanager-connection_setting_ipv4_widget.cpp
+ knetworkmanager-connection_setting_ppp_widget.cpp
+ knetworkmanager-connection_setting_serial_widget.cpp
+ knetworkmanager-connection_setting_wireless_security_widget.cpp
+ knetworkmanager-connection_setting_wireless_widget.cpp
+ knetworkmanager-connection_setting_vpn_widget.cpp knetworkmanager-connection_settings_dialog.cpp
+ knetworkmanager-connection_setting_widget_interface.cpp knetworkmanager-nmsettings.cpp
+ sha1.cpp md5.cpp xmlmarshaller.cpp knetworkmanager-storage.cpp
+ knetworkmanager-wireless_network.cpp knetworkmanager-wireless_manager.cpp
+ knetworkmanager-connection_editor.cpp knetworkmanager-plugin.cpp knetworkmanager-vpnplugin.cpp
+ knetworkmanager-pluginmanager.cpp knetworkmanager-vpnservice.cpp knetworkmanager-vpnmanager.cpp
+ knetworkmanager-vpnauthenticationdialog.cpp devicetraycomponent.cpp traycomponent.cpp
+ vpn_tray_component.cpp secret_storage_plugin.cpp
+ LINK knm_dbus-static kdeui-shared kutils-shared ${DBUS_TQT_LIBRARIES}
+)
diff --git a/knetworkmanager-0.8/src/Makefile.am b/knetworkmanager-0.8/src/Makefile.am
new file mode 100644
index 0000000..3527112
--- /dev/null
+++ b/knetworkmanager-0.8/src/Makefile.am
@@ -0,0 +1,220 @@
+SUBDIRS = dbus
+
+# set the include path for X, qt and KDE
+INCLUDES = $(PACKAGE_CFLAGS) $(all_includes)
+
+# headers to install
+include_HEADERS = knetworkmanager-plugin.h \
+ knetworkmanager-vpnplugin.h
+
+# these are the headers for your project
+noinst_HEADERS = knetworkmanager.h \
+ knetworkmanager-tray.h \
+ knetworkmanager-hal_device_proxy.h \
+ knetworkmanager-nm_proxy.h \
+ knetworkmanager-device.h \
+ knetworkmanager-wired_device.h \
+ knetworkmanager-vpn_device.h \
+ knetworkmanager-vpn_plugin.h \
+ knetworkmanager-gsm_device.h \
+ knetworkmanager-cdma_device.h \
+ knetworkmanager-cellular_device.h \
+ knetworkmanager-wireless_device.h \
+ knetworkmanager-devicestore.h \
+ knetworkmanager-cellular_device_tray.h \
+ knetworkmanager-device_tray.h \
+ knetworkmanager-wired_device_tray.h \
+ knetworkmanager-wireless_device_tray.h \
+ knetworkmanager-accesspoint.h \
+ knetworkmanager-wireless_menuitem.h \
+ knetworkmanager-menuitem.h \
+ knetworkmanager-menu_subhead.h \
+ knetworkmanager-connection_setting.h \
+ knetworkmanager-connection_setting_info.h \
+ knetworkmanager-connection_setting_ipv4.h \
+ knetworkmanager-connection_setting_wired.h \
+ knetworkmanager-connection_setting_wireless.h \
+ knetworkmanager-connection_setting_wireless_security.h \
+ knetworkmanager-connection_setting_8021x.h \
+ knetworkmanager-connection_setting_vpn.h \
+ knetworkmanager-connection_setting_serial.h \
+ knetworkmanager-connection_setting_cdma.h \
+ knetworkmanager-connection_setting_gsm.h \
+ knetworkmanager-connection_setting_ppp.h \
+ knetworkmanager-ppp_connection.h \
+ knetworkmanager-cdma_connection.h \
+ knetworkmanager-gsm_connection.h \
+ knetworkmanager-wired_connection.h \
+ knetworkmanager-vpn_connection.h \
+ knetworkmanager-wireless_connection.h \
+ knetworkmanager-generic_connection.h \
+ knetworkmanager-connection.h \
+ knetworkmanager-connection_dbus.h \
+ knetworkmanager-connection_secrets_dbus.h \
+ knetworkmanager-connection_store.h \
+ knetworkmanager-connection_setting_gsm_widget.h \
+ knetworkmanager-connection_setting_cdma_widget.h \
+ knetworkmanager-connection_setting_info_widget.h \
+ knetworkmanager-connection_setting_ipv4_widget.h \
+ knetworkmanager-connection_setting_ppp_widget.h \
+ knetworkmanager-connection_setting_serial_widget.h \
+ knetworkmanager-connection_setting_widget_interface.h \
+ knetworkmanager-connection_setting_wireless_security_widget.h \
+ knetworkmanager-connection_setting_wireless_widget.h \
+ knetworkmanager-connection_setting_vpn_widget.h \
+ knetworkmanager-connection_setting_widget_interface.h \
+ knetworkmanager-nmsettings.h \
+ sha1.h \
+ md5.h \
+ xmlmarshaller.h \
+ knetworkmanager-storage.h \
+ knetworkmanager-wireless_network.h \
+ knetworkmanager-wireless_manager.h \
+ knetworkmanager-connection_editor.h \
+ knetworkmanager-plugin.h \
+ knetworkmanager-vpnplugin.h \
+ knetworkmanager-pluginmanager.h \
+ knetworkmanager-vpnservice.h \
+ knetworkmanager-vpnmanager.h \
+ knetworkmanager-vpnauthenticationdialog.h \
+ devicetraycomponent.h \
+ traycomponent.h \
+ vpn_tray_component.h \
+ secret_storage_plugin.h
+
+# let automoc handle all of the meta source files (moc)
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/knetworkmanager.pot
+
+#########################################################################
+# APPLICATION SECTION
+#########################################################################
+# this is the program that gets installed. it's name is used for all
+# of the other Makefile.am variables
+bin_PROGRAMS =
+lib_LTLIBRARIES =
+kdeinit_LTLIBRARIES = knetworkmanager.la
+
+KDE_CXXFLAGS = -UQT_NO_ASCII_CAST ${LIBNMUTIL_CFLAGS}
+
+# the application source, library search path, and link libraries
+knetworkmanager_la_SOURCES = connection_setting_info.ui \
+ connection_setting_wireless_security_wep.ui \
+ connection_setting_gsm.ui \
+ connection_setting_cdma.ui \
+ connection_setting_ipv4.ui \
+ connection_setting_ppp.ui \
+ connection_setting_serial.ui \
+ connection_setting_wireless_security_wpacipher.ui \
+ connection_setting_wireless_security_eap.ui \
+ connection_setting_wireless_security_wpapsk.ui \
+ connection_setting_wireless_security_phase2.ui \
+ connection_setting_wireless_security_wpaversion.ui \
+ connection_setting_wireless_security.ui \
+ connection_setting_wireless.ui \
+ connection_setting_wireless_security_wepencryption.ui \
+ connection_settings.ui \
+ connection_setting_wireless_security_auth.ui \
+ connection_setting_vpn.ui \
+ connection_editor.ui \
+ vpnauthentication.ui \
+ main.cpp \
+ knetworkmanager.cpp \
+ knetworkmanager-tray.cpp \
+ knetworkmanager-hal_device_proxy.cpp \
+ knetworkmanager-nm_proxy.cpp \
+ knetworkmanager-device.cpp \
+ knetworkmanager-cdma_device.cpp \
+ knetworkmanager-cellular_device.cpp \
+ knetworkmanager-gsm_device.cpp \
+ knetworkmanager-wired_device.cpp \
+ knetworkmanager-vpn_device.cpp \
+ knetworkmanager-vpn_plugin.cpp \
+ knetworkmanager-wireless_device.cpp \
+ knetworkmanager-devicestore.cpp \
+ knetworkmanager-cellular_device_tray.cpp \
+ knetworkmanager-device_tray.cpp \
+ knetworkmanager-wired_device_tray.cpp \
+ knetworkmanager-wireless_device_tray.cpp \
+ knetworkmanager-accesspoint.cpp \
+ knetworkmanager-wireless_menuitem.cpp \
+ knetworkmanager-menuitem.cpp \
+ knetworkmanager-menu_subhead.cpp \
+ knetworkmanager-connection_setting.cpp \
+ knetworkmanager-connection_setting_info.cpp \
+ knetworkmanager-connection_setting_ipv4.cpp \
+ knetworkmanager-connection_setting_wired.cpp \
+ knetworkmanager-connection_setting_wireless.cpp \
+ knetworkmanager-connection_setting_wireless_security.cpp \
+ knetworkmanager-connection_setting_8021x.cpp \
+ knetworkmanager-connection_setting_vpn.cpp \
+ knetworkmanager-connection_setting_serial.cpp \
+ knetworkmanager-connection_setting_cdma.cpp \
+ knetworkmanager-connection_setting_gsm.cpp \
+ knetworkmanager-connection_setting_ppp.cpp \
+ knetworkmanager-connection_dbus.cpp \
+ knetworkmanager-connection_secrets_dbus.cpp \
+ knetworkmanager-connection.cpp \
+ knetworkmanager-generic_connection.cpp \
+ knetworkmanager-cdma_connection.cpp \
+ knetworkmanager-gsm_connection.cpp \
+ knetworkmanager-ppp_connection.cpp \
+ knetworkmanager-wireless_connection.cpp \
+ knetworkmanager-wired_connection.cpp \
+ knetworkmanager-vpn_connection.cpp \
+ knetworkmanager-connection_store.cpp \
+ knetworkmanager-connection_setting_cdma_widget.cpp \
+ knetworkmanager-connection_setting_gsm_widget.cpp \
+ knetworkmanager-connection_setting_info_widget.cpp \
+ knetworkmanager-connection_setting_ipv4_widget.cpp \
+ knetworkmanager-connection_setting_ppp_widget.cpp \
+ knetworkmanager-connection_setting_serial_widget.cpp \
+ knetworkmanager-connection_setting_wireless_security_widget.cpp \
+ knetworkmanager-connection_setting_wireless_widget.cpp \
+ knetworkmanager-connection_setting_vpn_widget.cpp \
+ knetworkmanager-connection_settings_dialog.cpp \
+ knetworkmanager-connection_setting_widget_interface.cpp \
+ knetworkmanager-nmsettings.cpp \
+ sha1.cpp \
+ md5.cpp \
+ xmlmarshaller.cpp \
+ knetworkmanager-storage.cpp \
+ knetworkmanager-wireless_network.cpp \
+ knetworkmanager-wireless_manager.cpp \
+ knetworkmanager-connection_editor.cpp \
+ knetworkmanager-plugin.cpp \
+ knetworkmanager-vpnplugin.cpp \
+ knetworkmanager-pluginmanager.cpp \
+ knetworkmanager-vpnservice.cpp \
+ knetworkmanager-vpnmanager.cpp \
+ knetworkmanager-vpnauthenticationdialog.cpp \
+ devicetraycomponent.cpp \
+ traycomponent.cpp \
+ vpn_tray_component.cpp \
+ secret_storage_plugin.cpp
+
+knetworkmanager_la_LDFLAGS = -module \
+ $(KDE_RPATH) \
+ $(all_libraries) \
+ $(KDE_PLUGIN)
+
+knetworkmanager_la_LIBADD = dbus/libknm_dbus.la \
+ $(PACKAGE_LIBS) \
+ $(LIB_KDEUI) \
+ $(LIB_KUTILS) \
+ $(LIB_KWALLETCLIENT) \
+ $(LIB_KDEUI)
+
+# this is where the desktop file will go
+xdg_apps_DATA = knetworkmanager.desktop
+
+mydatadir = $(kde_datadir)/knetworkmanager
+mydata_DATA = eventsrc
+
+servicetype_DATA = knetworkmanager_plugin.desktop knetworkmanager_vpnplugin.desktop
+servicetypedir = $(kde_servicetypesdir)
+
+EXTRA_DIST = $(xdg_apps_DATA) $(mydata_DATA) $(servicetype_DATA)
+
diff --git a/knetworkmanager-0.8/src/connection_editor.ui b/knetworkmanager-0.8/src/connection_editor.ui
new file mode 100644
index 0000000..3a68f2c
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_editor.ui
@@ -0,0 +1,123 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionEditor</class>
+<widget class="TQDialog">
+ <property name="name">
+ <cstring>ConnectionEditor</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Edit Connections ...</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListView" row="1" column="0" rowspan="5" colspan="1">
+ <column>
+ <property name="text">
+ <string>Connection</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Type</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>lvConnections</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="showSortIndicator">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="0" column="0">
+ <property name="name">
+ <cstring>cboConnectionType</cstring>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="5" column="1">
+ <property name="name">
+ <cstring>pbClose</cstring>
+ </property>
+ <property name="text">
+ <string>Close</string>
+ </property>
+ </widget>
+ <spacer row="4" column="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>240</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>pbNew</cstring>
+ </property>
+ <property name="text">
+ <string>New Connection</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="3" column="1">
+ <property name="name">
+ <cstring>pbDelete</cstring>
+ </property>
+ <property name="text">
+ <string>Delete Connection</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="2" column="1">
+ <property name="name">
+ <cstring>pbEdit</cstring>
+ </property>
+ <property name="text">
+ <string>Edit Connection</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+
+
+
+
+
+
+</includehints>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_setting_cdma.ui b/knetworkmanager-0.8/src/connection_setting_cdma.ui
new file mode 100644
index 0000000..5a81378
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_setting_cdma.ui
@@ -0,0 +1,131 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionSettingCdmaWidget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>ConnectionSettingCdmaWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>381</width>
+ <height>102</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>tqlayout10</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>mPassword</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Password needed to access the service</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Number:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mNumber</cstring>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>mUsername</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Username needed to access the service</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Username:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mUsername</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Password:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mUsername</cstring>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>mNumber</cstring>
+ </property>
+ </widget>
+ <spacer row="0" column="2" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>146</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<tabstops>
+ <tabstop>mNumber</tabstop>
+ <tabstop>mUsername</tabstop>
+ <tabstop>mPassword</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_setting_gsm.ui b/knetworkmanager-0.8/src/connection_setting_gsm.ui
new file mode 100644
index 0000000..c03e11e
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_setting_gsm.ui
@@ -0,0 +1,294 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionSettingGsmWidget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>ConnectionSettingGsmWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>381</width>
+ <height>245</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>tqlayout9</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="2" column="2">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Network &amp;ID:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mNetworkId</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>PU&amp;K:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mUsername</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="2">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Number:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mNumber</cstring>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>mPassword</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Password needed to access the service</string>
+ </property>
+ </widget>
+ <widget class="TQComboBox" row="3" column="3">
+ <item>
+ <property name="text">
+ <string>Any</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>GPRS</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>GSM</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Prefer GPRS</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Prefer GSM</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>mNetworkType</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Select the type of cellular data network the connection should use</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Any chooses the best available; GSM/GPRS locks the connection to the specified network type; Prefer options prefer one type but will use the other if necessary</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="3" column="2">
+ <property name="name">
+ <cstring>textLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Network &amp;Type:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mNetworkType</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Username:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mUsername</cstring>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="1" column="3">
+ <property name="name">
+ <cstring>mApn</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Access Point Name</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The hostname of the machine providing network access</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="4" column="2">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Band:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mBand</cstring>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>mPuk</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Personal Unblocking Code</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string> A code used to unblock a blocked SIM card</string>
+ </property>
+ </widget>
+ <widget class="TQSpinBox" row="4" column="3">
+ <property name="name">
+ <cstring>mBand</cstring>
+ </property>
+ <property name="maxValue">
+ <number>5</number>
+ </property>
+ <property name="minValue">
+ <number>-1</number>
+ </property>
+ <property name="value">
+ <number>-1</number>
+ </property>
+ </widget>
+ <spacer row="4" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>171</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>mPin</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Personal Identification Number</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>A code used for all GSM-based phones to establish authorisation for access to certain functions or information</string>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>mUsername</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Username needed to access the service</string>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="0" column="3">
+ <property name="name">
+ <cstring>mNumber</cstring>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="2" column="3">
+ <property name="name">
+ <cstring>mNetworkId</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>The GSM network to connect to</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2_3</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;PIN:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mUsername</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Pass&amp;word:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mUsername</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="2">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;APN:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mApn</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>51</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<tabstops>
+ <tabstop>mUsername</tabstop>
+ <tabstop>mPassword</tabstop>
+ <tabstop>mPin</tabstop>
+ <tabstop>mPuk</tabstop>
+ <tabstop>mNumber</tabstop>
+ <tabstop>mApn</tabstop>
+ <tabstop>mNetworkId</tabstop>
+ <tabstop>mNetworkType</tabstop>
+ <tabstop>mBand</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_setting_info.ui b/knetworkmanager-0.8/src/connection_setting_info.ui
new file mode 100644
index 0000000..bc99ca2
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_setting_info.ui
@@ -0,0 +1,71 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionSettingInfoWidget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>ConnectionSettingInfoWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>591</width>
+ <height>151</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Connection Name:</string>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>txtConnectionName</cstring>
+ </property>
+ </widget>
+ <spacer row="2" column="0">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Autoconnect:</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="1" column="1">
+ <property name="name">
+ <cstring>chkAutoConnect</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_setting_ipv4.ui b/knetworkmanager-0.8/src/connection_setting_ipv4.ui
new file mode 100644
index 0000000..0f08a00
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_setting_ipv4.ui
@@ -0,0 +1,116 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionSettingIPv4Widget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>ConnectionSettingIPv4Widget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>534</width>
+ <height>330</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form3</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupIPConfig</cstring>
+ </property>
+ <property name="title">
+ <string>Use manual IP configuration</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>DNS Addresses:</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>DNS Search:</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>IP Address:</string>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>txtIP</cstring>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>txtDNSAddresses</cstring>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="4" column="1">
+ <property name="name">
+ <cstring>txtDNSSearch</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2_3</cstring>
+ </property>
+ <property name="text">
+ <string>Netmask:</string>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>txtNetmask</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Gateway:</string>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>txtGateway</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<tabstops>
+ <tabstop>txtIP</tabstop>
+ <tabstop>txtNetmask</tabstop>
+ <tabstop>txtGateway</tabstop>
+ <tabstop>txtDNSAddresses</tabstop>
+ <tabstop>txtDNSSearch</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_setting_ppp.ui b/knetworkmanager-0.8/src/connection_setting_ppp.ui
new file mode 100644
index 0000000..0b47e61
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_setting_ppp.ui
@@ -0,0 +1,320 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionSettingPppWidget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>ConnectionSettingPppWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>472</width>
+ <height>284</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form2</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>tqlayout9</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQCheckBox" row="3" column="1">
+ <property name="name">
+ <cstring>mRequireMppe128</cstring>
+ </property>
+ <property name="text">
+ <string>Require MPPE128</string>
+ </property>
+ </widget>
+ <spacer row="5" column="2" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>50</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQLayoutWidget" row="4" column="2">
+ <property name="name">
+ <cstring>tqlayout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQSpinBox">
+ <property name="name">
+ <cstring>mLcpEchoInterval</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>textLabel11</cstring>
+ </property>
+ <property name="text">
+ <string>LCP Echo Interval</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="TQLayoutWidget" row="3" column="2">
+ <property name="name">
+ <cstring>tqlayout12</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQSpinBox">
+ <property name="name">
+ <cstring>mLcpEchoFailure</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>textLabel10</cstring>
+ </property>
+ <property name="text">
+ <string>LCP Echo Failure</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="TQLayoutWidget" row="0" column="2">
+ <property name="name">
+ <cstring>tqlayout15</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQSpinBox">
+ <property name="name">
+ <cstring>mBaudRate</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>textLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>Baud rate</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="TQLayoutWidget" row="2" column="2">
+ <property name="name">
+ <cstring>tqlayout13</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQSpinBox">
+ <property name="name">
+ <cstring>mMtu</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>textLabel9</cstring>
+ </property>
+ <property name="text">
+ <string>MTU</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="TQCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>mRefusePap</cstring>
+ </property>
+ <property name="text">
+ <string>Refuse PAP</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>mNoAuth</cstring>
+ </property>
+ <property name="text">
+ <string>No Authorization</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="1" column="1">
+ <property name="name">
+ <cstring>mNoVjComp</cstring>
+ </property>
+ <property name="text">
+ <string>No VJ Compression</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="4" column="0">
+ <property name="name">
+ <cstring>mRefuseMschap</cstring>
+ </property>
+ <property name="text">
+ <string>Refuse MSCHAP</string>
+ </property>
+ </widget>
+ <widget class="TQLayoutWidget" row="1" column="2">
+ <property name="name">
+ <cstring>tqlayout14</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQSpinBox">
+ <property name="name">
+ <cstring>mMru</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>textLabel8</cstring>
+ </property>
+ <property name="text">
+ <string>MRU</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="TQCheckBox" row="2" column="1">
+ <property name="name">
+ <cstring>mRequireMppe</cstring>
+ </property>
+ <property name="text">
+ <string>Require MPPE</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="5" column="1">
+ <property name="name">
+ <cstring>mRequireMppc</cstring>
+ </property>
+ <property name="text">
+ <string>Require MPPC</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="5" column="0">
+ <property name="name">
+ <cstring>mRefuseMschapV2</cstring>
+ </property>
+ <property name="text">
+ <string>Refuse MSCHAPv2</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="6" column="0">
+ <property name="name">
+ <cstring>mNoBsd</cstring>
+ </property>
+ <property name="text">
+ <string>No BSD</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="4" column="1">
+ <property name="name">
+ <cstring>mStatefulMppe</cstring>
+ </property>
+ <property name="text">
+ <string>Stateful MPPE</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="6" column="1">
+ <property name="name">
+ <cstring>mCrtscts</cstring>
+ </property>
+ <property name="text">
+ <string>CRTSCTS</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="0" column="1">
+ <property name="name">
+ <cstring>mNoDeflate</cstring>
+ </property>
+ <property name="text">
+ <string>No Deflate</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="3" column="0">
+ <property name="name">
+ <cstring>mRefuseChap</cstring>
+ </property>
+ <property name="text">
+ <string>Refuse CHAP</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>mRefuseEap</cstring>
+ </property>
+ <property name="text">
+ <string>Refuse EAP</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>41</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<tabstops>
+ <tabstop>mNoAuth</tabstop>
+ <tabstop>mRefuseEap</tabstop>
+ <tabstop>mRefusePap</tabstop>
+ <tabstop>mRefuseChap</tabstop>
+ <tabstop>mRefuseMschap</tabstop>
+ <tabstop>mRefuseMschapV2</tabstop>
+ <tabstop>mNoBsd</tabstop>
+ <tabstop>mNoDeflate</tabstop>
+ <tabstop>mNoVjComp</tabstop>
+ <tabstop>mRequireMppe</tabstop>
+ <tabstop>mRequireMppe128</tabstop>
+ <tabstop>mStatefulMppe</tabstop>
+ <tabstop>mRequireMppc</tabstop>
+ <tabstop>mCrtscts</tabstop>
+ <tabstop>mBaudRate</tabstop>
+ <tabstop>mMru</tabstop>
+ <tabstop>mMtu</tabstop>
+ <tabstop>mLcpEchoFailure</tabstop>
+ <tabstop>mLcpEchoInterval</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_setting_serial.ui b/knetworkmanager-0.8/src/connection_setting_serial.ui
new file mode 100644
index 0000000..67e0586
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_setting_serial.ui
@@ -0,0 +1,185 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionSettingSerialWidget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>ConnectionSettingSerialWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>170</width>
+ <height>187</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form2</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>tqlayout23</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQSpinBox" row="4" column="1">
+ <property name="name">
+ <cstring>mSendDelay</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel11</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Send delay</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mSendDelay</cstring>
+ </property>
+ </widget>
+ <widget class="TQComboBox" row="2" column="1">
+ <item>
+ <property name="text">
+ <string>None</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Even</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Odd</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>mParity</cstring>
+ </property>
+ </widget>
+ <widget class="TQComboBox" row="3" column="1">
+ <item>
+ <property name="text">
+ <string>0</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>1</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>mStopBits</cstring>
+ </property>
+ <property name="currentItem">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="TQComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>7</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>8</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>9</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>mDataBits</cstring>
+ </property>
+ <property name="currentItem">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="TQSpinBox" row="0" column="1">
+ <property name="name">
+ <cstring>mBaudRate</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel12_3</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Stop bits:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mStopBits</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>Baud rate</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel12_2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Parity:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mParity</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel12</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Data bits:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mDataBits</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>141</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<tabstops>
+ <tabstop>mBaudRate</tabstop>
+ <tabstop>mDataBits</tabstop>
+ <tabstop>mParity</tabstop>
+ <tabstop>mStopBits</tabstop>
+ <tabstop>mSendDelay</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_setting_vpn.ui b/knetworkmanager-0.8/src/connection_setting_vpn.ui
new file mode 100644
index 0000000..976fc25
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_setting_vpn.ui
@@ -0,0 +1,51 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionSettingVPNWidget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>VPN</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>331</width>
+ <height>155</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>VPN</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>cboServices</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Service</string>
+ </property>
+ </widget>
+ <widget class="TQWidgetStack" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>widgetStack</cstring>
+ </property>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>WStackPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>0</number>
+ </attribute>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_setting_wireless.ui b/knetworkmanager-0.8/src/connection_setting_wireless.ui
new file mode 100644
index 0000000..49df622
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_setting_wireless.ui
@@ -0,0 +1,140 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionSettingWirelessWidget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>ConnectionSettingWirelessWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>506</width>
+ <height>418</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form6</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Essid:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>txtEssid</cstring>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="3" column="2" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>pbExpert</cstring>
+ </property>
+ <property name="text">
+ <string>Expert options</string>
+ </property>
+ </widget>
+ <spacer row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>282</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KListView" row="1" column="0" rowspan="1" colspan="4">
+ <column>
+ <property name="text">
+ <string>Essid</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Quality</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Security</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>lvEssids</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="fullWidth">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="TQFrame" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>framePlaceholder</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="0" column="3">
+ <property name="name">
+ <cstring>chkAutoRefresh</cstring>
+ </property>
+ <property name="text">
+ <string>Refresh automatically</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klistview.h</includehint>
+</includehints>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_setting_wireless_security.ui b/knetworkmanager-0.8/src/connection_setting_wireless_security.ui
new file mode 100644
index 0000000..5fce58f
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_setting_wireless_security.ui
@@ -0,0 +1,87 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionSettingWirelessSecurityWidget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>522</width>
+ <height>158</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupUseEncryption</cstring>
+ </property>
+ <property name="title">
+ <string>Use Wireless Security</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>cboSecurity</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Security:</string>
+ </property>
+ </widget>
+ <widget class="TQButtonGroup" row="1" column="1">
+ <property name="name">
+ <cstring>buttonGroup5</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ </hbox>
+ </widget>
+ <widget class="TQPushButton" row="0" column="2">
+ <property name="name">
+ <cstring>pbExtra</cstring>
+ </property>
+ <property name="text">
+ <string>Expert settings</string>
+ </property>
+ <property name="toggleButton">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_setting_wireless_security_auth.ui b/knetworkmanager-0.8/src/connection_setting_wireless_security_auth.ui
new file mode 100644
index 0000000..ce88e51
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_setting_wireless_security_auth.ui
@@ -0,0 +1,51 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>Form1</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>342</width>
+ <height>97</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Authentication</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Method:</string>
+ </property>
+ </widget>
+ <widget class="TQComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>cboAuthAlg</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_setting_wireless_security_eap.ui b/knetworkmanager-0.8/src/connection_setting_wireless_security_eap.ui
new file mode 100644
index 0000000..a851a93
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_setting_wireless_security_eap.ui
@@ -0,0 +1,163 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionSettingWirelessSecurityEAP</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>ConnectionSettingWirelessSecurityEAP</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>583</width>
+ <height>174</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form2</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>EAP</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel8</cstring>
+ </property>
+ <property name="text">
+ <string>Method:</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel9</cstring>
+ </property>
+ <property name="text">
+ <string>Identity:</string>
+ </property>
+ </widget>
+ <widget class="TQComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>cboMethod</cstring>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>txtIdentity</cstring>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>txtAnonIdentity</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel10</cstring>
+ </property>
+ <property name="text">
+ <string>Anonymous Identity:</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel11</cstring>
+ </property>
+ <property name="text">
+ <string>Password:</string>
+ </property>
+ </widget>
+ <widget class="KPasswordEdit" row="3" column="1">
+ <property name="name">
+ <cstring>txtPassword</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel16</cstring>
+ </property>
+ <property name="text">
+ <string>Private Secret Key:</string>
+ </property>
+ </widget>
+ <widget class="KPasswordEdit" row="4" column="1">
+ <property name="name">
+ <cstring>txtPrivateSecretKey</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="2">
+ <property name="name">
+ <cstring>textLabel12</cstring>
+ </property>
+ <property name="text">
+ <string>Client Certificate:</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="0" column="3">
+ <property name="name">
+ <cstring>kURLClientCert</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="1" column="3">
+ <property name="name">
+ <cstring>kURLPrivateKey</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="2">
+ <property name="name">
+ <cstring>textLabel15</cstring>
+ </property>
+ <property name="text">
+ <string>Private Keyfile:</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="3" column="2">
+ <property name="name">
+ <cstring>textLabel14</cstring>
+ </property>
+ <property name="text">
+ <string>CA Certificate:</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="3" column="3">
+ <property name="name">
+ <cstring>kURLCACert</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="2" column="2">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Use System CA Certificates</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="2" column="3">
+ <property name="name">
+ <cstring>chkCAStore</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+</includehints>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_setting_wireless_security_phase2.ui b/knetworkmanager-0.8/src/connection_setting_wireless_security_phase2.ui
new file mode 100644
index 0000000..b3237d4
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_setting_wireless_security_phase2.ui
@@ -0,0 +1,54 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionSettingWirelessSecurityPhase2</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>ConnectionSettingWirelessSecurityPhase2</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>225</width>
+ <height>135</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form4</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox4</cstring>
+ </property>
+ <property name="title">
+ <string>Phase 2</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel17</cstring>
+ </property>
+ <property name="text">
+ <string>Method:</string>
+ </property>
+ </widget>
+ <widget class="TQComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>cboPhase2Method</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_setting_wireless_security_wep.ui b/knetworkmanager-0.8/src/connection_setting_wireless_security_wep.ui
new file mode 100644
index 0000000..c07033e
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_setting_wireless_security_wep.ui
@@ -0,0 +1,146 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionSettingWirelessSecurityWEP</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>ConnectionSettingWirelessSecurityWEP</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>333</width>
+ <height>238</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>WEP</cstring>
+ </property>
+ <property name="title">
+ <string>WEP</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQButtonGroup" row="0" column="0">
+ <property name="name">
+ <cstring>buttonGroup1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQLineEdit" row="4" column="1">
+ <property name="name">
+ <cstring>txtWEPKey2</cstring>
+ </property>
+ </widget>
+ <widget class="TQRadioButton" row="3" column="0">
+ <property name="name">
+ <cstring>rbKeyIdx1</cstring>
+ </property>
+ <property name="text">
+ <string>Key 2:</string>
+ </property>
+ </widget>
+ <widget class="TQRadioButton" row="5" column="0">
+ <property name="name">
+ <cstring>rbKeyIdx3</cstring>
+ </property>
+ <property name="text">
+ <string>Key 4:</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Type:</string>
+ </property>
+ </widget>
+ <widget class="TQRadioButton" row="2" column="0">
+ <property name="name">
+ <cstring>rbKeyIdx0</cstring>
+ </property>
+ <property name="text">
+ <string>Key 1:</string>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="5" column="1">
+ <property name="name">
+ <cstring>txtWEPKey3</cstring>
+ </property>
+ </widget>
+ <widget class="TQRadioButton" row="4" column="0">
+ <property name="name">
+ <cstring>rbKeyIdx2</cstring>
+ </property>
+ <property name="text">
+ <string>Key 3:</string>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>txtWEPKey1</cstring>
+ </property>
+ </widget>
+ <widget class="TQLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>txtWEPKey0</cstring>
+ </property>
+ </widget>
+ <widget class="TQComboBox" row="1" column="1">
+ <property name="name">
+ <cstring>cbKeyType</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Authentication:</string>
+ </property>
+ </widget>
+ <widget class="TQComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>cboAuthentication</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_setting_wireless_security_wepencryption.ui b/knetworkmanager-0.8/src/connection_setting_wireless_security_wepencryption.ui
new file mode 100644
index 0000000..50c149d
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_setting_wireless_security_wepencryption.ui
@@ -0,0 +1,46 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionSettingWirelessSecurityWEPEncryption</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>ConnectionSettingWirelessSecurityWEPEncryption</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>288</width>
+ <height>64</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Encryption</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQComboBox" row="0" column="0">
+ <property name="name">
+ <cstring>cboEncryption</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_setting_wireless_security_wpacipher.ui b/knetworkmanager-0.8/src/connection_setting_wireless_security_wpacipher.ui
new file mode 100644
index 0000000..430ff9c
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_setting_wireless_security_wpacipher.ui
@@ -0,0 +1,128 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionSettingWirelessSecurityWPACipher</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>ConnectionSettingWirelessSecurityWPACipher</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>99</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>grpUseCipher</cstring>
+ </property>
+ <property name="title">
+ <string>Use specific cipher</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel18</cstring>
+ </property>
+ <property name="text">
+ <string>Group Cipher:</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Pairwise Cipher:</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="0" column="2">
+ <property name="name">
+ <cstring>chkGroupCipherCCMP</cstring>
+ </property>
+ <property name="text">
+ <string>CCMP</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="0" column="1">
+ <property name="name">
+ <cstring>chkGroupCipherTKIP</cstring>
+ </property>
+ <property name="text">
+ <string>TKIP</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="1" column="1">
+ <property name="name">
+ <cstring>chkPairwiseCipherTKIP</cstring>
+ </property>
+ <property name="text">
+ <string>TKIP</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="1" column="2">
+ <property name="name">
+ <cstring>chkPairwiseCipherCCMP</cstring>
+ </property>
+ <property name="text">
+ <string>CCMP</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="0" column="3">
+ <property name="name">
+ <cstring>chkGroupCipherWEP40</cstring>
+ </property>
+ <property name="text">
+ <string>WEP 40</string>
+ </property>
+ </widget>
+ <spacer row="0" column="5">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>60</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQCheckBox" row="0" column="4">
+ <property name="name">
+ <cstring>chkGroupCipherWEP104</cstring>
+ </property>
+ <property name="text">
+ <string>WEP 104</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_setting_wireless_security_wpapsk.ui b/knetworkmanager-0.8/src/connection_setting_wireless_security_wpapsk.ui
new file mode 100644
index 0000000..4df8eea
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_setting_wireless_security_wpapsk.ui
@@ -0,0 +1,46 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionSettingWirelessSecurityWPAPSK</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>ConnectionSettingWirelessSecurityWPAPSK</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form2</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Shared Key</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLineEdit" row="0" column="0">
+ <property name="name">
+ <cstring>txtPSK</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_setting_wireless_security_wpaversion.ui b/knetworkmanager-0.8/src/connection_setting_wireless_security_wpaversion.ui
new file mode 100644
index 0000000..83729e2
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_setting_wireless_security_wpaversion.ui
@@ -0,0 +1,80 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionSettingWirelessSecurityWPAVersion</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>ConnectionSettingWirelessSecurityWPAVersion</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>308</width>
+ <height>64</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form3</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQButtonGroup" row="0" column="0">
+ <property name="name">
+ <cstring>grpUseWPAVersion</cstring>
+ </property>
+ <property name="title">
+ <string>Use specific WPA Version</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQCheckBox" row="0" column="1">
+ <property name="name">
+ <cstring>cbRSN</cstring>
+ </property>
+ <property name="text">
+ <string>WPA 2/RSN</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>cbWPA</cstring>
+ </property>
+ <property name="text">
+ <string>WPA 1</string>
+ </property>
+ </widget>
+ <spacer row="0" column="2">
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>50</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetworkmanager-0.8/src/connection_settings.ui b/knetworkmanager-0.8/src/connection_settings.ui
new file mode 100644
index 0000000..794c0e3
--- /dev/null
+++ b/knetworkmanager-0.8/src/connection_settings.ui
@@ -0,0 +1,137 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConnectionSettingsDialog</class>
+<widget class="TQDialog">
+ <property name="name">
+ <cstring>ConnectionSettingsDialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>644</width>
+ <height>318</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Connections</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton" row="2" column="0">
+ <property name="name">
+ <cstring>pbBack</cstring>
+ </property>
+ <property name="text">
+ <string>Back</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0" rowspan="1" colspan="6">
+ <property name="name">
+ <cstring>lblInfo</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>New Connection</string>
+ </property>
+ </widget>
+ <widget class="TQWidgetStack" row="1" column="0" rowspan="1" colspan="6">
+ <property name="name">
+ <cstring>wstackSettings</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>TabWidgetPanel</enum>
+ </property>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>WStackPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>0</number>
+ </attribute>
+ </widget>
+ </widget>
+ <widget class="KPushButton" row="2" column="5">
+ <property name="name">
+ <cstring>pbCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>180</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton" row="2" column="2">
+ <property name="name">
+ <cstring>pbNext</cstring>
+ </property>
+ <property name="text">
+ <string>Next</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="TQPushButton" row="2" column="4">
+ <property name="name">
+ <cstring>pbSave</cstring>
+ </property>
+ <property name="text">
+ <string>Save</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="2" column="3">
+ <property name="name">
+ <cstring>btnConnect</cstring>
+ </property>
+ <property name="text">
+ <string>Connect &amp;&amp; Save</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/knetworkmanager-0.8/src/dbus/CMakeLists.txt b/knetworkmanager-0.8/src/dbus/CMakeLists.txt
new file mode 100644
index 0000000..fa8d341
--- /dev/null
+++ b/knetworkmanager-0.8/src/dbus/CMakeLists.txt
@@ -0,0 +1,88 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${TQT_INCLUDE_DIRS}
+ ${DBUS_TQT_INCLUDE_DIRS}
+)
+
+
+##### knm_dbus (static) #########################
+
+set( INTROSPECTIONPATH "${CMAKE_SOURCE_DIR}/knetworkmanager-0.8/introspection" )
+
+# options:
+# p - generate proxy files
+# i - generate interface files
+# n - generate node files
+
+function( add_dbus_xml option basename classname namespace xmlfile )
+ if( classname )
+ set( classname -c ${classname} )
+ endif( )
+ add_custom_command( OUTPUT ${basename}.cpp ${basename}.h
+ COMMAND ${DBUSXML2QT3_EXECUTABLE} -${option} ${basename} ${classname} -N ${namespace} ${INTROSPECTIONPATH}/${xmlfile} 2>/dev/null
+ DEPENDS ${INTROSPECTIONPATH}/${xmlfile} )
+endfunction( )
+
+add_dbus_xml( p networkmanagerproxy NetworkManagerProxy DBus nm-manager.xml )
+add_dbus_xml( p networkmanagervpnproxy NetworkManagerVPNProxy DBus nm-vpn-manager.xml )
+add_dbus_xml( p deviceproxy DeviceProxy DBus nm-device.xml )
+add_dbus_xml( p wirelessproxy WirelessDeviceProxy DBus nm-device-802-11-wireless.xml )
+add_dbus_xml( p wiredproxy WiredDeviceProxy DBus nm-device-802-3-ethernet.xml )
+add_dbus_xml( p gsmproxy GSMDeviceProxy DBus nm-device-gsm.xml )
+add_dbus_xml( p cdmaproxy CDMADeviceProxy DBus nm-device-cdma.xml )
+add_dbus_xml( p accesspointproxy AccessPointProxy DBus nm-access-point.xml )
+add_dbus_xml( p activeconnectionproxy ActiveConnectionProxy DBus nm-active-connection.xml )
+add_dbus_xml( p vpnconnectionproxy VPNConnectionProxy DBus nm-vpn-connection-only.xml )
+add_dbus_xml( p vpnpluginproxy VPNPluginProxy DBus nm-vpn-plugin.xml )
+add_dbus_xml( i networkmanagersettings SettingsInterface DBus nm-settings.xml )
+add_dbus_xml( i connection "" DBus nm-exported-connection.xml )
+
+add_custom_command( OUTPUT connectionnode.cpp connectionnode.h introspectableinterface.cpp introspectableinterface.h
+ COMMAND ${DBUSXML2QT3_EXECUTABLE} -n connectionnode -c ConnectionNode -N DBus ${INTROSPECTIONPATH}/nm-exported-connection.xml 2>/dev/null
+ COMMAND sed s/\#include\\ \\"secrets.h\\"// connectionnode.cpp > connectionnode.cpp_tmp
+ COMMAND sed s/\#include\\ \\"introspectable.h\\"/\#include\\ \\"introspectableinterface.h\\"/ connectionnode.cpp_tmp > connectionnode.cpp
+ COMMAND rm -f connectionnode.cpp_tmp
+ DEPENDS ${INTROSPECTIONPATH}/nm-exported-connection.xml )
+
+
+# generate moc files
+
+set( MOCHEADERS accesspointproxy.h deviceproxy.h networkmanagerproxy.h networkmanagervpnproxy.h wiredproxy.h
+ wirelessproxy.h activeconnectionproxy.h vpnconnectionproxy.h vpnpluginproxy.h gsmproxy.h cdmaproxy.h )
+
+foreach( _header_file ${MOCHEADERS} )
+ get_filename_component( _basename "${_header_file}" NAME_WE )
+ set( _moc_file ${_basename}.moc )
+ list( APPEND _moc_files ${_moc_file} )
+ add_custom_command( OUTPUT ${_moc_file}
+ COMMAND ${TMOC_EXECUTABLE} ${_header_file} -o ${_moc_file}
+ DEPENDS ${_header_file} )
+endforeach( )
+
+add_custom_command( OUTPUT mocfiles.cpp
+ COMMAND cat ${_moc_files} > mocfiles.cpp
+ DEPENDS ${_moc_files} )
+
+
+# build the library
+
+tde_add_library( knm_dbus STATIC_PIC
+ SOURCES
+ networkmanagerproxy.cpp networkmanagervpnproxy.cpp
+ deviceproxy.cpp wiredproxy.cpp wirelessproxy.cpp
+ accesspointproxy.cpp networkmanagersettings.cpp
+ connection.cpp connectionnode.cpp introspectableinterface.cpp
+ mocfiles.cpp activeconnectionproxy.cpp vpnconnectionproxy.cpp
+ vpnpluginproxy.cpp gsmproxy.cpp cdmaproxy.cpp
+)
diff --git a/knetworkmanager-0.8/src/dbus/Makefile.am b/knetworkmanager-0.8/src/dbus/Makefile.am
new file mode 100644
index 0000000..6383078
--- /dev/null
+++ b/knetworkmanager-0.8/src/dbus/Makefile.am
@@ -0,0 +1,129 @@
+INCLUDES = $(DBUS_TQT_CFLAGS) $(QT_INCLUDES)
+
+INTROSPECTIONPATH = $(srcdir)/../../introspection/
+
+MOCHEADERS = accesspointproxy.h deviceproxy.h networkmanagerproxy.h networkmanagervpnproxy.h \
+ wiredproxy.h wirelessproxy.h activeconnectionproxy.h vpnconnectionproxy.h vpnpluginproxy.h gsmproxy.h cdmaproxy.h
+#ip4configproxy.h
+
+MOCSUBS = accesspointproxy.moc deviceproxy.moc networkmanagerproxy.moc networkmanagervpnproxy.moc \
+ wiredproxy.moc wirelessproxy.moc activeconnectionproxy.moc vpnconnectionproxy.moc vpnpluginproxy.moc gsmproxy.moc cdmaproxy.moc
+#ip4configproxy.moc
+
+DBUSPROXY = networkmanagerproxy.cpp \
+ networkmanagervpnproxy.cpp \
+ deviceproxy.cpp \
+ wiredproxy.cpp \
+ wirelessproxy.cpp \
+ accesspointproxy.cpp \
+ networkmanagersettings.cpp \
+ connection.cpp \
+ connectionnode.cpp \
+ introspectableinterface.cpp \
+ mocfiles.cpp \
+ activeconnectionproxy.cpp \
+ vpnconnectionproxy.cpp \
+ vpnpluginproxy.cpp \
+ gsmproxy.cpp \
+ cdmaproxy.cpp
+# ip4configproxy.cpp
+
+DBUSPROXYHEADERS = networkmanagerproxy.h \
+ networkmanagervpnproxy.h \
+ deviceproxy.h \
+ wiredproxy.h \
+ wirelessproxy.h \
+ accesspointproxy.h \
+ networkmanagersettings.h \
+ connection.h \
+ connectionnode.h \
+ introspectableinterface.h \
+ activeconnectionproxy.h \
+ vpnconnectionproxy.h \
+ vpnpluginproxy.h \
+ gsmproxy.h \
+ cdmaproxy.h
+# ip4configproxy.h
+
+noinst_HEADERS = accesspointproxy.h \
+connection.h \
+connectionnode.h \
+deviceproxy.h \
+introspectableinterface.h \
+networkmanagerproxy.h \
+networkmanagervpnproxy.h \
+networkmanagersettings.h \
+wiredproxy.h \
+wirelessproxy.h \
+activeconnectionproxy.h \
+vpnconnectionproxy.h \
+vpnpluginproxy.h \
+gsmproxy.h \
+cdmaproxy.h
+#ip4configproxy.h
+
+noinst_LTLIBRARIES = libknm_dbus.la
+libknm_dbus_la_SOURCES = $(DBUSPROXY)
+
+CLEANFILES = $(DBUSPROXY) $(DBUSPROXYHEADERS) $(MOCSUBS)
+
+.h.moc:
+ $(TQTMOC) $< -o $@
+
+mocfiles.cpp: $(MOCSUBS)
+ cat $(MOCSUBS) > mocfiles.cpp
+
+networkmanagerproxy.cpp networkmanagerproxy.h:
+ $(DBUSXML2QT3) -p networkmanagerproxy -c NetworkManagerProxy -N DBus $(INTROSPECTIONPATH)nm-manager.xml
+
+networkmanagervpnproxy.cpp networkmanagervpnproxy.h:
+ $(DBUSXML2QT3) -p networkmanagervpnproxy -c NetworkManagerVPNProxy -N DBus $(INTROSPECTIONPATH)nm-vpn-manager.xml
+
+deviceproxy.cpp deviceproxy.h:
+ $(DBUSXML2QT3) -p deviceproxy -c DeviceProxy -N DBus $(INTROSPECTIONPATH)nm-device.xml
+
+wirelessproxy.cpp wirelessproxy.h:
+ $(DBUSXML2QT3) -p wirelessproxy -c WirelessDeviceProxy -N DBus $(INTROSPECTIONPATH)nm-device-802-11-wireless.xml
+
+wiredproxy.cpp wiredproxy.h:
+ $(DBUSXML2QT3) -p wiredproxy -c WiredDeviceProxy -N DBus $(INTROSPECTIONPATH)nm-device-802-3-ethernet.xml
+
+gsmproxy.cpp gsmproxy.h:
+ $(DBUSXML2QT3) -p gsmproxy -c GSMDeviceProxy -N DBus $(INTROSPECTIONPATH)nm-device-gsm.xml
+
+cdmaproxy.cpp cdmaproxy.h:
+ $(DBUSXML2QT3) -p cdmaproxy -c CDMADeviceProxy -N DBus $(INTROSPECTIONPATH)nm-device-cdma.xml
+
+#ip4configproxy.cpp ip4configproxy.h:
+# $(DBUSXML2QT3) -p ip4configproxy -c IP4ConfigProxy -N DBus $(INTROSPECTIONPATH)nm-ip4-config.xml
+
+accesspointproxy.cpp accesspointproxy.h:
+ $(DBUSXML2QT3) -p accesspointproxy -c AccessPointProxy -N DBus $(INTROSPECTIONPATH)nm-access-point.xml
+
+activeconnectionproxy.cpp activeconnectionproxy.h:
+ $(DBUSXML2QT3) -p activeconnectionproxy -c ActiveConnectionProxy -N DBus $(INTROSPECTIONPATH)nm-active-connection.xml
+
+#vpnconnectionproxy.cpp vpnconnectionproxy.h:
+# $(DBUSXML2QT3) -p vpnconnectionproxy -c VPNConnectionProxy -N DBus $(INTROSPECTIONPATH)nm-vpn-connection.xml
+
+#vpnconnectionproxy.cpp vpnconnectionproxy.h:
+# $(DBUSXML2QT3) -p vpnconnectionproxy -N DBus $(INTROSPECTIONPATH)nm-vpn-connection.xml
+
+vpnconnectionproxy.cpp vpnconnectionproxy.h:
+ $(DBUSXML2QT3) -p vpnconnectionproxy -c VPNConnectionProxy -N DBus $(INTROSPECTIONPATH)nm-vpn-connection-only.xml
+
+vpnpluginproxy.cpp vpnpluginproxy.h:
+ $(DBUSXML2QT3) -p vpnpluginproxy -c VPNPluginProxy -N DBus $(INTROSPECTIONPATH)nm-vpn-plugin.xml
+
+networkmanagersettings.cpp networkmanagersettings.h:
+ $(DBUSXML2QT3) -i networkmanagersettings -c SettingsInterface -N DBus $(INTROSPECTIONPATH)nm-settings.xml
+
+connection.cpp connection.h:
+ $(DBUSXML2QT3) -i connection -N DBus $(INTROSPECTIONPATH)nm-exported-connection.xml
+
+connectionnode.cpp connectionnode.h introspectableinterface.cpp introspectableinterface.h:
+ $(DBUSXML2QT3) -n connectionnode -c ConnectionNode -N DBus $(INTROSPECTIONPATH)nm-exported-connection.xml
+ sed s/#include\ \"secrets.h\"// connectionnode.cpp > connectionnode.cpp_tmp
+ sed s/#include\ \"introspectable.h\"/#include\ \"introspectableinterface.h\"/ connectionnode.cpp_tmp > connectionnode.cpp
+ rm -f connectionnode.cpp_tmp
+
diff --git a/knetworkmanager-0.8/src/devicetraycomponent.cpp b/knetworkmanager-0.8/src/devicetraycomponent.cpp
new file mode 100644
index 0000000..9b63cc4
--- /dev/null
+++ b/knetworkmanager-0.8/src/devicetraycomponent.cpp
@@ -0,0 +1,133 @@
+/*
+Copyright 2008 Will Stephenson <[email protected]>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "devicetraycomponent.h"
+
+#include <kiconloader.h>
+#include <klocale.h>
+#include <ksystemtray.h>
+
+#include "knetworkmanager-device.h"
+#include "knetworkmanager-nm_proxy.h"
+
+DeviceTrayComponent::DeviceTrayComponent(Device * device, KSystemTray * parent, const char * name )
+ : TrayComponent(parent, name), m_device(device)
+{
+ connect( m_device, TQT_SIGNAL(StateChanged(NMDeviceState)), TQT_SLOT(deviceStateChanged(NMDeviceState)));
+
+ m_pixmaps[NM_DEVICE_STATE_UNKNOWN] = "nm_no_connection";
+ m_pixmaps[NM_DEVICE_STATE_UNMANAGED] = "nm_no_connection";
+ m_pixmaps[NM_DEVICE_STATE_UNAVAILABLE] = "nm_no_connection";
+ m_pixmaps[NM_DEVICE_STATE_DISCONNECTED] = "nm_no_connection";
+ m_pixmaps[NM_DEVICE_STATE_ACTIVATED] = "ok";
+ m_pixmaps[NM_DEVICE_STATE_FAILED] = "nm_no_connection";
+
+ m_movies[NM_DEVICE_STATE_PREPARE] = "nm_stage01_connecting";
+ m_movies[NM_DEVICE_STATE_CONFIG] = "nm_stage02_connecting";
+ m_movies[NM_DEVICE_STATE_IP_CONFIG] = "nm_stage03_connecting";
+ m_movies[NM_DEVICE_STATE_NEED_AUTH] = m_movies[NM_DEVICE_STATE_CONFIG];
+
+ m_tooltips[NM_DEVICE_STATE_UNKNOWN] = i18n("Unknown");
+ m_tooltips[NM_DEVICE_STATE_UNAVAILABLE] = i18n("Down");
+ m_tooltips[NM_DEVICE_STATE_UNMANAGED] = i18n("Unmanaged");
+ m_tooltips[NM_DEVICE_STATE_DISCONNECTED] = i18n("Disconnected");
+ m_tooltips[NM_DEVICE_STATE_PREPARE] = i18n("Preparing");
+ m_tooltips[NM_DEVICE_STATE_CONFIG] = i18n("Configuration");
+ m_tooltips[NM_DEVICE_STATE_NEED_AUTH] = i18n("Awaiting authentication");
+ m_tooltips[NM_DEVICE_STATE_IP_CONFIG] = i18n("IP configuration");
+ m_tooltips[NM_DEVICE_STATE_ACTIVATED] = i18n("Activated");
+ m_tooltips[NM_DEVICE_STATE_FAILED] = i18n("Failed");
+}
+
+DeviceTrayComponent::~DeviceTrayComponent()
+{
+}
+
+Device* DeviceTrayComponent::device() const
+{
+ return m_device;
+}
+
+TQStringList DeviceTrayComponent::getToolTipText()
+{
+ TQStringList list;
+ NMDeviceState state = m_device->getState();
+ if (m_tooltips.contains(state)) {
+ list.append(i18n("Device: %1").tqarg(m_device->getInterface()));
+ list.append(i18n("State: %1").tqarg(m_tooltips[state]));
+ }
+ return list;
+}
+
+
+TQPixmap DeviceTrayComponent::pixmapForState(NMDeviceState state)
+{
+ if (m_pixmaps.contains(state)) {
+ return KSystemTray::loadIcon(m_pixmaps[state]);
+ } else {
+ return TQPixmap();
+ }
+}
+
+TQMovie DeviceTrayComponent::movieForState(NMDeviceState state)
+{
+ if (m_movies.contains(state)) {
+ return TQMovie( KGlobal::iconLoader()->moviePath(m_movies[state], KIcon::Panel));
+ } else {
+ return TQMovie();
+ }
+}
+
+void DeviceTrayComponent::setMovieForState(NMDeviceState state, TQString movie)
+{
+ m_movies[state] = movie;
+}
+
+void DeviceTrayComponent::setPixmapForState(NMDeviceState state, TQString pixmap)
+{
+ m_pixmaps[state] = pixmap;
+}
+
+void DeviceTrayComponent::deviceStateChanged(NMDeviceState state)
+{
+ //check if our device now holds the default active connection
+ // if it is the default active connection
+ // or if it is activating. what if 2 devices are activating simultaneously?
+ NMProxy * nm = 0;
+ switch (state) {
+ case NM_DEVICE_STATE_PREPARE:
+ emit needsCenterStage(this, true);
+ break;
+ case NM_DEVICE_STATE_ACTIVATED:
+ nm = NMProxy::getInstance();
+ if ( m_device == nm->getDefaultDevice() ) {
+ emit needsCenterStage(this, true);
+ }
+ break;
+ case NM_DEVICE_STATE_UNAVAILABLE:
+ case NM_DEVICE_STATE_DISCONNECTED:
+ case NM_DEVICE_STATE_FAILED:
+ emit needsCenterStage(this, false);
+ break;
+ default:
+ break;
+ }
+}
+#include "devicetraycomponent.moc"
diff --git a/knetworkmanager-0.8/src/devicetraycomponent.h b/knetworkmanager-0.8/src/devicetraycomponent.h
new file mode 100644
index 0000000..fb1d4c2
--- /dev/null
+++ b/knetworkmanager-0.8/src/devicetraycomponent.h
@@ -0,0 +1,63 @@
+/*
+Copyright 2008 Will Stephenson <[email protected]>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DEVICE_TRAY_COMPONENT_H
+#define DEVICE_TRAY_COMPONENT_H
+
+#include <NetworkManager.h>
+
+#include <tqmap.h>
+#include <tqmovie.h>
+#include <tqobject.h>
+#include <tqpixmap.h>
+
+#include "traycomponent.h"
+
+class Device;
+class KPopupMenu;
+class KSystemTray;
+
+class DeviceTrayComponent : public TrayComponent
+{
+Q_OBJECT
+ TQ_OBJECT
+public:
+ DeviceTrayComponent(Device * device, KSystemTray * parent, const char * name );
+ virtual ~DeviceTrayComponent();
+ TQPixmap pixmapForState(NMDeviceState state);
+ TQMovie movieForState(NMDeviceState state);
+ virtual TQStringList getToolTipText();
+ Device* device() const;
+signals:
+ void needsCenterStage(TrayComponent *, bool);
+public slots:
+ virtual void newConnection() = 0;
+protected slots:
+ void deviceStateChanged(NMDeviceState);
+protected:
+ void setMovieForState(NMDeviceState, TQString);
+ void setPixmapForState(NMDeviceState, TQString);
+private:
+ Device * m_device;
+ TQMap<NMDeviceState, TQString> m_movies;
+ TQMap<NMDeviceState, TQString> m_pixmaps;
+ TQMap<NMDeviceState, TQString> m_tooltips;
+};
+#endif // DEVICE_TRAY_COMPONENT_H
diff --git a/knetworkmanager-0.8/src/eventsrc b/knetworkmanager-0.8/src/eventsrc
new file mode 100644
index 0000000..47723af
--- /dev/null
+++ b/knetworkmanager-0.8/src/eventsrc
@@ -0,0 +1,315 @@
+[!Global!]
+IconName=network
+Comment=KNetworkManager
+Comment[bn]=কে-নেটওয়ার্ক-ম্যানেজার
+Comment[da]=Netværkshåndtering
+Comment[sv]=Nätverkshantering
+
+[knm-nm-vpn-banner]
+Comment=VPN Banner Notification Received
+default_presentation=0
+
+[knm-nm-sleeping]
+Name=KNetworkManager Offline
+Name[bg]=KNetworkManager - изключен от Интернет
+Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার অফলাইন
+Name[br]=Ezlinenn eo KNetworkManager
+Name[ca]=El KNetworkManager està desconnectat
+Name[cs]=KNetworkManager offline
+Name[da]=Netværkshåndtering offline
+Name[el]=Ο KNetworkManager χωρίς σύνδεση
+Name[es]=KNetworkManager desconectado
+Name[et]=KNetworkManager võrguta režiimis
+Name[it]=KNetworkManager Non in linea
+Name[ja]=KNetworkManager オフライン
+Name[pt]=KNetworkManager Desligado
+Name[sr]=KNetworkManager ван везе
+Name[sr@Latn]=KNetworkManager van veze
+Name[sv]=Nätverkshantering nerkopplad
+Name[tr]=KNetworkManager Çevrimdışı
+Comment=Switched to offline mode
+Comment[bg]=Преминаване в режим "Изключен от Интернет"
+Comment[bn]=অফলাইন মোড চালু করা হয়েছে
+Comment[ca]=S'ha canviat al mode 'desconnectat'
+Comment[cs]=Přepnutý do offline režimu
+Comment[da]=Skiftede til offline tilstand
+Comment[de]=In Offline-Modus gewechselt
+Comment[el]=Άλλαξε σε λειτουργία χωρίς σύνδεση
+Comment[es]=Se ha pasado al modo desconectado
+Comment[et]=Lülituti võrguta režiimi
+Comment[it]=Passato in modalità non in linea
+Comment[ja]=オフラインモードに切り替わりました
+Comment[nl]=Offline-modus geactiveerd
+Comment[pt]=Mudou-se para o modo desligado
+Comment[sr]=Пребачен у режим ван везе
+Comment[sr@Latn]=Prebačen u režim van veze
+Comment[sv]=Bytte till nerkopplat läge
+Comment[tr]=Çevrimdışı kipe geçildi
+default_presentation=0
+
+[knm-nm-connected]
+Name=KNetworkManager Connected
+Name[bg]=KNetworkManager - свързан
+Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার সংযুক্ত
+Name[br]=Kevreet eo KNetworkManager
+Name[ca]=El KNetworkManager està connectat
+Name[cs]=KNetworkManager připojen
+Name[da]=Netværkshåndtering forbundet
+Name[de]=KNetworkManager Verbunden
+Name[el]=Ο KNetworkManager συνδέθηκε
+Name[es]=KNetworkManager conectado
+Name[et]=KNetworkManager ühendatud
+Name[it]=KNetworkManager Connesso
+Name[ja]=KNetworkManager 接続しました
+Name[nl]=KNetworkManager Verbonden
+Name[pt]=KNetworkManager Ligado
+Name[sr]=KNetworkManager је повезан
+Name[sr@Latn]=KNetworkManager je povezan
+Name[sv]=Nätverkshantering ansluten
+Name[tr]=KNetworkManager Bağlandı
+Comment=NetworkManager is now connected
+Comment[bg]=NetworkManager е свързан
+Comment[bn]=এখন নেটওয়ার্ক-ম্যানেজার সংযুক্ত
+Comment[ca]=Ara el NetworkManager està connectat
+Comment[cs]=NetworkManager je nyní připojen
+Comment[da]=Networkmanager er nu forbundet
+Comment[de]=NetworkManager ist jetzt verbunden
+Comment[el]=Ο NetworkManager είναι τώρα συνδεδεμένος
+Comment[es]=NetworkManager está ahora conectado
+Comment[et]=Võrguhaldur on nüüd ühendatud
+Comment[it]=NetworkManager è ora connesso
+Comment[ja]=NetworkManager は接続しました
+Comment[nl]=NetworkManager is nu verbonden
+Comment[pt]=O NetworkManager está agora ligado
+Comment[sr]=NetworkManager је сада повезан
+Comment[sr@Latn]=NetworkManager je sada povezan
+Comment[sv]=Networkmanager är nu ansluten
+Comment[tr]=NetworkManager şimdi bağlı
+default_presentation=0
+
+[knm-nm-connecting]
+Name=KNetworkManager Connecting
+Name[bg]=KNetworkManager се свързва
+Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার সংযোগ স্থাপন করছে
+Name[ca]=El KNetworkManager s'està connectant
+Name[da]=Netværkshåndtering forbinder
+Name[de]=KNetworkManager Verbinden
+Name[el]=Ο KNetworkManager συνδέεται
+Name[es]=KNetworkManager conectando
+Name[et]=KNetworkManager ühendub
+Name[it]=KNetworkManager Connessione in corso
+Name[ja]=KNetworkManager 接続中
+Name[nl]=KNetworkManager Verbinden
+Name[pt]=KNetworkManager a Ligar
+Name[sr]=KNetworkManager се повезује
+Name[sr@Latn]=KNetworkManager se povezuje
+Name[sv]=Nätverkshantering kopplar upp
+Name[tr]=KNetworkManager Bağlanıyor
+Comment=NetworkManager is connecting
+Comment[bg]=NetworkManager се свързва
+Comment[bn]=নেটওয়ার্ক-ম্যানেজার সংযোগ স্থাপন করছে
+Comment[ca]=El NetworkManager s'està connectant
+Comment[da]=Networkmanager forbinder
+Comment[de]=NetworkManager stellt eine Verbindung her
+Comment[el]=Ο KNetworkManager συνδέεται
+Comment[es]=NetworkManager se está conectando
+Comment[et]=Võrguhaldur ühendub
+Comment[it]=NetworkManager si sta connettendo
+Comment[ja]=NetworkManager は接続中です
+Comment[nl]=NetworkManager is bezig met verbinden
+Comment[pt]=O NetworkManager está a estabelecer a ligação
+Comment[sr]=NetworkManager се повезује
+Comment[sr@Latn]=NetworkManager se povezuje
+Comment[sv]=Networkmanager kopplar upp
+Comment[tr]=NetworkManager bağlanıyor
+default_presentation=0
+
+[knm-nm-disconnected]
+Name=KNetworkManager Disconnected
+Name[bg]=KNetworkManager - изключен от Интернет
+Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার সংযোগ বিহীন
+Name[br]=Digevreet eo KNetworkManager
+Name[ca]=El KNetworkManager està desconnectat
+Name[da]=Netværkshåndtering afbrudt
+Name[de]=KNetworkManager Getrennt
+Name[el]=Ο KNetworkManager αποσυνδέθηκε
+Name[es]=KNetworkManager desconectado
+Name[et]=KNetworkManager lahutatud
+Name[it]=KNetworkManager Disconnesso
+Name[ja]=KNetworkManager 切断しました
+Name[nl]=KNetworkManager Niet verbonden
+Name[pt]=KNetworkManager Desligado
+Name[sr]=KNetworkManager је развезан
+Name[sr@Latn]=KNetworkManager je razvezan
+Name[sv]=Nätverkshantering nerkopplad
+Name[tr]=KNetworkManager Bağlı Değil
+Comment=NetworkManager is now disconnected
+Comment[bg]=NetworkManager е изключен от Интернет
+Comment[bn]=এখন নেটওয়ার্ক-ম্যানেজার সংযোগ বিহীন
+Comment[ca]=Ara el NetworkManager està desconnectat
+Comment[da]=Networkmanager er nu afbrudt
+Comment[de]=NetworkManager ist jetzt getrennt
+Comment[el]=Ο NetworkManager είναι τώρα αποσυνδεδεμένος
+Comment[es]=NetworkManager está ahora desconectado
+Comment[et]=Võrguhaldur on nüüd lahutatud
+Comment[it]=NetworkManager è ora disconnesso
+Comment[ja]=NetworkManager は切断しました
+Comment[nl]=NetworkManager is niet verbonden met het netwerk
+Comment[pt]=O NetworkManager está agora desligado
+Comment[sr]=NetworkManager је сада развезан
+Comment[sr@Latn]=NetworkManager je sada razvezan
+Comment[sv]=Networkmanager är nu nerkopplad
+Comment[tr]=NetworkManager artık bağlı değil
+default_presentation=0
+
+[knm-nm-device-added]
+Name=KNetworkManager Device Added
+Name[bg]=KNetworkManager - добавено е устройство
+Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার ডিভাইস যোগ করা হয়েছে
+Name[ca]=S'ha afegit un dispositiu del KNetworkManager
+Name[da]=Netværkshåndtering enhed tilføjet
+Name[de]=KNetworkManager Gerät hinzugefügt
+Name[el]=Προστέθηκε συσκευή στον KNetworkManager
+Name[es]=Añadido dispositivo a KNetworkManager
+Name[et]=KNetworkManager lisas seadme
+Name[it]=KNetworkManager Dispositivo aggiunto
+Name[ja]=KNetworkManager デバイスが追加されました
+Name[nl]=KNetworkManager Apparaat toegevoegd
+Name[pt]=KNetworkManager com Dispositivo Adicionado
+Name[sr]=KNetworkManager уређај додат
+Name[sr@Latn]=KNetworkManager uređaj dodat
+Name[sv]=Nätverkshantering enhet tillagd
+Name[tr]=KNetworkManager Aygıt Eklendi
+Comment=New network device found
+Comment[bg]=Открито е ново мрежово устройство
+Comment[bn]=নতুন নেটওয়ার্ক ডিভাইস খুঁজে পেয়েছে
+Comment[br]=Kavet eo an drobarzhell rouedad nevez
+Comment[ca]=S'ha trobat un nou dispositiu de xarxa
+Comment[da]=Ny netværksenhed fundet
+Comment[de]=Neues Netzwerkgerät gefunden
+Comment[el]=Βρέθηκε νέα συσκευή δικτύου
+Comment[es]=Se ha encontrado un nuevo dispositivo de red
+Comment[et]=Leiti uus võrguseade
+Comment[it]=Trovato nuovo dispositivo di rete
+Comment[ja]=新しいネットワークデバイスが見つかりました
+Comment[nl]=Nieuw netwerkapparaat gevonden
+Comment[pt]=Foi detectado um novo dispositivo de rede
+Comment[sr]=Нађен је нови мрежни уређај
+Comment[sr@Latn]=Nađen je novi mrežni uređaj
+Comment[sv]=Ny nätverksenhet hittades
+Comment[tr]=Yeni ağ aygıtı bulundu
+default_presentation=0
+
+[knm-nm-device-removed]
+Name=KNetworkManager Device Removed
+Name[bg]=KNetworkManager - устройството е премахнато
+Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার ডিভাইস অপসারিত করা হয়েছে
+Name[ca]=S'ha eliminat un dispositiu del KNetworkManager
+Name[da]=Netværkshåndtering enhed fjernet
+Name[de]=KNetworkManager Gerät entfernt
+Name[el]=Αφαιρέθηκε συσκευή από τον KNetworkManager
+Name[es]=Eliminado dispositivo de KNetworkManager
+Name[et]=KNetworkManager eemaldas seadme
+Name[it]=KNetworkManager Dispositivo rimosso
+Name[ja]=KNetworkManager デバイスが削除されました
+Name[nl]=KNetworkManager Apparaat verwijderd
+Name[pt]=KNetworkManager com Dispositivo Removido
+Name[sr]=KNetworkManager уређај уклоњен
+Name[sr@Latn]=KNetworkManager uređaj uklonjen
+Name[sv]=Nätverkshantering enhet borttagen
+Name[tr]=KNetworkManager Aygıt Kaldırıldı
+Comment=Network device removed
+Comment[bg]=Мрежовото устройство е премахнато
+Comment[bn]=নেটওয়ার্ক ডিভাইস অপসারিত করা হয়েছে
+Comment[br]=Lemet eo an drobarzhell rouedad
+Comment[ca]=S'ha eliminat un dispositiu de xarxa
+Comment[da]=Netværksenhed fjernet
+Comment[de]=Netzwerkgerät entfernt
+Comment[el]=Μια συσκευή δικτύου αφαιρέθηκε
+Comment[es]=Se ha eliminado un dispositivo de red
+Comment[et]=Võrguseade eemaldatud
+Comment[it]=Dispositivo di rete rimosso
+Comment[ja]=ネットワークデバイスが削除されました
+Comment[nl]=Netwerkapparaat verwijderd
+Comment[pt]=O dispositivo de rede foi removido
+Comment[sr]=Мрежни уређај је уклоњен
+Comment[sr@Latn]=Mrežni uređaj je uklonjen
+Comment[sv]=Nätverksenhet borttagen
+Comment[tr]=Ağ aygıtı kaldırıldı
+default_presentation=0
+
+[knm-nm-network-found]
+Name=KNetworkManager New Wireless Network Found
+Name[bg]=KNetworkManager - намерена е нова безжична мрежа
+Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার নতুন ওয়্যারলেস নেটওয়ার্ক খুঁজে পেয়েছে
+Name[ca]=S'ha trobat una nova xarxa sense fils del KNetworkManager
+Name[da]=Netværkshåndtering fandt nyt trådløst netværk
+Name[de]=KNetworkManager Neues drahtloses Netzwerk gefunden
+Name[el]=Βρέθηκε νέο ασύρματο δίκτυο στον KNetworkManager
+Name[es]=Encontrada nueva red inalámbrica en KNetworkManager
+Name[et]=KNetworkManager leidis uue traadita võrgu
+Name[it]=KNetworkManager Trovata nuova rete senza fili
+Name[ja]=KNetworkManager ワイヤレスネットワークを検出
+Name[nl]=KNetworkManager Nieuw draadloos netwerk gevonden
+Name[pt]=KNetworkManager com Nova Rede Sem-Fios Encontrada
+Name[sr]=KNetworkManager нова бежична мрежа је нађена
+Name[sr@Latn]=KNetworkManager nova bežična mreža je nađena
+Name[sv]=Nätverkshantering ny trådlös enhet hittades
+Name[tr]=KNetworkManager Yeni Kablosuz Ağ Bulundu
+Comment=New wireless network found
+Comment[bg]=Намерена е нова безжична мрежа
+Comment[bn]=নতুন ওয়্যারলেস নেটওয়ার্ক খুঁজে পেয়েছে
+Comment[ca]=S'ha trobat una nova xarxa sense fils
+Comment[da]=Nyt trådløst netværk fundet
+Comment[de]=Neues drahtloses Netzwerk gefunden
+Comment[el]=Βρέθηκε νέο ασύρματο δίκτυο
+Comment[es]=Se ha encontrado una nueva red inalámbrica
+Comment[et]=Leiti uus traadita võrk
+Comment[it]=Trovata nuova rete senza fili
+Comment[ja]=新しいワイヤレスネットワークが見つかりました
+Comment[nl]=Nieuw draadloos netwerk gevonden
+Comment[pt]=Foi encontrada uma nova rede sem-fios
+Comment[sr]=Нова бежична мрежа је нађена
+Comment[sr@Latn]=Nova bežična mreža je nađena
+Comment[sv]=Nytt trådlöst nätverk hittades
+Comment[tr]=Yeni kablosuz ağ bulundu
+default_presentation=0
+
+[knm-nm-network-gone]
+Name=KNetworkManager Wireless Network Disappeared
+Name[bg]=KNetworkManager - безжичната мрежа се изгуби
+Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার ওয়্যারলেস নেটওয়ার্ক অন্তর্ধান করেছে
+Name[ca]=Ha desaparegut la xarxa sense fils del KNetworkManager
+Name[da]=Netværkshåndtering trådløst netværk forsvandt
+Name[de]=KNetworkManager Drahtloses Netzwerk nicht mehr vorhanden
+Name[el]=Ένα ασύρματο δίκτυο αφαιρέθηκε από τον KNetworkManager
+Name[es]=Desaparecida red inalámbrica en KNetworkManager
+Name[et]=KNetworkManager kaotas traadita võrgu
+Name[it]=KNetworkManager È scomparsa la rete senza fili
+Name[ja]=KNetworkManager ワイヤレスネットワークが消失
+Name[nl]=KNetworkManager Draadloos netwerk verdwenen
+Name[pt]=KNetworkManager Rede Sem-Fios Desaparecida
+Name[sr]=KNetworkManager бежична мрежа је нестала
+Name[sr@Latn]=KNetworkManager bežična mreža je nestala
+Name[sv]=Nätverkshantering trådlöst nätverk försvann
+Name[tr]=KNetworkManager Kablosuz Ağ Yok Oldu
+Comment=Wireless network disappeared
+Comment[bg]=Безжичната мрежа се изгуби
+Comment[bn]=ওয়্যারলেস নেটওয়ার্ক অন্তর্ধান করেছে
+Comment[ca]=Ha desaparegut la xarxa sense fils
+Comment[da]=Trådløst netværk forsvandt
+Comment[de]=Drahtloses Netzwerk nicht mehr vorhanden
+Comment[el]=Ένα ασύρματο δίκτυο αφαιρέθηκε
+Comment[es]=Ha desaparecido una red inalámbrica
+Comment[et]=Traadita võrk kadus
+Comment[it]=La rete senza fili è scomparsa
+Comment[ja]=ワイヤレスネットワークが消失しました
+Comment[nl]=Draadloos netwerk is verdwenen
+Comment[pt]=Desapareceu uma rede sem-fios
+Comment[sr]=Бежична мрежа је нестала
+Comment[sr@Latn]=Bežična mreža je nestala
+Comment[sv]=Trådlöst nätverk försvann
+Comment[tr]=Kablosuz ağ kaybedildi
+default_presentation=0
+
+
diff --git a/knetworkmanager-0.8/src/knetworkmanager-accesspoint.cpp b/knetworkmanager-0.8/src/knetworkmanager-accesspoint.cpp
new file mode 100644
index 0000000..0bd5528
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-accesspoint.cpp
@@ -0,0 +1,222 @@
+/***************************************************************************
+ *
+ * knetworkmanager-accesspoint.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// TQt
+#include <tqguardedptr.h>
+
+// TQT_DBus includes
+#include <tqdbuserror.h>
+#include <tqdbusconnection.h>
+#include <tqdbuserror.h>
+
+// NM includes
+#include <NetworkManager.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "knetworkmanager-accesspoint.h"
+#include "dbus/accesspointproxy.h"
+
+class AccessPointPrivate
+{
+public:
+ AccessPointPrivate(TQString objpath = TQString(), const DBus::AccessPointProxy* proxy = NULL)
+ : nmAccessPoint(proxy)
+ , objPath(objpath)
+ {
+ }
+
+ ~AccessPointPrivate() { }
+
+ // pointer to the shared DBus proxy
+ TQGuardedPtr<const DBus::AccessPointProxy> nmAccessPoint;
+ // DBus object path
+ TQString objPath;
+
+ // Properties
+ TQ_UINT32 flags;
+ TQ_UINT32 wpaFlags;
+ TQ_UINT32 rsnFlags;
+ TQValueList<TQ_UINT8> ssid;
+ TQ_UINT32 freq;
+ TQString hwAddress;
+ TQ_INT32 mode;
+ TQ_UINT32 rate;
+ TQ_UINT8 strength;
+};
+
+TQ_UINT32 AccessPoint::getFlags() const
+{
+ return d->flags;
+}
+
+TQ_UINT32 AccessPoint::getWpaFlags() const
+{
+ return d->wpaFlags;
+}
+
+TQ_UINT32 AccessPoint::getRsnFlags() const
+{
+ return d->rsnFlags;
+}
+
+TQValueList<TQ_UINT8> AccessPoint::getSsid() const
+{
+ return d->ssid;
+}
+
+TQ_UINT32 AccessPoint::getFrequency() const
+{
+ return d->freq;
+}
+
+TQString AccessPoint::getHwAddress() const
+{
+ return d->hwAddress;
+}
+
+TQ_INT32 AccessPoint::getMode() const
+{
+ return d->mode;
+}
+
+TQ_UINT32 AccessPoint::getRate() const
+{
+ return d->rate;
+}
+
+TQ_UINT8 AccessPoint::getStrength() const
+{
+ return d->strength;
+}
+
+const TQByteArray AccessPoint::getSsidByteArray() const
+{
+ // FIXME: Wow, thats ugly
+ TQValueList<TQ_UINT8> ssid = d->ssid;
+ TQByteArray ret_ssid(ssid.count());
+ TQByteArray::Iterator byteit = ret_ssid.begin();
+ for (TQValueList<TQ_UINT8>::iterator it = ssid.begin(); it != ssid.end(); ++it)
+ {
+ (*byteit) = (*it);
+ ++byteit;
+ }
+ return ret_ssid;
+}
+
+TQString AccessPoint::getDisplaySsid() const
+{
+ return TQString(getSsidByteArray());
+}
+
+bool AccessPoint::isEncrypted() const
+{
+ return (getFlags() && NM_802_11_AP_FLAGS_PRIVACY);
+}
+
+void AccessPoint::slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>& properties)
+{
+ updateProperties();
+}
+
+void AccessPoint::updateProperties()
+{
+ //TODO do this proper-like
+ TQT_DBusError err;
+ if (d->nmAccessPoint.isNull())
+ return;
+
+ d->flags = d->nmAccessPoint->getFlags(err);
+ d->wpaFlags = d->nmAccessPoint->getWpaFlags(err);
+ d->rsnFlags = d->nmAccessPoint->getRsnFlags(err);
+ d->ssid = d->nmAccessPoint->getSsid(err);
+ d->freq = d->nmAccessPoint->getFrequency(err);
+ d->hwAddress = d->nmAccessPoint->getHwAddress(err);
+ d->mode = d->nmAccessPoint->getMode(err);
+ d->rate = d->nmAccessPoint->getMaxBitrate(err);
+ d->strength = d->nmAccessPoint->getStrength(err);
+ emit strengthChanged(d->strength);
+}
+
+TQString AccessPoint::getObjectPath() const
+{
+ return d->objPath;
+}
+
+bool AccessPoint::isValid() const
+{
+ return !(d->objPath.isEmpty());
+}
+
+bool AccessPoint::operator== (const AccessPoint& other) const
+{
+ return (other.getObjectPath() == getObjectPath());
+}
+#if 0
+AccessPoint& AccessPoint::operator= (const AccessPoint& other)
+{
+ kdDebug() << "AccessPoint::operator=\n" << endl;
+ d->objPath = other.d->objPath;
+ d->nmAccessPoint = other.d->nmAccessPoint;
+ connect(d->nmAccessPoint, TQT_SIGNAL(PropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)), this, TQT_SLOT(slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)));
+
+ updateProperties();
+
+ return *this;
+}
+#endif
+AccessPoint::AccessPoint(TQString obj_path, TQObject * parent, const char * name)
+: TQObject(parent, name)
+{
+ DBus::AccessPointProxy * proxy = new DBus::AccessPointProxy(NM_DBUS_SERVICE, obj_path);
+ proxy->setConnection(TQT_DBusConnection::systemBus());
+ d = new AccessPointPrivate(obj_path, proxy);
+
+ if (!d->nmAccessPoint.isNull())
+ connect(d->nmAccessPoint, TQT_SIGNAL(PropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)), this, TQT_SLOT(slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)));
+
+ updateProperties();
+}
+#if 0
+// copy constructor
+AccessPoint::AccessPoint(const AccessPoint& other)
+ : TQObject()
+{
+ // just copy the private data from other
+ d = new AccessPointPrivate(*other.d);
+
+ if (!d->nmAccessPoint.isNull())
+ connect(d->nmAccessPoint, TQT_SIGNAL(PropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)), this, TQT_SLOT(slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)));
+
+ updateProperties();
+}
+#endif
+AccessPoint::~AccessPoint()
+{
+ delete d->nmAccessPoint;
+ delete d;
+}
+
+
+#include "knetworkmanager-accesspoint.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-accesspoint.h b/knetworkmanager-0.8/src/knetworkmanager-accesspoint.h
new file mode 100644
index 0000000..be929aa
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-accesspoint.h
@@ -0,0 +1,75 @@
+/***************************************************************************
+ *
+ * knetworkmanager-device.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_ACCESSPOINT_H
+#define KNETWORKMANAGER_ACCESSPOINT_H
+
+#include "knetworkmanager.h"
+#include <tqdbusvariant.h>
+
+class AccessPointPrivate;
+namespace DBus
+{
+ class AccessPointProxy;
+};
+
+class AccessPoint : public TQObject
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ AccessPoint (const AccessPoint&);
+ AccessPoint (TQString objpath = TQString(), TQObject * parent = 0, const char * name = 0);
+ ~AccessPoint ();
+
+ AccessPoint& operator= (const AccessPoint& other);
+ bool operator== (const AccessPoint& other) const;
+
+ TQ_UINT32 getFlags() const;
+ TQ_UINT32 getWpaFlags() const;
+ TQ_UINT32 getRsnFlags() const;
+ TQValueList<TQ_UINT8> getSsid() const;
+ TQ_UINT32 getFrequency() const;
+ TQString getHwAddress() const;
+ TQ_INT32 getMode() const;
+ TQ_UINT32 getRate() const;
+ TQ_UINT8 getStrength() const;
+ TQString getDisplaySsid() const;
+ const TQByteArray getSsidByteArray() const;
+ bool isEncrypted() const;
+ TQString getObjectPath() const;
+ bool isValid() const;
+ signals:
+ void strengthChanged(TQ_UINT8);
+ private slots:
+ void slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>& properties);
+ void updateProperties();
+
+ private:
+
+ AccessPointPrivate * d;
+};
+
+#endif /* KNETWORKMANAGER_DEVICE_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-cdma_connection.cpp b/knetworkmanager-0.8/src/knetworkmanager-cdma_connection.cpp
new file mode 100644
index 0000000..9118c49
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-cdma_connection.cpp
@@ -0,0 +1,61 @@
+/***************************************************************************
+ *
+ * knetworkmanager-cdma_connection.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Author: Will Stephenson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include "knetworkmanager-cdma_connection.h"
+
+#include <nm-setting-cdma.h>
+#include "knetworkmanager-connection_setting_serial.h"
+
+ConnectionSettings::CDMAConnection::CDMAConnection()
+ : PPPConnection(NM_SETTING_CDMA_SETTING_NAME)
+{
+ appendSetting(new CDMA(this));
+ appendSetting(new Serial(this));
+}
+
+ConnectionSettings::CDMAConnection::~CDMAConnection()
+{
+
+}
+
+ConnectionSettings::CDMA* ConnectionSettings::CDMAConnection::getCDMASetting() const
+{
+ return dynamic_cast<CDMA*>(getSetting(NM_SETTING_CDMA_SETTING_NAME));
+}
+
+ConnectionSettings::Serial* ConnectionSettings::CDMAConnection::getSerialSetting() const
+{
+ return dynamic_cast<Serial*>(getSetting(NM_SETTING_SERIAL_SETTING_NAME));
+}
+
+ConnectionSettings::Connection* ConnectionSettings::CDMAConnection::duplicate()
+{
+ CDMAConnection* conn = new CDMAConnection();
+ conn->updateSettings(this);
+ return conn;
+}
+
+#include "knetworkmanager-cdma_connection.moc"
+
+// vim: sw=4 sts=4 noet tw=100
diff --git a/knetworkmanager-0.8/src/knetworkmanager-cdma_connection.h b/knetworkmanager-0.8/src/knetworkmanager-cdma_connection.h
new file mode 100644
index 0000000..903e278
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-cdma_connection.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ *
+ * knetworkmanager-cdma_connection.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Author: Will Stephenson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CDMA_CONNECTION_H
+#define KNETWORKMANAGER_CDMA_CONNECTION_H
+
+#include "knetworkmanager-ppp_connection.h"
+#include "knetworkmanager-connection_setting_cdma.h"
+
+namespace ConnectionSettings
+{
+ class CDMA;
+ class Serial;
+
+ class CDMAConnection : public PPPConnection
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ CDMAConnection();
+ ~CDMAConnection();
+ CDMA* getCDMASetting() const;
+ Serial* getSerialSetting() const;
+ Connection* duplicate();
+ };
+} // namespace ConnectionSettings
+
+#endif
+
diff --git a/knetworkmanager-0.8/src/knetworkmanager-cdma_device.cpp b/knetworkmanager-0.8/src/knetworkmanager-cdma_device.cpp
new file mode 100644
index 0000000..0aecade
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-cdma_device.cpp
@@ -0,0 +1,67 @@
+/***************************************************************************
+ *
+ * knetworkmanager-cdma_device.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// KDE includes
+#include <kdebug.h>
+
+// TQt includes
+#include <tqhostaddress.h>
+
+// TQT_DBus includes
+#include <tqdbuserror.h>
+#include <tqdbusconnection.h>
+
+// NM includes
+#include <NetworkManager.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "knetworkmanager-cdma_device.h"
+#include "dbus/cdmaproxy.h"
+
+class CDMADevicePrivate
+{
+public:
+ CDMADevicePrivate(TQString service, TQString obj_path)
+ : nmCDMA(service, obj_path)
+ {}
+ ~CDMADevicePrivate() {}
+
+ DBus::CDMADeviceProxy nmCDMA;
+};
+
+CDMADevice::CDMADevice (const TQString & obj_path)
+ : CellularDevice(obj_path)
+{
+ d = new CDMADevicePrivate(NM_DBUS_SERVICE, obj_path);
+ d->nmCDMA.setConnection(TQT_DBusConnection::systemBus());
+}
+
+CDMADevice::~CDMADevice ()
+{
+ delete d;
+}
+
+
+#include "knetworkmanager-cdma_device.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-cdma_device.h b/knetworkmanager-0.8/src/knetworkmanager-cdma_device.h
new file mode 100644
index 0000000..3546f59
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-cdma_device.h
@@ -0,0 +1,51 @@
+/***************************************************************************
+ *
+ * knetworkmanager-cdma_device.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CDMADEVICE_H
+#define KNETWORKMANAGER_CDMADEVICE_H
+
+// std includes
+#include <stdint.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "knetworkmanager-cellular_device.h"
+
+class KNetworkManager;
+
+class CDMADevicePrivate;
+
+class CDMADevice : public CellularDevice
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ CDMADevice (const TQString & obj_path );
+ ~CDMADevice ();
+
+ private:
+ CDMADevicePrivate * d;
+};
+
+#endif /* KNETWORKMANAGER_CDMADEVICE_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-cellular_device.cpp b/knetworkmanager-0.8/src/knetworkmanager-cellular_device.cpp
new file mode 100644
index 0000000..e74c590
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-cellular_device.cpp
@@ -0,0 +1,37 @@
+/***************************************************************************
+ *
+ * knetworkmanager-cellular_device.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Author: Will Stephenson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// KNM includes
+#include "knetworkmanager-cellular_device.h"
+
+CellularDevice::CellularDevice (const TQString & obj_path)
+ : Device(obj_path)
+{
+}
+
+CellularDevice::~CellularDevice()
+{
+}
+
+#include "knetworkmanager-cellular_device.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-cellular_device.h b/knetworkmanager-0.8/src/knetworkmanager-cellular_device.h
new file mode 100644
index 0000000..b6e8d78
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-cellular_device.h
@@ -0,0 +1,40 @@
+/***************************************************************************
+ *
+ * knetworkmanager-cellular_device.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Author: Will Stephenson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CELLULARDEVICE_H
+#define KNETWORKMANAGER_CELLULARDEVICE_H
+
+// KNM includes
+#include "knetworkmanager-device.h"
+
+class CellularDevice : public Device
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ CellularDevice (const TQString & obj_path );
+ ~CellularDevice ();
+};
+
+#endif /* KNETWORKMANAGER_CELLULARDEVICE_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-cellular_device_tray.cpp b/knetworkmanager-0.8/src/knetworkmanager-cellular_device_tray.cpp
new file mode 100644
index 0000000..8dab95a
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-cellular_device_tray.cpp
@@ -0,0 +1,184 @@
+/***************************************************************************
+ *
+ * knetworkmanager-cellular_device_tray.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/// TQt includes
+#include <tqwidget.h> // for TQt::WidgetFlags
+
+// KDE includes
+#include <kdebug.h>
+#include <klocale.h>
+#include <kiconloader.h>
+
+// TQt DBus
+#include <tqdbusobjectpath.h>
+
+
+// KNM includes
+#include "knetworkmanager-cellular_device_tray.h"
+#include "knetworkmanager-cellular_device.h"
+#include "knetworkmanager-menuitem.h"
+#include "knetworkmanager-menu_subhead.h"
+#include "knetworkmanager-connection_store.h"
+#include "knetworkmanager-cdma_connection.h"
+#include "knetworkmanager-gsm_connection.h"
+#include "knetworkmanager-nm_proxy.h"
+
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-connection_setting_ipv4.h"
+#include "knetworkmanager-connection_setting_cdma.h"
+#include "knetworkmanager-connection_setting_gsm.h"
+#include "knetworkmanager-connection_settings_dialog.h"
+
+#if !defined(NM_CHECK_VERSION)
+#define NM_CHECK_VERSION(x,y,z) 0
+#endif
+
+using namespace ConnectionSettings;
+
+class CellularDeviceTrayPrivate
+{
+ public:
+ CellularDeviceTrayPrivate() {}
+ ~CellularDeviceTrayPrivate() {}
+
+ CellularDevice* dev;
+};
+
+void CellularDeviceTray::newConnection()
+{
+ // create an appropriate connection
+ Connection* conn = 0;
+ switch (d->dev->getDeviceType()) {
+#if NM_CHECK_VERSION(0,8,992)
+ case NM_DEVICE_TYPE_MODEM:
+#else
+ case DEVICE_TYPE_GSM:
+#endif
+ conn = new GSMConnection();
+ break;
+#if NM_CHECK_VERSION(0,8,992)
+#else
+ case DEVICE_TYPE_CDMA:
+ conn = new CDMAConnection();
+ break;
+#endif
+ default:
+ break;
+ }
+
+ // edit the new connection
+ ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, tray(), "connect_something", false, TQt::WDestructiveClose);
+ dlg->show();
+}
+
+
+void CellularDeviceTray::addMenuItems(KPopupMenu* menu)
+{
+ ConnectionStore* connectionStore = ConnectionStore::getInstance();
+
+ // device title
+ Subhead* subhead = new Subhead (menu, "subhead", d->dev->getInterface(), SmallIcon("nm_device_wwan", TQIconSet::Automatic));
+ menu->insertItem (subhead, -1, -1);
+
+ //menu->insertSeparator();
+ NMProxy* nm = NMProxy::getInstance();
+ Connection* active_conn = nm->getActiveConnection(d->dev);
+ if (active_conn)
+ kdDebug() << active_conn->getObjectPath().data() << endl;
+
+ // get all available Connections for cellular devices
+ // WILLTODO : repeat for GSM
+ TQValueList<Connection*> connections = connectionStore->getConnections(NM_SETTING_CDMA_SETTING_NAME);
+ for (TQValueList<Connection*>::iterator it = connections.begin(); it != connections.end(); ++it)
+ {
+ CDMAConnection* cellularconn = dynamic_cast<CDMAConnection*>(*it);
+ if (cellularconn)
+ {
+ // cellular connection found :)
+ Info* info = cellularconn->getInfoSetting();
+ IPv4* ip = cellularconn->getIPv4Setting();
+
+ // lets create a nice name for this connection
+ if (info)
+ {
+ TQString title = info->getName();
+ if (ip)
+ title += TQString(" (%1)").tqarg(ip->getMethod() == IPv4::METHOD_DHCP ? i18n("DHCP") : i18n("Manual IP config"));
+
+ NetworkMenuItem* item = new NetworkMenuItem(d->dev, cellularconn, TQT_TQOBJECT(menu));
+
+ int id = menu->insertItem(title, item, TQT_SLOT(slotActivate()));
+ menu->setItemChecked(id, ((*it) == active_conn));
+ }
+ }
+ }
+ connections = connectionStore->getConnections(NM_SETTING_GSM_SETTING_NAME);
+ for (TQValueList<Connection*>::iterator it = connections.begin(); it != connections.end(); ++it)
+ {
+ GSMConnection* cellularconn = dynamic_cast<GSMConnection*>(*it);
+ if (cellularconn)
+ {
+ // cellular connection found :)
+ Info* info = cellularconn->getInfoSetting();
+ IPv4* ip = cellularconn->getIPv4Setting();
+
+ // lets create a nice name for this connection
+ if (info)
+ {
+ TQString title = info->getName();
+ if (ip)
+ title += TQString(" (%1)").tqarg(ip->getMethod() == IPv4::METHOD_DHCP ? i18n("DHCP") : i18n("Manual IP config"));
+
+ NetworkMenuItem* item = new NetworkMenuItem(d->dev, cellularconn, TQT_TQOBJECT(menu));
+
+ int id = menu->insertItem(title, item, TQT_SLOT(slotActivate()));
+ menu->setItemChecked(id, ((*it) == active_conn));
+ }
+ }
+ }
+
+ // bring the device down
+ KAction* deactivate = tray()->actionCollection()->action("deactivate_device");
+ if (deactivate)
+ deactivate->plug(menu);
+
+ menu->insertSeparator();
+}
+
+CellularDeviceTray::CellularDeviceTray (CellularDevice* dev, KSystemTray * parent, const char * name)
+ : DeviceTrayComponent (dev, parent, name)
+{
+ d = new CellularDeviceTrayPrivate();
+ d->dev = dev;
+
+ setPixmapForState(NM_DEVICE_STATE_ACTIVATED, "nm_device_wwan");
+}
+
+CellularDeviceTray::~CellularDeviceTray ()
+{
+ delete d;
+}
+
+
+#include "knetworkmanager-cellular_device_tray.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-cellular_device_tray.h b/knetworkmanager-0.8/src/knetworkmanager-cellular_device_tray.h
new file mode 100644
index 0000000..455b9f7
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-cellular_device_tray.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ *
+ * knetworkmanager.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CELLULAR_DEVICE_TRAY_H
+#define KNETWORKMANAGER_CELLULAR_DEVICE_TRAY_H
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "devicetraycomponent.h"
+
+// predefs
+class CellularDevice;
+class CellularDeviceTrayPrivate;
+
+class CellularDeviceTray : public DeviceTrayComponent
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ CellularDeviceTray (CellularDevice*, KSystemTray * parent = 0, const char * name = 0);
+ ~CellularDeviceTray ();
+
+ void addMenuItems(KPopupMenu* menu);
+
+ public slots:
+ void newConnection();
+
+ private:
+ CellularDeviceTrayPrivate* d;
+};
+
+#endif /* KNETWORKMANAGER_CELLULAR_DEVICE_TRAY_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection.cpp
new file mode 100644
index 0000000..f0da309
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection.cpp
@@ -0,0 +1,299 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqvaluelist.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQDbus headers */
+#include <tqdbusconnection.h>
+#include <tqdbusobjectpath.h>
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+#include <tqdbusvariant.h>
+
+/* NM headers */
+#include <NetworkManager.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_dbus.h"
+#include "knetworkmanager-connection_secrets_dbus.h"
+#include "knetworkmanager-connection_setting.h"
+#include "knetworkmanager-nmsettings.h"
+#include <stdio.h>
+
+extern unsigned char vpn_new_credentials_needed;
+
+using namespace ConnectionSettings;
+
+namespace ConnectionSettings
+{
+
+class ConnectionPrivate
+{
+ public:
+ ConnectionPrivate(Connection* parent)
+ {
+ conn_dbus = new ConnectionDBus(parent);
+ conn_secrets_dbus = new ConnectionSecretsDBus(parent);
+ secrets_requested = false;
+ }
+ ~ConnectionPrivate() {}
+
+ TQT_DBusObjectPath obj_path;
+ ConnectionDBus* conn_dbus;
+ ConnectionSecretsDBus* conn_secrets_dbus;
+ TQValueList<ConnectionSetting*> settings;
+ TQString specific_object;
+ bool secrets_requested;
+};
+
+}
+
+/*
+ class Connection
+*/
+Connection::Connection()
+{
+ d = new ConnectionPrivate(this);
+
+ NMSettings* nmSettings = NMSettings::getInstance();
+ d->obj_path = nmSettings->getObjPathForConnection();
+
+ TQT_DBusConnection conn = TQT_DBusConnection::systemBus();
+
+ if (!registerObject(conn, objectPath()))
+ kdError() << "registerobjectpath failed" << endl;
+
+ // get notified whenever NM needs a secret
+ connect(d->conn_secrets_dbus, TQT_SIGNAL(SecretsNeeded(const TQString&, const TQStringList&, bool)), this, TQT_SLOT(slotSecretsNeeded(const TQString&, const TQStringList&, bool)));
+}
+
+Connection::~Connection()
+{
+ for (TQValueList<ConnectionSetting*>::Iterator it= d->settings.begin(); it != d->settings.end(); ++it)
+ {
+ delete (*it);
+ *it = NULL;
+ }
+ delete d;
+}
+
+ConnectionSetting*
+Connection::getSetting(const TQString& type) const
+{
+ // find a setting by its type
+ for (TQValueList<ConnectionSetting*>::ConstIterator it = d->settings.begin(); it != d->settings.end(); ++it)
+ {
+ if ((*it)->getType() == type)
+ return (*it);
+ }
+ return NULL;
+}
+
+TQValueList<ConnectionSetting*>
+Connection::getSettings() const
+{
+ return d->settings;
+}
+
+void
+Connection::appendSetting(ConnectionSetting* setting)
+{
+ // that's our setting now :)
+ d->settings.append(setting);
+ connect(setting, TQT_SIGNAL(validityChanged()), this, TQT_SLOT(slotSettingValidityChanged()));
+}
+
+void
+Connection::setSpecificObject(const TQString& obj_path)
+{
+ d->specific_object = obj_path;
+}
+
+TQString
+Connection::getSpecificObject() const
+{
+ return d->specific_object;
+}
+
+TQT_DBusObjectPath
+Connection::getObjectPath() const
+{
+ return d->obj_path;
+}
+
+TQString
+Connection::objectPath() const
+{
+ return d->obj_path;
+}
+
+bool
+Connection::isValid() const
+{
+ bool retval = true;
+ // check if every enabled setting is valid
+ for (TQValueList<ConnectionSetting*>::ConstIterator it = d->settings.begin(); it != d->settings.end(); ++it)
+ {
+ if ((*it)->getEnabled())
+ retval &= (*it)->isValid();
+ }
+ return retval;
+}
+
+void
+Connection::slotSecretsNeeded(const TQString& setting_name, const TQStringList& hints, bool request_new)
+{
+ printf("Connection::slotSecretsNeeded %s, new: %s\n\r", setting_name.ascii(), (request_new ? "yes" : "no"));
+ kdDebug() << "Connection::slotSecretsNeeded " << setting_name.ascii() << ", new: " << (request_new ? "yes" : "no") << endl;
+ ConnectionSetting* setting = getSetting(setting_name);
+
+ // If needed, request new VPN credentials
+ if (strcmp("vpn", setting_name.ascii()) == 0) {
+ if (vpn_new_credentials_needed == 1) {
+ vpn_new_credentials_needed = 0;
+ request_new = 1;
+ }
+ }
+
+ if (!setting)
+ {
+ // send an error to NM
+ d->conn_secrets_dbus->SendGetSecretsReply(NULL);
+ }
+ else
+ {
+ if (!request_new && setting->hasSecrets())
+ {
+ // if the setting has secrets just send them
+ d->conn_secrets_dbus->SendGetSecretsReply(setting);
+ }
+ else
+ {
+ // NetworkManager asks for new secrets, ask user for new secrets/retry
+ d->secrets_requested = true;
+ emit SecretsNeeded(this, setting, hints, request_new);
+ }
+ }
+}
+
+void
+Connection::slotSecretsProvided(ConnectionSetting* setting)
+{
+ if (!d->secrets_requested)
+ return;
+
+ if (!setting)
+ {
+ // send all settings to NM
+ d->conn_secrets_dbus->SendGetSecretsReply(NULL);
+ }
+ else
+ {
+ // if we have the secrets already send them to NM
+ d->conn_secrets_dbus->SendGetSecretsReply(setting);
+ }
+ d->secrets_requested = false;
+}
+
+void
+Connection::slotSecretsError()
+{
+ if (!d->secrets_requested)
+ return;
+
+ d->conn_secrets_dbus->SendGetSecretsError();
+ d->secrets_requested = false;
+}
+
+TQT_DBusObjectBase*
+Connection::createInterface(const TQString& interfaceName)
+{
+ // the interfaces are already created, just return the right one
+ if (interfaceName == NM_DBUS_IFACE_SETTINGS_CONNECTION)
+ return d->conn_dbus;
+
+ if (interfaceName == NM_DBUS_IFACE_SETTINGS_CONNECTION_SECRETS)
+ return d->conn_secrets_dbus;
+
+ return NULL;
+}
+
+TQString
+Connection::getType()
+{
+ return TQString();
+}
+
+void
+Connection::slotSettingValidityChanged()
+{
+ emit validityChanged();
+}
+
+void
+Connection::slotAboutToBeRemoved()
+{
+ d->conn_dbus->slotAboutToBeRemoved();
+}
+void
+Connection::slotUpdated()
+{
+ d->conn_dbus->slotUpdated();
+}
+
+void
+Connection::updateSettings(Connection* conn)
+{
+ TQValueList<ConnectionSetting*> settings = conn->getSettings();
+ // copy all settings over to the new connection
+ for (TQValueList<ConnectionSetting*>::Iterator it = settings.begin(); it != settings.end(); ++it)
+ {
+ ConnectionSetting* other_setting = *it;
+ ConnectionSetting* my_setting = getSetting(other_setting->getType());
+ if (my_setting)
+ {
+ my_setting->fromMap(other_setting->toMap());
+ my_setting->fromSecretsMap(other_setting->toSecretsMap(false));
+ }
+ else
+ {
+ // should not happen
+ }
+ }
+}
+
+bool
+Connection::awaitingSecrets()
+{
+ return d->secrets_requested;
+}
+
+#include "knetworkmanager-connection.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection.h b/knetworkmanager-0.8/src/knetworkmanager-connection.h
new file mode 100644
index 0000000..8d024e1
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection.h
@@ -0,0 +1,133 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_H
+#define KNETWORKMANAGER_CONNECTION_H
+
+#include <tqmap.h>
+#include <tqobject.h>
+
+#include "knetworkmanager-connection_setting.h"
+#include "dbus/connection.h"
+#include "dbus/connectionnode.h"
+
+class AccessPoint;
+class TQT_DBusObjectPath;
+
+namespace ConnectionSettings
+{
+
+ class WirelessSecurity;
+ class Connection;
+ class ConnectionSetting;
+ class ConnectionPrivate;
+ class Info;
+ class Wired;
+ class Wireless;
+ class WirelessSecurity;
+ class IPv4;
+
+ typedef TQMap<TQString, SettingsMap> ConnectionMap;
+
+ // a connection wraps multiple settings
+ class Connection : public TQObject, DBus::ConnectionNode
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ Connection();
+ virtual ~Connection();
+
+ virtual TQString getID() const = 0;
+ virtual void setID(const TQString& id) = 0;
+
+ // get a specific setting
+ ConnectionSetting* getSetting(const TQString&) const;
+
+ // get all settings of this connection
+ TQValueList<ConnectionSetting*> getSettings() const;
+
+ // attach a new setting
+ virtual void appendSetting(ConnectionSetting* setting);
+
+ // ugly stuff introduced by NM
+ void setSpecificObject(const TQString&);
+ TQString getSpecificObject() const;
+
+ // sometimes its usefull to have the object_path
+ TQT_DBusObjectPath getObjectPath() const;
+
+ // is the connection valid?
+ virtual bool isValid() const;
+
+ // the connections type (only for KNM use)
+ virtual TQString getType();
+
+ // duplicate
+ virtual Connection* duplicate() = 0;
+
+ // update the settings from another connection
+ void updateSettings(Connection*);
+
+ // true if the NM requested new secrets for this connection
+ bool awaitingSecrets();
+
+ public slots:
+
+ // gets called from NM when it needs the secrets
+ void slotSecretsNeeded(const TQString& setting_name, const TQStringList& hints, bool request_new);
+
+ // gets called when the GUI provided new secrets
+ void slotSecretsProvided(ConnectionSetting* setting);
+
+ // signal a failure in getting new secrets
+ void slotSecretsError();
+
+ // gets called when a settings validity changes
+ void slotSettingValidityChanged();
+
+ // gets called when the connection is about to be removed
+ void slotAboutToBeRemoved();
+
+ // gets called when the connections settings changed
+ void slotUpdated();
+
+ protected:
+ // implementations for ConnectionNode
+ TQT_DBusObjectBase* createInterface(const TQString& interfaceName);
+ TQString objectPath() const;
+
+ signals:
+
+ // signal when we need new secrets
+ void SecretsNeeded(Connection* connection, ConnectionSetting* setting, const TQStringList& hints, bool request_new);
+
+ // signal gets emitted when connections validity changes
+ void validityChanged();
+
+ private:
+ ConnectionPrivate* d;
+ };
+}
+#endif /* KNETWORKMANAGER_CONNECTION_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_dbus.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_dbus.cpp
new file mode 100644
index 0000000..ecca0f5
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_dbus.cpp
@@ -0,0 +1,200 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqvaluelist.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQDbus headers */
+#include <tqdbusconnection.h>
+#include <tqdbusobjectpath.h>
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+#include <tqdbusvariant.h>
+#include <tqdbuserror.h>
+
+/* NM headers */
+#include <NetworkManager.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_dbus.h"
+#include "knetworkmanager-connection_setting.h"
+#include "knetworkmanager-nmsettings.h"
+#include "xmlmarshaller.h"
+
+using namespace ConnectionSettings;
+
+namespace ConnectionSettings
+{
+
+class ConnectionDBusPrivate
+{
+ public:
+ ConnectionDBusPrivate() {}
+ ~ConnectionDBusPrivate() {}
+
+ ConnectionSettings::Connection* parent;
+};
+}
+
+/*
+ class Connection
+*/
+ConnectionDBus::ConnectionDBus(ConnectionSettings::Connection* parent)
+ : TQObject(parent)
+{
+ d = new ConnectionDBusPrivate();
+ d->parent = parent;
+}
+
+ConnectionDBus::~ConnectionDBus()
+{
+ delete d;
+}
+
+bool
+ConnectionDBus::GetID(TQString& id, TQT_DBusError& /*error*/)
+{
+ kdDebug() << "Connection::GetID" << endl;
+ id = d->parent->getID();
+
+ return true;
+}
+
+bool
+ConnectionDBus::GetSettings(TQT_DBusDataMap<TQString>& settings, TQT_DBusError& /*error*/)
+{
+ kdDebug() << "Connection::GetSettings, obj: " << objectPath().ascii() << endl;
+
+ TQValueList<ConnectionSetting*> all_settings = d->parent->getSettings();
+
+ // FIXME: ugly conversions, ask Kevin on how to make it better
+ for (TQValueList<ConnectionSetting*>::Iterator it = all_settings.begin(); it != all_settings.end(); ++it)
+ {
+ kdDebug() << " Processing Setting '" << (*it)->getType().ascii() << "'" << endl;
+ // only append this setting if it is really used
+ if (!(*it)->getEnabled())
+ {
+ kdDebug() << " Setting '" << (*it)->getType().ascii() << "' is not enabled, discarding" << endl;
+ continue;
+ }
+
+ if (!(*it)->isValid())
+ {
+ kdDebug() << " Setting '" << (*it)->getType().ascii() << "' is not valid, discarding" << endl;
+ continue;
+ }
+
+ // copy the settingsmap over to a variantmap
+ TQMap<TQString, TQT_DBusData> map = (*it)->toMap();
+
+ // only take used settings
+ if (map.size() == 0)
+ {
+ kdDebug() << " Setting '" << (*it)->getType().ascii() << "' is empty, discarding" << endl;
+ continue;
+ }
+
+ kdDebug() << " Attach setting '" << (*it)->getType().ascii() << "'" << endl;
+
+ TQMap<TQString, TQT_DBusVariant> variant_map;
+
+ for (TQMap<TQString, TQT_DBusData>::Iterator it2 = map.begin(); it2 != map.end(); ++it2)
+ {
+ TQString dataxml = XMLMarshaller::fromTQT_DBusData(it2.data());
+ kdDebug() << " " << it2.key().ascii() << ": " << dataxml.replace('\n', ' ').ascii() << endl;
+ TQT_DBusVariant var;
+ var.value = it2.data();
+ var.signature = var.value.buildDBusSignature();
+ variant_map.insert(it2.key(), var);
+ }
+
+ // convert the variantma
+ TQT_DBusDataMap<TQString> map2 = TQT_DBusDataMap<TQString>(variant_map);
+ TQT_DBusData data = TQT_DBusData::fromStringKeyMap(map2);
+
+ // insert this setting
+ settings.insert((*it)->getType(), data);
+ }
+
+ return true;
+}
+
+bool
+ConnectionDBus::Update(const TQT_DBusDataMap<TQString>& properties, TQT_DBusError& error)
+{
+ // FIXME
+ return true;
+}
+
+bool
+ConnectionDBus::Delete(TQT_DBusError& error)
+{
+ // FIXME
+ return true;
+}
+
+
+void
+ConnectionDBus::handleMethodReply(const TQT_DBusMessage& reply)
+{
+ TQT_DBusConnection::systemBus().send(reply);
+}
+
+bool
+ConnectionDBus::handleSignalSend(const TQT_DBusMessage& reply)
+{
+ TQT_DBusConnection::systemBus().send(reply);
+ return true;
+}
+
+
+TQString
+ConnectionDBus::objectPath() const
+{
+ return TQString(d->parent->getObjectPath());
+}
+
+void
+ConnectionDBus::slotAboutToBeRemoved()
+{
+ // tell NM about us being removed
+ emitRemoved();
+}
+
+void
+ConnectionDBus::slotUpdated()
+{
+ TQT_DBusDataMap<TQString> settings;
+ TQT_DBusError error;
+ if (GetSettings(settings, error))
+ emitUpdated(settings);
+}
+
+#include "knetworkmanager-connection_dbus.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_dbus.h b/knetworkmanager-0.8/src/knetworkmanager-connection_dbus.h
new file mode 100644
index 0000000..3d12d49
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_dbus.h
@@ -0,0 +1,77 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_DBUS_H
+#define KNETWORKMANAGER_CONNECTION_DBUS_H
+
+#include <hal/libhal.h>
+#include <stdint.h>
+#include <tqhostaddress.h>
+#include <tqmap.h>
+#include <tqvariant.h>
+#include <tqobject.h>
+
+#include "knetworkmanager-connection_setting.h"
+#include "dbus/connection.h"
+#include "dbus/connectionnode.h"
+
+class TQT_DBusObjectPath;
+
+namespace ConnectionSettings
+{
+
+ class Connection;
+ class ConnectionSetting;
+ class ConnectionDBusPrivate;
+
+ // DBUS abstraction for a connection
+ class ConnectionDBus : public TQObject, public DBus::Connection
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ ConnectionDBus(ConnectionSettings::Connection* parent);
+ ~ConnectionDBus();
+
+ public slots:
+ void slotAboutToBeRemoved();
+ void slotUpdated();
+
+ protected:
+ // implementations of the Setting DBus-interface
+ bool GetID(TQString& id, TQT_DBusError& error);
+ bool GetSettings(TQT_DBusDataMap<TQString>& settings, TQT_DBusError& error);
+ bool Update(const TQT_DBusDataMap<TQString>& properties, TQT_DBusError& error);
+ bool Delete(TQT_DBusError& error);
+
+ // used from both interfaces
+ void handleMethodReply(const TQT_DBusMessage& reply);
+ bool handleSignalSend(const TQT_DBusMessage& reply);
+ TQString objectPath() const;
+
+ private:
+ ConnectionDBusPrivate* d;
+ };
+}
+#endif /* KNETWORKMANAGER_CONNECTION_DBUS_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_editor.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_editor.cpp
new file mode 100644
index 0000000..e787a79
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_editor.cpp
@@ -0,0 +1,250 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_editor.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ * Author: Timothy Pearson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// qt headers
+#include <tqwidget.h>
+#include <tqcombobox.h>
+#include <tqtabwidget.h>
+#include <tqpushbutton.h>
+#include <tqwidgetstack.h>
+#include <tqapplication.h>
+#include <tqlabel.h>
+#include <tqpopupmenu.h>
+
+// kde headers
+#include <kiconloader.h>
+#include <kdebug.h>
+#include <kpushbutton.h>
+#include <klistview.h>
+#include <klocale.h>
+#include <kcombobox.h>
+
+// knm headers
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-wired_connection.h"
+#include "knetworkmanager-wireless_connection.h"
+#include "knetworkmanager-vpn_connection.h"
+#include "knetworkmanager-connection_store.h"
+#include "knetworkmanager-connection_editor.h"
+#include "knetworkmanager-connection_settings_dialog.h"
+#include "knetworkmanager-storage.h"
+#include "knetworkmanager-vpnservice.h"
+#include "knetworkmanager-vpnmanager.h"
+
+using namespace ConnectionSettings;
+
+/*
+ * ConnectionListViewItem
+ */
+class ConnectionListViewItem : public KListViewItem
+{
+ public:
+
+ ConnectionListViewItem(TQListView* parent, GenericConnection* connection)
+ : KListViewItem(parent)
+ , _conn(connection)
+ {
+ Info* info = _conn->getInfoSetting();
+ if (info)
+ {
+ setText(0, info->getName());
+ setText(1, info->getDevType());
+ // TODO: Move to a Factory
+ if (info->getDevType() == NM_SETTING_WIRED_SETTING_NAME)
+ setPixmap(0, KGlobal::iconLoader()->loadIcon("wired", KIcon::Small));
+ else if (info->getDevType() == NM_SETTING_WIRELESS_SETTING_NAME)
+ setPixmap(0, KGlobal::iconLoader()->loadIcon("wireless", KIcon::Small));
+ else if (info->getDevType() == NM_SETTING_VPN_SETTING_NAME)
+ setPixmap(0, KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small));
+ else
+ setPixmap(0, KGlobal::iconLoader()->loadIcon("help", KIcon::Small));
+ }
+ }
+
+ GenericConnection* _conn;
+};
+
+/*
+ * Constructor
+ */
+ConnectionEditorImpl::ConnectionEditorImpl(TQWidget* parent, const char* name, bool modal, WFlags fl)
+ : ConnectionEditor(parent, name, modal, fl)
+{
+
+ // TODO: enable combobox if implemented
+ cboConnectionType->hide();
+
+ // TODO: Editmode is not ready yet, hide the button
+// pbEdit->hide();
+
+
+ pbNew->setIconSet(KGlobal::iconLoader()->loadIcon("add", KIcon::Small));
+ pbDelete->setIconSet(KGlobal::iconLoader()->loadIcon("remove", KIcon::Small));
+ pbEdit->setIconSet(KGlobal::iconLoader()->loadIcon("edit", KIcon::Small));
+
+ TQPopupMenu* popup = new TQPopupMenu(pbNew);
+ // TODO: move to a factory class
+ popup->insertItem(KGlobal::iconLoader()->loadIcon("wireless", KIcon::Small), i18n("Wireless"), this, TQT_SLOT(slotNewWirelessConnection()));
+ popup->insertItem(KGlobal::iconLoader()->loadIcon("wired", KIcon::Small), i18n("Wired"), this, TQT_SLOT(slotNewWiredConnection()));
+
+ if (!VPNManager::getVPNServices().isEmpty())
+ popup->insertItem(KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small), i18n("VPN"), this, TQT_SLOT(slotNewVPNConnection()));
+
+ pbNew->setPopup(popup);
+
+ connect(pbClose, TQT_SIGNAL(clicked()), this, TQT_SLOT(close()));
+ connect(pbDelete, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotRemoveCurrentConnection()));
+ connect(pbEdit, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotEditCurrentConnection()));
+
+ // show all connections
+ fillConnectionList();
+}
+
+/*
+ * Destructor
+ */
+ConnectionEditorImpl::~ConnectionEditorImpl()
+{
+ // remove the popupmenu
+ if (pbNew->popup())
+ delete pbNew->popup();
+}
+
+/*
+ * New Wireless connection
+ */
+void ConnectionEditorImpl::slotNewWirelessConnection()
+{
+ // create a new wireless connection
+ slotEditNewConnection(new WirelessConnection());
+}
+
+/*
+ * New Wired connection
+ */
+void ConnectionEditorImpl::slotNewWiredConnection()
+{
+ slotEditNewConnection(new WiredConnection());
+}
+
+/*
+ * New VPN connection
+ */
+void ConnectionEditorImpl::slotNewVPNConnection()
+{
+ slotEditNewConnection(new VPNConnection());
+}
+
+/*
+ *
+ */
+void ConnectionEditorImpl::slotEditNewConnection(Connection* conn)
+{
+ // open a dialog for editing the connection
+ ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, this, "connect_something", false, TQt::WDestructiveClose);
+ connect(dlg, TQT_SIGNAL(connectionSaved()), this, TQT_SLOT(slotRefershConnectionList()));
+ dlg->show();
+}
+
+void ConnectionEditorImpl::slotRefershConnectionList()
+{
+ fillConnectionList();
+}
+
+/*
+ * Edit the selected connection
+ */
+void ConnectionEditorImpl::slotEditCurrentConnection()
+{
+ ConnectionListViewItem* item = dynamic_cast<ConnectionListViewItem*>(lvConnections->currentItem());
+ if (!item)
+ return;
+
+ Connection* conn = item->_conn;
+ Storage* storage = Storage::getInstance();
+ bool hasSecretsStored = storage->hasSecretsStored(conn);
+
+ // we need the secrets for editing
+ if (hasSecretsStored)
+ storage->restoreAllSecrets(conn);
+
+ ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, false, NULL, this, "connect_something", false, TQt::WDestructiveClose);
+ dlg->show();
+
+ // save all connections (if not done already)
+ storage->saveConnections();
+}
+
+
+/*
+ * Delete the selected connection
+ */
+void ConnectionEditorImpl::slotRemoveCurrentConnection()
+{
+ ConnectionListViewItem* item = dynamic_cast<ConnectionListViewItem*>(lvConnections->currentItem());
+ if (!item)
+ return;
+
+ ConnectionStore* cstore = ConnectionStore::getInstance();
+ Connection* conn = item->_conn;
+
+ lvConnections->takeItem(item);
+ delete item;
+
+ cstore->removeConnection(conn);
+}
+
+/*
+ * Fill the connection list
+ */
+void ConnectionEditorImpl::fillConnectionList()
+{
+ ConnectionStore* cstore = ConnectionStore::getInstance();
+ TQValueList<Connection*> conns = cstore->getConnections();
+ TQValueList<Connection*>::Iterator it = conns.begin();
+
+ lvConnections->clear();
+
+ for (; it != conns.end(); ++it)
+ {
+ GenericConnection* conn = dynamic_cast<GenericConnection*>(*it);
+ if (conn)
+ {
+ Info* info = conn->getInfoSetting();
+ if (info)
+ {
+ new ConnectionListViewItem(lvConnections, conn);
+ }
+ else
+ kdWarning() << k_funcinfo << "Connection without Info setting, drop it." << endl;
+ }
+ else
+ kdWarning() << k_funcinfo << "non-generic connection, dropping it." << endl;
+
+ }
+}
+
+#include "knetworkmanager-connection_editor.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_editor.h b/knetworkmanager-0.8/src/knetworkmanager-connection_editor.h
new file mode 100644
index 0000000..fc5f4e5
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_editor.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_editor.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_EDITOR_H
+#define KNETWORKMANAGER_CONNECTION_EDITOR_H
+
+// qt headers
+#include <tqvaluelist.h>
+
+// qt autogenerated headers
+#include "connection_editor.h"
+
+// knm headers
+#include "knetworkmanager-connection_setting.h"
+
+class TQWidget;
+class Device;
+
+namespace ConnectionSettings
+{
+ class WidgetInterface;
+ class ConnectionSetting;
+}
+
+class ConnectionEditorImpl : public ConnectionEditor
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ ConnectionEditorImpl(TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
+ ~ConnectionEditorImpl();
+
+ protected slots:
+ void slotRemoveCurrentConnection();
+ void slotEditCurrentConnection();
+ void slotNewWirelessConnection();
+ void slotNewWiredConnection();
+ void slotEditNewConnection(Connection* conn);
+ void slotRefershConnectionList();
+ void slotNewVPNConnection();
+
+ private:
+ void fillConnectionList();
+};
+
+#endif /* KNETWORKMANAGER_CONNECTION_EDITOR_H*/
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_secrets_dbus.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_secrets_dbus.cpp
new file mode 100644
index 0000000..aa64666
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_secrets_dbus.cpp
@@ -0,0 +1,230 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqhostaddress.h>
+#include <tqvariant.h>
+#include <tqvaluelist.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQDbus headers */
+#include <tqdbusconnection.h>
+#include <tqdbusobjectpath.h>
+#include <tqdbusdata.h>
+#include <tqdbusdatalist.h>
+#include <tqdbusdatamap.h>
+#include <tqdbusvariant.h>
+#include <tqdbuserror.h>
+#include <tqdbusmessage.h>
+
+/* NM headers */
+#include <NetworkManager.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_secrets_dbus.h"
+#include "knetworkmanager-connection_dbus.h"
+#include "knetworkmanager-connection_setting.h"
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-connection_setting_ipv4.h"
+#include "knetworkmanager-connection_setting_wired.h"
+#include "knetworkmanager-connection_setting_wireless.h"
+#include "knetworkmanager-connection_setting_wireless_security.h"
+#include "knetworkmanager-accesspoint.h"
+#include "knetworkmanager-nmsettings.h"
+#include "xmlmarshaller.h"
+#include "stdio.h"
+
+using namespace ConnectionSettings;
+
+namespace ConnectionSettings
+{
+
+class ConnectionSecretsDBusPrivate
+{
+ public:
+ ConnectionSecretsDBusPrivate(Connection* par)
+ : parent(par)
+ , currentRequest(-1)
+ {}
+ ~ConnectionSecretsDBusPrivate() {}
+
+ Connection* parent;
+ int currentRequest;
+};
+
+}
+
+/*
+ class Connection
+*/
+ConnectionSecretsDBus::ConnectionSecretsDBus(Connection* parent)
+ : TQObject(parent)
+{
+ d = new ConnectionSecretsDBusPrivate(parent);
+}
+
+ConnectionSecretsDBus::~ConnectionSecretsDBus()
+{
+ delete d;
+}
+
+void
+ConnectionSecretsDBus::SendGetSecretsError()
+{
+ GetSecretsAsyncError(d->currentRequest, TQT_DBusError::stdFailed("Requested setting is empty"));
+}
+
+void
+ConnectionSecretsDBus::SendGetSecretsReply(ConnectionSettings::ConnectionSetting* setting)
+{
+ TQT_DBusMessage reply;
+
+ kdDebug() << "SendGetSecretsReply1 id " << d->currentRequest << endl;
+
+ // if no secret is needed we should not send one, right?
+ if (d->currentRequest < 0)
+ return;
+ kdDebug() << "SendGetSecretsReply2" << endl;
+/*
+ // no such setting
+ if (!setting)
+ {
+ GetSecretsAsyncError(d->currentRequest, TQT_DBusError::stdFailed("Requested setting is unknown"));
+ }
+ else
+ {
+ kdDebud() << "SendGetSecretsReply3" << endl;
+ // copy the settingsmap over to a variantmap
+ TQMap<TQString, TQT_DBusData> map = setting->toSecretsMap();
+
+ // only take used settings
+ if (map.size() == 0)
+ {
+ kdDebug() << "SendGetSecretsReply4" << endl;
+ GetSecretsAsyncError(d->currentRequest, TQT_DBusError::stdFailed("Requested setting is empty"));
+ }
+ else
+ {
+ kdDebug() << "SendGetSecretsReply5" << endl;
+ TQT_DBusDataMap<TQString> secrets(map);
+
+ TQMap<TQString, TQT_DBusVariant> secrets;
+ for (TQMap<TQString, TQT_DBusData>::Iterator it2 = map.begin(); it2 != map.end(); ++it2)
+ {
+ TQT_DBusVariant var;
+ var.value = it2.data();
+ var.signature = var.value.buildDBusSignature();
+ secrets.insert(it2.key(), var);
+ }
+ kdDebug() << "SendGetSecretsReply6" << endl;
+
+ GetSecretsAsyncReply(d->currentRequest, secrets);
+ }
+ }*/
+
+ TQT_DBusDataMap<TQString> settings;
+ TQValueList<ConnectionSetting*> all_settings = d->parent->getSettings();
+
+ // FIXME: ugly conversions, ask Kevin on how to make it better
+ for (TQValueList<ConnectionSetting*>::Iterator it = all_settings.begin(); it != all_settings.end(); ++it)
+ {
+ kdDebug() << " Processing Setting '" << (*it)->getType().ascii() << "'" << endl;
+ if (!(*it)->isValid())
+ {
+ kdDebug() << " Setting '" << (*it)->getType().ascii() << "' is not valid, discarding" << endl;
+ continue;
+ }
+
+ // copy the settingsmap over to a variantmap
+ TQMap<TQString, TQT_DBusData> map = (*it)->toSecretsMap();
+
+ // only take used settings
+ if (map.size() == 0)
+ {
+ kdDebug() << " Setting '" << (*it)->getType().ascii() << "' is empty, discarding" << endl;
+ continue;
+ }
+
+ kdDebug() << " Attach setting '" << (*it)->getType().ascii() << "'" << endl;
+
+ TQMap<TQString, TQT_DBusVariant> variant_map;
+
+ for (TQMap<TQString, TQT_DBusData>::Iterator it2 = map.begin(); it2 != map.end(); ++it2)
+ {
+ TQString dataxml = XMLMarshaller::fromTQT_DBusData(it2.data());
+ kdDebug() << " " << it2.key().ascii() << ": " << dataxml.replace('\n', ' ').ascii() << endl;
+ TQT_DBusVariant var;
+ var.value = it2.data();
+ var.signature = var.value.buildDBusSignature();
+ variant_map.insert(it2.key(), var);
+ }
+
+ // convert the variantma
+ TQT_DBusDataMap<TQString> map2 = TQT_DBusDataMap<TQString>(variant_map);
+ TQT_DBusData data = TQT_DBusData::fromStringKeyMap(map2);
+
+ // insert this setting
+ settings.insert((*it)->getType(), data);
+ }
+
+ GetSecretsAsyncReply(d->currentRequest, settings);
+ d->currentRequest = -1;
+
+}
+
+void
+ConnectionSecretsDBus::GetSecretsAsync(int id, const TQString& setting_name, const TQStringList& hints, bool request_new)
+{
+ printf("Connection::GetSecretsAsync for setting %s, %s\n\r", setting_name.ascii(), id);
+ kdDebug() << "Connection::GetSecretsAsync for setting " << setting_name.ascii() << ", " << id << endl;
+ d->currentRequest = id;
+ emit SecretsNeeded(setting_name, hints, request_new);
+}
+
+void
+ConnectionSecretsDBus::handleMethodReply(const TQT_DBusMessage& reply)
+{
+ TQT_DBusConnection::systemBus().send(reply);
+}
+
+bool
+ConnectionSecretsDBus::handleSignalSend(const TQT_DBusMessage& reply)
+{
+ TQT_DBusConnection::systemBus().send(reply);
+ return true;
+}
+
+TQString
+ConnectionSecretsDBus::objectPath() const
+{
+ return TQString(d->parent->getObjectPath());
+}
+
+
+#include "knetworkmanager-connection_secrets_dbus.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_secrets_dbus.h b/knetworkmanager-0.8/src/knetworkmanager-connection_secrets_dbus.h
new file mode 100644
index 0000000..36136f1
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_secrets_dbus.h
@@ -0,0 +1,76 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SECRETS_DBUS_H
+#define KNETWORKMANAGER_CONNECTION_SECRETS_DBUS_H
+
+#include <hal/libhal.h>
+#include <stdint.h>
+#include <tqhostaddress.h>
+#include <tqmap.h>
+#include <tqvariant.h>
+#include <tqobject.h>
+
+#include "knetworkmanager-connection_setting.h"
+#include "dbus/connection.h"
+#include "dbus/connectionnode.h"
+
+class AccessPoint;
+class TQT_DBusObjectPath;
+namespace ConnectionSettings
+{
+
+ class WirelessSecurity;
+ class Connection;
+ class ConnectionSetting;
+ class ConnectionSecretsDBusPrivate;
+
+ // a connection wraps multiple settings
+ class ConnectionSecretsDBus : public TQObject, public DBus::Secrets
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ ConnectionSecretsDBus(ConnectionSettings::Connection* parent);
+ virtual ~ConnectionSecretsDBus();
+
+ void SendGetSecretsReply(ConnectionSettings::ConnectionSetting* setting);
+ void SendGetSecretsError();
+
+ protected:
+ // implementation of the Secrets DBus-interface
+ void GetSecretsAsync(int, const TQString&, const TQStringList&, bool);
+ void handleMethodReply(const TQT_DBusMessage& reply);
+ bool handleSignalSend(const TQT_DBusMessage& reply);
+ TQString objectPath() const;
+
+ signals:
+ void SecretsNeeded(const TQString& setting_name, const TQStringList& hints, bool request_new);
+
+ private:
+ ConnectionSecretsDBusPrivate* d;
+ };
+
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SECRETS_DBUS_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting.cpp
new file mode 100644
index 0000000..50d7423
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting.cpp
@@ -0,0 +1,106 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqhostaddress.h>
+#include <tqvariant.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQT_DBus headers*/
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-connection_setting.h"
+#include "knetworkmanager-connection.h"
+
+using namespace ConnectionSettings;
+
+/*
+ class ConnectionSetting
+*/
+ConnectionSetting::ConnectionSetting(Connection* conn, TQString type, const char* name, bool enabled)
+ : TQObject(conn, name)
+{
+ _type = type;
+ _enabled = enabled;
+ _conn = conn;
+}
+
+ConnectionSetting::ConnectionSetting(const ConnectionSetting& setting)
+ : TQObject()
+{
+ _type = setting.getType();
+ _enabled = setting.getEnabled();
+ _conn = setting.getConnection();
+}
+
+SettingsMap
+ConnectionSetting::toSecretsMap(bool with_settings) const
+{
+ kdDebug() << "ConnectionSetting::toSecretsMap" << endl;
+ return SettingsMap();
+}
+
+bool
+ConnectionSetting::fromSecretsMap(const SettingsMap& /*map*/)
+{
+ return true;
+}
+
+bool
+ConnectionSetting::getEnabled(void) const
+{
+ return true;
+}
+
+TQString
+ConnectionSetting::getType(void) const
+{
+ return _type;
+}
+
+Connection*
+ConnectionSetting::getConnection(void) const
+{
+ return _conn;
+}
+
+bool
+ConnectionSetting::hasSecrets(void) const
+{
+ return !(toSecretsMap(false).isEmpty());
+}
+
+void
+ConnectionSetting::emitValidityChanged()
+{
+ emit validityChanged();
+}
+
+#include "knetworkmanager-connection_setting.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting.h
new file mode 100644
index 0000000..daf6acf
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting.h
@@ -0,0 +1,94 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_H
+
+#include <tqmap.h>
+#include <tqobject.h>
+#include <tqdbusdata.h>
+
+namespace ConnectionSettings
+{
+
+/*
+ Annotation: hopefully we can convert these to
+ TQMap<TQString, TQVariant> when switching to TQt4
+*/
+typedef TQMap<TQString, TQT_DBusData> SettingsMap;
+
+class Connection;
+
+// the base class for all settings
+class ConnectionSetting : public TQObject
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ ConnectionSetting(Connection* conn, TQString type, const char* name = 0, bool enabled = true);
+ ConnectionSetting(const ConnectionSetting&);
+
+ // serialize the setting to a map
+ virtual SettingsMap toMap() const = 0;
+
+ // serialize the secrets to a map
+ virtual SettingsMap toSecretsMap(bool withSettings = true) const;
+
+ // initialize setting from a settingsmap
+ virtual void fromMap(const SettingsMap&) = 0;
+
+ // set secrtes from a secretsmap
+ virtual bool fromSecretsMap(const SettingsMap&);
+
+ // return whether this setting should be used or not
+ virtual bool getEnabled(void) const;
+
+ // return whether this setting is valid or not
+ virtual bool isValid() const = 0;
+
+ // return the settings type
+ TQString getType(void) const;
+
+ // return the connection this setting belongs to
+ Connection* getConnection(void) const;
+
+ // return whether the setting has secrets or not
+ virtual bool hasSecrets(void) const;
+
+ signals:
+ void validityChanged();
+
+ protected:
+ void emitValidityChanged();
+
+ // parent-connection
+ Connection* _conn;
+
+ private:
+ TQString _type;
+ bool _enabled;
+};
+
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_8021x.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_8021x.cpp
new file mode 100644
index 0000000..4904f01
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_8021x.cpp
@@ -0,0 +1,380 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_8021x.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqhostaddress.h>
+#include <tqvariant.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQT_DBus headers*/
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-connection_setting_8021x.h"
+#include "knetworkmanager-accesspoint.h"
+#include "knetworkmanager-connection_setting_wireless.h"
+#include "knetworkmanager-connection.h"
+#include "sha1.h"
+#include "md5.h"
+
+#define WPA_PMK_LEN 32
+
+using namespace ConnectionSettings;
+
+/*
+ class IEEE8021x
+*/
+IEEE8021x::IEEE8021x(Connection* conn)
+ : ConnectionSetting(conn, NM_SETTING_802_1X_SETTING_NAME)
+ , _eap(EAP_PHASE1_NONE)
+ , _identity(TQString())
+ , _anonIdentity(TQString())
+ , _caPath(TQString())
+ , _phase1PeapVer(TQString())
+ , _phase1PeapLabel(TQString())
+ , _phase1FastProvisioning(TQString())
+ , _eapPhase2(EAP_PHASE2_AUTH_NONE)
+ , _phase2AuthEAP(TQString())
+ , _phase2CaPath(TQString())
+ , _useSystemCaCert(false)
+{
+ // init eap map
+ _eapMap[EAP_NONE] = TQString();
+ _eapMap[EAP_LEAP] = "leap";
+ _eapMap[EAP_MD5] = "md5";
+ _eapMap[EAP_PAP] = "pap";
+ _eapMap[EAP_CHAP] = "chap";
+ _eapMap[EAP_MSCHAP] = "mschap";
+ _eapMap[EAP_MSCHAPV2] = "mschapv2";
+ _eapMap[EAP_FAST] = "fast";
+ _eapMap[EAP_PSK] = "psk";
+ _eapMap[EAP_PAX] = "pax";
+ _eapMap[EAP_SAKE] = "sake";
+ _eapMap[EAP_GPSK] = "gpsk";
+ _eapMap[EAP_TLS] = "tls";
+ _eapMap[EAP_PEAP] = "peap";
+ _eapMap[EAP_TTLS] = "ttls";
+ _eapMap[EAP_SIM] = "sim";
+ _eapMap[EAP_GTC] = "gtc";
+ _eapMap[EAP_OTP] = "otp";
+}
+
+TQString
+IEEE8021x::getIdentity(void) const
+{
+ return _identity;
+}
+
+void
+IEEE8021x::setIdentity(const TQString & identity)
+{
+ _identity = identity;
+}
+
+TQString
+IEEE8021x::getAnonIdentity(void) const
+{
+ return _anonIdentity;
+}
+
+void
+IEEE8021x::setAnonIdentity(const TQString & identity)
+{
+ _anonIdentity = identity;
+}
+
+void
+IEEE8021x::setPassword(const TQString& pwd)
+{
+ _password = pwd;
+}
+
+TQString
+IEEE8021x::getPassword(void) const
+{
+ return _password;
+}
+
+bool
+IEEE8021x::getUseSystemCaCert(void) const
+{
+ return _useSystemCaCert;
+}
+
+void
+IEEE8021x::setUseSystemCaCert(bool use)
+{
+ _useSystemCaCert = use;
+}
+
+IEEE8021x::EAP_PHASE1
+IEEE8021x::getEAP(void) const
+{
+ return _eap;
+}
+
+void
+IEEE8021x::setEAP(EAP_PHASE1 eap)
+{
+ _eap = eap;
+}
+
+IEEE8021x::EAP_PHASE2
+IEEE8021x::getPhase2EAP(void) const
+{
+ return _eapPhase2;
+}
+
+void
+IEEE8021x::setPhase2EAP(EAP_PHASE2 eap)
+{
+ _eapPhase2 = eap;
+}
+
+SettingsMap
+IEEE8021x::toMap() const
+{
+ SettingsMap map;
+
+ // EAP
+ TQString eap = _eapMap[(EAP)_eap];
+ if (!eap.isEmpty())
+ {
+ TQValueList<TQT_DBusData> eap_methods;
+ eap_methods.append(TQT_DBusData::fromString(eap));
+ map.insert(NM_SETTING_802_1X_EAP, TQT_DBusData::fromTQValueList(eap_methods));
+ }
+ // Phase2 EAP
+ if (_eapPhase2 != EAP_PHASE2_AUTH_NONE)
+ {
+ map.insert(NM_SETTING_802_1X_PHASE2_AUTH, TQT_DBusData::fromString(_eapMap[(EAP)_eapPhase2]));
+ }
+
+ if (!_identity.isEmpty())
+ map.insert(NM_SETTING_802_1X_IDENTITY, TQT_DBusData::fromString(_identity));
+
+ if (!_anonIdentity.isEmpty())
+ map.insert(NM_SETTING_802_1X_ANONYMOUS_IDENTITY, TQT_DBusData::fromString(_anonIdentity));
+
+// FIXME
+/*
+ if (!_caCert.isNull())
+ map.insert("ca-cert", TQT_DBusData::fromString(_caCert));
+*/
+
+ if (!_caPath.isEmpty())
+ map.insert(NM_SETTING_802_1X_CA_PATH, TQT_DBusData::fromString(_caPath));
+
+ if (!eap.isEmpty())
+ map.insert(NM_SETTING_802_1X_SYSTEM_CA_CERTS, TQT_DBusData::fromBool(_useSystemCaCert));
+
+//FIXME
+/*
+ if (!_clientCert.isNull())
+ map.insert("client-cert", TQT_DBusData::fromString(_clientCert));
+
+ if (!_privateKey.isNull())
+ map.insert("private-key", TQT_DBusData::fromString(_privateKey));
+*/
+
+ if (!_phase1PeapVer.isNull())
+ map.insert(NM_SETTING_802_1X_PHASE1_PEAPVER, TQT_DBusData::fromString(_phase1PeapVer));
+
+ if (!_phase1PeapLabel.isNull())
+ map.insert(NM_SETTING_802_1X_PHASE1_PEAPLABEL, TQT_DBusData::fromString(_phase1PeapLabel));
+
+ if (!_phase1FastProvisioning.isNull())
+ map.insert(NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING, TQT_DBusData::fromString(_phase1FastProvisioning));
+
+ if (!_phase2AuthEAP.isNull())
+ map.insert(NM_SETTING_802_1X_PHASE2_AUTHEAP, TQT_DBusData::fromString(_phase2AuthEAP));
+
+// FIXME
+/*
+ if (!_phase2CaCert.isNull())
+ map.insert("phase2-ca-cert", TQVariant(_phase2CaCert));
+*/
+
+ if (!_phase2CaPath.isNull())
+ map.insert(NM_SETTING_802_1X_PHASE2_CA_PATH, TQT_DBusData::fromString(_phase2CaPath));
+
+// FIXME
+/*
+ if (!_phase2ClientCert.isNull())
+ map.insert("phase2-client-cert", TQVariant(_phase2ClientCert));
+
+ if (!_phase2PrivateKey.isNull())
+ map.insert("phase2-private-key", TQVariant(_phase2PrivateKey));
+*/
+
+ if(!_password.isNull())
+ map.insert(NM_SETTING_802_1X_PASSWORD, TQT_DBusData::fromString(""));
+/*
+ 899 g_hash_table_insert (hash, "password", string_to_gvalue (self->password));
+ 900 if (self->pin)
+ 901 g_hash_table_insert (hash, "pin", string_to_gvalue (self->pin));
+ 902 if (self->eappsk)
+ 903 g_hash_table_insert (hash, "eappsk", string_to_gvalue (self->eappsk));
+ 904 if (self->private_key_passwd)
+ 905 g_hash_table_insert (hash, "private-key-passwd", string_to_gvalue (self->private_key_passwd));
+ 906 if (self->phase2_private_key_passwd)
+ 907 g_hash_table_insert (hash, "phase2-private-key-passwd", string_to_gvalue (self->phase2_private_key_passwd));
+*/
+
+ return map;
+}
+
+void
+IEEE8021x::fromMap(const SettingsMap& map)
+{
+ kdDebug() << "IEEE8021x::fromMap" << endl;
+
+ for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
+ {
+ if(it.key() == NM_SETTING_802_1X_EAP)
+ {
+ TQValueList<TQT_DBusData> eap_methods = it.data().toTQValueList();
+ if (!eap_methods.isEmpty())
+ {
+ TQString eap = eap_methods.first().toString();
+ TQBiDirectionalMap<EAP, TQString>::Iterator it2;
+ if (_eapMap.end() != (it2 = _eapMap.findData(eap)))
+ setEAP((EAP_PHASE1)it2.key());
+ }
+ else
+ {
+ // older version of NM used TQString instead of TQValueList<TQString>
+ TQString eap = it.data().toString();
+ if (!eap.isEmpty())
+ {
+ TQBiDirectionalMap<EAP, TQString>::Iterator it2;
+ if (_eapMap.end() != (it2 = _eapMap.findData(eap)))
+ setEAP((EAP_PHASE1)it2.key());
+ }
+ }
+ }
+ else if (it.key() == NM_SETTING_802_1X_PHASE2_AUTH)
+ {
+ TQString eapPhase2 = it.data().toString();
+ TQBiDirectionalMap<EAP, TQString>::Iterator it2;
+ if (_eapMap.end() != (it2 = _eapMap.findData(eapPhase2)))
+ setPhase2EAP((EAP_PHASE2)it2.key());
+ }
+ else if (it.key() == NM_SETTING_802_1X_IDENTITY)
+ _identity = it.data().toString();
+ else if (it.key() == NM_SETTING_802_1X_ANONYMOUS_IDENTITY)
+ _anonIdentity = it.data().toString();
+ else if (it.key() == NM_SETTING_802_1X_CA_PATH)
+ _caPath = it.data().toString();
+ else if (it.key() == NM_SETTING_802_1X_PHASE1_PEAPVER)
+ _phase1PeapVer = it.data().toString();
+ else if (it.key() == NM_SETTING_802_1X_PHASE1_PEAPLABEL)
+ _phase1PeapLabel = it.data().toString();
+ else if (it.key() == NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING)
+ _phase1FastProvisioning = it.data().toString();
+ else if (it.key() == NM_SETTING_802_1X_PHASE2_AUTHEAP)
+ _phase2AuthEAP = it.data().toString();
+ else if (it.key() == NM_SETTING_802_1X_PHASE2_CA_PATH)
+ _phase2CaPath = it.data().toString();
+ else if (it.key() == NM_SETTING_802_1X_SYSTEM_CA_CERTS)
+ _useSystemCaCert = it.data().toBool();
+ else
+ kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
+ }
+}
+
+SettingsMap
+IEEE8021x::toSecretsMap(bool with_settings) const
+{
+ SettingsMap map;
+ kdDebug() << "IEEE8021x::toSecretsMap" << endl;
+ // first serialize the settings if needed
+ if (with_settings)
+ map = toMap();
+
+ // add password
+ if (!_password.isNull())
+ map.insert(NM_SETTING_802_1X_PASSWORD, TQT_DBusData::fromString(_password));
+
+ if (!_privateKeyPasswd.isNull())
+ map.insert(NM_SETTING_802_1X_PRIVATE_KEY, TQT_DBusData::fromString(_privateKeyPasswd));
+
+ if (!_phase2PrivateKeyPasswd.isNull())
+ map.insert(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY, TQT_DBusData::fromString(_phase2PrivateKeyPasswd));
+
+ return map;
+}
+
+bool
+IEEE8021x::fromSecretsMap(const SettingsMap& map)
+{
+ kdDebug() << "IEEE8021x::fromMap" << endl;
+
+ for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
+ {
+ if (it.key() == NM_SETTING_802_1X_PASSWORD)
+ _password = it.data().toString();
+ else if (it.key() == NM_SETTING_802_1X_PRIVATE_KEY)
+ _privateKeyPasswd = it.data().toString();
+ else if (it.key() == NM_SETTING_802_1X_PHASE2_PRIVATE_KEY)
+ _phase2PrivateKeyPasswd = it.data().toString();
+ else
+ kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
+ }
+ return true;
+}
+
+bool
+IEEE8021x::isValid() const
+{
+ return true;
+}
+
+TQValueList<IEEE8021x::EAP_PHASE2>
+IEEE8021x::getAllowedPhase2Methods() const
+{
+ TQValueList<EAP_PHASE2> phase2;
+ // TODO : not sure if this is correct, jsut copied from nm-applet
+ switch(_eap)
+ {
+ case EAP_PHASE1_TTLS:
+ phase2.append(EAP_PHASE2_AUTH_MSCHAPV2);
+ phase2.append(EAP_PHASE2_AUTH_MSCHAP);
+ phase2.append(EAP_PHASE2_AUTH_CHAP);
+ phase2.append(EAP_PHASE2_AUTH_PAP);
+ break;
+ case EAP_PHASE1_PEAP:
+ phase2.append(EAP_PHASE2_AUTH_MSCHAPV2);
+ phase2.append(EAP_PHASE2_AUTH_MD5);
+ break;
+ default:
+ phase2.append(EAP_PHASE2_AUTH_NONE);
+ }
+ return phase2;
+}
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_8021x.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_8021x.h
new file mode 100644
index 0000000..a5c593e
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_8021x.h
@@ -0,0 +1,195 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_8021x.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_8021X_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_8021X_H
+
+#include <stdint.h>
+#include <tqhostaddress.h>
+#include <tqmap.h>
+#include <tqvariant.h>
+#include <tqobject.h>
+
+#include <tqdbusdata.h>
+
+#include "knetworkmanager-connection_setting.h"
+#include "qbidirectionalmap.h"
+/* NM */
+#include <nm-setting-8021x.h>
+#include <nm-setting-wireless.h>
+
+
+class AccessPoint;
+
+namespace ConnectionSettings
+{
+
+// setting for 802.1x parameters
+class IEEE8021x : public ConnectionSetting
+{
+ public:
+
+ enum EAP
+ {
+ EAP_NONE = 0
+ , EAP_LEAP
+ , EAP_MD5
+ , EAP_PAP
+ , EAP_CHAP
+ , EAP_MSCHAP
+ , EAP_MSCHAPV2
+ , EAP_FAST
+ , EAP_PSK
+ , EAP_PAX
+ , EAP_SAKE
+ , EAP_GPSK
+ , EAP_TLS
+ , EAP_PEAP
+ , EAP_TTLS
+ , EAP_SIM
+ , EAP_GTC
+ , EAP_OTP
+ };
+
+ enum EAP_PHASE1
+ {
+ EAP_PHASE1_NONE = EAP_NONE
+ , EAP_PHASE1_LEAP = EAP_LEAP
+ , EAP_PHASE1_MD5 = EAP_MD5
+ , EAP_PHASE1_TLS = EAP_TLS
+ , EAP_PHASE1_PEAP = EAP_PEAP
+ , EAP_PHASE1_TTLS = EAP_TTLS
+ , EAP_PHASE1_SIM = EAP_SIM
+ , EAP_PHASE1_FAST = EAP_FAST
+ };
+
+ enum EAP_PHASE2
+ {
+ EAP_PHASE2_AUTH_NONE = EAP_NONE
+ , EAP_PHASE2_AUTH_PAP = EAP_PAP
+ , EAP_PHASE2_AUTH_CHAP = EAP_CHAP
+ , EAP_PHASE2_AUTH_MSCHAP = EAP_MSCHAP
+ , EAP_PHASE2_AUTH_MSCHAPV2 = EAP_MSCHAPV2
+ , EAP_PHASE2_AUTH_GTC = EAP_GTC
+ , EAP_PHASE2_AUTH_OTP = EAP_OTP
+ , EAP_PHASE2_AUTH_MD5 = EAP_MD5
+ , EAP_PHASE2_AUTH_TLS = EAP_TLS
+ };
+
+ enum EAP_PHASE2_AUTH_EAP
+ {
+ EAP_PHASE2_AUTH_EAP_NONE = EAP_NONE
+ , EAP_PHASE2_AUTH_EAP_MD5 = EAP_MD5
+ , EAP_PHASE2_AUTH_EAP_MSCHAPV2 = EAP_MSCHAPV2
+ , EAP_PHASE2_AUTH_EAP_OTP = EAP_OTP
+ , EAP_PHASE2_AUTH_EAP_GTC = EAP_GTC
+ , EAP_PHASE2_AUTH_EAP_TLS = EAP_TLS
+ };
+
+ enum PEAPVER
+ {
+ PEAPVER_0 = 0
+ , PEAPVER_1
+ };
+
+ IEEE8021x(Connection* conn);
+
+ SettingsMap toMap() const;
+ void fromMap(const SettingsMap&);
+
+ SettingsMap toSecretsMap(bool with_settings = true) const;
+ bool fromSecretsMap(const SettingsMap&);
+
+ // FIXME
+ // multiple EAP methods are allowed
+ EAP_PHASE1 getEAP(void) const;
+ void setEAP(EAP_PHASE1);
+
+ EAP_PHASE2 getPhase2EAP(void) const;
+ void setPhase2EAP(EAP_PHASE2);
+
+ TQString getIdentity(void) const;
+ void setIdentity(const TQString&);
+
+ TQString getAnonIdentity(void) const;
+ void setAnonIdentity(const TQString&);
+
+ TQString getPassword(void) const;
+ void setPassword(const TQString&);
+
+ // FIXME
+ // ca cert
+
+ TQString getCaPath(void) const;
+ void setCaPath(TQString);
+
+ bool getUseSystemCaCert(void) const;
+ void setUseSystemCaCert(bool);
+
+ //FIXME
+ // client cert
+
+ // FIXME
+ // private key
+
+ PEAPVER getPhase1PeapVer(void) const;
+ void setPhase1PeapVer(PEAPVER);
+
+ // get a list of allowed phase2 methods
+ TQValueList<EAP_PHASE2> getAllowedPhase2Methods() const;
+
+ bool isValid() const;
+
+ private:
+ // settigs
+ EAP_PHASE1 _eap;
+ EAP_PHASE2 _eapPhase2;
+
+ TQString _identity;
+ TQString _anonIdentity;
+ TQByteArray _caCert;
+ bool _useSystemCaCert;
+ TQString _caPath;
+ TQByteArray _clientCert;
+ TQByteArray _privateKey;
+ TQString _phase1PeapVer;
+ TQString _phase1PeapLabel;
+ TQString _phase1FastProvisioning;
+ TQString _phase2AuthEAP;
+ TQByteArray _phase2CaCert;
+ TQString _phase2CaPath;
+ TQByteArray _phase2ClientCert;
+ TQByteArray _phase2PrivateKey;
+
+ // secrets
+ TQString _password;
+ TQString _privateKeyPasswd;
+ TQString _phase2PrivateKeyPasswd;
+
+ // map the different eap types (enum EAP) to their string representation
+ TQBiDirectionalMap<EAP, TQString> _eapMap;
+};
+
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_8021X_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_cdma.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_cdma.cpp
new file mode 100644
index 0000000..854590c
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_cdma.cpp
@@ -0,0 +1,138 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_serial.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqhostaddress.h>
+#include <tqvariant.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQT_DBus headers*/
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_setting_cdma.h"
+
+using namespace ConnectionSettings;
+
+/*
+ class CDMA
+*/
+CDMA::CDMA(Connection* conn)
+ : ConnectionSetting(conn, NM_SETTING_CDMA_SETTING_NAME), _number("#777")
+{
+}
+
+void CDMA::setNumber(const TQString& number)
+{
+ _number = number;
+}
+
+TQString CDMA::getNumber() const
+{
+ return _number;
+}
+
+void CDMA::setUsername(const TQString& username)
+{
+ _username = username;
+}
+
+TQString CDMA::getUsername() const
+{
+ return _username;
+}
+
+void CDMA::setPassword(const TQString& password)
+{
+ _password = password;
+}
+
+TQString CDMA::getPassword() const
+{
+ return _password;
+}
+
+bool
+CDMA::isValid() const
+{
+ return true;
+}
+
+SettingsMap
+CDMA::toMap() const
+{
+ SettingsMap map;
+
+ map.insert(NM_SETTING_CDMA_NUMBER, TQT_DBusData::fromString(_number));
+ map.insert(NM_SETTING_CDMA_USERNAME, TQT_DBusData::fromString(_username));
+
+ return map;
+}
+
+SettingsMap
+CDMA::toSecretsMap(bool with_settings) const
+{
+ SettingsMap map;
+
+ // first serialize the settings if needed
+ if (with_settings)
+ map = toMap();
+
+ map.insert(NM_SETTING_CDMA_PASSWORD, TQT_DBusData::fromString(_password));
+
+ return map;
+}
+
+bool
+CDMA::fromSecretsMap(const SettingsMap& map)
+{
+ for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
+ {
+ if (it.key() == NM_SETTING_CDMA_PASSWORD)
+ setPassword(it.data().toString());
+ else
+ kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
+ }
+ return true;
+}
+
+void
+CDMA::fromMap(const SettingsMap& map)
+{
+ for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
+ {
+ if (it.key() == NM_SETTING_CDMA_NUMBER)
+ setNumber(it.data().toString());
+ else if (it.key() == NM_SETTING_CDMA_USERNAME)
+ setUsername(it.data().toString());
+ else
+ kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
+ }
+}
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_cdma.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_cdma.h
new file mode 100644
index 0000000..c0825b3
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_cdma.h
@@ -0,0 +1,75 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_cdma.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_CDMA_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_CDMA_H
+
+#include <stdint.h>
+#include <tqhostaddress.h>
+#include <tqmap.h>
+#include <tqvariant.h>
+#include <tqobject.h>
+
+#include <tqdbusdata.h>
+
+#include "knetworkmanager-connection_setting.h"
+
+/* NM headers */
+#include <nm-setting-cdma.h>
+
+namespace ConnectionSettings
+{
+
+class Connection;
+
+// serial setting
+class CDMA : public ConnectionSetting
+{
+ public:
+ CDMA(Connection* conn);
+
+ SettingsMap toMap() const;
+ SettingsMap toSecretsMap(bool with_settings = true) const;
+ void fromMap(const SettingsMap&);
+ bool fromSecretsMap(const SettingsMap&);
+
+ bool isValid() const;
+ bool useSetting();
+
+ void setNumber(const TQString&);
+ TQString getNumber() const;
+
+ void setUsername(const TQString&);
+ TQString getUsername() const;
+
+ void setPassword(const TQString&);
+ TQString getPassword() const;
+
+ private:
+ TQString _number;
+ TQString _username;
+ TQString _password;
+};
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_CDMA_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_cdma_widget.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_cdma_widget.cpp
new file mode 100644
index 0000000..b637b70
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_cdma_widget.cpp
@@ -0,0 +1,89 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_cdma_widget.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// qt headers
+#include <tqwidget.h>
+#include <tqlineedit.h>
+#include <tqcheckbox.h>
+#include <tqlayout.h>
+#include <tqcombobox.h>
+#include <tqiconset.h>
+#include <kiconloader.h>
+#include <tqwidgetstack.h>
+#include <kuser.h>
+
+// knm headers
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_setting_cdma.h"
+#include "knetworkmanager-connection_setting_cdma_widget.h"
+#include "knetworkmanager-device.h"
+
+#include "connection_setting_cdma.h"
+
+using namespace ConnectionSettings;
+
+CDMAWidgetImpl::CDMAWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl)
+ : WidgetInterface(parent, name, fl)
+{
+ _cdmasetting = dynamic_cast<ConnectionSettings::CDMA*> (conn->getSetting(NM_SETTING_CDMA_SETTING_NAME));
+
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
+ _mainWid = new ConnectionSettingCdmaWidget(this);
+ tqlayout->addWidget(_mainWid);
+
+ Init();
+}
+
+void
+CDMAWidgetImpl::Init()
+{
+ _mainWid->mUsername->setText( _cdmasetting->getUsername() );
+ _mainWid->mPassword->setText( _cdmasetting->getPassword( ) );
+ _mainWid->mNumber->setText( _cdmasetting->getNumber() );
+ connect( _mainWid->mUsername, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
+ connect( _mainWid->mPassword, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
+ connect( _mainWid->mNumber, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
+}
+
+void
+CDMAWidgetImpl::Deactivate()
+{
+}
+
+void
+CDMAWidgetImpl::Activate()
+{
+
+}
+
+void
+CDMAWidgetImpl::dirty()
+{
+ _cdmasetting->setUsername( _mainWid->mUsername->text() );
+ _cdmasetting->setPassword( _mainWid->mPassword->text() );
+ _cdmasetting->setNumber( _mainWid->mNumber->text() );
+}
+
+
+#include "knetworkmanager-connection_setting_cdma_widget.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_cdma_widget.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_cdma_widget.h
new file mode 100644
index 0000000..4685b78
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_cdma_widget.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_cdma_widget.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Author: Will Stephenson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_CDMA_WIDGET_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_CDMA_WIDGET_H
+
+
+// qt headers
+#include <tqwidget.h>
+#include <tqlineedit.h>
+
+// knm headers
+#include "knetworkmanager-connection_setting_cdma.h"
+#include "knetworkmanager-connection_setting_widget_interface.h"
+#include "knetworkmanager-device.h"
+
+//class VPNService;
+class ConnectionSettingCdmaWidget;
+
+namespace ConnectionSettings
+{
+
+class Connection;
+
+class CDMAWidgetImpl : public WidgetInterface
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ CDMAWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0);
+ void Activate();
+ void Deactivate();
+ public slots:
+ void dirty();
+
+ private:
+ void Init();
+ //VPNConfigWidget* getVPNConfigWidget(VPNService* service);
+
+
+ CDMA* _cdmasetting;
+ ConnectionSettingCdmaWidget* _mainWid;
+};
+
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_CDMA_WIDGET_H*/
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_gsm.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_gsm.cpp
new file mode 100644
index 0000000..cd38c3f
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_gsm.cpp
@@ -0,0 +1,251 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_gsm.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqhostaddress.h>
+#include <tqvariant.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQT_DBus headers*/
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_setting_gsm.h"
+
+/* network-manager headers */
+#include <NetworkManager.h>
+
+#if !defined(NM_CHECK_VERSION)
+#define NM_CHECK_VERSION(x,y,z) 0
+#endif
+
+using namespace ConnectionSettings;
+
+/*
+ class GSM
+*/
+GSM::GSM(Connection* conn)
+ : ConnectionSetting(conn, NM_SETTING_GSM_SETTING_NAME), _number("*99#"), _network_type(-1), _band(-1)
+{
+}
+
+void GSM::setNumber(const TQString& number)
+{
+ _number = number;
+}
+
+TQString GSM::getNumber() const
+{
+ return _number;
+}
+
+void GSM::setUsername(const TQString& username)
+{
+ _username = username;
+}
+
+TQString GSM::getUsername() const
+{
+ return _username;
+}
+
+void GSM::setPassword(const TQString& password)
+{
+ _password = password;
+}
+
+TQString GSM::getPassword() const
+{
+ return _password;
+}
+
+void GSM::setPin(const TQString& pin)
+{
+ _pin = pin;
+}
+
+TQString GSM::getPin() const
+{
+ return _pin;
+}
+
+void GSM::setPuk(const TQString& puk)
+{
+ _puk = puk;
+}
+
+TQString GSM::getPuk() const
+{
+ return _puk;
+}
+
+void GSM::setAPN(const TQString& apn)
+{
+ _apn = apn;
+}
+
+TQString GSM::getAPN() const
+{
+ return _apn;
+}
+
+void GSM::setNetworkID(const TQString& id)
+{
+ _network_id = id;
+}
+
+TQString GSM::getNetworkID() const
+{
+ return _network_id;
+}
+
+void GSM::setNetworkType(int type)
+{
+ _network_type = type;
+}
+
+int GSM::getNetworkType() const
+{
+ return _network_type;
+}
+
+void GSM::setBand(int band)
+{
+ _band = band;
+}
+
+int GSM::getBand() const
+{
+ return _band;
+}
+
+bool
+GSM::isValid() const
+{
+ return true;
+}
+
+SettingsMap
+GSM::toMap() const
+{
+ SettingsMap map;
+
+ if (!_number.isEmpty()) {
+ map.insert(NM_SETTING_GSM_NUMBER, TQT_DBusData::fromString(_number));
+ }
+ if (!_username.isEmpty()) {
+ map.insert(NM_SETTING_GSM_USERNAME, TQT_DBusData::fromString(_username));
+ }
+ if (!_apn.isEmpty()) {
+ map.insert(NM_SETTING_GSM_APN, TQT_DBusData::fromString(_apn));
+ }
+ if (!_network_id.isEmpty()) {
+ map.insert(NM_SETTING_GSM_NETWORK_ID, TQT_DBusData::fromString(_network_id));
+ }
+ map.insert(NM_SETTING_GSM_NETWORK_TYPE, TQT_DBusData::fromInt32(_network_type));
+#if NM_CHECK_VERSION(0,8,992)
+#else
+ map.insert(NM_SETTING_GSM_BAND, TQT_DBusData::fromInt32(_band));
+#endif
+
+ return map;
+}
+
+SettingsMap
+GSM::toSecretsMap(bool with_settings) const
+{
+ SettingsMap map;
+
+ // first serialize the settings if needed
+ if (with_settings)
+ map = toMap();
+
+ if (!_password.isEmpty()) {
+ map.insert(NM_SETTING_GSM_PASSWORD, TQT_DBusData::fromString(_password));
+ }
+ if (!_pin.isEmpty()) {
+ map.insert(NM_SETTING_GSM_PIN, TQT_DBusData::fromString(_pin));
+ }
+#if NM_CHECK_VERSION(0,8,992)
+#else
+ if (!_puk.isEmpty()) {
+ map.insert(NM_SETTING_GSM_PUK, TQT_DBusData::fromString(_puk));
+ }
+#endif
+
+ return map;
+}
+
+bool
+GSM::fromSecretsMap(const SettingsMap& map)
+{
+ for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
+ {
+ // TODO: add all secrets
+ if (it.key() == NM_SETTING_GSM_PASSWORD)
+ setPassword(it.data().toString());
+ else if (it.key() == NM_SETTING_GSM_PIN)
+ setPin(it.data().toString());
+#if NM_CHECK_VERSION(0,8,992)
+#else
+ else if (it.key() == NM_SETTING_GSM_PUK)
+ setPuk(it.data().toString());
+#endif
+ else
+ kdWarning() << k_funcinfo << " Unknown secret: " << it.key() << endl;
+ }
+ return true;
+}
+
+void
+GSM::fromMap(const SettingsMap& map)
+{
+ // TODO: add all attributes
+ for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
+ {
+ if (it.key() == NM_SETTING_GSM_NUMBER)
+ setNumber(it.data().toString());
+ else if (it.key() == NM_SETTING_GSM_USERNAME)
+ setUsername(it.data().toString());
+ else if (it.key() == NM_SETTING_GSM_APN)
+ setAPN(it.data().toString());
+ else if (it.key() == NM_SETTING_GSM_NETWORK_ID)
+ setNetworkID(it.data().toString());
+ else if (it.key() == NM_SETTING_GSM_NETWORK_TYPE)
+ setNetworkType(it.data().toUInt32());
+#if NM_CHECK_VERSION(0,8,992)
+#else
+ else if (it.key() == NM_SETTING_GSM_BAND)
+ setBand(it.data().toUInt32());
+#endif
+ else
+ kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
+ }
+}
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_gsm.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_gsm.h
new file mode 100644
index 0000000..ac912ae
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_gsm.h
@@ -0,0 +1,99 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_gsm.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_GSM_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_GSM_H
+
+#include <stdint.h>
+#include <tqhostaddress.h>
+#include <tqmap.h>
+#include <tqvariant.h>
+#include <tqobject.h>
+
+#include <tqdbusdata.h>
+
+#include "knetworkmanager-connection_setting.h"
+
+/* NM headers */
+#include <nm-setting-gsm.h>
+
+namespace ConnectionSettings
+{
+
+class Connection;
+
+// serial setting
+class GSM : public ConnectionSetting
+{
+ public:
+ GSM(Connection* conn);
+
+ SettingsMap toMap() const;
+ SettingsMap toSecretsMap(bool with_settings = true) const;
+ void fromMap(const SettingsMap&);
+ bool fromSecretsMap(const SettingsMap&);
+
+ bool isValid() const;
+ bool useSetting();
+
+ void setNumber(const TQString&);
+ TQString getNumber() const;
+
+ void setUsername(const TQString&);
+ TQString getUsername() const;
+
+ void setPassword(const TQString&);
+ TQString getPassword() const;
+
+ void setAPN(const TQString&);
+ TQString getAPN() const;
+
+ void setNetworkID(const TQString&);
+ TQString getNetworkID() const;
+
+ void setNetworkType(int);
+ int getNetworkType() const;
+
+ void setBand(int);
+ int getBand() const;
+
+ void setPin(const TQString&);
+ TQString getPin() const;
+
+ void setPuk(const TQString&);
+ TQString getPuk() const;
+
+ private:
+ TQString _number;
+ TQString _username;
+ TQString _password;
+ TQString _apn;
+ TQString _network_id;
+ int _network_type;
+ int _band;
+ TQString _pin;
+ TQString _puk;
+};
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_CDMA_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_gsm_widget.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_gsm_widget.cpp
new file mode 100644
index 0000000..c43f4ad
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_gsm_widget.cpp
@@ -0,0 +1,108 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_gsm_widget.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// qt headers
+#include <tqwidget.h>
+#include <tqlineedit.h>
+#include <tqcheckbox.h>
+#include <tqlayout.h>
+#include <tqcombobox.h>
+#include <tqspinbox.h>
+#include <tqiconset.h>
+#include <kiconloader.h>
+#include <tqwidgetstack.h>
+#include <kuser.h>
+
+// knm headers
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_setting_gsm.h"
+#include "knetworkmanager-connection_setting_gsm_widget.h"
+#include "knetworkmanager-device.h"
+
+#include "connection_setting_gsm.h"
+
+using namespace ConnectionSettings;
+
+GSMWidgetImpl::GSMWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl)
+ : WidgetInterface(parent, name, fl)
+{
+ _gsmsetting = dynamic_cast<ConnectionSettings::GSM*> (conn->getSetting(NM_SETTING_GSM_SETTING_NAME));
+
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
+ _mainWid = new ConnectionSettingGsmWidget(this);
+ tqlayout->addWidget(_mainWid);
+
+ Init();
+}
+
+void
+GSMWidgetImpl::Init()
+{
+ _mainWid->mUsername->setText( _gsmsetting->getUsername() );
+ _mainWid->mPassword->setText( _gsmsetting->getPassword( ) );
+ _mainWid->mPin->setText( _gsmsetting->getPin() );
+ _mainWid->mPuk->setText( _gsmsetting->getPuk() );
+ _mainWid->mNumber->setText( _gsmsetting->getNumber() );
+ _mainWid->mApn->setText( _gsmsetting->getAPN() );
+ _mainWid->mNetworkId->setText( _gsmsetting->getNetworkID( ));
+ _mainWid->mNetworkType->setCurrentItem( _gsmsetting->getNetworkType( ) +1);
+ _mainWid->mBand->setValue( _gsmsetting->getBand() );
+
+ connect( _mainWid->mUsername, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
+ connect( _mainWid->mPassword, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
+ connect( _mainWid->mPin, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
+ connect( _mainWid->mPuk, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
+ connect( _mainWid->mNumber, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
+ connect( _mainWid->mApn, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
+ connect( _mainWid->mNetworkId, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
+ connect( _mainWid->mNetworkType, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty()));
+ connect( _mainWid->mBand, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dirty()));
+}
+
+void
+GSMWidgetImpl::Deactivate()
+{
+}
+
+void
+GSMWidgetImpl::Activate()
+{
+
+}
+
+void
+GSMWidgetImpl::dirty()
+{
+ _gsmsetting->setUsername( _mainWid->mUsername->text() );
+ _gsmsetting->setPassword( _mainWid->mPassword->text() );
+ _gsmsetting->setPin( _mainWid->mPin->text() );
+ _gsmsetting->setPuk( _mainWid->mPuk->text() );
+ _gsmsetting->setNumber( _mainWid->mNumber->text() );
+ _gsmsetting->setAPN( _mainWid->mApn->text() );
+ _gsmsetting->setNetworkID( _mainWid->mNetworkId->text() );
+ _gsmsetting->setNetworkType( _mainWid->mNetworkType->currentItem() - 1 );
+ _gsmsetting->setBand( _mainWid->mBand->value() );
+}
+
+#include "knetworkmanager-connection_setting_gsm_widget.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_gsm_widget.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_gsm_widget.h
new file mode 100644
index 0000000..b4b5501
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_gsm_widget.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_gsm_widget.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Author: Will Stephenson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_GSM_WIDGET_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_GSM_WIDGET_H
+
+
+// qt headers
+#include <tqwidget.h>
+#include <tqlineedit.h>
+
+// knm headers
+#include "knetworkmanager-connection_setting_gsm.h"
+#include "knetworkmanager-connection_setting_widget_interface.h"
+#include "knetworkmanager-device.h"
+
+//class VPNService;
+class ConnectionSettingGsmWidget;
+
+namespace ConnectionSettings
+{
+
+class Connection;
+
+class GSMWidgetImpl : public WidgetInterface
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ GSMWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0);
+ void Activate();
+ void Deactivate();
+ public slots:
+ void dirty();
+
+ private:
+ void Init();
+ //VPNConfigWidget* getVPNConfigWidget(VPNService* service);
+
+
+ GSM* _gsmsetting;
+ ConnectionSettingGsmWidget* _mainWid;
+};
+
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_GSM_WIDGET_H*/
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_info.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_info.cpp
new file mode 100644
index 0000000..225d002
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_info.cpp
@@ -0,0 +1,163 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqhostaddress.h>
+#include <tqvariant.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQT_DBus headers*/
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-accesspoint.h"
+
+
+using namespace ConnectionSettings;
+
+/*
+ class Info
+*/
+Info::Info(Connection* conn, TQString devtype, const TQString& name, bool autoconnect)
+ : ConnectionSetting(conn, NM_SETTING_CONNECTION_SETTING_NAME)
+{
+ _name = name;
+ _devtype = devtype;
+ _autoconnect = autoconnect;
+}
+
+TQString
+Info::getDevType() const
+{
+ return _devtype;
+}
+
+void
+Info::setDevType(const TQString& devtype)
+{
+ _devtype = devtype;
+ emitValidityChanged();
+}
+
+TQString
+Info::getName() const
+{
+ return _name;
+}
+
+void
+Info::setName(const TQString& name)
+{
+ _name = name;
+ emitValidityChanged();
+}
+
+bool
+Info::getAutoconnect() const
+{
+ return _autoconnect;
+}
+
+void
+Info::setAutoconnect(bool autoconnect)
+{
+ _autoconnect = autoconnect;
+ emitValidityChanged();
+}
+
+TQDateTime
+Info::getTimestamp() const
+{
+ return _timestamp;
+}
+
+void
+Info::setTimestamp(const TQDateTime& dt)
+{
+ _timestamp = dt;
+}
+
+TQString
+Info::getUUID() const
+{
+ return _uuid;
+}
+
+void
+Info::setUUID(const TQString& uuid)
+{
+ _uuid = uuid;
+}
+
+SettingsMap
+Info::toMap() const
+{
+ SettingsMap map;
+ map.insert(NM_SETTING_CONNECTION_ID, TQT_DBusData::fromString(_name));
+ map.insert(NM_SETTING_CONNECTION_TYPE, TQT_DBusData::fromString(_devtype));
+ map.insert(NM_SETTING_CONNECTION_AUTOCONNECT, TQT_DBusData::fromBool(_autoconnect));
+ map.insert(NM_SETTING_CONNECTION_UUID, TQT_DBusData::fromString(_uuid));
+
+ if (!_timestamp.isNull())
+ map.insert(NM_SETTING_CONNECTION_TIMESTAMP, TQT_DBusData::fromUInt32(_timestamp.toTime_t()));
+
+ return map;
+}
+
+void
+Info::fromMap(const SettingsMap& map)
+{
+ SettingsMap::ConstIterator it;
+
+ if ((it = map.find(NM_SETTING_CONNECTION_ID)) != map.end())
+ _name = it.data().toString();
+
+ if ((it = map.find(NM_SETTING_CONNECTION_TYPE)) != map.end())
+ _devtype = it.data().toString();
+
+ if ((it = map.find(NM_SETTING_CONNECTION_AUTOCONNECT)) != map.end())
+ _autoconnect = it.data().toBool();
+
+ if ((it = map.find(NM_SETTING_CONNECTION_TIMESTAMP)) != map.end())
+ _timestamp.setTime_t(it.data().toUInt32());
+
+ if ((it = map.find(NM_SETTING_CONNECTION_UUID)) != map.end())
+ _uuid = it.data().toString();
+}
+
+bool
+Info::isValid() const
+{
+ // name is essential
+ if (_name.isEmpty())
+ return false;
+
+ return true;
+}
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_info.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_info.h
new file mode 100644
index 0000000..705387b
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_info.h
@@ -0,0 +1,79 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_INFO_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_INFO_H
+
+#include <stdint.h>
+#include <tqhostaddress.h>
+#include <tqmap.h>
+#include <tqvariant.h>
+#include <tqobject.h>
+#include <tqdatetime.h>
+
+#include <tqdbusdata.h>
+#include "knetworkmanager-connection_setting.h"
+
+/* NM headers */
+#include <nm-setting-connection.h>
+
+namespace ConnectionSettings
+{
+
+// info setting
+class Info : public ConnectionSetting
+{
+ public:
+ Info(Connection* conn, TQString devtype = TQString(), const TQString& name = TQString(), bool autoconnect = false);
+
+ SettingsMap toMap() const;
+ void fromMap(const SettingsMap&);
+
+ TQString getDevType() const;
+ void setDevType(const TQString&);
+
+ TQString getName() const;
+ void setName(const TQString&);
+
+ bool getAutoconnect() const;
+ void setAutoconnect(bool);
+
+ TQDateTime getTimestamp() const;
+ void setTimestamp(const TQDateTime&);
+
+ TQString getUUID() const;
+ void setUUID(const TQString&);
+
+ bool isValid() const;
+
+ private:
+ TQString _name;
+ TQString _devtype;
+ bool _autoconnect;
+ TQDateTime _timestamp;
+ TQString _uuid;
+};
+
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_INFO_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_info_widget.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_info_widget.cpp
new file mode 100644
index 0000000..a97e0c0
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_info_widget.cpp
@@ -0,0 +1,79 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Valentine Sinitsyn <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// qt headers
+#include <tqwidget.h>
+#include <tqlineedit.h>
+#include <tqcheckbox.h>
+#include <tqlayout.h>
+
+// knm headers
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-connection_setting_info_widget.h"
+#include "knetworkmanager-device.h"
+
+using namespace ConnectionSettings;
+
+InfoWidgetImpl::InfoWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl)
+ : WidgetInterface(parent, name, fl)
+{
+ _infosetting = dynamic_cast<ConnectionSettings::Info*> (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME));
+
+
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
+ _mainWid = new ConnectionSettingInfoWidget(this);
+ tqlayout->addWidget(_mainWid);
+
+ Init();
+}
+
+void
+InfoWidgetImpl::Init()
+{
+ connect(_mainWid->txtConnectionName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotNameChanged(const TQString&)));
+ connect(_mainWid->chkAutoConnect, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotAutoconnectChanged(bool)));
+}
+
+void
+InfoWidgetImpl::Activate()
+{
+ _mainWid->txtConnectionName->setText(_infosetting->getName());
+ _mainWid->chkAutoConnect->setChecked(_infosetting->getAutoconnect());
+}
+
+void
+InfoWidgetImpl::slotNameChanged(const TQString& name)
+{
+ _infosetting->setName(name);
+}
+
+void
+InfoWidgetImpl::slotAutoconnectChanged(bool autoconnect)
+{
+ _infosetting->setAutoconnect(autoconnect);
+}
+
+#include "knetworkmanager-connection_setting_info_widget.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_info_widget.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_info_widget.h
new file mode 100644
index 0000000..b09d61c
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_info_widget.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Valentine Sinitsyn <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_INFO_WIDGET_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_INFO_WIDGET_H
+
+
+// qt headers
+#include <tqwidget.h>
+#include <tqlineedit.h>
+
+// knm headers
+#include "connection_setting_info.h"
+#include "knetworkmanager-connection_setting_widget_interface.h"
+#include "knetworkmanager-device.h"
+
+namespace ConnectionSettings
+{
+
+class Info;
+class Connection;
+
+class InfoWidgetImpl : public WidgetInterface
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ InfoWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0);
+ void Activate();
+
+ public slots:
+ void slotNameChanged(const TQString&);
+ void slotAutoconnectChanged(bool);
+
+ private:
+ void Init();
+
+ Info* _infosetting;
+ ConnectionSettingInfoWidget* _mainWid;
+};
+
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_INFO_WIDGET_H*/
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ipv4.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ipv4.cpp
new file mode 100644
index 0000000..15f8978
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ipv4.cpp
@@ -0,0 +1,318 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqhostaddress.h>
+#include <tqvariant.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQT_DBus headers*/
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-connection_setting_ipv4.h"
+
+
+using namespace ConnectionSettings;
+
+// reverse order the bytes
+TQ_UINT32 swap32(TQ_UINT32 x)
+{
+ TQ_UINT32 ret = 0;
+
+ TQ_UINT8* from = (TQ_UINT8*) &x;
+ TQ_UINT8* to = (TQ_UINT8*) &ret;
+
+ for (int i = 0; i < 4; ++i)
+ to[3-i] = from[i];
+ return ret;
+}
+
+/*
+ class IPv4
+*/
+IPv4::IPv4(Connection* conn)
+ : ConnectionSetting(conn, NM_SETTING_IP4_CONFIG_SETTING_NAME)
+{
+ _method = METHOD_DHCP;
+ _ignore_auto_dns = false;
+ _ignore_auto_routes = false;
+}
+
+TQValueList<IPv4Address> IPv4::getAddresses() const
+{
+ return _addresses;
+}
+
+void IPv4::setAddresses(const TQValueList<IPv4Address> & adr)
+{
+ _addresses = adr;
+ emitValidityChanged();
+}
+
+TQValueList<TQHostAddress> IPv4::getDNS() const
+{
+ return _dns;
+}
+
+void IPv4::setDNS(const TQValueList<TQHostAddress>& dns)
+{
+ _dns = dns;
+ emitValidityChanged();
+}
+
+TQStringList IPv4::getDNSSearch() const
+{
+ return _dns_search;
+}
+
+void IPv4::setDNSSearch(const TQStringList & dnsSearch)
+{
+ _dns_search = dnsSearch;
+ emitValidityChanged();
+}
+
+void
+IPv4::setMethod(IPV4METHOD method)
+{
+ _method = method;
+ emitValidityChanged();
+}
+
+IPv4::IPV4METHOD
+IPv4::getMethod() const
+{
+ return _method;
+}
+
+void
+IPv4::setIgnoreAutoDNS(bool ignore)
+{
+ _ignore_auto_dns = ignore;
+ emitValidityChanged();
+}
+
+bool
+IPv4::getIgnoreAutoDNS() const
+{
+ return _ignore_auto_dns;
+}
+
+void
+IPv4::setIgnoreAutoRoutes(bool ignore)
+{
+ _ignore_auto_routes = ignore;
+ emitValidityChanged();
+}
+
+bool
+IPv4::getIgnoreAutoRoutes() const
+{
+ return _ignore_auto_routes;
+}
+
+bool
+IPv4::isValid() const
+{
+ if (_method == METHOD_MANUAL)
+ {
+ // only check the manual settings
+
+ // at least one address has to be specified
+ if (_addresses.empty())
+ return false;
+
+ // check every address
+ for (TQValueList<IPv4Address>::ConstIterator it = _addresses.begin(); it != _addresses.end(); ++it)
+ {
+ if ((*it).address.isNull())
+ return false;
+ if ((*it).netmask.isNull())
+ return false;
+ // no need to check gateway as it is optional
+ }
+
+ // check DNS addresses but may be empty
+ for (TQValueList<TQHostAddress>::ConstIterator it = _dns.begin(); it != _dns.end(); ++it)
+ {
+ if ((*it).isNull())
+ return false;
+ }
+
+ // don't check DNS Search because it is optional ...
+ }
+
+ return true;
+}
+
+SettingsMap
+IPv4::toMap() const
+{
+ SettingsMap map;
+
+ if (_method == METHOD_DHCP)
+ map.insert(NM_SETTING_IP4_CONFIG_METHOD, TQT_DBusData::fromString(NM_SETTING_IP4_CONFIG_METHOD_AUTO));
+ else if (_method == METHOD_AUTOIP)
+ map.insert(NM_SETTING_IP4_CONFIG_METHOD, TQT_DBusData::fromString(NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL));
+ else if (_method == METHOD_SHARED)
+ map.insert(NM_SETTING_IP4_CONFIG_METHOD, TQT_DBusData::fromString(NM_SETTING_IP4_CONFIG_METHOD_SHARED));
+ else if (_method == METHOD_MANUAL)
+ {
+ map.insert(NM_SETTING_IP4_CONFIG_METHOD, TQT_DBusData::fromString(NM_SETTING_IP4_CONFIG_METHOD_MANUAL));
+
+ // DNS search
+ if (_dns_search.size() > 0)
+ {
+ TQValueList<TQT_DBusData> dns_search;
+ TQStringList::ConstIterator it = _dns_search.begin();
+ for(;it != _dns_search.end(); ++it)
+ dns_search.append(TQT_DBusData::fromString(*it));
+
+ map.insert(NM_SETTING_IP4_CONFIG_DNS_SEARCH, TQT_DBusData::fromTQValueList(dns_search));
+ }
+
+ // DNS addresses
+ if (_dns.size() > 0)
+ {
+ TQValueList<TQT_DBusData> dns;
+ TQValueList<TQHostAddress>::ConstIterator it_dns = _dns.begin();
+ // the strange swap32 is needed as NM reads the address exactly the other way round as TQt
+ for(;it_dns != _dns.end(); ++it_dns)
+ dns.append(TQT_DBusData::fromUInt32(swap32((*it_dns).toIPv4Address())));
+
+ map.insert(NM_SETTING_IP4_CONFIG_DNS, TQT_DBusData::fromTQValueList(dns));
+ }
+
+ // IP's
+ if (_addresses.size() > 0)
+ {
+ TQValueList<TQT_DBusData> ips;
+ for (TQValueList<IPv4Address>::ConstIterator it = _addresses.begin(); it != _addresses.end(); ++it)
+ {
+ TQValueList<TQT_DBusData> cur_ip;
+ cur_ip.append(TQT_DBusData::fromUInt32(swap32((*it).address.toIPv4Address())));
+ cur_ip.append(TQT_DBusData::fromUInt32(toCIDRSuffix((*it).netmask)));
+ if (!(*it).gateway.isNull())
+ cur_ip.append(TQT_DBusData::fromUInt32(swap32((*it).gateway.toIPv4Address())));
+ ips.append(TQT_DBusData::fromTQValueList(cur_ip));
+ }
+ map.insert(NM_SETTING_IP4_CONFIG_ADDRESSES, TQT_DBusData::fromTQValueList(ips));
+ }
+ }
+ map.insert(NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, TQT_DBusData::fromBool(_ignore_auto_routes));
+ map.insert(NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, TQT_DBusData::fromBool(_ignore_auto_dns));
+ return map;
+}
+
+void
+IPv4::fromMap(const SettingsMap& map)
+{
+ SettingsMap::ConstIterator it;
+
+ if ((it = map.find(NM_SETTING_IP4_CONFIG_METHOD)) != map.end())
+ {
+ if (it.data().toString() == NM_SETTING_IP4_CONFIG_METHOD_AUTO || it.data().toString() == "dhcp")
+ _method = METHOD_DHCP;
+ else if (it.data().toString() == NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL || it.data().toString() == "autoip")
+ _method = METHOD_AUTOIP;
+ else if (it.data().toString() == NM_SETTING_IP4_CONFIG_METHOD_SHARED)
+ _method = METHOD_SHARED;
+ else if (it.data().toString() == NM_SETTING_IP4_CONFIG_METHOD_MANUAL)
+ _method = METHOD_MANUAL;
+ }
+
+ // DNS search
+ if ((it = map.find(NM_SETTING_IP4_CONFIG_DNS_SEARCH)) != map.end())
+ {
+ TQValueList<TQT_DBusData> dns_search = it.data().toTQValueList();
+ for (TQValueList<TQT_DBusData>::Iterator it = dns_search.begin(); it != dns_search.end(); ++it)
+ {
+ _dns_search.append( (*it).toString());
+ }
+ }
+
+ // DNS addresses
+ if ((it = map.find(NM_SETTING_IP4_CONFIG_DNS)) != map.end())
+ {
+ TQValueList<TQT_DBusData> dns = it.data().toTQValueList();
+ for (TQValueList<TQT_DBusData>::Iterator it = dns.begin(); it != dns.end(); ++it)
+ {
+ _dns.append( TQHostAddress(swap32((*it).toUInt32())) );
+ }
+ }
+
+ // IP's
+ if ((it = map.find(NM_SETTING_IP4_CONFIG_ADDRESSES)) != map.end())
+ {
+ TQValueList<TQT_DBusData> ips = it.data().toTQValueList();
+ for (TQValueList<TQT_DBusData>::Iterator it2 = ips.begin(); it2 != ips.end(); ++it2)
+ {
+ TQValueList<TQT_DBusData> cur_ip = (*it2).toTQValueList();
+ IPv4Address address;
+
+ address.address = swap32(cur_ip[0].toUInt32());
+
+ if (cur_ip[1].toUInt32() >= 0 && cur_ip[1].toUInt32() <= 32)
+ address.netmask = fromCIDRSuffix(cur_ip[1].toUInt32());
+ else
+ address.netmask = swap32(cur_ip[1].toUInt32());
+
+ if (cur_ip.size() > 2)
+ address.gateway = swap32(cur_ip[2].toUInt32());
+
+ _addresses.append(address);
+ }
+ }
+
+ if ((it = map.find(NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES)) != map.end())
+ _ignore_auto_routes = it.data().toBool();
+
+ if ((it = map.find(NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS)) != map.end())
+ _ignore_auto_dns = it.data().toBool();
+}
+
+TQ_UINT32 IPv4::toCIDRSuffix(const TQHostAddress& adr) const
+{
+ TQ_UINT32 netmask = adr.toIPv4Address();
+ TQ_UINT32 suffix = 0;
+ while (netmask > 0)
+ {
+ suffix++;
+ netmask = netmask << 1;
+ }
+ return suffix;
+}
+
+TQHostAddress IPv4::fromCIDRSuffix(TQ_UINT32 suffix)
+{
+ TQ_UINT32 netmask = 0xFFFFFFFF;
+ netmask = netmask << (32 - suffix);
+ return TQHostAddress(netmask);
+}
+
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ipv4.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ipv4.h
new file mode 100644
index 0000000..7788769
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ipv4.h
@@ -0,0 +1,112 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_IPV4_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_IPV4_H
+
+#include <stdint.h>
+#include <tqhostaddress.h>
+#include <tqmap.h>
+#include <tqvariant.h>
+#include <tqobject.h>
+
+#include <tqdbusdata.h>
+
+#include "knetworkmanager-connection_setting.h"
+
+/* NM headers */
+#include <nm-setting-ip4-config.h>
+
+namespace ConnectionSettings
+{
+
+class Connection;
+
+class IPv4Address
+{
+ public:
+ TQHostAddress address;
+ TQHostAddress netmask;
+ TQHostAddress gateway;
+};
+
+// ipv4 setting
+class IPv4 : public ConnectionSetting
+{
+ public:
+ enum IPV4METHOD
+ {
+ METHOD_DHCP = 1
+ , METHOD_AUTO = METHOD_DHCP // DHCP is obsolete now
+ , METHOD_AUTOIP
+ , METHOD_LINK_LOCAL = METHOD_AUTOIP // AUTOIP is obsolete now
+ , METHOD_MANUAL
+ , METHOD_SHARED
+ };
+
+ IPv4(Connection* conn);
+
+ SettingsMap toMap() const;
+ void fromMap(const SettingsMap&);
+
+ void addAddress(const IPv4Address&);
+ void removeAddress(const IPv4Address&);
+
+ TQValueList<IPv4Address> getAddresses() const;
+ void setAddresses(const TQValueList<IPv4Address>&);
+
+ TQValueList<TQHostAddress> getDNS() const;
+ void setDNS(const TQValueList<TQHostAddress>&);
+
+ TQStringList getDNSSearch() const;
+ void setDNSSearch(const TQStringList&);
+
+ void setMethod(IPV4METHOD);
+ IPV4METHOD getMethod() const;
+
+ void setIgnoreAutoDNS(bool);
+ bool getIgnoreAutoDNS() const;
+
+ void setIgnoreAutoRoutes(bool);
+ bool getIgnoreAutoRoutes() const;
+
+ bool isValid() const;
+
+ bool useSetting();
+
+ TQ_UINT32 toCIDRSuffix(const TQHostAddress&) const;
+ TQHostAddress fromCIDRSuffix(TQ_UINT32 suffix);
+
+ private:
+ TQValueList<TQHostAddress> _dns;
+ TQStringList _dns_search;
+ TQValueList<IPv4Address> _addresses;
+ IPV4METHOD _method;
+ bool _ignore_auto_dns;
+ bool _ignore_auto_routes;
+
+ // TODO routes, dhcp-client-id, dhcp-hostname
+};
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_IPV4_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ipv4_widget.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ipv4_widget.cpp
new file mode 100644
index 0000000..e43d646
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ipv4_widget.cpp
@@ -0,0 +1,175 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Valentine Sinitsyn <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include <tqwidget.h>
+#include <tqlineedit.h>
+#include <tqgroupbox.h>
+#include <tqlayout.h>
+#include <tqhostaddress.h>
+
+#include "knetworkmanager-connection_setting_ipv4_widget.h"
+#include "knetworkmanager-connection_setting_ipv4.h"
+
+using namespace ConnectionSettings;
+
+#define IP_INPUT_MASK "900.900.900.900"
+
+IPv4WidgetImpl::IPv4WidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl)
+ : WidgetInterface(parent, name, fl)
+{
+ _ipv4_setting = dynamic_cast<ConnectionSettings::IPv4*> (conn->getSetting(NM_SETTING_IP4_CONFIG_SETTING_NAME));
+
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
+ _mainWid = new ConnectionSettingIPv4Widget(this);
+ tqlayout->addWidget(_mainWid);
+
+ Init();
+}
+
+void
+IPv4WidgetImpl::Init()
+{
+ _mainWid->groupIPConfig->setChecked(_ipv4_setting->getMethod() == IPv4::METHOD_MANUAL);
+
+ connect(_mainWid->groupIPConfig, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotIPConfigEnabled(bool)));
+
+ _mainWid->txtIP->setInputMask(IP_INPUT_MASK);
+ _mainWid->txtNetmask->setInputMask(IP_INPUT_MASK);
+ _mainWid->txtGateway->setInputMask(IP_INPUT_MASK);
+
+ if (!_ipv4_setting->getAddresses().isEmpty())
+ {
+ _mainWid->txtIP->setText(_ipv4_setting->getAddresses()[0].address.toString());
+ _mainWid->txtNetmask->setText(_ipv4_setting->getAddresses()[0].netmask.toString());
+ _mainWid->txtGateway->setText(_ipv4_setting->getAddresses()[0].gateway.toString());
+ }
+
+ if (!_ipv4_setting->getDNS().isEmpty())
+ {
+ TQValueList<TQHostAddress> hosts = _ipv4_setting->getDNS();
+ TQStringList list;
+ for (TQValueList<TQHostAddress>::Iterator it = hosts.begin(); it != hosts.end(); ++it)
+ {
+ list.append((*it).toString());
+ }
+ _mainWid->txtDNSAddresses->setText(list.join(" "));
+ }
+
+ if (!_ipv4_setting->getDNSSearch().isEmpty())
+ _mainWid->txtDNSSearch->setText(_ipv4_setting->getDNSSearch().join(" "));
+
+ // connect the signals after setting up the values
+ connect(_mainWid->txtIP, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotIPAddressChanged(const TQString&)));
+ connect(_mainWid->txtNetmask, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotNetmaskChanged(const TQString&)));
+ connect(_mainWid->txtGateway, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotGatewayChanged(const TQString&)));
+ connect(_mainWid->txtDNSAddresses, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotDNSAddressesChanged(const TQString&)));
+ connect(_mainWid->txtDNSSearch, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotDNSSearchChanged(const TQString&)));
+}
+
+void
+IPv4WidgetImpl::Activate()
+{
+
+}
+
+void
+IPv4WidgetImpl::slotDNSAddressesChanged(const TQString& adr)
+{
+ // TODO: use , and ; for splitting too
+ TQStringList list = TQStringList::split(" ", adr);
+ TQValueList<TQHostAddress> hosts;
+ for (TQStringList::Iterator it = list.begin(); it != list.end(); ++it)
+ {
+ TQHostAddress host(*it);
+ if (!host.isNull())
+ hosts.append(host);
+ }
+ _ipv4_setting->setDNS(hosts);
+}
+
+
+void
+IPv4WidgetImpl::slotDNSSearchChanged(const TQString& search)
+{
+ // TODO: use , and ; for splitting too
+ _ipv4_setting->setDNSSearch(TQStringList::split(" ", search));
+}
+
+void
+IPv4WidgetImpl::slotIPConfigEnabled(bool enabled)
+{
+ _ipv4_setting->setMethod(enabled ? IPv4::METHOD_MANUAL : IPv4::METHOD_DHCP );
+}
+
+void
+IPv4WidgetImpl::slotIPAddressChanged(const TQString& ip)
+{
+ TQHostAddress ipadr(ip);
+ if (!ipadr.isNull())
+ {
+ TQValueList<IPv4Address> addrs = _ipv4_setting->getAddresses();
+ if (addrs.size() > 0)
+ addrs[0].address = ipadr;
+ else
+ {
+ IPv4Address adr;
+ adr.address = ipadr;
+ addrs.append(adr);
+ }
+ _ipv4_setting->setAddresses(addrs);
+
+ // if netmask is not set yet we preset it to a default value depending on the network class
+ if (_mainWid->txtNetmask->text() == "...")
+ {
+ if ( (ipadr.toIPv4Address() & 0xFF000000) < 0xDF000000)
+ {
+ if ( (ipadr.toIPv4Address() & 0xFF000000) >= 0xC0000000)
+ _mainWid->txtNetmask->setText("255.255.255.0"); // class C
+ else if ( (ipadr.toIPv4Address() & 0xFF000000) >= 0x80000000)
+ _mainWid->txtNetmask->setText("255.255.0.0"); // class B
+ else
+ _mainWid->txtNetmask->setText("255.0.0.0"); // class A
+ }
+ }
+ }
+}
+
+void
+IPv4WidgetImpl::slotNetmaskChanged(const TQString& ip)
+{
+ TQValueList<IPv4Address> addrs = _ipv4_setting->getAddresses();
+ addrs[0].netmask = TQHostAddress(ip);
+ _ipv4_setting->setAddresses(addrs);
+}
+
+void
+IPv4WidgetImpl::slotGatewayChanged(const TQString& ip)
+{
+ TQValueList<IPv4Address> addrs = _ipv4_setting->getAddresses();
+ addrs[0].gateway = TQHostAddress(ip);
+ _ipv4_setting->setAddresses(addrs);
+}
+
+#include "knetworkmanager-connection_setting_ipv4_widget.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ipv4_widget.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ipv4_widget.h
new file mode 100644
index 0000000..e65e4da
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ipv4_widget.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_IPV4_WIDGET_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_IPV4_WIDGET_H
+
+// qt autogenerated headers
+#include "connection_setting_ipv4.h"
+
+// knetworkmanager headers
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_setting_widget_interface.h"
+#include "knetworkmanager-connection_setting_ipv4.h"
+
+namespace ConnectionSettings
+{
+ class IPv4;
+
+ class IPv4WidgetImpl : public WidgetInterface
+ {
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+ IPv4WidgetImpl(Connection* conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ void Activate();
+
+ public slots:
+ void slotIPConfigEnabled(bool);
+ void slotIPAddressChanged(const TQString&);
+ void slotNetmaskChanged(const TQString&);
+ void slotGatewayChanged(const TQString&);
+ void slotDNSSearchChanged(const TQString&);
+ void slotDNSAddressesChanged(const TQString&);
+
+ private:
+ void Init();
+
+ IPv4* _ipv4_setting;
+ ConnectionSettingIPv4Widget* _mainWid;
+ };
+
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_IPv4_WIDGET_H*/
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ppp.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ppp.cpp
new file mode 100644
index 0000000..257a012
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ppp.cpp
@@ -0,0 +1,376 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_ppp.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* NM headers */
+#include <nm-setting-ppp.h>
+
+/* qt headers */
+#include <tqhostaddress.h>
+#include <tqvariant.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQT_DBus headers*/
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_setting_ppp.h"
+
+using namespace ConnectionSettings;
+
+/*
+ class PPP
+*/
+PPP::PPP(Connection* conn)
+: ConnectionSetting(conn, NM_SETTING_PPP_SETTING_NAME),
+ _noauth(false),
+ _refuse_eap(false),
+ _refuse_pap(false),
+ _refuse_chap(false),
+ _refuse_mschap(false),
+ _refuse_mschapv2(false),
+ _nobsdcomp(false),
+ _nodeflate(false),
+ _novjcomp(false),
+ _require_mppe(false),
+ _require_mppe_128(false),
+ _mppe_stateful(false),
+ _require_mppc(false),
+ _crtscts(false),
+ _baud(0),
+ _mru(0),
+ _mtu(0),
+ _lcp_echo_failure(0),
+ _lcp_echo_interval(0)
+{
+ // set defaults
+}
+
+bool
+PPP::getNoAuth() const
+{
+ return _noauth;
+}
+
+void
+PPP::setNoAuth(bool noauth)
+{
+ _noauth = noauth;
+}
+
+bool
+PPP::getRefuseEAP() const
+{
+ return _refuse_eap;
+}
+
+void
+PPP::setRefuseEAP(bool refuse_eap)
+{
+ _refuse_eap = refuse_eap;
+}
+
+bool
+PPP::getRefusePAP() const
+{
+ return _refuse_pap;
+}
+
+void
+PPP::setRefusePAP(bool refuse_pap)
+{
+ _refuse_pap = refuse_pap;
+}
+
+bool
+PPP::getRefuseChap() const
+{
+ return _refuse_chap;
+}
+
+void
+PPP::setRefuseChap(bool refuse_chap)
+{
+ _refuse_chap = refuse_chap;
+}
+
+bool
+PPP::getRefuseMSChap() const
+{
+ return _refuse_mschap;
+}
+
+void
+PPP::setRefuseMSChap(bool refuse_mschap)
+{
+ _refuse_mschap = refuse_mschap;
+}
+
+bool
+PPP::getRefuseMSChapV2() const
+{
+ return _refuse_mschapv2;
+}
+
+void
+PPP::setRefuseMSChapV2(bool refuse_mschapv2)
+{
+ _refuse_mschapv2 = refuse_mschapv2;
+}
+
+bool
+PPP::getNoBSDComp() const
+{
+ return _nobsdcomp;
+}
+
+void
+PPP::setNoBSDComp(bool nobsdcomp)
+{
+ _nobsdcomp = nobsdcomp;
+}
+
+bool
+PPP::getNoDeflate() const
+{
+ return _nodeflate;
+}
+
+void
+PPP::setNoDeflate(bool nodeflate)
+{
+ _nodeflate = nodeflate;
+}
+
+bool
+PPP::getNoVJComp() const
+{
+ return _novjcomp;
+}
+
+void
+PPP::setNoVJComp(bool novjcomp)
+{
+ _novjcomp = novjcomp;
+}
+
+bool
+PPP::getRequireMPPE() const
+{
+ return _require_mppe;
+}
+
+void
+PPP::setRequireMPPE(bool require_mppe)
+{
+ _require_mppe = require_mppe;
+}
+
+bool
+PPP::getRequireMPPE128() const
+{
+ return _require_mppe_128;
+}
+
+void
+PPP::setRequireMPPE128(bool require_mppe_128)
+{
+ _require_mppe_128 = require_mppe_128;
+}
+
+bool
+PPP::getMPPEStateful() const
+{
+ return _mppe_stateful;
+}
+
+void
+PPP::setMPPEStateful(bool b)
+{
+ _mppe_stateful = b;
+}
+
+bool
+PPP::getRequireMPPC() const
+{
+ return _require_mppc;
+}
+
+void
+PPP::setRequireMPPC(bool b)
+{
+ _require_mppc = b;
+}
+
+bool
+PPP::getCRTSCTS() const
+{
+ return _crtscts;
+}
+
+void
+PPP::setCRTSCTS(bool b)
+{
+ _crtscts = b;
+}
+
+TQ_INT32
+PPP::getBaud() const
+{
+ return _baud;
+}
+
+void
+PPP::setBaud(TQ_INT32 i)
+{
+ _baud = i;
+}
+
+TQ_INT32
+PPP::getMRU() const
+{
+ return _mru;
+}
+
+void
+PPP::setMRU(TQ_INT32 i)
+{
+ _mru = i;
+}
+
+TQ_INT32
+PPP::getMTU() const
+{
+ return _mtu;
+}
+
+void
+PPP::setMTU(TQ_INT32 i)
+{
+ _mtu = i;
+}
+
+TQ_INT32
+PPP::getLCPEchoFailure() const
+{
+ return _lcp_echo_failure;
+}
+
+void
+PPP::setLCPEchoFailure(TQ_INT32 i)
+{
+ _lcp_echo_failure = i;
+}
+
+TQ_INT32
+PPP::getLCPEchoInterval() const
+{
+ return _lcp_echo_interval;
+}
+
+void
+PPP::setLCPEchoInterval(TQ_INT32 i)
+{
+ _lcp_echo_interval = i;
+}
+
+bool
+PPP::isValid() const
+{
+ return true;
+}
+
+SettingsMap
+PPP::toMap() const
+{
+ SettingsMap map;
+
+ // TODO
+ map.insert(NM_SETTING_PPP_NOAUTH, TQT_DBusData::fromBool(_noauth));
+ map.insert(NM_SETTING_PPP_REFUSE_EAP, TQT_DBusData::fromBool(_refuse_eap));
+ map.insert(NM_SETTING_PPP_REFUSE_PAP, TQT_DBusData::fromBool(_refuse_pap));
+ map.insert(NM_SETTING_PPP_REFUSE_CHAP, TQT_DBusData::fromBool(_refuse_chap));
+ map.insert(NM_SETTING_PPP_REFUSE_MSCHAP, TQT_DBusData::fromBool(_refuse_mschap));
+ map.insert(NM_SETTING_PPP_NOBSDCOMP, TQT_DBusData::fromBool(_nobsdcomp));
+ map.insert(NM_SETTING_PPP_NODEFLATE, TQT_DBusData::fromBool(_nodeflate));
+ map.insert(NM_SETTING_PPP_NO_VJ_COMP, TQT_DBusData::fromBool(_novjcomp));
+ map.insert(NM_SETTING_PPP_REQUIRE_MPPE, TQT_DBusData::fromBool(_require_mppe));
+ map.insert(NM_SETTING_PPP_REQUIRE_MPPE_128, TQT_DBusData::fromBool(_require_mppe_128));
+ map.insert(NM_SETTING_PPP_MPPE_STATEFUL, TQT_DBusData::fromBool(_mppe_stateful));
+ map.insert(NM_SETTING_PPP_CRTSCTS, TQT_DBusData::fromBool(_crtscts));
+ map.insert(NM_SETTING_PPP_BAUD, TQT_DBusData::fromUInt32(_baud));
+ map.insert(NM_SETTING_PPP_MRU, TQT_DBusData::fromUInt32(_mru));
+ map.insert(NM_SETTING_PPP_MTU, TQT_DBusData::fromUInt32(_mtu));
+ map.insert(NM_SETTING_PPP_LCP_ECHO_FAILURE, TQT_DBusData::fromUInt32(_lcp_echo_failure));
+ map.insert(NM_SETTING_PPP_LCP_ECHO_INTERVAL, TQT_DBusData::fromUInt32(_lcp_echo_interval));
+
+ return map;
+}
+
+SettingsMap
+PPP::toSecretsMap(bool with_settings) const
+{
+ SettingsMap map;
+
+ // first serialize the settings if needed
+ if (with_settings)
+ map = toMap();
+
+ return map;
+}
+
+bool
+PPP::fromSecretsMap(const SettingsMap& map)
+{
+ for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
+ {
+ // TODO
+ /*if (it.key() == NM_SETTING_PPP_PASSWORD)
+ setPassword(it.data().toString());
+ else
+ kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
+ */
+ }
+ return true;
+}
+
+void
+PPP::fromMap(const SettingsMap& map)
+{
+ for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
+ {
+ // TODO
+ /*
+ if (it.key() == NM_SETTING_PPP_NUMBER)
+ setNumber(it.data().toString());
+ else
+ kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
+ */
+ }
+}
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ppp.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ppp.h
new file mode 100644
index 0000000..9f72e42
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ppp.h
@@ -0,0 +1,136 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_ppp.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_PPP_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_PPP_H
+
+#include <stdint.h>
+#include <tqhostaddress.h>
+#include <tqmap.h>
+#include <tqvariant.h>
+#include <tqobject.h>
+
+#include <tqdbusdata.h>
+
+#include "knetworkmanager-connection_setting.h"
+
+namespace ConnectionSettings
+{
+
+class Connection;
+
+// serial setting
+class PPP : public ConnectionSetting
+{
+ public:
+ PPP(Connection* conn);
+
+ SettingsMap toMap() const;
+ SettingsMap toSecretsMap(bool with_settings = true) const;
+ void fromMap(const SettingsMap&);
+ bool fromSecretsMap(const SettingsMap&);
+
+ bool isValid() const;
+ bool useSetting();
+
+ bool getNoAuth() const;
+ void setNoAuth(bool);
+
+ bool getRefuseEAP() const;
+ void setRefuseEAP(bool);
+
+ bool getRefusePAP() const;
+ void setRefusePAP(bool);
+
+ bool getRefuseChap() const;
+ void setRefuseChap(bool);
+
+ bool getRefuseMSChap() const;
+ void setRefuseMSChap(bool);
+
+ bool getRefuseMSChapV2() const;
+ void setRefuseMSChapV2(bool);
+
+ bool getNoBSDComp() const;
+ void setNoBSDComp(bool);
+
+ bool getNoDeflate() const;
+ void setNoDeflate(bool);
+
+ bool getNoVJComp() const;
+ void setNoVJComp(bool);
+
+ bool getRequireMPPE() const;
+ void setRequireMPPE(bool);
+
+ bool getRequireMPPE128() const;
+ void setRequireMPPE128(bool);
+
+ bool getMPPEStateful() const;
+ void setMPPEStateful(bool);
+
+ bool getRequireMPPC() const;
+ void setRequireMPPC(bool);
+
+ bool getCRTSCTS() const;
+ void setCRTSCTS(bool);
+
+ TQ_INT32 getBaud() const;
+ void setBaud(TQ_INT32);
+
+ TQ_INT32 getMRU() const;
+ void setMRU(TQ_INT32);
+
+ TQ_INT32 getMTU() const;
+ void setMTU(TQ_INT32);
+
+ TQ_INT32 getLCPEchoFailure() const;
+ void setLCPEchoFailure(TQ_INT32);
+
+ TQ_INT32 getLCPEchoInterval() const;
+ void setLCPEchoInterval(TQ_INT32);
+
+ private:
+ bool _noauth;
+ bool _refuse_eap;
+ bool _refuse_pap;
+ bool _refuse_chap;
+ bool _refuse_mschap;
+ bool _refuse_mschapv2;
+ bool _nobsdcomp;
+ bool _nodeflate;
+ bool _novjcomp;
+ bool _require_mppe;
+ bool _require_mppe_128;
+ bool _mppe_stateful;
+ bool _require_mppc;
+ bool _crtscts;
+ TQ_UINT32 _baud;
+ TQ_UINT32 _mru;
+ TQ_UINT32 _mtu;
+ TQ_UINT32 _lcp_echo_failure;
+ TQ_UINT32 _lcp_echo_interval;
+};
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_PPP_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ppp_widget.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ppp_widget.cpp
new file mode 100644
index 0000000..4dff5ce
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ppp_widget.cpp
@@ -0,0 +1,130 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_ppp_widget.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Author: Will Stephenson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include <nm-setting-ppp.h>
+
+// qt headers
+#include <tqwidget.h>
+#include <tqlineedit.h>
+#include <tqcheckbox.h>
+#include <tqlayout.h>
+#include <tqcombobox.h>
+#include <tqspinbox.h>
+#include <tqiconset.h>
+#include <kiconloader.h>
+#include <tqwidgetstack.h>
+#include <kuser.h>
+
+// knm headers
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_setting_ppp.h"
+#include "knetworkmanager-connection_setting_ppp_widget.h"
+#include "knetworkmanager-device.h"
+
+#include "connection_setting_ppp.h"
+
+using namespace ConnectionSettings;
+
+PPPWidgetImpl::PPPWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl)
+ : WidgetInterface(parent, name, fl)
+{
+ _pppsetting = dynamic_cast<ConnectionSettings::PPP*> (conn->getSetting(NM_SETTING_PPP_SETTING_NAME));
+
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
+ _mainWid = new ConnectionSettingPppWidget(this);
+ tqlayout->addWidget(_mainWid);
+
+ Init();
+}
+
+void
+PPPWidgetImpl::Init()
+{
+ _mainWid->mNoAuth->setChecked( _pppsetting->getNoAuth() );
+ _mainWid->mRefuseEap->setChecked( _pppsetting->getRefuseEAP( ) );
+ _mainWid->mRefusePap->setChecked( _pppsetting->getRefusePAP( ) );
+ _mainWid->mRefuseChap->setChecked( _pppsetting->getRefuseChap() );
+ _mainWid->mRefuseMschap->setChecked( _pppsetting->getRefuseMSChap() );
+ _mainWid->mRefuseMschapV2->setChecked( _pppsetting->getRefuseMSChapV2() );
+ _mainWid->mNoBsd->setChecked( _pppsetting->getNoBSDComp() );
+ _mainWid->mNoDeflate->setChecked( _pppsetting->getNoDeflate() );
+ _mainWid->mNoVjComp->setChecked( _pppsetting->getNoVJComp() );
+ _mainWid->mRequireMppe->setChecked( _pppsetting->getRequireMPPE( ));
+ _mainWid->mRequireMppe128->setChecked( _pppsetting->getRequireMPPE128( ));
+ _mainWid->mStatefulMppe->setChecked( _pppsetting->getMPPEStateful() );
+ _mainWid->mRequireMppc->setChecked( _pppsetting->getRequireMPPC() );
+ _mainWid->mCrtscts->setChecked( _pppsetting->getCRTSCTS() );
+
+ _mainWid->mBaudRate->setValue(_pppsetting->getBaud());
+ _mainWid->mMru->setValue(_pppsetting->getMRU());
+ _mainWid->mMtu->setValue(_pppsetting->getMTU());
+ _mainWid->mLcpEchoFailure->setValue(_pppsetting->getLCPEchoFailure());
+ _mainWid->mLcpEchoInterval->setValue(_pppsetting->getLCPEchoInterval());
+ connect( _mainWid->mNoAuth, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
+ connect( _mainWid->mRefuseEap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
+ connect( _mainWid->mRefusePap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
+ connect( _mainWid->mRefuseChap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
+ connect( _mainWid->mRefuseMschap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
+ connect( _mainWid->mRefuseMschapV2, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
+ connect( _mainWid->mNoBsd, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
+ connect( _mainWid->mNoDeflate, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
+ connect( _mainWid->mRequireMppe, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
+ connect( _mainWid->mRequireMppe128, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
+ connect( _mainWid->mStatefulMppe, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
+ connect( _mainWid->mRequireMppc, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
+ connect( _mainWid->mCrtscts, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
+}
+
+void
+PPPWidgetImpl::Deactivate()
+{
+}
+
+void
+PPPWidgetImpl::Activate()
+{
+
+}
+
+void
+PPPWidgetImpl::dirty()
+{
+ _pppsetting->setNoAuth( _mainWid->mNoAuth->isChecked() );
+ _pppsetting->setRefuseEAP( _mainWid->mRefuseEap->isChecked() );
+ _pppsetting->setRefuseChap( _mainWid->mRefuseChap->isChecked() );
+ _pppsetting->setRefuseMSChap( _mainWid->mRefuseMschap->isChecked() );
+ _pppsetting->setNoBSDComp( _mainWid->mNoBsd->isChecked() );
+ _pppsetting->setNoDeflate( _mainWid->mNoDeflate->isChecked() );
+ _pppsetting->setRequireMPPE( _mainWid->mRequireMppe->isChecked() );
+ _pppsetting->setRequireMPPE( _mainWid->mRequireMppe128->isChecked() );
+ _pppsetting->setMPPEStateful( _mainWid->mStatefulMppe->isChecked() );
+
+ _pppsetting->setBaud(_mainWid->mBaudRate->value());
+ _pppsetting->setMRU(_mainWid->mMru->value());
+ _pppsetting->setMTU(_mainWid->mMtu->value());
+ _pppsetting->setLCPEchoFailure(_mainWid->mLcpEchoFailure->value());
+ _pppsetting->setLCPEchoInterval(_mainWid->mLcpEchoInterval->value());
+}
+
+#include "knetworkmanager-connection_setting_ppp_widget.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ppp_widget.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ppp_widget.h
new file mode 100644
index 0000000..0d92587
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_ppp_widget.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_ppp_widget.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Author: Will Stephenson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_PPP_WIDGET_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_PPP_WIDGET_H
+
+
+// qt headers
+#include <tqwidget.h>
+#include <tqlineedit.h>
+
+// knm headers
+#include "knetworkmanager-connection_setting_ppp.h"
+#include "knetworkmanager-connection_setting_widget_interface.h"
+#include "knetworkmanager-device.h"
+
+//class VPNService;
+class ConnectionSettingPppWidget;
+
+namespace ConnectionSettings
+{
+
+class Connection;
+
+class PPPWidgetImpl : public WidgetInterface
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ PPPWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0);
+ void Activate();
+ void Deactivate();
+ public slots:
+ void dirty();
+
+ private:
+ void Init();
+
+ PPP* _pppsetting;
+ ConnectionSettingPppWidget* _mainWid;
+};
+
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_PPP_WIDGET_H*/
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_serial.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_serial.cpp
new file mode 100644
index 0000000..4861e7b
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_serial.cpp
@@ -0,0 +1,168 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_serial.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqhostaddress.h>
+#include <tqvariant.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQT_DBus headers*/
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_setting_serial.h"
+
+using namespace ConnectionSettings;
+
+/*
+ class Serial
+*/
+Serial::Serial(Connection* conn)
+ : ConnectionSetting(conn, NM_SETTING_SERIAL_SETTING_NAME),
+ _baud( 115200 ),
+ _bits( 8 ),
+ _parity( PARITY_NONE ),
+ _stopBits( 1 ),
+ _sendDelay( 0 )
+{
+}
+
+void Serial::setBaud(TQ_UINT32 baud)
+{
+ _baud = baud;
+}
+
+TQ_UINT32 Serial::getBaud() const
+{
+ return _baud;
+}
+
+void Serial::setBits(TQ_UINT32 bits)
+{
+ if (bits >= 5 && bits <= 8)
+ _bits = bits;
+ else
+ kdWarning() << k_funcinfo << "bits property not accepted" << endl;
+}
+
+TQ_UINT32 Serial::getBits() const
+{
+ return _bits;
+}
+
+void Serial::setParity(PARITY_MODE parity)
+{
+ _parity = parity;
+}
+
+Serial::PARITY_MODE Serial::getParity() const
+{
+ return _parity;
+}
+
+void Serial::setStopBits(TQ_UINT32 stopBits)
+{
+ if (stopBits >= 1 && stopBits <= 2)
+ _stopBits = stopBits;
+ else
+ kdWarning() << k_funcinfo << "stopbits property: wrong value" << endl;
+}
+
+TQ_UINT32 Serial::getStopBits() const
+{
+ return _stopBits;
+}
+
+void Serial::setSendDelay(TQ_UINT64 delay)
+{
+ _sendDelay = delay;
+}
+
+TQ_UINT64 Serial::getSendDelay() const
+{
+ return _sendDelay;
+}
+
+bool
+Serial::isValid() const
+{
+ // serial setting without ppp setting is not valid
+ if (!(getConnection()->getSetting(NM_SETTING_PPP_SETTING_NAME)))
+ return false;
+ return true;
+}
+
+SettingsMap
+Serial::toMap() const
+{
+ SettingsMap map;
+
+ map.insert(NM_SETTING_SERIAL_BAUD, TQT_DBusData::fromUInt32(_baud));
+ map.insert(NM_SETTING_SERIAL_BITS, TQT_DBusData::fromUInt32(_bits));
+
+ if (_parity == PARITY_NONE)
+ map.insert(NM_SETTING_SERIAL_PARITY, TQT_DBusData::fromByte('n'));
+ else if (_parity == PARITY_EVEN)
+ map.insert(NM_SETTING_SERIAL_PARITY, TQT_DBusData::fromByte('e'));
+ else if (_parity == PARITY_ODD)
+ map.insert(NM_SETTING_SERIAL_PARITY, TQT_DBusData::fromByte('o'));
+
+ map.insert(NM_SETTING_SERIAL_STOPBITS, TQT_DBusData::fromUInt32(_stopBits));
+ map.insert(NM_SETTING_SERIAL_SEND_DELAY, TQT_DBusData::fromUInt64(_sendDelay));
+
+ return map;
+}
+
+void
+Serial::fromMap(const SettingsMap& map)
+{
+ for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
+ {
+ if (it.key() == NM_SETTING_SERIAL_BAUD)
+ setBaud(it.data().toUInt32());
+ else if (it.key() == NM_SETTING_SERIAL_BITS)
+ setBits(it.data().toUInt32());
+ else if (it.key() == NM_SETTING_SERIAL_PARITY)
+ {
+ if (it.data().toByte() == 'n')
+ _parity = PARITY_NONE;
+ else if (it.data().toByte() == 'e')
+ _parity = PARITY_EVEN;
+ else if (it.data().toByte() == 'o')
+ _parity = PARITY_ODD;
+ }
+ else if (it.key() == NM_SETTING_SERIAL_STOPBITS)
+ setStopBits(it.data().toUInt32());
+ else if (it.key() == NM_SETTING_SERIAL_SEND_DELAY)
+ setSendDelay(it.data().toUInt64());
+ else
+ kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
+ }
+}
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_serial.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_serial.h
new file mode 100644
index 0000000..40099a7
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_serial.h
@@ -0,0 +1,89 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_serial.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_H
+
+#include <stdint.h>
+#include <tqhostaddress.h>
+#include <tqmap.h>
+#include <tqvariant.h>
+#include <tqobject.h>
+
+#include <tqdbusdata.h>
+
+#include "knetworkmanager-connection_setting.h"
+
+/* NM headers */
+#include <nm-setting-ppp.h>
+#include <nm-setting-serial.h>
+
+namespace ConnectionSettings
+{
+
+class Connection;
+
+// serial setting
+class Serial : public ConnectionSetting
+{
+ public:
+ enum PARITY_MODE
+ {
+ PARITY_NONE = 0
+ , PARITY_EVEN
+ , PARITY_ODD
+ };
+
+ Serial(Connection* conn);
+
+ SettingsMap toMap() const;
+ void fromMap(const SettingsMap&);
+
+ bool isValid() const;
+ bool useSetting();
+
+ void setBaud(TQ_UINT32);
+ TQ_UINT32 getBaud() const;
+
+ void setBits(TQ_UINT32);
+ TQ_UINT32 getBits() const;
+
+ void setParity(PARITY_MODE);
+ PARITY_MODE getParity() const;
+
+ void setStopBits(TQ_UINT32);
+ TQ_UINT32 getStopBits() const;
+
+ void setSendDelay(TQ_UINT64);
+ TQ_UINT64 getSendDelay() const;
+
+ private:
+ TQ_UINT32 _baud;
+ TQ_UINT32 _bits;
+ PARITY_MODE _parity;
+ TQ_UINT32 _stopBits;
+ TQ_UINT64 _sendDelay;
+};
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_serial_widget.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_serial_widget.cpp
new file mode 100644
index 0000000..bdb2f82
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_serial_widget.cpp
@@ -0,0 +1,97 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_serial_widget.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Author: Will Stephenson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include <limits.h>
+// qt headers
+#include <tqwidget.h>
+#include <tqlineedit.h>
+#include <tqcheckbox.h>
+#include <tqlayout.h>
+#include <tqcombobox.h>
+#include <tqspinbox.h>
+#include <tqiconset.h>
+#include <kiconloader.h>
+#include <tqwidgetstack.h>
+#include <kuser.h>
+
+// knm headers
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_setting_serial.h"
+#include "knetworkmanager-connection_setting_serial_widget.h"
+#include "knetworkmanager-device.h"
+
+#include "connection_setting_serial.h"
+
+using namespace ConnectionSettings;
+
+SerialWidgetImpl::SerialWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl)
+ : WidgetInterface(parent, name, fl)
+{
+ _serialsetting = dynamic_cast<ConnectionSettings::Serial*> (conn->getSetting(NM_SETTING_SERIAL_SETTING_NAME));
+
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
+ _mainWid = new ConnectionSettingSerialWidget(this);
+ tqlayout->addWidget(_mainWid);
+ _mainWid->mBaudRate->setMaxValue(INT_MAX);
+ Init();
+}
+
+void
+SerialWidgetImpl::Init()
+{
+ _mainWid->mBaudRate->setValue(_serialsetting->getBaud());
+ _mainWid->mDataBits->setCurrentItem(_serialsetting->getBits() - 7);
+ _mainWid->mParity->setCurrentItem(_serialsetting->getParity());
+ _mainWid->mStopBits->setCurrentItem(_serialsetting->getStopBits());
+ _mainWid->mSendDelay->setValue(_serialsetting->getSendDelay());
+
+ connect( _mainWid->mBaudRate, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dirty()));
+ connect( _mainWid->mDataBits, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty()));
+ connect( _mainWid->mParity, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty()));
+ connect( _mainWid->mStopBits, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty()));
+ connect( _mainWid->mSendDelay, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dirty()));
+}
+
+void
+SerialWidgetImpl::Deactivate()
+{
+}
+
+void
+SerialWidgetImpl::Activate()
+{
+
+}
+
+void
+SerialWidgetImpl::dirty()
+{
+ _serialsetting->setBaud( _mainWid->mBaudRate->value() );
+ _serialsetting->setBits( _mainWid->mDataBits->currentItem() + 7 );
+ _serialsetting->setParity( (ConnectionSettings::Serial::PARITY_MODE)_mainWid->mParity->currentItem() );
+ _serialsetting->setStopBits( _mainWid->mStopBits->currentItem() );
+ _serialsetting->setSendDelay( _mainWid->mSendDelay->value() );
+}
+
+#include "knetworkmanager-connection_setting_serial_widget.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_serial_widget.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_serial_widget.h
new file mode 100644
index 0000000..81dbb16
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_serial_widget.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_serial_widget.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Author: Will Stephenson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_WIDGET_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_WIDGET_H
+
+
+// qt headers
+#include <tqwidget.h>
+#include <tqlineedit.h>
+
+// knm headers
+#include "knetworkmanager-connection_setting_serial.h"
+#include "knetworkmanager-connection_setting_widget_interface.h"
+#include "knetworkmanager-device.h"
+
+//class VPNService;
+class ConnectionSettingSerialWidget;
+
+namespace ConnectionSettings
+{
+
+class Connection;
+
+class SerialWidgetImpl : public WidgetInterface
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ SerialWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0);
+ void Activate();
+ void Deactivate();
+ public slots:
+ void dirty();
+
+ private:
+ void Init();
+
+ Serial* _serialsetting;
+ ConnectionSettingSerialWidget* _mainWid;
+};
+
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_WIDGET_H*/
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_vpn.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_vpn.cpp
new file mode 100644
index 0000000..22e8b20
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_vpn.cpp
@@ -0,0 +1,206 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_vpn.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqhostaddress.h>
+#include <tqvariant.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQT_DBus headers*/
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-connection_setting_vpn.h"
+
+using namespace ConnectionSettings;
+
+/*
+ class VPN
+*/
+VPN::VPN(Connection* conn)
+ : ConnectionSetting(conn, NM_SETTING_VPN_SETTING_NAME)
+{
+
+}
+
+TQString VPN::getUserName() const
+{
+ return _userName;
+}
+
+void VPN::setUserName(const TQString& u)
+{
+ _userName = u;
+ emitValidityChanged();
+}
+
+TQString VPN::getServiceType() const
+{
+ return _serviceType;
+}
+
+void VPN::setServiceType(const TQString& s)
+{
+ _serviceType = s;
+ emitValidityChanged();
+}
+
+TQValueList<TQString> VPN::getRoutes() const
+{
+ return _routes;
+}
+
+void VPN::setRoutes(const TQValueList<TQString>& r)
+{
+ _routes = r;
+ emitValidityChanged();
+}
+
+void VPN::setData(TQMap<TQString, TQString> data)
+{
+ _data = data;
+ emitValidityChanged();
+}
+
+TQMap<TQString, TQString> VPN::getData() const
+{
+ return _data;
+}
+
+void VPN::setSecrets(const TQMap<TQString, TQString>& data)
+{
+ _secrets = data;
+ emitValidityChanged();
+}
+
+TQMap<TQString, TQString> VPN::getSecrets() const
+{
+ return _secrets;
+}
+
+
+SettingsMap
+VPN::toMap() const
+{
+ SettingsMap map;
+
+ map.insert(NM_SETTING_VPN_SERVICE_TYPE, TQT_DBusData::fromString(_serviceType));
+ map.insert(NM_SETTING_VPN_USER_NAME, TQT_DBusData::fromString(_userName));
+
+ if (!_routes.isEmpty())
+ {
+ TQValueList<TQT_DBusData> list;
+ for (TQValueList<TQString>::ConstIterator it = _routes.begin(); it != _routes.end(); ++it)
+ {
+ list.append(TQT_DBusData::fromString(*it));
+ }
+ }
+
+ // NM expects a String/String map -> convert
+ TQT_DBusDataMap<TQString> data;
+
+ for (TQMap<TQString, TQString>::ConstIterator it = _data.begin(); it != _data.end(); ++it)
+ {
+ data.insert(it.key(), TQT_DBusData::fromString(it.data()));
+ }
+
+ map.insert(NM_SETTING_VPN_DATA, TQT_DBusData::fromStringKeyMap(data));
+
+
+ return map;
+}
+
+void
+VPN::fromMap(const SettingsMap& map)
+{
+ SettingsMap::ConstIterator it;
+
+ if ((it = map.find(NM_SETTING_VPN_SERVICE_TYPE)) != map.end())
+ _serviceType = it.data().toString();
+
+ if ((it = map.find(NM_SETTING_VPN_USER_NAME)) != map.end())
+ _userName = it.data().toString();
+
+ TQT_DBusDataMap<TQString> data;
+ _data.clear();
+
+ if ((it = map.find(NM_SETTING_VPN_DATA)) != map.end())
+ {
+ data = it.data().toStringKeyMap();
+ for (TQMap<TQString, TQT_DBusData>::ConstIterator it = data.begin(); it != data.end(); ++it)
+ {
+ _data.insert(it.key(), it.data().toString());
+ }
+ }
+}
+
+SettingsMap
+VPN::toSecretsMap(bool with_settings) const
+{
+ SettingsMap map;
+
+ // NM does not want the settings too
+/* if (with_settings)
+ map = toMap();*/
+
+ // copy all secrets into the map
+ for (TQMap<TQString, TQString>::ConstIterator it = _secrets.begin(); it != _secrets.end(); ++it)
+ map.insert(it.key(), TQT_DBusData::fromString(it.data()));
+
+ return map;
+}
+
+bool
+VPN::fromSecretsMap(const SettingsMap& map)
+{
+/* SettingsMap::ConstIterator it;
+ TQT_DBusDataMap<TQString> data;
+
+ if ((it = map.find(NM_SETTING_VPN_DATA)) != map.end())
+ {
+ data = it.data().toStringKeyMap();
+ _data = data.toTQMap();
+ }*/
+ // FIXME
+ return false;
+}
+
+bool
+VPN::isValid() const
+{
+ // name is essential
+ if (_userName.isEmpty() || _serviceType.isEmpty())
+ return false;
+
+ // data is essential
+ if (_data.isEmpty())
+ return false;
+
+ return true;
+}
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_vpn.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_vpn.h
new file mode 100644
index 0000000..6850fc2
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_vpn.h
@@ -0,0 +1,83 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_vpn.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_VPN_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_VPN_H
+
+#include <stdint.h>
+#include <tqhostaddress.h>
+#include <tqmap.h>
+#include <tqvariant.h>
+#include <tqobject.h>
+#include <tqdatetime.h>
+
+#include <tqdbusdata.h>
+#include "knetworkmanager-connection_setting.h"
+
+/* NM headers */
+#include <nm-setting-vpn.h>
+
+namespace ConnectionSettings
+{
+
+// info setting
+class VPN : public ConnectionSetting
+{
+ public:
+ VPN(Connection* conn);
+
+ SettingsMap toMap() const;
+ void fromMap(const SettingsMap&);
+
+ SettingsMap toSecretsMap(bool with_settings = true) const;
+ bool fromSecretsMap(const SettingsMap&);
+
+ TQString getUserName() const;
+ void setUserName(const TQString&);
+
+ TQString getServiceType() const;
+ void setServiceType(const TQString&);
+
+ TQValueList<TQString> getRoutes() const;
+ void setRoutes(const TQValueList<TQString>&);
+
+ TQMap<TQString, TQString> getData() const;
+ void setData(TQMap<TQString, TQString> data);
+
+ // Ugh, that is ugly
+ TQMap<TQString, TQString> getSecrets() const;
+ void setSecrets(const TQMap<TQString, TQString>& secrets);
+
+ bool isValid() const;
+
+ private:
+ TQString _userName;
+ TQString _serviceType;
+ TQValueList<TQString> _routes;
+ TQMap<TQString, TQString> _data;
+ TQMap<TQString, TQString> _secrets;
+};
+
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_VPN_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_vpn_widget.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_vpn_widget.cpp
new file mode 100644
index 0000000..913996a
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_vpn_widget.cpp
@@ -0,0 +1,206 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_vpn_widget.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ * Author: Timothy Pearson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// qt headers
+#include <tqwidget.h>
+#include <tqlineedit.h>
+#include <tqcheckbox.h>
+#include <tqlayout.h>
+#include <tqcombobox.h>
+#include <tqiconset.h>
+#include <kiconloader.h>
+#include <tqwidgetstack.h>
+#include <kuser.h>
+
+// knm headers
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_setting_vpn.h"
+#include "knetworkmanager-connection_setting_vpn_widget.h"
+#include "knetworkmanager-device.h"
+#include "knetworkmanager-vpnmanager.h"
+#include "knetworkmanager-vpnservice.h"
+
+using namespace ConnectionSettings;
+
+VPNWidgetImpl::VPNWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl)
+ : WidgetInterface(parent, name, fl)
+ , _new_conn(new_conn)
+{
+ _vpnsetting = dynamic_cast<ConnectionSettings::VPN*> (conn->getSetting(NM_SETTING_VPN_SETTING_NAME));
+
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
+ _mainWid = new ConnectionSettingVPNWidget(this);
+ tqlayout->addWidget(_mainWid);
+
+ Init();
+}
+
+void
+VPNWidgetImpl::Init()
+{
+ // fill in all possible VPN services
+ VPNServiceList list = VPNManager::getVPNServices();
+
+ if (list.isEmpty())
+ {
+ // FIXME Do something useful here
+ }
+ else
+ {
+ int index = 0;
+ for (VPNServiceList::Iterator it = list.begin(); it != list.end(); ++it)
+ {
+ TQString icon;
+ TQString disp_name;
+
+ // get service icon and display name
+ VPNService* service = *it;
+ if (service)
+ {
+ icon = service->getIcon();
+ disp_name = service->getDisplayName();
+ }
+
+ if (strcmp(disp_name, "vpnc") == 0) {
+ disp_name = "Cisco VPN";
+ }
+ else if (strcmp(disp_name, "pptp") == 0) {
+ disp_name = "Microsoft PPTP VPN";
+ }
+ else if (strcmp(disp_name, "openvpn") == 0) {
+ disp_name = "Open VPN";
+ }
+ else if (strcmp(disp_name, "strongswan") == 0) {
+ disp_name = "StrongSwan VPN";
+ }
+
+ // the service should not get changed when editing a connection
+ if (service->getService() != _vpnsetting->getServiceType() && !_new_conn)
+ continue;
+
+ // no special icon for this service, use default
+ if (icon.isEmpty())
+ icon = "encrypted";
+
+ _mainWid->cboServices->insertItem(SmallIcon(icon, TQIconSet::Automatic), disp_name, index);
+ _mapServiceCombo.insert(index++, *it);
+
+ if (service->getService() == _vpnsetting->getServiceType())
+ {
+ // preselect the correct service
+ _mainWid->cboServices->setCurrentItem(index - 1);
+ slotServiceComboActivated(index - 1);
+ }
+ }
+ }
+
+ // lock the combo when editing an already existing connection
+ if (!_new_conn)
+ _mainWid->cboServices->setEnabled(false);
+ else
+ {
+ // preselect the correct service
+ _mainWid->cboServices->setCurrentItem(0);
+ slotServiceComboActivated(0);
+ }
+
+ // update the username to the current one
+ KUser user;
+ _vpnsetting->setUserName(user.loginName());
+
+ // notification if VPN service is selected
+ connect(_mainWid->cboServices, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotServiceComboActivated(int)));
+}
+
+VPNConfigWidget*
+VPNWidgetImpl::getVPNConfigWidget(VPNService* service)
+{
+ if (_mapServiceWidget.find(service) != _mapServiceWidget.end())
+ {
+ // return the already available config widget
+ return *_mapServiceWidget.find(service);
+ }
+ else
+ {
+ // we have to create a new one
+ VPNPlugin* plugin = service->getVPNPlugin();
+ if (plugin)
+ {
+ VPNConfigWidget* config = plugin->CreateConfigWidget(_mainWid->widgetStack);
+ _mapServiceWidget.insert(service, config);
+ return config;
+ }
+ }
+ return NULL;
+}
+
+
+void
+VPNWidgetImpl::slotServiceComboActivated(int index)
+{
+ VPNService* service;
+ if (_mapServiceCombo.find(index) != _mapServiceCombo.end())
+ {
+ service = *_mapServiceCombo.find(index);
+ if (service)
+ {
+ VPNConfigWidget* config = getVPNConfigWidget(service);
+ _mainWid->widgetStack->raiseWidget(config);
+
+ config->setVPNData(_vpnsetting->getRoutes(), _vpnsetting->getData());
+ }
+ }
+ else
+ {
+ //FIXME - do something useful here
+ }
+}
+
+void
+VPNWidgetImpl::Deactivate()
+{
+ // update the setting from the currently selected vpn service
+ VPNService* service = *_mapServiceCombo.find(_mainWid->cboServices->currentItem());
+ if (service)
+ {
+ // set the correct service type
+ _vpnsetting->setServiceType(service->getService());
+
+ VPNConfigWidget* config = *_mapServiceWidget.find(service);
+ if (config)
+ {
+ // update the vpn properties
+ _vpnsetting->setData(config->getVPNProperties());
+ }
+ }
+}
+
+void
+VPNWidgetImpl::Activate()
+{
+
+}
+
+#include "knetworkmanager-connection_setting_vpn_widget.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_vpn_widget.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_vpn_widget.h
new file mode 100644
index 0000000..ef0b7bd
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_vpn_widget.h
@@ -0,0 +1,69 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_vpn_widget.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_VPN_WIDGET_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_VPN_WIDGET_H
+
+
+// qt headers
+#include <tqwidget.h>
+#include <tqlineedit.h>
+
+// knm headers
+#include "connection_setting_vpn.h"
+#include "knetworkmanager-connection_setting_widget_interface.h"
+#include "knetworkmanager-device.h"
+
+class VPNService;
+class VPNConfigWidget;
+
+namespace ConnectionSettings
+{
+
+class Connection;
+
+class VPNWidgetImpl : public WidgetInterface
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ VPNWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0);
+ void Activate();
+ void Deactivate();
+ public slots:
+ void slotServiceComboActivated(int);
+
+ private:
+ void Init();
+ VPNConfigWidget* getVPNConfigWidget(VPNService* service);
+
+ bool _new_conn;
+ VPN* _vpnsetting;
+ ConnectionSettingVPNWidget* _mainWid;
+ TQMap<int, VPNService*> _mapServiceCombo;
+ TQMap<VPNService*, VPNConfigWidget*> _mapServiceWidget;
+};
+
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_VPN_WIDGET_H*/
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_widget_interface.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_widget_interface.cpp
new file mode 100644
index 0000000..2c00288
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_widget_interface.cpp
@@ -0,0 +1,37 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_widget_interface.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// qt headers
+#include <tqwidget.h>
+#include "knetworkmanager-connection_setting_widget_interface.h"
+
+using namespace ConnectionSettings;
+
+WidgetInterface::WidgetInterface(TQWidget* parent, const char* name, WFlags fl)
+ : TQWidget(parent, name, fl)
+{
+
+}
+
+#include "knetworkmanager-connection_setting_widget_interface.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_widget_interface.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_widget_interface.h
new file mode 100644
index 0000000..25f5e5f
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_widget_interface.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_widget_interface.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIDGET_INTERFACE_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_WIDGET_INTERFACE_H
+
+// qt headers
+#include <tqwidget.h>
+
+namespace ConnectionSettings
+{
+
+ class WidgetInterface : public TQWidget
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ WidgetInterface(TQWidget* parent = NULL, const char* name = 0, WFlags fl = 0);
+ virtual void Activate() = 0;
+ virtual void Deactivate() {};
+ signals:
+ void next();
+ };
+}
+
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIDGET_INTERFACE_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wired.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wired.cpp
new file mode 100644
index 0000000..03aa61f
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wired.cpp
@@ -0,0 +1,99 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqhostaddress.h>
+#include <tqvariant.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQT_DBus headers*/
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+
+/* NM headers */
+#include <nm-setting-wired.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-connection_setting_wired.h"
+#include "knetworkmanager-accesspoint.h"
+
+
+using namespace ConnectionSettings;
+/*
+ class Wired
+*/
+Wired::Wired(Connection* conn, TQString port, uint32_t speed, TQString duplex, bool autoNegotiate, TQByteArray macAddress, uint32_t mtu)
+ : ConnectionSetting(conn, NM_SETTING_WIRED_SETTING_NAME)
+{
+ _port = port;
+ _speed = speed;
+ _duplex = duplex;
+ _autoNegotiate = autoNegotiate;
+ _macAddress = macAddress;
+ _mtu = mtu;
+}
+
+SettingsMap
+Wired::toMap() const
+{
+ SettingsMap map;
+
+ if (!_port.isNull())
+ map.insert(NM_SETTING_WIRED_PORT, TQT_DBusData::fromString(_port));
+
+ map.insert(NM_SETTING_WIRED_SPEED, TQT_DBusData::fromUInt32(_speed));
+
+ if (!_duplex.isNull())
+ map.insert(NM_SETTING_WIRED_DUPLEX, TQT_DBusData::fromString(_duplex));
+
+ map.insert(NM_SETTING_WIRED_AUTO_NEGOTIATE, TQT_DBusData::fromBool(_autoNegotiate));
+
+ //FIXME
+/*
+ if (!_macAddress.isNull())
+ map.insert(NM_SETTING_WIRED_MAC_ADDRESS, TQT_DBusData::from(_macAddress));
+*/
+ map.insert(NM_SETTING_WIRED_MTU, TQT_DBusData::fromUInt32(_mtu));
+
+ return map;
+}
+
+void
+Wired::fromMap(const SettingsMap& map)
+{
+ SettingsMap::ConstIterator it;
+
+ // TODO
+
+}
+
+bool
+Wired::isValid() const
+{
+ return true;
+}
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wired.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wired.h
new file mode 100644
index 0000000..9da930e
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wired.h
@@ -0,0 +1,62 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRED_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_WIRED_H
+
+#include <stdint.h>
+#include <tqhostaddress.h>
+#include <tqmap.h>
+#include <tqvariant.h>
+#include <tqobject.h>
+
+#include <tqdbusdata.h>
+#include "knetworkmanager-connection_setting.h"
+#include <nm-setting-wired.h>
+
+namespace ConnectionSettings
+{
+
+// setting for wired interfaces
+class Wired: public ConnectionSetting
+{
+ public:
+ Wired(Connection* conn, TQString port = TQString(), uint32_t speed = 0, TQString duplex = TQString(), bool autoNegotiate = true, TQByteArray macAddress = TQByteArray(), uint32_t mtu = 0);
+
+ SettingsMap toMap() const;
+ void fromMap(const SettingsMap&);
+
+ bool isValid() const;
+
+ private:
+ TQString _port;
+ uint32_t _speed;
+ TQString _duplex;
+ bool _autoNegotiate;
+ TQByteArray _macAddress;
+ uint32_t _mtu;
+};
+
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRED_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless.cpp
new file mode 100644
index 0000000..2e1db8e
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless.cpp
@@ -0,0 +1,220 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqhostaddress.h>
+#include <tqvariant.h>
+#include <tqregexp.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQT_DBus headers*/
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-connection_setting_wireless.h"
+#include "knetworkmanager-connection_setting_wireless_security.h"
+#include "knetworkmanager-accesspoint.h"
+
+// the bssid should look like XX:XX:XX:XX:XX:XX where X is a hexadecimal digit
+#define MAC_ADDRESS_PATTERN "[0-9A-Fa-f]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}"
+
+using namespace ConnectionSettings;
+
+/*
+ class Wireless
+*/
+Wireless::Wireless(Connection* conn, ::AccessPoint* ap, WirelessSecurity* security)
+ : ConnectionSetting(conn, NM_SETTING_WIRELESS_SETTING_NAME)
+{
+ _security = TQString();
+
+ if (ap)
+ {
+ _essid = ap->getSsidByteArray();
+ _mode = ap->getMode() == 0 ? MODE_ADHOC : MODE_INFRASTRUCTURE;
+ }
+ else
+ {
+ _essid = TQByteArray();
+ _mode = MODE_INFRASTRUCTURE;
+ }
+
+ _modeMap[MODE_INFRASTRUCTURE] = "infrastructure";
+ _modeMap[MODE_ADHOC] = "adhoc";
+}
+
+SettingsMap
+Wireless::toMap() const
+{
+ SettingsMap map;
+
+ map.insert(NM_SETTING_WIRELESS_MODE, TQT_DBusData::fromString(_modeMap[_mode]));
+
+ TQValueList<TQT_DBusData> essid;
+ for (TQByteArray::ConstIterator it = _essid.begin(); it != _essid.end(); ++it)
+ essid.append(TQT_DBusData::fromByte(*it));
+
+ if (essid.size() > 0)
+ map.insert(NM_SETTING_WIRELESS_SSID, TQT_DBusData::fromTQValueList(essid));
+ else
+ kdWarning() << k_funcinfo << " SSID undefined" << endl;
+
+ if (!_security.isEmpty())
+ map.insert(NM_SETTING_WIRELESS_SEC, TQT_DBusData::fromString(_security));
+
+ if (!_seenBssids.empty())
+ {
+ TQValueList<TQT_DBusData> bssids;
+ for (TQValueList<TQString>::ConstIterator it = _seenBssids.begin(); it != _seenBssids.end(); ++it)
+ bssids.append(TQT_DBusData::fromString(*it));
+
+ map.insert(NM_SETTING_WIRELESS_SEEN_BSSIDS, TQT_DBusData::fromTQValueList(bssids));
+ }
+
+ return map;
+}
+
+void
+Wireless::fromMap(const SettingsMap& map)
+{
+ SettingsMap::ConstIterator it;
+
+ // Mode
+ if ((it = map.find(NM_SETTING_WIRELESS_MODE)) != map.end())
+ {
+ TQBiDirectionalMap<MODES, TQString>::Iterator mode_it = _modeMap.findData(it.data().toString());
+ if (mode_it != _modeMap.end())
+ _mode = mode_it.key();
+ else
+ _mode = MODE_INFRASTRUCTURE;
+ }
+
+ // Essid
+ if ((it = map.find(NM_SETTING_WIRELESS_SSID)) != map.end())
+ {
+ TQValueList<TQT_DBusData> dbus_essid = (*it).toTQValueList();
+ TQByteArray essid(dbus_essid.size());
+
+ int index = 0;
+ for (TQValueList<TQT_DBusData>::ConstIterator byte_it = dbus_essid.begin(); byte_it != dbus_essid.end(); ++byte_it)
+ {
+ essid[index] = (*byte_it).toByte();
+ index++;
+ }
+ _essid = essid;
+ }
+
+ if ((it = map.find(NM_SETTING_WIRELESS_SEC)) != map.end())
+ {
+ _security = (*it).toString();
+ }
+
+ // Seen BSSIDS
+ if ((it = map.find(NM_SETTING_WIRELESS_SEEN_BSSIDS)) != map.end())
+ {
+ TQRegExp exp(MAC_ADDRESS_PATTERN);
+ TQValueList<TQT_DBusData> bssids = (*it).toTQValueList();
+ _seenBssids.clear();
+
+ for(TQValueList<TQT_DBusData>::Iterator it = bssids.begin(); it != bssids.end(); ++it)
+ {
+ TQString bssid = (*it).toString();
+ if (exp.exactMatch(bssid))
+ _seenBssids.append(bssid);
+ }
+ }
+}
+
+void
+Wireless::setEssid(const TQByteArray& essid)
+{
+ _essid = essid;
+ emitValidityChanged();
+}
+
+TQByteArray
+Wireless::getEssid(void) const
+{
+ return _essid;
+}
+
+void
+Wireless::setMode(MODES mode)
+{
+ _mode = mode;
+ emitValidityChanged();
+}
+
+Wireless::MODES
+Wireless::getMode(void) const
+{
+ return _mode;
+}
+
+void
+Wireless::setSecurity(const TQString& security)
+{
+ _security = security;
+ emitValidityChanged();
+}
+
+TQString
+Wireless::getSecurity(void) const
+{
+ return _security;
+}
+
+bool
+Wireless::isValid() const
+{
+ // ESSID is essential
+ if (_essid.isEmpty())
+ return false;
+
+ return true;
+}
+
+void
+Wireless::addSeenBssid(const TQString& bssid)
+{
+ TQRegExp exp(MAC_ADDRESS_PATTERN);
+ if (!exp.exactMatch(bssid))
+ return;
+
+ // no duplicates please
+ for(TQValueList<TQString>::Iterator it = _seenBssids.begin(); it != _seenBssids.end(); ++it)
+ {
+ if ((*it) == bssid)
+ return;
+ }
+
+ // insert this bssid
+ _seenBssids.append(bssid);
+ emitValidityChanged();
+}
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless.h
new file mode 100644
index 0000000..acdec94
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless.h
@@ -0,0 +1,97 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_H
+
+#include <stdint.h>
+#include <tqhostaddress.h>
+#include <tqmap.h>
+#include <tqvariant.h>
+#include <tqobject.h>
+
+#include <tqdbusdata.h>
+#include "knetworkmanager-connection_setting.h"
+#include "qbidirectionalmap.h"
+/* NM headers */
+#include <nm-setting-wireless.h>
+
+
+class AccessPoint;
+
+namespace ConnectionSettings
+{
+
+
+class WirelessSecurity;
+class Connection;
+
+
+// setting for wireless interfaces
+class Wireless : public ConnectionSetting
+{
+ public:
+
+ enum MODES
+ {
+ MODE_INFRASTRUCTURE = 0
+ , MODE_ADHOC
+ };
+
+ Wireless(Connection* conn, ::AccessPoint* ap = NULL, WirelessSecurity* security = NULL);
+
+ SettingsMap toMap() const;
+ void fromMap(const SettingsMap&);
+
+ void setEssid(const TQByteArray&);
+ TQByteArray getEssid(void) const;
+
+ void setMode(MODES);
+ MODES getMode(void) const;
+
+ void setSecurity(const TQString&);
+ TQString getSecurity(void) const;
+
+ bool isValid() const;
+
+ void addSeenBssid(const TQString&);
+
+ private:
+ TQByteArray _essid;
+ MODES _mode;
+ TQString _band;
+ uint32_t _channel;
+ TQByteArray _bssid;
+ uint32_t _rate;
+ uint32_t _txPower;
+ TQByteArray _macAddress;
+ uint32_t _mtu;
+ TQValueList<TQString> _seenBssids;
+ TQString _security;
+
+ TQBiDirectionalMap<MODES, TQString> _modeMap;
+};
+
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_security.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_security.cpp
new file mode 100644
index 0000000..a01f8f6
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_security.cpp
@@ -0,0 +1,451 @@
+/**************************************************************************
+ *
+ * knetworkmanager-connection_setting_wireless_security.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqhostaddress.h>
+#include <tqvariant.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQT_DBus headers*/
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-connection_setting_wireless_security.h"
+#include "knetworkmanager-accesspoint.h"
+#include "knetworkmanager-connection_setting_wireless.h"
+#include "knetworkmanager-connection.h"
+#include "sha1.h"
+#include "md5.h"
+
+
+using namespace ConnectionSettings;
+
+/*
+ class WirelessSecurity
+*/
+WirelessSecurity::WirelessSecurity(Connection* conn)
+ : ConnectionSetting(conn, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)
+ , _keyMgmt(KEY_MGMT_NONE)
+ , _wepTxKeyidx(0)
+ , _authAlg(AUTH_ALG_NONE)
+ , _proto(PROTO_NONE)
+ , _pairwise(CIPHER_TKIP | CIPHER_CCMP)
+ , _group(CIPHER_TKIP | CIPHER_CCMP)
+{
+ // init key_mgmt map
+ _keyMgmtMap[KEY_MGMT_NONE] = "none";
+ _keyMgmtMap[KEY_MGMT_WPA_PSK] = "wpa-psk";
+ _keyMgmtMap[KEY_MGMT_WPA_EAP] = "wpa-eap";
+ _keyMgmtMap[KEY_MGMT_IEEE8021X] = "ieee8021x";
+
+ // init auth_alg map
+ _authAlgMap[AUTH_ALG_NONE] = TQString(); // do not include auth alg if none is needed
+ _authAlgMap[AUTH_ALG_OPEN] = "open";
+ _authAlgMap[AUTH_ALG_SHARED] = "shared";
+ _authAlgMap[AUTH_ALG_LEAP] = "leap";
+
+ // proto map
+ _protoMap[PROTO_WPA] = "wpa";
+ _protoMap[PROTO_RSN] = "rsn"; // Info: rsn is wpa2
+
+ // cipher map
+ _cipherMap[CIPHER_TKIP] = "tkip";
+ _cipherMap[CIPHER_CCMP] = "ccmp";
+ _cipherMap[CIPHER_WEP40] = "wep40";
+ _cipherMap[CIPHER_WEP104] = "wep104";
+
+}
+
+bool WirelessSecurity::getEnabled() const
+{
+ Connection* conn = getConnection();
+ if (conn)
+ {
+ Wireless* wireless = dynamic_cast<Wireless*>(conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME));
+ if (wireless && wireless->getSecurity() != getType())
+ {
+ kdDebug() << "WirelessSecurity::getEnabled false " << wireless->getSecurity().ascii() << endl;
+ return false;
+ }
+ }
+ return true;
+}
+
+int
+WirelessSecurity::getWepTxidx(void) const
+{
+ return _wepTxKeyidx;
+}
+
+void
+WirelessSecurity::setWepTxidx(int idx)
+{
+ if (idx >= 0 && idx < 4)
+ _wepTxKeyidx = idx;
+}
+
+void
+WirelessSecurity::setWepKey(int idx, TQString key)
+{
+ kdDebug() << "WirelessSecurity::setWepKey " << idx << " " << key.ascii() << endl;
+ if (idx >= 0 && idx < 4)
+ _wepKey[idx] = key;
+}
+
+TQString
+WirelessSecurity::getWepKey(int idx) const
+{
+ if (idx >= 0 && idx < 4)
+ return _wepKey[idx];
+ return TQString();
+}
+
+uint32_t
+WirelessSecurity::getGroupCiphers(void) const
+{
+ return _group;
+}
+
+void
+WirelessSecurity::setGroupCiphers(uint32_t ciphers)
+{
+ _group= ciphers & (CIPHER_TKIP | CIPHER_CCMP | CIPHER_WEP40 | CIPHER_WEP104);
+}
+
+uint32_t
+WirelessSecurity::getPairwiseCiphers(void) const
+{
+ return _pairwise;
+}
+
+void
+WirelessSecurity::setPairwiseCiphers(uint32_t ciphers)
+{
+ // only tkip and ccmp allowed
+ _pairwise = ciphers & (CIPHER_TKIP | CIPHER_CCMP);
+}
+
+uint32_t
+WirelessSecurity::getProto(void) const
+{
+ return _proto;
+}
+
+void
+WirelessSecurity::setProto(uint32_t proto)
+{
+ _proto = proto & (PROTO_WPA | PROTO_RSN);
+}
+
+void
+WirelessSecurity::addProto(uint32_t proto)
+{
+ setProto(_proto | proto);
+}
+
+void
+WirelessSecurity::delProto(uint32_t proto)
+{
+ setProto(_proto & ~proto);
+}
+
+TQString
+WirelessSecurity::getPSK(void) const
+{
+ return _psk;
+}
+
+void
+WirelessSecurity::setPSK(const TQString& psk)
+{
+ _psk = psk;
+}
+
+TQString
+WirelessSecurity::getLeapPassword(void) const
+{
+ return _leapPassword;
+}
+
+void
+WirelessSecurity::setLeapPassword(const TQString& p)
+{
+ _leapPassword = p;
+}
+
+TQString
+WirelessSecurity::getLeapUsername(void) const
+{
+ return _leapUsername;
+}
+
+void
+WirelessSecurity::setLeapUsername(const TQString& u)
+{
+ _leapUsername = u;
+}
+
+WirelessSecurity::KEY_MGMT
+WirelessSecurity::getKeyMgmt(void) const
+{
+ return _keyMgmt;
+}
+
+void
+WirelessSecurity::setKeyMgmt(KEY_MGMT keyMgmt)
+{
+ _keyMgmt = keyMgmt;
+}
+
+WirelessSecurity::AUTH_ALG
+WirelessSecurity::getAuthAlg(void) const
+{
+ return _authAlg;
+}
+
+void
+WirelessSecurity::setAuthAlg(AUTH_ALG authAlg)
+{
+ _authAlg = authAlg;
+}
+
+SettingsMap
+WirelessSecurity::toMap() const
+{
+ SettingsMap map;
+
+ // KEY MGMT
+ map.insert(NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, TQT_DBusData::fromString(_keyMgmtMap[_keyMgmt]));
+
+ // WEP TX KEYIDX is only needed if WEP is used
+ if (_keyMgmt == KEY_MGMT_NONE && _wepTxKeyidx >= 0 && _wepTxKeyidx <= 3)
+ {
+ // WEP TX KEYIDX
+ map.insert(NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, TQT_DBusData::fromInt32(_wepTxKeyidx));
+ }
+
+ // AUTH ALG
+ if (_authAlg != AUTH_ALG_NONE)
+ map.insert(NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, TQT_DBusData::fromString(_authAlgMap[_authAlg]));
+
+ // PROTO is only needed for WPA connections
+ if (_proto != PROTO_NONE && (_keyMgmt == KEY_MGMT_WPA_NONE || _keyMgmt == KEY_MGMT_WPA_PSK || _keyMgmt == KEY_MGMT_WPA_EAP))
+ {
+ TQValueList<TQT_DBusData> protos;
+ for (TQMap<PROTO, TQString>::ConstIterator it = _protoMap.begin(); it != _protoMap.end(); ++it)
+ if (_proto & it.key())
+ protos.append(TQT_DBusData::fromString(it.data()));
+ if (protos.size() > 0)
+ map.insert(NM_SETTING_WIRELESS_SECURITY_PROTO, TQT_DBusData::fromTQValueList(protos));
+ }
+
+ // groupcipher
+ if (_group != CIPHER_NONE)
+ {
+ TQValueList<TQT_DBusData> ciphers;
+ for (TQMap<CIPHERS, TQString>::ConstIterator it = _cipherMap.begin(); it != _cipherMap.end(); ++it)
+ if (_group & it.key())
+ ciphers.append(TQT_DBusData::fromString(it.data()));
+
+ if (ciphers.size() > 0)
+ map.insert(NM_SETTING_WIRELESS_SECURITY_GROUP, TQT_DBusData::fromTQValueList(ciphers));
+ }
+
+ // pairwise cipher
+ if (_pairwise != CIPHER_NONE)
+ {
+ TQValueList<TQT_DBusData> ciphers;
+
+ for (TQMap<CIPHERS, TQString>::ConstIterator it = _cipherMap.begin(); it != _cipherMap.end(); ++it)
+ if (_pairwise & it.key())
+ ciphers.append(TQT_DBusData::fromString(it.data()));
+
+ if (ciphers.size() > 0)
+ map.insert(NM_SETTING_WIRELESS_SECURITY_PAIRWISE, TQT_DBusData::fromTQValueList(ciphers));
+ }
+
+ if (!_leapUsername.isEmpty())
+ map.insert(NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME, TQT_DBusData::fromString(_leapUsername));
+
+ return map;
+}
+
+void
+WirelessSecurity::fromMap(const SettingsMap& map)
+{
+ kdDebug() << "WirelessSecurity::fromMap" << endl;
+
+ for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
+ {
+ if (it.key() == NM_SETTING_WIRELESS_SECURITY_KEY_MGMT)
+ {
+ TQBiDirectionalMap<KEY_MGMT, TQString>::Iterator it2;
+ if (_keyMgmtMap.end() != (it2 = _keyMgmtMap.findData(it.data().toString())))
+ setKeyMgmt(it2.key());
+ }
+ else if (it.key() == NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX)
+ {
+ _wepTxKeyidx = it.data().toInt32();
+ }
+ else if (it.key() == NM_SETTING_WIRELESS_SECURITY_AUTH_ALG)
+ {
+ TQBiDirectionalMap<AUTH_ALG, TQString>::Iterator it2;
+ if (_authAlgMap.end() != (it2 = _authAlgMap.findData(it.data().toString())))
+ setAuthAlg(it2.key());
+ }
+ else if(it.key() == NM_SETTING_WIRELESS_SECURITY_PROTO)
+ {
+ TQValueList<TQT_DBusData> proto_list = it.data().toTQValueList();
+ uint32_t protos = PROTO_NONE;
+ for (TQValueList<TQT_DBusData>::Iterator proto_it = proto_list.begin(); proto_it != proto_list.end(); ++proto_it)
+ {
+ TQBiDirectionalMap<PROTO, TQString>::Iterator it2;
+ if (_protoMap.end() != (it2 = _protoMap.findData( (*proto_it).toString() )))
+ protos |= it2.key();
+ }
+ setProto(protos);
+ }
+ else if(it.key() == NM_SETTING_WIRELESS_SECURITY_GROUP)
+ {
+ TQValueList<TQT_DBusData> cipher_list = it.data().toTQValueList();
+ uint32_t ciphers = CIPHER_NONE;
+ for (TQValueList<TQT_DBusData>::Iterator cipher_it = cipher_list.begin(); cipher_it != cipher_list.end(); ++cipher_it)
+ {
+ TQBiDirectionalMap<CIPHERS, TQString>::Iterator it2;
+ if (_cipherMap.end() != (it2 = _cipherMap.findData( (*cipher_it).toString() )))
+ ciphers |= it2.key();
+ }
+ setGroupCiphers(ciphers);
+ }
+ else if (it.key() == NM_SETTING_WIRELESS_SECURITY_PAIRWISE)
+ {
+ TQValueList<TQT_DBusData> cipher_list = it.data().toTQValueList();
+ uint32_t ciphers = CIPHER_NONE;
+ for (TQValueList<TQT_DBusData>::Iterator cipher_it = cipher_list.begin(); cipher_it != cipher_list.end(); ++cipher_it)
+ {
+ TQBiDirectionalMap<CIPHERS, TQString>::Iterator it2;
+ if (_cipherMap.end() != (it2 = _cipherMap.findData( (*cipher_it).toString() )))
+ ciphers |= it2.key();
+ }
+ setPairwiseCiphers(ciphers);
+ }
+ else if (it.key() == NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME)
+ {
+ _leapUsername = it.data().toString();
+ }
+ else if (it.key() == NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD)
+ {
+ _leapPassword = it.data().toString();
+ }
+ else
+ kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
+ }
+}
+
+SettingsMap
+WirelessSecurity::toSecretsMap(bool with_settings) const
+{
+ SettingsMap map;
+ kdDebug() << "WirelessSecurity::toSecretsMap" << endl;
+ // first serialize the settings if needed
+ if (with_settings)
+ map = toMap();
+
+ // add the hashed psk
+ if (!_psk.isNull())
+ {
+ map.insert(NM_SETTING_WIRELESS_SECURITY_PSK, TQT_DBusData::fromString(_psk), TRUE);
+ }
+
+ // wep keys
+ if (!_wepKey[0].isNull())
+ {
+ kdDebug() << "insert wep key0: " << _wepKey[0].ascii() << endl;
+ map.insert(NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, TQT_DBusData::fromString(_wepKey[0]));
+ }
+
+ if (!_wepKey[1].isNull())
+ {
+ map.insert(NM_SETTING_WIRELESS_SECURITY_WEP_KEY1, TQT_DBusData::fromString(_wepKey[1]));
+ }
+
+ if (!_wepKey[2].isNull())
+ {
+ map.insert(NM_SETTING_WIRELESS_SECURITY_WEP_KEY2, TQT_DBusData::fromString(_wepKey[2]));
+ }
+
+ if (!_wepKey[3].isNull())
+ {
+ map.insert(NM_SETTING_WIRELESS_SECURITY_WEP_KEY3, TQT_DBusData::fromString(_wepKey[3]));
+ }
+
+ if (!_leapPassword.isEmpty())
+ map.insert(NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD, TQT_DBusData::fromString(_leapPassword));
+
+ return map;
+}
+
+bool
+WirelessSecurity::fromSecretsMap(const SettingsMap& map)
+{
+ kdDebug() << "WirelessSecurity::fromMap" << endl;
+
+ for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
+ {
+ if (it.key() == NM_SETTING_WIRELESS_SECURITY_PSK)
+ {
+ _psk = it.data().toString();
+ }
+ else if (it.key() == NM_SETTING_WIRELESS_SECURITY_WEP_KEY0)
+ {
+ _wepKey[0] = it.data().toString();
+ }
+ else if (it.key() == NM_SETTING_WIRELESS_SECURITY_WEP_KEY1)
+ {
+ _wepKey[1] = it.data().toString();
+ }
+ else if (it.key() == NM_SETTING_WIRELESS_SECURITY_WEP_KEY2)
+ {
+ _wepKey[2] = it.data().toString();
+ }
+ else if (it.key() == NM_SETTING_WIRELESS_SECURITY_WEP_KEY3)
+ {
+ _wepKey[3] = it.data().toString();
+ }
+ else
+ kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
+ }
+ return true;
+}
+
+bool
+WirelessSecurity::isValid() const
+{
+ return true;
+}
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_security.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_security.h
new file mode 100644
index 0000000..187fd37
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_security.h
@@ -0,0 +1,156 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_H
+
+#include <stdint.h>
+#include <tqhostaddress.h>
+#include <tqmap.h>
+#include <tqvariant.h>
+#include <tqobject.h>
+
+#include <tqdbusdata.h>
+
+#include "knetworkmanager-connection_setting.h"
+#include "qbidirectionalmap.h"
+/* NM */
+#include <nm-setting-wireless-security.h>
+#include <nm-setting-wireless.h>
+
+
+class AccessPoint;
+
+namespace ConnectionSettings
+{
+
+class WirelessSecurity;
+
+
+// setting for wireless security parameters
+class WirelessSecurity : public ConnectionSetting
+{
+ public:
+ // bitwise or-able ciphers
+ enum CIPHERS
+ {
+ CIPHER_NONE = 0
+ , CIPHER_TKIP = 1
+ , CIPHER_CCMP = 2
+ , CIPHER_WEP40 = 4
+ , CIPHER_WEP104 = 8
+ , CIPHER_AUTO = CIPHER_TKIP | CIPHER_CCMP
+ };
+
+ enum KEY_MGMT
+ {
+ KEY_MGMT_NONE = 0
+ , KEY_MGMT_IEEE8021X
+ , KEY_MGMT_WPA_NONE
+ , KEY_MGMT_WPA_PSK
+ , KEY_MGMT_WPA_EAP
+ };
+
+ enum AUTH_ALG
+ {
+ AUTH_ALG_NONE = 0
+ , AUTH_ALG_OPEN
+ , AUTH_ALG_SHARED
+ , AUTH_ALG_LEAP
+ };
+
+ // bitwise or-able protos
+ enum PROTO
+ {
+ PROTO_NONE = 0
+ , PROTO_AUTO = PROTO_NONE
+ , PROTO_WPA
+ , PROTO_RSN
+ };
+
+ WirelessSecurity(Connection* conn);
+ SettingsMap toMap() const;
+ void fromMap(const SettingsMap&);
+
+ SettingsMap toSecretsMap(bool with_settings = true) const;
+ bool fromSecretsMap(const SettingsMap&);
+
+ uint32_t getGroupCiphers(void) const;
+ void setGroupCiphers(uint32_t);
+
+ uint32_t getPairwiseCiphers(void) const;
+ void setPairwiseCiphers(uint32_t);
+
+ KEY_MGMT getKeyMgmt(void) const;
+ void setKeyMgmt(KEY_MGMT);
+
+ AUTH_ALG getAuthAlg(void) const;
+ void setAuthAlg(AUTH_ALG);
+
+ uint32_t getProto(void) const;
+ void setProto(uint32_t);
+ void addProto(uint32_t);
+ void delProto(uint32_t);
+
+ TQString getPSK(void) const;
+ void setPSK(const TQString&);
+
+ TQString getLeapUsername(void) const;
+ void setLeapUsername(const TQString&);
+
+ TQString getLeapPassword(void) const;
+ void setLeapPassword(const TQString&);
+
+ TQString getWepKey(int) const;
+ void setWepKey(int, TQString);
+
+ int getWepTxidx() const;
+ void setWepTxidx(int);
+
+ bool isValid() const;
+ bool getEnabled() const;
+
+ private:
+ // settigs
+ KEY_MGMT _keyMgmt;
+ int _wepTxKeyidx;
+ AUTH_ALG _authAlg;
+ uint32_t _proto;
+ uint32_t _pairwise;
+ uint32_t _group;
+ TQString _leapUsername;
+
+ // secrets
+ TQString _wepKey[4];
+ TQString _psk;
+ TQString _leapPassword;
+
+ TQBiDirectionalMap<KEY_MGMT, TQString> _keyMgmtMap;
+ TQBiDirectionalMap<AUTH_ALG, TQString> _authAlgMap;
+ TQBiDirectionalMap<PROTO, TQString> _protoMap;
+ TQBiDirectionalMap<CIPHERS, TQString> _cipherMap;
+};
+
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_security_widget.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_security_widget.cpp
new file mode 100644
index 0000000..5f508fc
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_security_widget.cpp
@@ -0,0 +1,999 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_setting_wireless_security_widget.cpp
+ * - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqwidget.h>
+#include <tqlineedit.h>
+#include <tqgroupbox.h>
+#include <tqbuttongroup.h>
+#include <tqwidgetstack.h>
+#include <tqcombobox.h>
+#include <tqradiobutton.h>
+#include <tqlayout.h>
+#include <tqcheckbox.h>
+
+/* kde headers */
+#include <kurlrequester.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kpassdlg.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager-accesspoint.h"
+#include "knetworkmanager-wireless_device.h"
+#include "knetworkmanager-device.h"
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_setting_wireless_security_widget.h"
+#include "knetworkmanager-connection_setting_wireless_security.h"
+#include "knetworkmanager-connection_setting_wireless.h"
+#include "knetworkmanager-connection_setting_8021x.h"
+#include "sha1.h"
+#include "md5.h"
+#include "knetworkmanager-wireless_manager.h"
+
+#define WPA_PMK_LEN 32
+
+using namespace ConnectionSettings;
+
+/*
+ class WirelessSecurityWEPImpl
+*/
+WirelessSecurityWEPImpl::WirelessSecurityWEPImpl(WirelessSecurity* sec, TQWidget* parent, const char* name, WFlags fl)
+ : ConnectionSettingWirelessSecurityWEP(parent, name, fl)
+ , _security_setting(sec)
+ , _wepKeyType( WEPKEY_TYPE_HEX )
+{
+ cboAuthentication->insertItem(i18n("Open System"), 0);
+ cboAuthentication->insertItem(i18n("Shared Key"), 1);
+ if (_security_setting->getAuthAlg() == WirelessSecurity::AUTH_ALG_OPEN)
+ cboAuthentication->setCurrentItem(0);
+ else if (_security_setting->getAuthAlg() == WirelessSecurity::AUTH_ALG_SHARED)
+ cboAuthentication->setCurrentItem(1);
+
+ cbKeyType->insertItem(i18n("WEP 40/128-bit ASCII"), WEPKEY_TYPE_ASCII);
+ cbKeyType->insertItem(i18n("WEP 40/128-bit Hexadecimal"), WEPKEY_TYPE_HEX);
+ cbKeyType->insertItem(i18n("WEP 128-bit passphrase"), WEPKEY_TYPE_PASSPHRASE);
+ cbKeyType->setCurrentItem(_wepKeyType );
+
+ txtWEPKey0->setText(_security_setting->getWepKey(0));
+ txtWEPKey1->setText(_security_setting->getWepKey(1));
+ txtWEPKey2->setText(_security_setting->getWepKey(2));
+ txtWEPKey3->setText(_security_setting->getWepKey(3));
+
+ switch(_security_setting->getWepTxidx())
+ {
+ case 0:
+ rbKeyIdx0->setChecked(true);
+ break;
+ case 1:
+ rbKeyIdx1->setChecked(true);
+ break;
+ case 2:
+ rbKeyIdx2->setChecked(true);
+ break;
+ case 3:
+ rbKeyIdx3->setChecked(true);
+ break;
+ default:
+ rbKeyIdx0->setChecked(true);
+ break;
+ }
+
+ connect(cboAuthentication, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotAuthAlgChanged(int)));
+ connect(cbKeyType, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotKeyTypeChanged(int)));
+ connect(txtWEPKey0, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotWepKey0Changed(const TQString&)));
+ connect(txtWEPKey1, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotWepKey1Changed(const TQString&)));
+ connect(txtWEPKey2, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotWepKey2Changed(const TQString&)));
+ connect(txtWEPKey3, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotWepKey3Changed(const TQString&)));
+
+ connect(rbKeyIdx0, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWepIdx0Checked(bool)));
+ connect(rbKeyIdx1, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWepIdx1Checked(bool)));
+ connect(rbKeyIdx2, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWepIdx2Checked(bool)));
+ connect(rbKeyIdx3, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWepIdx3Checked(bool)));
+}
+
+void WirelessSecurityWEPImpl::slotAuthAlgChanged(int index)
+{
+ if (index == 0)
+ _security_setting->setAuthAlg(WirelessSecurity::AUTH_ALG_OPEN);
+ else if (index == 1)
+ _security_setting->setAuthAlg(WirelessSecurity::AUTH_ALG_SHARED);
+}
+
+void WirelessSecurityWEPImpl::slotKeyTypeChanged(int index)
+{
+ _wepKeyType = (WEPKEY_TYPE)index;
+
+ // update all WEP-Keys here due to the new key_type
+}
+
+void WirelessSecurityWEPImpl::slotWepKey0Changed(const TQString &key)
+{
+ TQCString hashed = getHashedWEPKey(key, _wepKeyType);
+ _security_setting->setWepKey(0, hashed);
+}
+
+void WirelessSecurityWEPImpl::slotWepKey1Changed(const TQString &key)
+{
+ TQCString hashed = getHashedWEPKey(key, _wepKeyType);
+ _security_setting->setWepKey(1, hashed);
+}
+
+void WirelessSecurityWEPImpl::slotWepKey2Changed(const TQString &key)
+{
+ TQCString hashed = getHashedWEPKey(key, _wepKeyType);
+ _security_setting->setWepKey(2, hashed);
+}
+
+void WirelessSecurityWEPImpl::slotWepKey3Changed(const TQString& key)
+{
+ TQCString hashed = getHashedWEPKey(key, _wepKeyType);
+ _security_setting->setWepKey(3, hashed);
+}
+
+void WirelessSecurityWEPImpl::slotWepIdx0Checked(bool check)
+{
+ if (check)
+ _security_setting->setWepTxidx(0);
+}
+
+void WirelessSecurityWEPImpl::slotWepIdx1Checked(bool check)
+{
+ if (check)
+ _security_setting->setWepTxidx(1);
+}
+
+void WirelessSecurityWEPImpl::slotWepIdx2Checked(bool check)
+{
+ if (check)
+ _security_setting->setWepTxidx(2);
+}
+
+void WirelessSecurityWEPImpl::slotWepIdx3Checked(bool check)
+{
+ if (check)
+ _security_setting->setWepTxidx(3);
+}
+
+TQCString
+WirelessSecurityWEPImpl::getHashedWEPKey(TQString key, WEPKEY_TYPE type) const
+{
+ TQCString hashed;
+ switch(type)
+ {
+ case WEPKEY_TYPE_HEX:
+ return TQCString(key);
+ break;
+ case WEPKEY_TYPE_ASCII:
+ hashed = String2Hex(TQCString(key), key.length() * 2);
+ return hashed;
+ break;
+ case WEPKEY_TYPE_PASSPHRASE:
+ return getWEP128PassphraseHash(TQCString(key));
+ break;
+ }
+ return hashed;
+}
+
+TQCString
+WirelessSecurityWEPImpl::getWEP128PassphraseHash(TQCString input) const
+{
+ char md5_data[65];
+ TQCString digest(16);
+ int input_len;
+ int i;
+
+ if (input.isNull()) return input;
+
+ input_len = input.length();
+ if (input_len < 1)
+ return TQCString();
+
+ /* Get at least 64 bytes */
+ for (i = 0; i < 64; i++)
+ md5_data [i] = input [i % input_len];
+
+ /* Null terminate md5 seed data and hash it */
+ md5_data[64] = 0;
+ gnome_keyring_md5_string (md5_data, (unsigned char*)digest.data());
+ return (String2Hex(TQByteArray(digest), 26));
+
+}
+
+TQCString
+WirelessSecurityWEPImpl::String2Hex(TQByteArray bytes, int final_len) const
+{
+ TQCString result(final_len+1);
+ static char hex_digits[] = "0123456789abcdef";
+ result.resize(bytes.size() * 2 + 1);
+ for (uint i = 0; i < bytes.size(); i++)
+ {
+ result[2*i] = hex_digits[(bytes[i] >> 4) & 0xf];
+ result[2*i+1] = hex_digits[bytes[i] & 0xf];
+ }
+ /* Cut converted key off at the correct length for this cipher type */
+ if (final_len > -1)
+ result[final_len] = '\0';
+ return result;
+}
+
+
+/*
+ class WirelessSecurityWEPEncryptionImpl
+*/
+WirelessSecurityWEPEncryptionImpl::WirelessSecurityWEPEncryptionImpl(WirelessSecurity* security_setting, TQWidget* parent, const char* name, WFlags fl)
+ : ConnectionSettingWirelessSecurityWEPEncryption(parent, name, fl)
+ , _security_setting(security_setting)
+{
+ cboEncryption->insertItem(i18n("None"));
+ cboEncryption->insertItem(i18n("Dynamic WEP"));
+}
+
+
+/*
+ class WirelessSecurityWPAVersionImpl
+*/
+WirelessSecurityWPAVersionImpl::WirelessSecurityWPAVersionImpl(WirelessSecurity* security_setting, TQWidget* parent, const char* name, WFlags fl)
+ : ConnectionSettingWirelessSecurityWPAVersion(parent, name, fl)
+ , _security_setting(security_setting)
+{
+ cbWPA->setChecked(_security_setting->getProto() & WirelessSecurity::PROTO_WPA);
+ cbRSN->setChecked(_security_setting->getProto() & WirelessSecurity::PROTO_RSN);
+
+ connect(cbWPA, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWPA1(bool)));
+ connect(cbRSN, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWPA2(bool)));
+
+ connect(grpUseWPAVersion, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotAuto(bool)));
+}
+
+void
+WirelessSecurityWPAVersionImpl::slotAuto(bool on)
+{
+ if (!on)
+ {
+ // auto-select proto
+ _security_setting->setProto(WirelessSecurity::PROTO_AUTO);
+ }
+ else
+ {
+ // use selected wpa-version
+ TQ_UINT32 proto = WirelessSecurity::PROTO_NONE;
+ if (cbWPA->isChecked())
+ proto |= WirelessSecurity::PROTO_WPA;
+ if (cbRSN->isChecked())
+ proto |= WirelessSecurity::PROTO_RSN;
+ _security_setting->setProto(proto);
+ }
+}
+
+void
+WirelessSecurityWPAVersionImpl::slotWPA1(bool on)
+{
+ if (on)
+ _security_setting->addProto(WirelessSecurity::PROTO_WPA);
+ else
+ _security_setting->delProto(WirelessSecurity::PROTO_WPA);
+}
+
+void
+WirelessSecurityWPAVersionImpl::slotWPA2(bool on)
+{
+ if (on)
+ _security_setting->addProto(WirelessSecurity::PROTO_RSN);
+ else
+ _security_setting->delProto(WirelessSecurity::PROTO_RSN);
+}
+
+/*
+ class WirelessSecurityWPACipherImpl
+*/
+WirelessSecurityWPACipherImpl::WirelessSecurityWPACipherImpl(WirelessSecurity* security_setting, TQWidget* parent, const char* name, WFlags fl)
+ : ConnectionSettingWirelessSecurityWPACipher(parent, name, fl)
+ , _security_setting(security_setting)
+{
+ connect(grpUseCipher, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotCipherChangedAuto(bool)));
+
+ connect(chkGroupCipherTKIP, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotGroupCipherChangedTKIP(bool)));
+ connect(chkGroupCipherCCMP, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotGroupCipherChangedCCMP(bool)));
+ connect(chkGroupCipherWEP40, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotGroupCipherChangedWEP40(bool)));
+ connect(chkGroupCipherWEP104, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotGroupCipherChangedWEP104(bool)));
+
+ connect(chkPairwiseCipherTKIP, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotPairwiseCipherChangedTKIP(bool)));
+ connect(chkPairwiseCipherCCMP, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotPairwiseCipherChangedCCMP(bool)));
+
+ chkPairwiseCipherCCMP->setChecked(_security_setting->getPairwiseCiphers() & WirelessSecurity::CIPHER_CCMP);
+ chkPairwiseCipherTKIP->setChecked(_security_setting->getPairwiseCiphers() & WirelessSecurity::CIPHER_TKIP);
+
+ chkGroupCipherCCMP->setChecked(_security_setting->getGroupCiphers() & WirelessSecurity::CIPHER_CCMP);
+ chkGroupCipherTKIP->setChecked(_security_setting->getGroupCiphers() & WirelessSecurity::CIPHER_TKIP);
+ chkGroupCipherWEP40->setChecked(_security_setting->getGroupCiphers() & WirelessSecurity::CIPHER_WEP40);
+ chkGroupCipherWEP104->setChecked(_security_setting->getGroupCiphers() & WirelessSecurity::CIPHER_WEP104);
+
+}
+
+void
+WirelessSecurityWPACipherImpl::slotCipherChangedAuto(bool checked)
+{
+ if (!checked)
+ {
+ // select auto for both ciphers
+ _security_setting->setGroupCiphers(WirelessSecurity::CIPHER_AUTO);
+ _security_setting->setPairwiseCiphers(WirelessSecurity::CIPHER_AUTO);
+ }
+ else
+ {
+ // use the already selected ciphers
+
+ // group cipher
+ TQ_UINT32 cipher = WirelessSecurity::CIPHER_NONE;
+ if (chkGroupCipherTKIP->isChecked())
+ cipher |= WirelessSecurity::CIPHER_TKIP;
+ if (chkGroupCipherCCMP->isChecked())
+ cipher |= WirelessSecurity::CIPHER_CCMP;
+ if (chkGroupCipherWEP40->isChecked())
+ cipher |= WirelessSecurity::CIPHER_WEP40;
+ if (chkGroupCipherWEP104->isChecked())
+ cipher |= WirelessSecurity::CIPHER_WEP104;
+ _security_setting->setGroupCiphers(cipher);
+
+ // pairwise cipher
+ cipher = WirelessSecurity::CIPHER_NONE;
+ if (chkPairwiseCipherTKIP->isChecked())
+ cipher |= WirelessSecurity::CIPHER_TKIP;
+ if (chkPairwiseCipherCCMP->isChecked())
+ cipher |= WirelessSecurity::CIPHER_CCMP;
+ _security_setting->setPairwiseCiphers(cipher);
+
+ }
+}
+
+void
+WirelessSecurityWPACipherImpl::slotGroupCipherChangedTKIP(bool checked)
+{
+ if (checked)
+ _security_setting->setGroupCiphers(_security_setting->getGroupCiphers() | WirelessSecurity::CIPHER_TKIP);
+ else
+ _security_setting->setGroupCiphers(_security_setting->getGroupCiphers() & (!WirelessSecurity::CIPHER_TKIP));
+}
+
+void
+WirelessSecurityWPACipherImpl::slotGroupCipherChangedCCMP(bool checked)
+{
+ if (checked)
+ _security_setting->setGroupCiphers(_security_setting->getGroupCiphers() | WirelessSecurity::CIPHER_CCMP);
+ else
+ _security_setting->setGroupCiphers(_security_setting->getGroupCiphers() & (!WirelessSecurity::CIPHER_CCMP));
+}
+
+void
+WirelessSecurityWPACipherImpl::slotGroupCipherChangedWEP40(bool checked)
+{
+ if (checked)
+ _security_setting->setGroupCiphers(_security_setting->getGroupCiphers() | WirelessSecurity::CIPHER_WEP40);
+ else
+ _security_setting->setGroupCiphers(_security_setting->getGroupCiphers() & (!WirelessSecurity::CIPHER_WEP40));
+}
+
+void
+WirelessSecurityWPACipherImpl::slotGroupCipherChangedWEP104(bool checked)
+{
+ if (checked)
+ _security_setting->setGroupCiphers(_security_setting->getGroupCiphers() | WirelessSecurity::CIPHER_WEP104);
+ else
+ _security_setting->setGroupCiphers(_security_setting->getGroupCiphers() & (!WirelessSecurity::CIPHER_WEP104));
+}
+
+void
+WirelessSecurityWPACipherImpl::slotPairwiseCipherChangedTKIP(bool checked)
+{
+ if (checked)
+ _security_setting->setPairwiseCiphers(_security_setting->getPairwiseCiphers() | WirelessSecurity::CIPHER_TKIP);
+ else
+ _security_setting->setPairwiseCiphers(_security_setting->getPairwiseCiphers() & (!WirelessSecurity::CIPHER_TKIP));
+}
+
+void
+WirelessSecurityWPACipherImpl::slotPairwiseCipherChangedCCMP(bool checked)
+{
+ if (checked)
+ _security_setting->setPairwiseCiphers(_security_setting->getPairwiseCiphers() | WirelessSecurity::CIPHER_CCMP);
+ else
+ _security_setting->setPairwiseCiphers(_security_setting->getPairwiseCiphers() & (!WirelessSecurity::CIPHER_CCMP));
+}
+
+/*
+ class WirelessSecurityWPAPSK
+*/
+WirelessSecurityWPAPSKImpl::WirelessSecurityWPAPSKImpl(WirelessSecurity* security_setting, Wireless* wireless_setting, TQWidget* parent, const char* name, WFlags fl)
+ : ConnectionSettingWirelessSecurityWPAPSK(parent, name, fl)
+ , _security_setting(security_setting)
+ , _wireless_setting(wireless_setting)
+{
+ txtPSK->setText(_security_setting->getPSK());
+ connect(txtPSK, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotPSKChanged(const TQString&)));
+}
+
+void
+WirelessSecurityWPAPSKImpl::slotPSKChanged(const TQString& psk)
+{
+ if (_wireless_setting)
+ {
+ _security_setting->setPSK(psk);
+ }
+}
+
+TQCString
+WirelessSecurityWPAPSKImpl::String2Hex(TQByteArray bytes, int final_len) const
+{
+ TQCString result(final_len+1);
+ static char hex_digits[] = "0123456789abcdef";
+ result.resize(bytes.size() * 2 + 1);
+ for (uint i = 0; i < bytes.size(); i++)
+ {
+ result[2*i] = hex_digits[(bytes[i] >> 4) & 0xf];
+ result[2*i+1] = hex_digits[bytes[i] & 0xf];
+ }
+ /* Cut converted key off at the correct length for this cipher type */
+ if (final_len > -1)
+ result[final_len] = '\0';
+ return result;
+}
+
+/*
+ class WirelessSecurityEAPImpl
+*/
+WirelessSecurityEAPImpl::WirelessSecurityEAPImpl(IEEE8021x* security_setting, WirelessSecurityPhase2Impl* phase2_widget, TQWidget* parent, const char* name, WFlags fl)
+ : ConnectionSettingWirelessSecurityEAP(parent, name, fl)
+ , _security_setting(security_setting)
+ , _phase2_widget(phase2_widget)
+{
+ // insert all EAP-Methods
+ int index = 0;
+ cboMethod->insertItem(i18n("None"), index);
+ _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_NONE;
+
+ cboMethod->insertItem(i18n("TTLS"), ++index);
+ _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_TTLS;
+
+ cboMethod->insertItem(i18n("PEAP"), ++index);
+ _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_PEAP;
+
+ cboMethod->insertItem(i18n("TLS"), ++index);
+ _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_TLS;
+
+ cboMethod->insertItem(i18n("Leap"), ++index);
+ _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_LEAP;
+
+ cboMethod->insertItem(i18n("MD5"), ++index);
+ _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_MD5;
+
+ cboMethod->insertItem(i18n("FAST"), ++index);
+ _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_FAST;
+
+ cboMethod->insertItem(i18n("SIM"), ++index);
+ _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_SIM;
+
+ // preselect the correct method
+ TQBiDirectionalMap<int, IEEE8021x::EAP_PHASE1>::Iterator it = _eapIndexMap.findData(_security_setting->getEAP());
+ cboMethod->setCurrentItem(it.key());
+
+ // update phase2 combobox
+ _phase2_widget->setAllowedPhase2Methods(_security_setting->getAllowedPhase2Methods());
+
+ txtIdentity->setText(_security_setting->getIdentity());
+ txtAnonIdentity->setText(_security_setting->getAnonIdentity());
+ txtPassword->setText(_security_setting->getPassword());
+
+ chkCAStore->setChecked(_security_setting->getUseSystemCaCert());
+ kURLCACert->setEnabled(!_security_setting->getUseSystemCaCert());
+
+ // get notified if the method changes
+ connect(cboMethod, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotMethodChanged(int)));
+ connect(txtIdentity, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotIdentityChanged(const TQString&)));
+ connect(txtAnonIdentity, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotAnonIdentityChanged(const TQString&)));
+ connect(txtPassword, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotPasswordChanged(const TQString&)));
+ connect(chkCAStore, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotUseSystemCaCertChanged(bool)));
+}
+
+void WirelessSecurityEAPImpl::slotUseSystemCaCertChanged(bool on)
+{
+ _security_setting->setUseSystemCaCert(on);
+ kURLCACert->setEnabled(!on);
+}
+
+void WirelessSecurityEAPImpl::slotMethodChanged(int index)
+{
+ // new method choosen
+ IEEE8021x::EAP_PHASE1 eap = _eapIndexMap[index];
+ _security_setting->setEAP(eap);
+
+ _phase2_widget->setAllowedPhase2Methods(_security_setting->getAllowedPhase2Methods());
+}
+
+void WirelessSecurityEAPImpl::slotIdentityChanged(const TQString& identity)
+{
+ _security_setting->setIdentity(identity);
+}
+
+void WirelessSecurityEAPImpl::slotAnonIdentityChanged(const TQString& identity)
+{
+ _security_setting->setAnonIdentity(identity);
+}
+
+void WirelessSecurityEAPImpl::slotPasswordChanged(const TQString& pwd)
+{
+ _security_setting->setPassword(TQString(txtPassword->password()));
+}
+
+/*
+ class WirelessSecurityPhase2Impl
+*/
+WirelessSecurityPhase2Impl::WirelessSecurityPhase2Impl(IEEE8021x* security_setting, TQWidget* parent, const char* name, WFlags fl)
+ : ConnectionSettingWirelessSecurityPhase2(parent, name, fl)
+ , _security_setting(security_setting)
+{
+ _allowed_methods.append(IEEE8021x::EAP_PHASE2_AUTH_NONE);
+ updateMethodComboBox();
+
+ connect(cboPhase2Method, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotPhase2MethodChanged(int)));
+}
+
+void WirelessSecurityPhase2Impl::updateMethodComboBox()
+{
+ // insert all phase2 EAP-Methods
+ int index = 0;
+ cboPhase2Method->clear();
+ _eapIndexMap.clear();
+
+ for (TQValueList<IEEE8021x::EAP_PHASE2>::Iterator it = _allowed_methods.begin(); it != _allowed_methods.end(); ++it)
+ {
+ if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_NONE)
+ {
+ cboPhase2Method->insertItem(i18n("None"), index);
+ _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_NONE;
+ index++;
+ }
+ else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_MSCHAPV2)
+ {
+ cboPhase2Method->insertItem(i18n("MSCHAPv2"), index);
+ _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_MSCHAPV2;
+ index++;
+ }
+ else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_PAP)
+ {
+ cboPhase2Method->insertItem(i18n("PAP"), index);
+ _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_PAP;
+ index++;
+ }
+ else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_CHAP)
+ {
+ cboPhase2Method->insertItem(i18n("CHAP"), index);
+ _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_CHAP;
+ index++;
+ }
+ else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_MSCHAP)
+ {
+ cboPhase2Method->insertItem(i18n("MSCHAP"), index);
+ _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_MSCHAP;
+ index++;
+ }
+ else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_GTC)
+ {
+ cboPhase2Method->insertItem(i18n("GTC"), index);
+ _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_GTC;
+ index++;
+ }
+ else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_OTP)
+ {
+ cboPhase2Method->insertItem(i18n("OTP"), index);
+ _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_OTP;
+ index++;
+ }
+ else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_MD5)
+ {
+ cboPhase2Method->insertItem(i18n("MD5"), index);
+ _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_MD5;
+ index++;
+ }
+ else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_TLS)
+ {
+ cboPhase2Method->insertItem(i18n("TLS"), index);
+ _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_TLS;
+ index++;
+ }
+ }
+
+ // preselect the correct method
+ TQBiDirectionalMap<int, IEEE8021x::EAP_PHASE2>::Iterator it = _eapIndexMap.findData(_security_setting->getPhase2EAP());
+ if (it != _eapIndexMap.end())
+ {
+ cboPhase2Method->setCurrentItem(it.key());
+ _security_setting->setPhase2EAP(it.data());
+ }
+ else
+ {
+ cboPhase2Method->setCurrentItem(0);
+ _security_setting->setPhase2EAP(_eapIndexMap[0]);
+ }
+}
+
+void WirelessSecurityPhase2Impl::setAllowedPhase2Methods(const TQValueList<IEEE8021x::EAP_PHASE2>& list)
+{
+ _allowed_methods = list;
+ updateMethodComboBox();
+}
+
+void WirelessSecurityPhase2Impl::slotPhase2MethodChanged(int index)
+{
+ // new method choosen
+ IEEE8021x::EAP_PHASE2 eap = _eapIndexMap[index];
+ _security_setting->setPhase2EAP(eap);
+}
+
+/*
+ class WirelessSecurityWidgetImpl
+*/
+
+WirelessSecurityWidgetImpl::WirelessSecurityWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl)
+ : WidgetInterface(parent, name, fl)
+{
+ _security_setting = dynamic_cast<WirelessSecurity*> (conn->getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME));
+ _wireless_setting = dynamic_cast<Wireless*> (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME));
+ _ieee8021x_setting = dynamic_cast<IEEE8021x*> (conn->getSetting(NM_SETTING_802_1X_SETTING_NAME));
+ _new_conn = new_conn;
+
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
+ _mainWid = new ConnectionSettingWirelessSecurityWidget(this);
+ tqlayout->addWidget(_mainWid);
+
+ TQTimer::singleShot(0, this, TQT_SLOT(slotInit()));
+}
+
+void
+WirelessSecurityWidgetImpl::slotInit()
+{
+ // create all security widgets...
+ TQWidget* wep = new WirelessSecurityWEPImpl(_security_setting, _mainWid->groupUseEncryption);
+ TQWidget* phase2 = new WirelessSecurityPhase2Impl(_ieee8021x_setting, _mainWid->groupUseEncryption);
+ TQWidget* eap = new WirelessSecurityEAPImpl(_ieee8021x_setting, (WirelessSecurityPhase2Impl*)phase2, _mainWid->groupUseEncryption);
+ TQWidget* wpaversion = new WirelessSecurityWPAVersionImpl(_security_setting, _mainWid->groupUseEncryption);
+ TQWidget* wpacipher = new WirelessSecurityWPACipherImpl(_security_setting, _mainWid->groupUseEncryption);
+ TQWidget* wpapsk = new WirelessSecurityWPAPSKImpl(_security_setting, _wireless_setting, _mainWid->groupUseEncryption);
+ TQWidget* wepencryption = new WirelessSecurityWEPEncryptionImpl(_security_setting, _mainWid->groupUseEncryption);
+
+ wep->setHidden(true);
+ eap->setHidden(true);
+ wpaversion->setHidden(true);
+ wpacipher->setHidden(true);
+ phase2->setHidden(true);
+ wpapsk->setHidden(true);
+ wepencryption->setHidden(true);
+
+ _widgets[SECURITY_WEP].clear();
+ _widgets[SECURITY_WPA_PSK].clear();
+ _widgets[SECURITY_WPA_EAP].clear();
+ _widgets[SECURITY_IEEE8021X].clear();
+
+ // create WEP widget list
+ _widgets[SECURITY_WEP].append(wep);
+
+ // create WPA PSK widget list
+ _extra_widgets[SECURITY_WPA_PSK].append(wpaversion);
+ _extra_widgets[SECURITY_WPA_PSK].append(wpacipher);
+ _widgets[SECURITY_WPA_PSK].append(wpapsk);
+
+ // create WPA EAP widget list
+ _extra_widgets[SECURITY_WPA_EAP].append(wpaversion);
+ _extra_widgets[SECURITY_WPA_EAP].append(wpacipher);
+ _widgets[SECURITY_WPA_EAP].append(eap);
+ _widgets[SECURITY_WPA_EAP].append(phase2);
+
+ // create IEEE8021X widget list
+ _widgets[SECURITY_IEEE8021X].append(wepencryption);
+ _widgets[SECURITY_IEEE8021X].append(eap);
+
+ connect(_mainWid->cboSecurity, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotComboSecurityActivated(int)));
+ connect(_mainWid->groupUseEncryption, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotUseEncryptionToggled(bool)));
+ connect(_mainWid->pbExtra, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotExtraSettingsToggled(bool)));
+
+}
+
+void
+WirelessSecurityWidgetImpl::Activate()
+{
+ kdDebug() << "Activate " << (_new_conn ? "New" : "Edit") << endl;
+ comboSecurityInit();
+}
+
+void
+WirelessSecurityWidgetImpl::comboSecurityInit()
+{
+ int index = 0;
+
+ TQValueList<SecurityMethods> allowed_methods;
+ _mainWid->cboSecurity->clear();
+
+ // TODO: Preselect the right security method
+ // We should have an Essid already, fetch all possible APs
+ TQValueList<AccessPoint *> aps;
+ if (_new_conn && !_wireless_setting->getEssid().isEmpty())
+ {
+ aps = WirelessManager::getAccessPointsForEssid(_wireless_setting->getEssid());
+#if 0
+ kdDebug() << "Hugo " << TQString(TQCString(_wireless_setting->getEssid())).ascii() << endl;
+#endif
+ }
+ if (!aps.isEmpty())
+ {
+ // if at least one AP has this security setting show the entry in the combobox
+ for (TQValueList<AccessPoint*>::Iterator it = aps.begin(); it != aps.end(); ++it)
+ {
+ if((*it)->isEncrypted())
+ {
+ kdDebug() << "AP " << (*it)->getDisplaySsid().ascii() << " is encrypted" << endl;
+ if ((*it)->getRsnFlags() != NM_802_11_AP_SEC_NONE || (*it)->getWpaFlags() != NM_802_11_AP_SEC_NONE)
+ {
+ // WPA or RSN
+ if ((*it)->getRsnFlags() & NM_802_11_AP_SEC_KEY_MGMT_PSK || (*it)->getWpaFlags() & NM_802_11_AP_SEC_KEY_MGMT_PSK)
+ if (!allowed_methods.contains(SECURITY_WPA_PSK))
+ allowed_methods.append(SECURITY_WPA_PSK);
+
+
+ if ((*it)->getRsnFlags() & NM_802_11_AP_SEC_KEY_MGMT_802_1X || (*it)->getWpaFlags() & NM_802_11_AP_SEC_KEY_MGMT_802_1X)
+ if (!allowed_methods.contains(SECURITY_WPA_EAP))
+ allowed_methods.append(SECURITY_WPA_EAP);
+ }
+
+ // No WPA & RSN => WEP or dynamic WEP with 802.1x authentication
+ // TODO: an AP can provide WEP in addition to WPA
+ if (!allowed_methods.contains(SECURITY_WEP))
+ allowed_methods.append(SECURITY_WEP);
+ if (!allowed_methods.contains(SECURITY_IEEE8021X))
+ allowed_methods.append(SECURITY_IEEE8021X);
+ }
+ }
+
+ // insert only allowed security methods
+ if (allowed_methods.contains(SECURITY_WPA_PSK))
+ {
+ _securityComboMap.insert(index, SECURITY_WPA_PSK);
+ _mainWid->cboSecurity->insertItem(i18n("WPA Personal"), index++);
+ }
+
+ if (allowed_methods.contains(SECURITY_WPA_EAP))
+ {
+ _securityComboMap.insert(index, SECURITY_WPA_EAP);
+ _mainWid->cboSecurity->insertItem(i18n("WPA Enterprise"), index++);
+ }
+
+ if (allowed_methods.contains(SECURITY_WEP))
+ {
+ _securityComboMap.insert(index, SECURITY_WEP);
+ _mainWid->cboSecurity->insertItem(i18n("WEP"), index++);
+ }
+
+ if (allowed_methods.contains(SECURITY_IEEE8021X))
+ {
+ _securityComboMap.insert(index, SECURITY_IEEE8021X);
+ _mainWid->cboSecurity->insertItem(i18n("IEEE 802.1X"), index++);
+ }
+ }
+ else
+ {
+ // insert all possible authentication methods
+ _mainWid->cboSecurity->insertItem(i18n("WEP"),SECURITY_WEP );
+ _mainWid->cboSecurity->insertItem(i18n("WPA Personal"), SECURITY_WPA_PSK);
+ _mainWid->cboSecurity->insertItem(i18n("WPA Enterprise"), SECURITY_WPA_EAP);
+ _mainWid->cboSecurity->insertItem(i18n("IEEE 802.1X"), SECURITY_IEEE8021X);
+ _securityComboMap.insert(SECURITY_WEP, SECURITY_WEP);
+ _securityComboMap.insert(SECURITY_WPA_PSK, SECURITY_WPA_PSK);
+ _securityComboMap.insert(SECURITY_WPA_EAP, SECURITY_WPA_EAP);
+ _securityComboMap.insert(SECURITY_IEEE8021X, SECURITY_IEEE8021X);
+ }
+
+ if (!_new_conn)
+ {
+ switch(_security_setting->getKeyMgmt())
+ {
+ case WirelessSecurity::KEY_MGMT_NONE:
+ if (_security_setting->getAuthAlg() == WirelessSecurity::AUTH_ALG_SHARED ||
+ !_security_setting->getWepKey(0).isEmpty() ||
+ !_security_setting->getWepKey(1).isEmpty() ||
+ !_security_setting->getWepKey(2).isEmpty() ||
+ !_security_setting->getWepKey(3).isEmpty() )
+ {
+ _mainWid->groupUseEncryption->setChecked(true);
+ _mainWid->cboSecurity->setCurrentItem(SECURITY_WEP);
+ slotComboSecurityActivated(_securityComboMap[SECURITY_WEP]);
+ }
+ else
+ _mainWid->groupUseEncryption->setChecked(false);
+ break;
+ case WirelessSecurity::KEY_MGMT_WPA_PSK:
+ _mainWid->groupUseEncryption->setChecked(true);
+ _mainWid->cboSecurity->setCurrentItem(SECURITY_WPA_PSK);
+ slotComboSecurityActivated(_securityComboMap[SECURITY_WPA_PSK]);
+ break;
+ case WirelessSecurity::KEY_MGMT_WPA_EAP:
+ _mainWid->groupUseEncryption->setChecked(true);
+ _mainWid->cboSecurity->setCurrentItem(SECURITY_WPA_EAP);
+ slotComboSecurityActivated(_securityComboMap[SECURITY_WPA_EAP]);
+ break;
+ case WirelessSecurity::KEY_MGMT_IEEE8021X:
+ _mainWid->groupUseEncryption->setChecked(true);
+ _mainWid->cboSecurity->setCurrentItem(SECURITY_IEEE8021X);
+ slotComboSecurityActivated(_securityComboMap[SECURITY_IEEE8021X]);
+ break;
+
+ default:
+ break;
+ }
+ }
+ else
+ {
+ // select first possible security method
+ if (_mainWid->cboSecurity->count() > 0)
+ {
+ _mainWid->groupUseEncryption->setChecked(true);
+ _mainWid->groupUseEncryption->setEnabled(true);
+ _mainWid->cboSecurity->setCurrentItem(0);
+ slotComboSecurityActivated(0);
+ }
+ else
+ {
+ _mainWid->groupUseEncryption->setChecked(false);
+ _mainWid->groupUseEncryption->setEnabled(false);
+ }
+ }
+}
+
+void
+WirelessSecurityWidgetImpl::slotUseEncryptionToggled(bool on)
+{
+ _wireless_setting->setSecurity(on ? _security_setting->getType() : NULL);
+}
+
+void
+WirelessSecurityWidgetImpl::slotComboSecurityActivated(int index)
+{
+ int i = _securityComboMap[index];
+
+ // authentication switched, we have to show the appropriate widgets and hide some others
+ switch(i)
+ {
+ case SECURITY_WEP:
+ configureForWEP();
+ break;
+
+ case SECURITY_WPA_PSK:
+ configureForWPAPSK();
+ break;
+
+ case SECURITY_WPA_EAP:
+ configureForWPAEAP();
+ break;
+
+ case SECURITY_IEEE8021X:
+ configureForIEEE8021X();
+ break;
+
+ default:
+ // should not happen, something is broken...
+ break;
+ }
+}
+
+void
+WirelessSecurityWidgetImpl::configureWidgets(SecurityMethods method)
+{
+ // store selected method
+ _currentMethod = method;
+
+ for (int i = 0; i < SECURITY_COUNT; ++i)
+ {
+ // remove all current widgets that do not belong to the selected method
+ if (i != method)
+ {
+ for (TQValueList<TQWidget*>::iterator it = _widgets[i].begin(); it != _widgets[i].end(); ++it)
+ {
+ _mainWid->groupUseEncryption->tqlayout()->remove(*it);
+ (*it)->hide();
+ }
+ // remove extra widgets too
+ for (TQValueList<TQWidget*>::iterator it = _extra_widgets[i].begin(); it != _extra_widgets[i].end(); ++it)
+ {
+ _mainWid->groupUseEncryption->tqlayout()->remove(*it);
+ (*it)->hide();
+ }
+ }
+ }
+
+ // show all widgets widgets for the selected security method
+ for (TQValueList<TQWidget*>::iterator it = _widgets[method].begin(); it != _widgets[method].end(); ++it)
+ {
+ _mainWid->groupUseEncryption->tqlayout()->add(*it);
+ (*it)->show();
+ }
+
+ if (_mainWid->pbExtra->isOn())
+ for (TQValueList<TQWidget*>::iterator it = _extra_widgets[method].begin(); it != _extra_widgets[method].end(); ++it)
+ {
+ _mainWid->groupUseEncryption->tqlayout()->add(*it);
+ (*it)->show();
+ }
+
+ // deactivate button if no extra settings are available
+ _mainWid->pbExtra->setEnabled(!(_extra_widgets[method].begin() == _extra_widgets[method].end()));
+}
+
+void
+WirelessSecurityWidgetImpl::slotExtraSettingsToggled(bool on)
+{
+ if (on)
+ for (TQValueList<TQWidget*>::iterator it = _extra_widgets[_currentMethod].begin(); it != _extra_widgets[_currentMethod].end(); ++it)
+ {
+ _mainWid->groupUseEncryption->tqlayout()->add(*it);
+ (*it)->show();
+ }
+ else
+ for (TQValueList<TQWidget*>::iterator it = _extra_widgets[_currentMethod].begin(); it != _extra_widgets[_currentMethod].end(); ++it)
+ {
+ _mainWid->groupUseEncryption->tqlayout()->remove(*it);
+ (*it)->hide();
+ }
+}
+
+void
+WirelessSecurityWidgetImpl::configureForWEP()
+{
+ _security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_NONE);
+ configureWidgets(SECURITY_WEP);
+}
+
+void
+WirelessSecurityWidgetImpl::configureForWPAPSK()
+{
+ _security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_WPA_PSK);
+ configureWidgets(SECURITY_WPA_PSK);
+}
+
+void
+WirelessSecurityWidgetImpl::configureForWPAEAP()
+{
+ _security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_WPA_EAP);
+ configureWidgets(SECURITY_WPA_EAP);
+}
+
+void
+WirelessSecurityWidgetImpl::configureForIEEE8021X()
+{
+ _security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_IEEE8021X);
+ configureWidgets(SECURITY_IEEE8021X);
+}
+
+
+
+
+#include "knetworkmanager-connection_setting_wireless_security_widget.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_security_widget.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_security_widget.h
new file mode 100644
index 0000000..9e1dd20
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_security_widget.h
@@ -0,0 +1,238 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H
+
+/* qt autogenerated headers */
+#include "connection_setting_wireless_security.h"
+#include "connection_setting_wireless_security_eap.h"
+#include "connection_setting_wireless_security_phase2.h"
+#include "connection_setting_wireless_security_wep.h"
+#include "connection_setting_wireless_security_wpaversion.h"
+#include "connection_setting_wireless_security_wpacipher.h"
+#include "connection_setting_wireless_security_wpapsk.h"
+#include "connection_setting_wireless_security_wepencryption.h"
+
+/* knetworkmanager headers */
+#include "knetworkmanager-connection_setting.h"
+#include "knetworkmanager-connection_setting_8021x.h"
+#include "knetworkmanager-connection_setting_widget_interface.h"
+
+namespace ConnectionSettings
+{
+ /* class declarations */
+ class WirelessSecurity;
+ class Wireless;
+ class IEEE8021x;
+ class WirelessSecurityPhase2Impl;
+
+ class WirelessSecurityWEPImpl : public ConnectionSettingWirelessSecurityWEP
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ enum WEPKEY_TYPE
+ {
+ WEPKEY_TYPE_ASCII = 0
+ , WEPKEY_TYPE_HEX
+ , WEPKEY_TYPE_PASSPHRASE
+ };
+
+ WirelessSecurityWEPImpl(WirelessSecurity* security, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ TQCString getHashedWEPKey(TQString key, WEPKEY_TYPE type) const;
+ TQCString getWEP128PassphraseHash(TQCString input) const;
+ TQCString String2Hex(TQByteArray bytes, int final_len) const;
+
+ public slots:
+ void slotAuthAlgChanged(int);
+ void slotKeyTypeChanged(int);
+ void slotWepKey0Changed(const TQString&);
+ void slotWepKey1Changed(const TQString&);
+ void slotWepKey2Changed(const TQString&);
+ void slotWepKey3Changed(const TQString&);
+ void slotWepIdx0Checked(bool);
+ void slotWepIdx1Checked(bool);
+ void slotWepIdx2Checked(bool);
+ void slotWepIdx3Checked(bool);
+ private:
+ WirelessSecurity* _security_setting;
+ WEPKEY_TYPE _wepKeyType;
+ };
+
+ class WirelessSecurityWEPEncryptionImpl : public ConnectionSettingWirelessSecurityWEPEncryption
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ WirelessSecurityWEPEncryptionImpl(WirelessSecurity* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ private:
+ WirelessSecurity* _security_setting;
+ };
+
+ class WirelessSecurityWPAVersionImpl : public ConnectionSettingWirelessSecurityWPAVersion
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ WirelessSecurityWPAVersionImpl(WirelessSecurity* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+
+ public slots:
+ void slotAuto(bool);
+ void slotWPA1(bool);
+ void slotWPA2(bool);
+
+ private:
+ WirelessSecurity* _security_setting;
+
+ };
+
+ class WirelessSecurityWPACipherImpl : public ConnectionSettingWirelessSecurityWPACipher
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ private:
+ enum WPA_CIPHERS
+ {
+ WPA_CIPHER_AUTO = 0
+ , WPA_CIPHER_TKIP
+ , WPA_CIPHER_CCMP
+ , WPA_CIPHER_LAST
+ };
+ public:
+ WirelessSecurityWPACipherImpl(WirelessSecurity* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+
+ public slots:
+ void slotCipherChangedAuto(bool);
+ void slotGroupCipherChangedTKIP(bool);
+ void slotGroupCipherChangedCCMP(bool);
+ void slotGroupCipherChangedWEP40(bool);
+ void slotGroupCipherChangedWEP104(bool);
+ void slotPairwiseCipherChangedTKIP(bool);
+ void slotPairwiseCipherChangedCCMP(bool);
+
+ private:
+ WirelessSecurity* _security_setting;
+ };
+
+ class WirelessSecurityWPAPSKImpl : public ConnectionSettingWirelessSecurityWPAPSK
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ WirelessSecurityWPAPSKImpl(WirelessSecurity* security_setting, Wireless* wireless_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ TQCString String2Hex(TQByteArray bytes, int final_len) const;
+
+ public slots:
+ void slotPSKChanged(const TQString&);
+
+ private:
+ WirelessSecurity* _security_setting;
+ Wireless* _wireless_setting;
+ };
+
+ class WirelessSecurityEAPImpl : public ConnectionSettingWirelessSecurityEAP
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ WirelessSecurityEAPImpl(IEEE8021x* security_setting, WirelessSecurityPhase2Impl* phase2_widget, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+
+ public slots:
+ void slotMethodChanged(int index);
+ void slotIdentityChanged(const TQString&);
+ void slotAnonIdentityChanged(const TQString&);
+ void slotPasswordChanged(const TQString&);
+ void slotUseSystemCaCertChanged(bool on);
+
+ private:
+ IEEE8021x* _security_setting;
+ TQBiDirectionalMap<int, IEEE8021x::EAP_PHASE1> _eapIndexMap;
+ WirelessSecurityPhase2Impl* _phase2_widget;
+ };
+
+ class WirelessSecurityPhase2Impl : public ConnectionSettingWirelessSecurityPhase2
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ WirelessSecurityPhase2Impl(IEEE8021x* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ public slots:
+ void setAllowedPhase2Methods(const TQValueList<IEEE8021x::EAP_PHASE2>&);
+ void slotPhase2MethodChanged(int index);
+ private:
+ void updateMethodComboBox();
+
+ IEEE8021x* _security_setting;
+ TQBiDirectionalMap<int, IEEE8021x::EAP_PHASE2> _eapIndexMap;
+ TQValueList<IEEE8021x::EAP_PHASE2> _allowed_methods;
+ };
+
+ class WirelessSecurityWidgetImpl : public WidgetInterface
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ private:
+ enum SecurityMethods
+ {
+ SECURITY_WEP = 0
+ , SECURITY_WPA_PSK
+ , SECURITY_WPA_EAP
+ , SECURITY_IEEE8021X
+ , SECURITY_COUNT
+ };
+
+ public:
+ WirelessSecurityWidgetImpl(Connection*, bool new_conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ void Activate();
+
+ public slots:
+ void slotComboSecurityActivated(int);
+ void slotUseEncryptionToggled(bool);
+ void slotExtraSettingsToggled(bool);
+
+ private slots:
+ void slotInit();
+
+ private:
+ void comboSecurityInit();
+ void configureWidgets(SecurityMethods);
+ void configureForWEP();
+ void configureForWPAPSK();
+ void configureForWPAEAP();
+ void configureForIEEE8021X();
+
+ SecurityMethods _currentMethod;
+ TQValueList<TQWidget*> _widgets[SECURITY_COUNT];
+ TQValueList<TQWidget*> _extra_widgets[SECURITY_COUNT];
+ WirelessSecurity* _security_setting;
+ Wireless* _wireless_setting;
+ IEEE8021x* _ieee8021x_setting;
+ ConnectionSettingWirelessSecurityWidget* _mainWid;
+ bool _new_conn;
+ TQMap<int, SecurityMethods> _securityComboMap;
+ };
+}
+
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H*/
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_widget.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_widget.cpp
new file mode 100644
index 0000000..3cf6a9f
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_widget.cpp
@@ -0,0 +1,231 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Valentine Sinitsyn <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include <tqwidget.h>
+#include <tqlineedit.h>
+#include <tqlayout.h>
+#include <tqlistview.h>
+
+#include <klistview.h>
+#include <klineedit.h>
+#include <klistviewsearchline.h>
+#include <kiconloader.h>
+#include <kglobal.h>
+#include <kpushbutton.h>
+
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_setting_widget_interface.h"
+#include "knetworkmanager-connection_setting_wireless_widget.h"
+#include "knetworkmanager-connection_setting_wireless.h"
+#include "knetworkmanager-connection_setting_wireless_security.h"
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-wireless_network.h"
+#include "knetworkmanager-wireless_manager.h"
+
+using namespace ConnectionSettings;
+
+class NetworkListViewItem : public KListViewItem
+{
+ public:
+
+ NetworkListViewItem(TQListView* parent, WirelessNetwork& net)
+ : KListViewItem(parent, TQString::fromUtf8(net.getDisplaySsid()), TQString("%1\%").tqarg(net.getStrength()))
+ , _net(net)
+ {
+ TQ_UINT8 strength = net.getStrength();
+ if (strength > 80)
+ setPixmap(1, KGlobal::iconLoader()->loadIcon("nm_signal_100", KIcon::Small));
+ else if (strength > 55)
+ setPixmap(1, KGlobal::iconLoader()->loadIcon("nm_signal_75", KIcon::Small));
+ else if (strength > 30)
+ setPixmap(1, KGlobal::iconLoader()->loadIcon("nm_signal_50", KIcon::Small));
+ else if (strength > 5)
+ setPixmap(1, KGlobal::iconLoader()->loadIcon("nm_signal_25", KIcon::Small));
+ else
+ setPixmap(1, KGlobal::iconLoader()->loadIcon("nm_signal_00", KIcon::Small));
+
+ if (net.isEncrypted())
+ setPixmap(2, KGlobal::iconLoader()->loadIcon("lock", KIcon::Small));
+ }
+
+ WirelessNetwork _net;
+};
+
+WirelessWidgetImpl::WirelessWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl)
+ : WidgetInterface(parent, name, fl)
+{
+ _wireless_setting = dynamic_cast<Wireless*> (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME));
+ _info_setting = dynamic_cast<Info*> (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME));
+ _security_setting = dynamic_cast<WirelessSecurity*> (conn->getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME));
+ _hasName = !_info_setting->getName().isEmpty();
+ _new_conn = new_conn;
+
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
+ _mainWid = new ConnectionSettingWirelessWidget(this);
+ tqlayout->addWidget(_mainWid);
+
+ // FIXME hide this button until it is implemented
+ _mainWid->pbExpert->hide();
+
+ Init();
+}
+
+void
+WirelessWidgetImpl::Init()
+{
+ TQVBoxLayout* tqlayout = new TQVBoxLayout(_mainWid->framePlaceholder, 1, 1);
+ _searchLine = new KListViewSearchLineWidget(_mainWid->lvEssids, _mainWid->framePlaceholder);
+ tqlayout->addWidget(_searchLine);
+
+ connect(_mainWid->txtEssid, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotEssidChanged(const TQString&)));
+ connect(_mainWid->lvEssids, TQT_SIGNAL(doubleClicked(TQListViewItem*, const TQPoint&, int)), this, TQT_SLOT(slotEssidDoubleClicked(TQListViewItem*, const TQPoint&, int)) );
+ connect(_mainWid->lvEssids, TQT_SIGNAL(selectionChanged(TQListViewItem*)), this, TQT_SLOT(slotEssidChanged(TQListViewItem*)));
+
+ if (!_new_conn)
+ {
+ _mainWid->chkAutoRefresh->hide();
+ _mainWid->lvEssids->hide();
+ _searchLine->hide();
+ }
+}
+
+void
+WirelessWidgetImpl::Activate()
+{
+ // Fill in all available networks from all devices
+ // get all aps from all devices grouped together using the ssid
+ TQValueList<WirelessNetwork> nets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID);
+
+ _mainWid->lvEssids->clear();
+
+ for (TQValueList<WirelessNetwork>::Iterator it = nets.begin(); it != nets.end(); ++it)
+ {
+ KListViewItem* item = new NetworkListViewItem(_mainWid->lvEssids, (*it));
+
+ _mainWid->lvEssids->insertItem(item);
+ }
+
+ // FIXME, if essid contains unprintable characters show the essid in hex
+ _mainWid->txtEssid->setText(_wireless_setting->getEssid());
+}
+
+void WirelessWidgetImpl::slotEssidChanged(TQListViewItem* item)
+{
+ NetworkListViewItem* net_item = dynamic_cast<NetworkListViewItem*>(item);
+ if (net_item)
+ {
+ // update the settingsobject
+ updateEssid(net_item->_net.getSsid());
+
+ // update the textbox to match the selected essid
+ _mainWid->txtEssid->setText(net_item->_net.getDisplaySsid());
+ }
+}
+
+void
+WirelessWidgetImpl::slotEssidDoubleClicked(TQListViewItem* item, const TQPoint& /*p*/, int /*i*/)
+{
+ NetworkListViewItem* net_item = dynamic_cast<NetworkListViewItem*>(item);
+ if (net_item)
+ {
+ updateEssid(net_item->_net.getSsid());
+ // essid selected with double click -> goto the next setting
+ emit next();
+ }
+}
+
+
+void
+WirelessWidgetImpl::slotEssidChanged(const TQString& new_essid)
+{
+ /* set the newly entered essid */
+ /* FIXME perhaps local8Bit is better? */
+ /* FIXME allow entering essid in hex */
+ /* FIXME select the appropriate essid in the list too */
+
+ TQByteArray essid(new_essid.utf8());
+
+ // remove trailing \0
+ essid.resize(essid.size() - 1);
+
+ updateEssid(essid);
+}
+
+void
+WirelessWidgetImpl::updateEssid(const TQByteArray& essid)
+{
+ _wireless_setting->setEssid(essid);
+
+ if (!_hasName)
+ {
+ // the connection has no name yet -> just take the essid for it
+ _info_setting->setName(essid);
+ }
+}
+
+TQByteArray WirelessWidgetImpl::byteArrayFromHexString(const TQCString& str)
+{
+ char c[2];
+ TQByteArray arr(str.length() - 1);
+ TQTextStream stream(str, IO_ReadOnly);
+
+ stream.setf(TQTextStream::hex);
+ stream.setf(TQTextStream::left);
+ stream.width(2);
+ stream.fill('0');
+
+ // 0x
+ stream.readRawBytes(c, 2);
+
+ for (uint i = 0; i < (str.length()-1)/2; ++i)
+ {
+ stream.readRawBytes(c, 2);
+ TQString hex;
+ hex += "0x";
+ hex += c[0];
+ hex += c[1];
+ arr[i] = (unsigned char)hex.toShort();
+ }
+ return arr;
+}
+
+TQString WirelessWidgetImpl::hexStringFromByteArray(const TQByteArray& bytes)
+{
+ TQString tmp;
+ TQTextStream stream(&tmp, IO_ReadWrite);
+ stream.setf(TQTextStream::hex);
+ stream.setf(TQTextStream::left);
+ stream.width(2);
+ stream.fill('0');
+
+ stream << "0x" ;
+ for (uint i = 0; i < bytes.size(); ++i)
+ {
+ stream << static_cast<unsigned char>(bytes[i]);
+ }
+ return tmp;
+}
+
+#include "knetworkmanager-connection_setting_wireless_widget.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_widget.h b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_widget.h
new file mode 100644
index 0000000..ffed2ea
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_setting_wireless_widget.h
@@ -0,0 +1,71 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Valentine Sinitsyn <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H
+#define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H
+
+#include "knetworkmanager-connection_setting_widget_interface.h"
+#include "connection_setting_wireless.h"
+#include "knetworkmanager-connection_setting.h"
+
+class KListViewSearchLineWidget;
+
+namespace ConnectionSettings
+{
+ class Wireless;
+ class WirelessSecurity;
+ class Info;
+
+
+ class WirelessWidgetImpl : public WidgetInterface
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ WirelessWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+
+ void Activate();
+
+ public slots:
+ void slotEssidChanged(const TQString& new_essid);
+ void slotEssidChanged(TQListViewItem*);
+ void slotEssidDoubleClicked(TQListViewItem*, const TQPoint&, int);
+
+ private:
+ void Init();
+ void updateEssid(const TQByteArray&);
+ TQByteArray byteArrayFromHexString(const TQCString&);
+ TQString hexStringFromByteArray(const TQByteArray& );
+
+ bool _hasName;
+ Wireless* _wireless_setting;
+ Info* _info_setting;
+ WirelessSecurity* _security_setting;
+ ConnectionSettingWirelessWidget* _mainWid;
+ KListViewSearchLineWidget* _searchLine;
+ bool _new_conn;
+ };
+}
+#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H*/
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_settings_dialog.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_settings_dialog.cpp
new file mode 100644
index 0000000..97f8350
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_settings_dialog.cpp
@@ -0,0 +1,530 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ * Author: Timothy Pearson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// qt headers
+#include <tqwidget.h>
+#include <tqcombobox.h>
+#include <tqtabwidget.h>
+#include <tqpushbutton.h>
+#include <tqwidgetstack.h>
+#include <tqapplication.h>
+#include <tqlabel.h>
+
+// kde headers
+#include <kiconloader.h>
+#include <kdebug.h>
+#include <kpushbutton.h>
+
+// TQt DBus headers
+#include <tqdbuserror.h>
+#include <tqdbusobjectpath.h>
+
+// NM headers
+#include <NetworkManager.h>
+
+// knm headers
+#include "knetworkmanager-connection_setting_widget_interface.h"
+#include "knetworkmanager-connection_setting.h"
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-connection_setting_ipv4.h"
+#include "knetworkmanager-connection_setting_wired.h"
+#include "knetworkmanager-connection_setting_cdma.h"
+#include "knetworkmanager-connection_setting_gsm.h"
+#include "knetworkmanager-connection_setting_wireless.h"
+#include "knetworkmanager-connection_setting_wireless_security.h"
+#include "knetworkmanager-devicestore.h"
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-wired_connection.h"
+#include "knetworkmanager-wireless_connection.h"
+#include "knetworkmanager-vpn_connection.h"
+#include "knetworkmanager-connection_store.h"
+#include "knetworkmanager-connection_settings_dialog.h"
+#include "knetworkmanager-connection_setting_cdma_widget.h"
+#include "knetworkmanager-connection_setting_gsm_widget.h"
+#include "knetworkmanager-connection_setting_ppp_widget.h"
+#include "knetworkmanager-connection_setting_serial_widget.h"
+#include "knetworkmanager-connection_setting_wireless_widget.h"
+#include "knetworkmanager-connection_setting_wireless_security_widget.h"
+#include "knetworkmanager-connection_setting_ipv4_widget.h"
+#include "knetworkmanager-connection_setting_info_widget.h"
+#include "knetworkmanager-connection_setting_vpn_widget.h"
+#include "knetworkmanager-device.h"
+#include "knetworkmanager-nm_proxy.h"
+#include "knetworkmanager-storage.h"
+#include "knetworkmanager-wireless_network.h"
+#include "knetworkmanager-wireless_manager.h"
+
+#if !defined(NM_CHECK_VERSION)
+#define NM_CHECK_VERSION(x,y,z) 0
+#endif
+
+char use_new_wireless_essid = 0;
+TQByteArray new_wireless_essid;
+
+ConnectionSettingsDialogImpl::ConnectionSettingsDialogImpl(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting, TQWidget* parent, const char* name, bool modal, WFlags fl)
+ : ConnectionSettingsDialog(parent, name, modal, fl)
+ , _conn(conn)
+ , _setting(setting)
+ , _new_conn(new_conn)
+{
+ updateDialogForDeviceType();
+
+ // get notified if device combo changes
+ connect(btnConnect, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotConnect()) );
+ connect(pbNext, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotNext()) );
+ connect(pbBack, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotBack()) );
+ connect(pbCancel, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotCancel()) );
+ connect(pbSave, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSave()) );
+
+ // nice images for the buttons
+ btnConnect->setIconSet(SmallIcon ("connect_creating", TQIconSet::Automatic));
+ pbNext->setIconSet(SmallIcon ("1rightarrow", TQIconSet::Automatic));
+ pbBack->setIconSet(SmallIcon ("1leftarrow", TQIconSet::Automatic));
+ pbCancel->setIconSet(SmallIcon("cancel", TQIconSet::Automatic));
+ pbSave->setIconSet(SmallIcon("ok", TQIconSet::Automatic));
+
+ // enable or disable buttons accroding to the current state
+ slotEnableButtons();
+}
+
+ConnectionSettingsDialogImpl::~ConnectionSettingsDialogImpl()
+{
+ kdDebug() << "ConnectionSettingsDialogImpl::~ConnectionSettingsDialogImpl" << endl;
+}
+
+TQValueList<WidgetInterface*>
+ConnectionSettingsDialogImpl::createWidgetsForWireless(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
+{
+ TQValueList<WidgetInterface*> ret;
+
+ // widgetlist for wireless connection
+ ret.append(new ConnectionSettings::WirelessWidgetImpl(conn, new_conn));
+ ret.append(new ConnectionSettings::WirelessSecurityWidgetImpl(conn, new_conn));
+ ret.append(new ConnectionSettings::IPv4WidgetImpl(conn));
+ ret.append(new ConnectionSettings::InfoWidgetImpl(conn));
+
+ if (ret.isEmpty())
+ {
+ // we have a problem here, NetworkManager asked for a setting we do not have
+ kdError() << k_funcinfo << "Unexpected setting requested" << endl;
+ }
+
+ return ret;
+}
+
+TQValueList<WidgetInterface*>
+ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting, const TQByteArray& essid)
+{
+ TQValueList<WidgetInterface*> ret;
+
+ // Set ESSID
+// _wireless_setting = dynamic_cast<Wireless*> (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME));
+// _info_setting = dynamic_cast<Info*> (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME));
+// _wireless_setting->setEssid(essid);
+// if (!_hasName)
+// {
+// // the connection has no name yet -> just take the essid for it
+// _info_setting->setName(essid);
+// }
+
+ // widgetlist for wireless connection
+ ret.append(new ConnectionSettings::WirelessSecurityWidgetImpl(conn, new_conn));
+ ret.append(new ConnectionSettings::IPv4WidgetImpl(conn));
+ ret.append(new ConnectionSettings::InfoWidgetImpl(conn));
+
+ if (ret.isEmpty())
+ {
+ // we have a problem here, NetworkManager asked for a setting we do not have
+ kdError() << k_funcinfo << "Unexpected setting requested" << endl;
+ }
+
+ return ret;
+}
+
+TQValueList<WidgetInterface*>
+ConnectionSettingsDialogImpl::createWidgetsForWired(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
+{
+ TQValueList<WidgetInterface*> ret;
+
+ // widgetlist for wired connection
+ ret.append(new ConnectionSettings::IPv4WidgetImpl(conn));
+ ret.append(new ConnectionSettings::InfoWidgetImpl(conn));
+
+ return ret;
+}
+
+TQValueList<WidgetInterface*>
+ConnectionSettingsDialogImpl::createWidgetsForVPN(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
+{
+ TQValueList<WidgetInterface*> ret;
+
+ // widgetlist for wired connection
+ ret.append(new ConnectionSettings::VPNWidgetImpl(conn, new_conn));
+ ret.append(new ConnectionSettings::InfoWidgetImpl(conn));
+
+ return ret;
+}
+
+TQValueList<WidgetInterface*>
+ConnectionSettingsDialogImpl::createWidgetsForCDMA(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
+{
+ TQValueList<WidgetInterface*> ret;
+
+ // widgetlist for wired connection
+ ret.append(new ConnectionSettings::CDMAWidgetImpl(conn));
+ ret.append(new ConnectionSettings::SerialWidgetImpl(conn));
+ ret.append(new ConnectionSettings::PPPWidgetImpl(conn));
+ ret.append(new ConnectionSettings::IPv4WidgetImpl(conn));
+ ret.append(new ConnectionSettings::InfoWidgetImpl(conn));
+
+ return ret;
+}
+
+TQValueList<WidgetInterface*>
+ConnectionSettingsDialogImpl::createWidgetsForGSM(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
+{
+ TQValueList<WidgetInterface*> ret;
+
+ // widgetlist for wired connection
+ ret.append(new ConnectionSettings::GSMWidgetImpl(conn));
+ ret.append(new ConnectionSettings::PPPWidgetImpl(conn));
+ ret.append(new ConnectionSettings::SerialWidgetImpl(conn));
+ ret.append(new ConnectionSettings::IPv4WidgetImpl(conn));
+ ret.append(new ConnectionSettings::InfoWidgetImpl(conn));
+
+ return ret;
+}
+
+void
+ConnectionSettingsDialogImpl::createWidgetsForConnection(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
+{
+ /*
+ Currently two modes:
+ * dev == NULL -> Connection should be edited without the wish to start a connection
+ * dev != NULL -> A connection should be edited for connection on this device
+ */
+
+ if (!conn)
+ {
+ // TODO: create an empty widget and show an error
+ kdWarning() << k_funcinfo << "Not handled yet" << endl;
+ }
+ else
+ {
+ TQValueList<WidgetInterface*> widgets;
+ // TODO: move to a factory class
+ if (conn->getType() == NM_SETTING_WIRELESS_SETTING_NAME) {
+ if (use_new_wireless_essid == 0) {
+ widgets = createWidgetsForWireless(conn, new_conn, setting);
+ }
+ else {
+ createWidgetsForWirelessKnownESSID(conn, new_conn, setting, new_wireless_essid);
+ new_wireless_essid = NULL;
+ }
+ }
+ else if (conn->getType() == NM_SETTING_WIRED_SETTING_NAME)
+ widgets = createWidgetsForWired(conn, new_conn, setting);
+ else if (conn->getType() == NM_SETTING_CDMA_SETTING_NAME)
+ widgets = createWidgetsForCDMA(conn, new_conn, setting);
+ else if (conn->getType() == NM_SETTING_GSM_SETTING_NAME)
+ widgets = createWidgetsForGSM(conn, new_conn, setting);
+ else if (conn->getType() == NM_SETTING_VPN_SETTING_NAME)
+ widgets = createWidgetsForVPN(conn, new_conn, setting);
+ else
+ {
+ kdWarning() << k_funcinfo << "Not handled yet" << endl;
+ }
+
+ int id;
+ for (TQValueList<WidgetInterface*>::Iterator it = widgets.begin(); it != widgets.end(); ++it)
+ {
+ id = wstackSettings->addWidget(*it);
+ _widgetIds.append(id);
+ }
+
+ if (widgets.begin() != widgets.end())
+ activateWidget(*widgets.begin());
+ }
+}
+
+void
+ConnectionSettingsDialogImpl::updateDialogForDeviceType()
+{
+ // clear our tabview first
+ TQWidget *page = NULL;
+ while ( (page = wstackSettings->visibleWidget()) != NULL)
+ {
+ wstackSettings->removeWidget(page);
+ delete page;
+ }
+
+ if (_conn)
+ {
+ connect(_conn, TQT_SIGNAL(validityChanged()), this, TQT_SLOT(slotEnableButtons()));
+ createWidgetsForConnection(_conn, _new_conn, _setting);
+ }
+ else
+ {
+ // this should never happen
+ TQLabel* lbl = new TQLabel(wstackSettings, "Unknown Device Type");
+ wstackSettings->addWidget(lbl);
+
+ wstackSettings->raiseWidget(lbl);
+ }
+}
+
+int
+ConnectionSettingsDialogImpl::getDeviceTypeFromConnection(Connection* conn)
+{
+ if (conn->getType() == NM_SETTING_WIRELESS_SETTING_NAME)
+#if NM_CHECK_VERSION(0,8,992)
+ return NM_DEVICE_TYPE_WIFI;
+#else
+ return DEVICE_TYPE_802_11_WIRELESS;
+#endif
+ else if (conn->getType() == NM_SETTING_WIRED_SETTING_NAME)
+#if NM_CHECK_VERSION(0,8,992)
+ return NM_DEVICE_TYPE_ETHERNET;
+#else
+ return DEVICE_TYPE_802_3_ETHERNET;
+#endif
+ else if (conn->getType() == NM_SETTING_GSM_SETTING_NAME)
+#if NM_CHECK_VERSION(0,8,992)
+ return NM_DEVICE_TYPE_MODEM;
+#else
+ return DEVICE_TYPE_GSM;
+#endif
+ else if (conn->getType() == NM_SETTING_CDMA_SETTING_NAME)
+#if NM_CHECK_VERSION(0,8,992)
+ return NM_DEVICE_TYPE_MODEM;
+#else
+ return DEVICE_TYPE_CDMA;
+#endif
+
+#if NM_CHECK_VERSION(0,8,992)
+ return NM_DEVICE_TYPE_UNKNOWN;
+#else
+ return DEVICE_TYPE_UNKNOWN;
+#endif
+}
+
+void
+ConnectionSettingsDialogImpl::slotConnect()
+{
+ DeviceStore* dstore = DeviceStore::getInstance();
+ Device* dev = dstore->getDevices(getDeviceTypeFromConnection(_conn)).first();
+ ConnectionStore* cstore = ConnectionStore::getInstance();
+ NMProxy* nm = NMProxy::getInstance();
+ TQT_DBusError err;
+
+ // add the connection to the store
+ cstore->addConnection(_conn);
+
+ // activate device
+ if (dev && _conn && nm)
+ {
+ int id;
+ if (_conn->awaitingSecrets())
+ {
+ _conn->Connection::slotSecretsProvided(NULL);
+ }
+ else
+ {
+
+ // VPN connection needs a special specific object
+ if (_conn->getType() == NM_SETTING_VPN_SETTING_NAME)
+ {
+ TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection();
+ TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn);
+#if NM_CHECK_VERSION(0,8,992)
+ nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), device, act_conn, err);
+#else
+ nm->ActivateConnectionAsync(id,NM_DBUS_SERVICE_USER_SETTINGS, _conn->getObjectPath(), device, act_conn, err);
+#endif
+ }
+ else
+ {
+ // we need to call ActivateDevice async
+#if NM_CHECK_VERSION(0,8,992)
+ nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), TQT_DBusObjectPath(QCString(dev->getObjectPath())), _conn->getObjectPath(), err);
+#else
+ nm->ActivateConnectionAsync(id, NM_DBUS_SERVICE_USER_SETTINGS, _conn->getObjectPath(), TQT_DBusObjectPath(TQCString(dev->getObjectPath())), _conn->getObjectPath(), err);
+#endif
+ }
+ }
+ }
+
+ emit connectionSaved();
+ this->close(true);
+}
+
+void
+ConnectionSettingsDialogImpl::slotSave()
+{
+ // Make sure settings are committed
+ TQValueList<int>::Iterator current = _widgetIds.find(wstackSettings->id(wstackSettings->visibleWidget()));
+ if (current != _widgetIds.fromLast())
+ {
+ WidgetInterface* widget = NULL;
+
+ // let the widget know about it being the active one
+ widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current));
+ if (widget)
+ deactivateWidget(widget);
+ }
+
+ // Now save
+ ConnectionStore* cstore = ConnectionStore::getInstance();
+ NMProxy* nm = NMProxy::getInstance();
+ TQT_DBusError err;
+
+ // add the connection to the store
+ cstore->addConnection(_conn);
+
+ // if the connection waits for new secrets
+ // signal an error to NM, the user only wants to save
+ // the connection
+ if (_conn->awaitingSecrets())
+ _conn->slotSecretsError();
+
+ emit connectionSaved();
+ this->close(true);
+}
+
+void
+ConnectionSettingsDialogImpl::slotCancel()
+{
+ _conn->slotSecretsError();
+ close();
+}
+
+void
+ConnectionSettingsDialogImpl::slotNext()
+{
+ TQValueList<int>::Iterator current = _widgetIds.find(wstackSettings->id(wstackSettings->visibleWidget()));
+ if (current != _widgetIds.fromLast())
+ {
+ WidgetInterface* widget = NULL;
+
+ // let the widget know about it being the active one
+ widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current));
+ if (widget)
+ deactivateWidget(widget);
+
+ // next widget
+ current++;
+
+ // let the widget know about it being the active one
+ widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current));
+ if (widget)
+ activateWidget(widget);
+ }
+ slotEnableButtons();
+}
+
+void
+ConnectionSettingsDialogImpl::slotBack()
+{
+ TQValueList<int>::Iterator current = _widgetIds.find(wstackSettings->id(wstackSettings->visibleWidget()));
+ if (current != _widgetIds.begin())
+ {
+ WidgetInterface* widget = NULL;
+
+ // let the widget know about it being the active one
+ widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current));
+ if (widget)
+ deactivateWidget(widget);
+
+ // one back
+ current--;
+
+ // let the widget know about it being the active one
+ widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current));
+ if (widget)
+ activateWidget(widget);
+ }
+ slotEnableButtons();
+}
+
+void
+ConnectionSettingsDialogImpl::activateWidget(WidgetInterface* widget)
+{
+ // allow the widget to press next
+ connect(widget, TQT_SIGNAL(next()), this, TQT_SLOT(slotNext()));
+
+ // allow the widget to do some initialization
+ widget->Activate();
+
+ // show the widget
+ wstackSettings->raiseWidget(widget);
+
+}
+
+void
+ConnectionSettingsDialogImpl::deactivateWidget(WidgetInterface* widget)
+{
+ // allow the widget to press next
+ disconnect(widget, TQT_SIGNAL(next()), this, TQT_SLOT(slotNext()));
+
+ // allow the widget to do some initialization
+ widget->Deactivate();
+}
+
+void
+ConnectionSettingsDialogImpl::slotEnableButtons()
+{
+ // enable the buttons according to the current state
+
+ TQValueList<int>::Iterator current = _widgetIds.find(wstackSettings->id(wstackSettings->visibleWidget()));
+ bool enabled;
+
+ /*
+ Next: enabled if another widget is available
+ */
+ enabled = true;
+ if (current == _widgetIds.fromLast())
+ enabled = false;
+ pbNext->setEnabled(enabled);
+
+ /*
+ Back: enabled if the current widget has a predecessor
+ */
+ enabled = true;
+ if (current == _widgetIds.begin())
+ enabled = false;
+ pbBack->setEnabled(enabled);
+
+ /*
+ Connect: only show connect if the connection is valid
+ */
+ if (_conn)
+ {
+ btnConnect->setEnabled(_conn->isValid());
+ pbSave->setEnabled(_conn->isValid());
+
+ }
+}
+
+#include "knetworkmanager-connection_settings_dialog.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_settings_dialog.h b/knetworkmanager-0.8/src/knetworkmanager-connection_settings_dialog.h
new file mode 100644
index 0000000..0d54fdc
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_settings_dialog.h
@@ -0,0 +1,86 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_SETTINGS_DIALOG_H
+#define KNETWORKMANAGER_CONNECTION_SETTINGS_DIALOG_H
+
+// qt headers
+#include <tqvaluelist.h>
+
+// qt autogenerated headers
+#include "connection_settings.h"
+
+// knm headers
+#include "knetworkmanager-connection_setting.h"
+
+class TQWidget;
+class Device;
+
+namespace ConnectionSettings
+{
+ class WidgetInterface;
+ class ConnectionSetting;
+}
+
+class ConnectionSettingsDialogImpl : public ConnectionSettingsDialog
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ ConnectionSettingsDialogImpl(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting = NULL, TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
+ ~ConnectionSettingsDialogImpl();
+
+ public slots:
+ void slotConnect();
+ void slotCancel();
+ void slotSave();
+ void slotNext();
+ void slotBack();
+ void slotEnableButtons();
+
+ signals:
+ void connectionSaved();
+
+ private:
+ void updateDialogForDeviceType();
+ void createWidgetsForConnection(ConnectionSettings::Connection*, bool new_conn, ConnectionSettings::ConnectionSetting* setting);
+ void activateWidget(ConnectionSettings::WidgetInterface* widget);
+ void deactivateWidget(ConnectionSettings::WidgetInterface* widget);
+ int getDeviceTypeFromConnection(ConnectionSettings::Connection* conn);
+
+ // TODO: To be moved to a factory class
+ TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForWired(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting);
+ TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForWireless(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting);
+ TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForWirelessKnownESSID(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting, const TQByteArray& essid);
+ TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForVPN(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting);
+ TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForCDMA(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting);
+ TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForGSM(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting);
+
+ ConnectionSettings::Connection* _conn;
+ ConnectionSettings::ConnectionSetting* _setting;
+ TQValueList<int> _widgetIds;
+ bool _new_conn;
+};
+
+#endif /* KNETWORKMANAGER_CONNECTION_SETTINGS_DIALOG_H*/
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_store.cpp b/knetworkmanager-0.8/src/knetworkmanager-connection_store.cpp
new file mode 100644
index 0000000..aeb3b60
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_store.cpp
@@ -0,0 +1,191 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_store.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include <tqtimer.h>
+#include <tquuid.h>
+#include <tqdbusobjectpath.h>
+
+#include <kstaticdeleter.h>
+#include <kapplication.h>
+#include <kdebug.h>
+
+#include "knetworkmanager-connection_store.h"
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_setting.h"
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-connection_setting_ipv4.h"
+#include "knetworkmanager-connection_setting_wired.h"
+#include "knetworkmanager-connection_setting_wireless.h"
+#include "knetworkmanager-connection_setting_wireless_security.h"
+
+using namespace ConnectionSettings;
+
+static KStaticDeleter<ConnectionStore> sd;
+
+ConnectionStore* ConnectionStore::_instance = NULL;
+
+ConnectionStore*
+ConnectionStore::getInstance()
+{
+ if (_instance)
+ return _instance;
+ return sd.setObject(_instance, new ConnectionStore());
+}
+
+ConnectionStore::ConnectionStore()
+ : _connectionList()
+{
+ // defer the connection init a bit
+ TQTimer::singleShot(0, this, TQT_SLOT(slotInit()));
+}
+
+ConnectionStore::~ConnectionStore()
+{
+ for (TQValueList<Connection*>::Iterator it = _connectionList.begin(); it != _connectionList.end(); ++it)
+ {
+ delete (*it);
+ *it = NULL;
+ }
+}
+
+void
+ConnectionStore::slotInit()
+{
+
+}
+
+void
+ConnectionStore::slotSecretsNeeded(Connection* conn, ConnectionSetting* setting, const TQStringList& hints, bool request_new)
+{
+ kdDebug() << "ConnectionStore::slotSecretsNeeded" << endl;
+ emit SecretsNeeded(conn, setting, hints, request_new);
+}
+
+void
+ConnectionStore::addConnection(Connection* con)
+{
+ if (_connectionList.find(con) != _connectionList.end())
+ {
+ con->slotUpdated();
+ emit signalConnectionUpdated(con);
+ return;
+ }
+
+ // check if the connection has an ID already
+ if (con->getID().isEmpty())
+ {
+ // set unique id for this connection
+ con->setID(createNewConnectionID());
+ }
+
+ // we own the connection now
+ _connectionList.append(con);
+
+ // let's get notified if the connection asks for new secrets
+ connect(con, TQT_SIGNAL(SecretsNeeded(Connection*, ConnectionSetting*, const TQStringList&, bool)),
+ this, TQT_SLOT(slotSecretsNeeded(Connection*, ConnectionSetting*, const TQStringList&, bool)));
+
+ // new connection, ring ring
+ emit signalConnectionAdded(con);
+}
+
+void
+ConnectionStore::removeConnection(Connection* con)
+{
+ // check if the connection is != NULL
+ if (!con)
+ return;
+
+ // remove the object from our list
+ if (_connectionList.remove(con) == 0)
+ return;
+
+ // notify everybody about the removed connection
+ emit signalConnectionRemoved(con);
+
+ // delete the connection, it will deregister itself from NM
+ con->slotAboutToBeRemoved();
+ delete con;
+}
+
+Connection*
+ConnectionStore::getConnection(const TQString& obj_path)
+{
+ // find a connection by obj_path
+ TQValueList<Connection*>::Iterator it = _connectionList.begin();
+ for (; it != _connectionList.end(); ++it)
+ if (TQString((*it)->getObjectPath()) == obj_path)
+ return (*it);
+ return NULL;
+}
+
+TQValueList<Connection*>
+ConnectionStore::getConnections(const TQString& type)
+{
+ // return a list of connection
+ if (type.isEmpty())
+ return _connectionList;
+ else
+ {
+ TQValueList<Connection*> ret;
+ for (TQValueList<Connection*>::Iterator it = _connectionList.begin(); it != _connectionList.end(); ++it)
+ {
+ if ( (*it)->getType() == type)
+ ret.append(*it);
+ }
+ return ret;
+ }
+}
+
+TQString
+ConnectionStore::createNewConnectionID()
+{
+ bool unique;
+ TQString id;
+
+ do
+ {
+ unique = true;
+
+ // 16 bytes of randomness should be enougth for getting a unique ID
+ id = TQUuid::createUuid().toString();
+ id = id.replace("{","");
+ id = id.replace("}","");
+
+ // nevertheless check if the id is used already
+ TQValueList<Connection*>::Iterator it = _connectionList.begin();
+ for (; it != _connectionList.end(); ++it)
+ {
+ if ((*it)->getID() == id)
+ {
+ unique = false;
+ break;
+ }
+ }
+ } while (unique == false);
+
+ return id;
+}
+
+#include "knetworkmanager-connection_store.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-connection_store.h b/knetworkmanager-0.8/src/knetworkmanager-connection_store.h
new file mode 100644
index 0000000..c65deab
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-connection_store.h
@@ -0,0 +1,88 @@
+/***************************************************************************
+ *
+ * knetworkmanager-connection_store.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_CONNECTION_STORE_H
+#define KNETWORKMANAGER_CONNECTION_STORE_H
+
+#include <tqvaluelist.h>
+#include <tqobject.h>
+
+namespace ConnectionSettings
+{
+ class Connection;
+ class ConnectionSetting;
+}
+
+using namespace ConnectionSettings;
+
+class ConnectionStore : public TQObject
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+ static ConnectionStore* getInstance();
+ ~ConnectionStore();
+
+ // add a new connection to the store
+ void addConnection(ConnectionSettings::Connection*);
+
+ // get all connections
+ TQValueList<ConnectionSettings::Connection*> getConnections(const TQString& type = TQString());
+
+ // get a connection by ID
+ ConnectionSettings::Connection* getConnection(const TQString&);
+
+ // delete the specified connection from the store and delete it
+ void removeConnection(ConnectionSettings::Connection*);
+
+ public slots:
+ // has to be called as response to the signal SecretsNeeded
+ void slotSecretsNeeded(Connection* connection, ConnectionSetting* setting, const TQStringList& hints, bool request_new);
+
+ signals:
+ // emitted when a new connection is added to the store
+ void signalConnectionAdded(ConnectionSettings::Connection*);
+
+ // emitted when a connection was updated
+ void signalConnectionUpdated(ConnectionSettings::Connection*);
+
+ // emitted when a connection is removed from the store
+ void signalConnectionRemoved(ConnectionSettings::Connection*);
+
+ // emitted when a connection needs new secrets
+ void SecretsNeeded(ConnectionSettings::Connection* connection, ConnectionSettings::ConnectionSetting* setting, const TQStringList& hints, bool request_new);
+
+ private slots:
+ void slotInit();
+
+ private:
+ ConnectionStore();
+ TQString createNewConnectionID();
+
+ TQValueList<ConnectionSettings::Connection*> _connectionList;
+ static ConnectionStore* _instance;
+};
+
+#endif /* KNETWORKMANAGER_CONNECTION_STORE_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-device.cpp b/knetworkmanager-0.8/src/knetworkmanager-device.cpp
new file mode 100644
index 0000000..585ce8d
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-device.cpp
@@ -0,0 +1,166 @@
+/***************************************************************************
+ *
+ * knetworkmanager-device.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include <NetworkManager.h>
+
+#include "knetworkmanager.h"
+#include "knetworkmanager-nm_proxy.h"
+#include "knetworkmanager-device.h"
+#include "dbus/deviceproxy.h"
+#include "knetworkmanager-hal_device_proxy.h"
+
+
+#include <kdebug.h>
+#include <tqhostaddress.h>
+
+#include <tqdbuserror.h>
+#include <tqdbusconnection.h>
+#include <tqdbusproxy.h>
+
+
+class NMDeviceProxy : public DBus::DeviceProxy
+{
+ public:
+ NMDeviceProxy(const TQString& service, const TQString& path, TQObject* parent = 0, const char* name = 0)
+ : DeviceProxy(service, path, parent, name)
+ {
+
+ }
+
+ TQString getObjectPath() const
+ {
+ return m_baseProxy->path();
+ }
+};
+
+class DevicePrivate
+{
+public:
+ DevicePrivate(TQString service, TQString obj_path)
+ : nmDevice(service, obj_path)
+ , halDevice(NULL)
+ {}
+ ~DevicePrivate() {}
+
+ NMDeviceProxy nmDevice;
+ HalDeviceProxy* halDevice;
+};
+
+TQ_UINT32 Device::getDeviceType() const
+{
+ TQT_DBusError err;
+ TQ_UINT32 type = d->nmDevice.getDeviceType(err);
+ kdWarning() << k_funcinfo << err.name() << err.message() << endl;
+ return type;
+}
+
+TQString Device::getInterface() const
+{
+ TQT_DBusError err;
+ return d->nmDevice.getInterface(err);
+}
+
+TQString Device::getUdi() const
+{
+ TQT_DBusError err;
+ return d->nmDevice.getUdi(err);
+}
+
+TQString Device::getDriver() const
+{
+ TQT_DBusError err;
+ return d->nmDevice.getDriver(err);
+}
+
+TQ_UINT32 Device::getCapabilities() const
+{
+ TQT_DBusError err;
+ return d->nmDevice.getCapabilities(err);
+}
+
+TQ_INT32 Device::getIp4Address() const
+{
+ TQT_DBusError err;
+ return d->nmDevice.getIp4Address(err);
+}
+
+NMDeviceState Device::getState() const
+{
+ TQT_DBusError err;
+ return (NMDeviceState)d->nmDevice.getState(err);
+}
+
+TQString Device::getVendor() const
+{
+ // FIXME: ask hal
+ return "";
+}
+
+TQString Device::getProduct() const
+{
+ // FIXME: ask hal
+ return "";
+}
+
+TQString Device::getObjectPath() const
+{
+ return d->nmDevice.getObjectPath();
+}
+
+void Device::slotStateChanged(TQ_UINT32 state)
+{
+ emit StateChanged((NMDeviceState)state);
+}
+
+void Device::slotDeactivate()
+{
+ // FIXME: the method was removed from NM API, use nm_proxy instead
+ NMProxy* nm = NMProxy::getInstance();
+
+ nm->deactivateDevice(this);
+
+// TQT_DBusError err;
+// d->nmDevice.Deactivate(err);
+}
+
+Device::Device (const TQString & obj_path)
+{
+ d = new DevicePrivate(NM_DBUS_SERVICE, obj_path);
+
+ // create the NM Device Proxy
+ d->nmDevice.setConnection(TQT_DBusConnection::systemBus());
+
+ connect(&(d->nmDevice), TQT_SIGNAL(StateChanged(TQ_UINT32)), this, TQT_SLOT(slotStateChanged(TQ_UINT32)));
+// d->halDevice = new HalDeviceProxy();
+}
+
+Device::~Device ()
+{
+// delete d->halDevice;
+ delete d;
+}
+
+
+#include "knetworkmanager-device.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-device.h b/knetworkmanager-0.8/src/knetworkmanager-device.h
new file mode 100644
index 0000000..56fcdab
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-device.h
@@ -0,0 +1,74 @@
+/***************************************************************************
+ *
+ * knetworkmanager-device.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_DEVICE_H
+#define KNETWORKMANAGER_DEVICE_H
+
+#include <NetworkManager.h>
+
+#include "knetworkmanager.h"
+
+#include <stdint.h>
+
+class KNetworkManager;
+class Network;
+class IP4Config;
+
+class DevicePrivate;
+
+class Device : public TQObject
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ Device (const TQString & obj_path );
+ ~Device ();
+
+ TQ_UINT32 getDeviceType() const;
+ TQString getInterface() const;
+ TQString getUdi() const;
+ TQString getDriver() const;
+ TQ_UINT32 getCapabilities() const;
+ TQ_INT32 getIp4Address() const;
+ NMDeviceState getState() const;
+// FIXME: should return IPv4-objects
+// TQDBusObjectPath getIp4Config() const;
+
+ TQString getVendor() const;
+ TQString getProduct() const;
+ TQString getObjectPath() const;
+
+ signals:
+ void StateChanged(NMDeviceState);
+
+ public slots:
+ void slotStateChanged(TQ_UINT32);
+ void slotDeactivate();
+
+ private:
+ DevicePrivate * d;
+};
+
+#endif /* KNETWORKMANAGER_DEVICE_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-device_tray.cpp b/knetworkmanager-0.8/src/knetworkmanager-device_tray.cpp
new file mode 100644
index 0000000..219508f
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-device_tray.cpp
@@ -0,0 +1,337 @@
+/***************************************************************************
+ *
+ * knetworkmanager-device_tray.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+class WirelessDialog;
+
+// TQt includes
+#include <tqevent.h>
+#include <tqvbox.h>
+#include <tqlayout.h>
+#include <tqpushbutton.h>
+#include <tqbitmap.h>
+#include <tqimage.h>
+#include <tqpixmap.h>
+#include <tqpixmapcache.h>
+#include <tqpainter.h>
+#include <tqstyle.h>
+#include <tqtimer.h>
+
+// KDE includes
+#include <dcopclient.h>
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <knotifyclient.h>
+#include <knotifydialog.h>
+#include <kiconeffect.h>
+#include <klocale.h>
+#include <kstdguiitem.h>
+#include <khelpmenu.h>
+#include <kprocess.h>
+#include <kiconloader.h>
+#include <kconfig.h>
+#include <kmessagebox.h>
+#include <kglobalsettings.h>
+
+// KNM includes
+#include "knetworkmanager-device_tray.h"
+#include "knetworkmanager-device.h"
+#include "knetworkmanager-menu_subhead.h"
+#include "knetworkmanager-connection_settings_dialog.h"
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-nm_proxy.h"
+#include "knetworkmanager-connection.h"
+
+using namespace ConnectionSettings;
+
+class DeviceTrayPrivate
+{
+ public:
+
+ DeviceTrayPrivate()
+ : dev(NULL)
+ {
+ tooltips[NM_DEVICE_STATE_UNKNOWN] = i18n("Unknown");
+ tooltips[NM_DEVICE_STATE_UNAVAILABLE] = i18n("Down");
+ tooltips[NM_DEVICE_STATE_UNMANAGED] = i18n("Unmanaged");
+ tooltips[NM_DEVICE_STATE_DISCONNECTED] = i18n("Disconnected");
+ tooltips[NM_DEVICE_STATE_PREPARE] = i18n("Preparing");
+ tooltips[NM_DEVICE_STATE_CONFIG] = i18n("Configuration");
+ tooltips[NM_DEVICE_STATE_NEED_AUTH] = i18n("Awaiting authentication");
+ tooltips[NM_DEVICE_STATE_IP_CONFIG] = i18n("IP configuration");
+ tooltips[NM_DEVICE_STATE_ACTIVATED] = i18n("Activated");
+ tooltips[NM_DEVICE_STATE_FAILED] = i18n("Failed");
+ }
+
+ ~DeviceTrayPrivate() {}
+
+ Device* dev;
+ TQMap<NMDeviceState, TQMovie> movies;
+ TQMap<NMDeviceState, TQPixmap> pixmaps;
+ TQMap<NMDeviceState, TQString> tooltips;
+};
+
+Device* DeviceTray::getDevice() const
+{
+ return d->dev;
+}
+
+TQString DeviceTray::getTooltipText()
+{
+ NMDeviceState state = d->dev->getState();
+ TQString tooltip = TQString();
+
+ if (!d->tooltips[state].isEmpty())
+ tooltip += i18n("State: %1").tqarg(d->tooltips[state]);
+
+ return tooltip;
+}
+
+void DeviceTray::enterEvent (TQEvent* /*e*/)
+{
+ // show tooltip
+ TQToolTip::remove (this);
+ TQString tooltip = getTooltipText();
+
+ if (!tooltip.isEmpty())
+ TQToolTip::add (this, tooltip);
+}
+
+
+void DeviceTray::setPixmap(const TQPixmap& pixmap)
+{
+ /*
+ int oldPixmapWidth = pixmap.size().width();
+ int oldPixmapHeight = pixmap.size().height();
+
+ // we want to show the interface name
+ TQString iface = d->dev->getInterface();
+
+ // grab a font
+ TQFont iface_font = KGlobalSettings::generalFont();
+// iface_font.setBold(true);
+
+ // resize the font to fit the icon's size
+ float fontSize = iface_font.pointSizeFloat();
+ TQFontMetrics qfm(iface_font);
+ int height = qfm.height();
+ int width = qfm.width(iface);
+ float factor = 1.0f;
+ float factor2 = 1.0f;
+
+ if (height > (oldPixmapHeight / 2.0f))
+ factor = float(oldPixmapHeight / 2.0f) / float(height);
+
+ if (width > (oldPixmapWidth / 1.1f))
+ factor2 = float(oldPixmapWidth / 1.1f) / float(width);
+
+ fontSize *= (factor2 < factor) ? factor2 : factor;
+
+ iface_font.setPointSizeFloat( fontSize);
+
+ // draw the text to a bitmap and put is as an overlay on top of the pixmap
+ TQPixmap iface_pixmap(oldPixmapWidth, oldPixmapHeight);
+ iface_pixmap.fill(TQt::white);
+ TQPainter p(&iface_pixmap);
+ p.setFont(iface_font);
+ p.setPen(TQt::blue);
+ p.drawText(iface_pixmap.rect(), TQt::AlignHCenter | TQt::AlignBottom, iface);
+ iface_pixmap.setMask(iface_pixmap.createHeuristicMask());
+ TQImage iface_image = iface_pixmap.convertToImage();
+
+ TQImage pixmap_with_overlay = pixmap.convertToImage();
+ KIconEffect::overlay(pixmap_with_overlay, iface_image);
+
+ TQPixmap new_pixmap;
+ new_pixmap.convertFromImage(pixmap_with_overlay);
+ // call base-class setPixmap
+ KSystemTray::setPixmap(new_pixmap);
+*/
+ KSystemTray::setPixmap(pixmap);
+}
+
+void DeviceTray::contextMenuAboutToShow (KPopupMenu* menu)
+{
+ menu->clear();
+
+ // insert title
+ menu->insertTitle (SmallIcon ("knetworkmanager", TQIconSet::Automatic), "KNetworkManager", -1, -1);
+
+ // let the specific device_tray add its items
+ addMenuItems(menu);
+
+ // quit
+ menu->insertSeparator ();
+ KAction* quitAction = actionCollection ()->action (KStdAction::name (KStdAction::Quit));
+ if (quitAction)
+ quitAction->plug (menu);
+}
+
+void DeviceTray::resizeEvent ( TQResizeEvent * )
+{
+ // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
+ loadIcons();
+ updateTrayIcon(m_currentIconState);
+}
+
+void DeviceTray::setPixmapForState(NMDeviceState state, TQMovie movie)
+{
+ d->movies[state] = movie;
+ slotUpdateDeviceState();
+}
+
+void DeviceTray::setPixmapForState(NMDeviceState state, TQPixmap pixmap)
+{
+ d->pixmaps[state] = pixmap;
+ slotUpdateDeviceState();
+}
+
+void DeviceTray::updateTrayIcon(NMDeviceState state)
+{
+ // stop the old movie to avoid unnecessary wakups
+ if (movie())
+ movie()->pause();
+
+ if (d->movies.find(state) != d->movies.end() && !d->movies[state].isNull())
+ {
+ if (m_currentIconState != state) {
+ // Clear the icon pixmap as the movie may be a different size
+ TQPixmap nullPixmap;
+ setPixmap(nullPixmap);
+ }
+
+ // animation desired
+ int frame = -1;
+ if (movie())
+ frame = movie()->frameNumber();
+
+ // set the movie
+ setMovie(d->movies[state]);
+
+ // start at the same frame as the movie before
+ if (frame > 0)
+ movie()->step(frame);
+
+ // start the animation
+ movie()->unpause();
+ }
+ else if (d->pixmaps.find(state) != d->pixmaps.end() && !d->pixmaps[state].isNull())
+ setPixmap(d->pixmaps[state]);
+ else
+ setPixmap(loadSizedIcon("KNetworkManager", width()));
+
+ m_currentIconState = state;
+}
+
+void DeviceTray::updateActions(NMDeviceState state)
+{
+ // allow device deactivation only when device is activated
+ KAction* deactivate = actionCollection()->action("deactivate_device");
+ if (deactivate)
+ deactivate->setEnabled( (state == NM_DEVICE_STATE_ACTIVATED ||
+ state == NM_DEVICE_STATE_IP_CONFIG ||
+ state == NM_DEVICE_STATE_PREPARE ||
+ state == NM_DEVICE_STATE_CONFIG ||
+ state == NM_DEVICE_STATE_NEED_AUTH) );
+}
+
+void DeviceTray::updateActiveConnection(NMDeviceState state)
+{
+ if (state != NM_DEVICE_STATE_ACTIVATED)
+ return;
+
+ NMProxy* nm = NMProxy::getInstance();
+ Connection* active_conn = nm->getActiveConnection(d->dev);
+ if (active_conn)
+ {
+ Info* info = dynamic_cast<Info*>(active_conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME));
+ if (info)
+ info->setTimestamp(TQDateTime::tqcurrentDateTime());
+ }
+}
+
+void DeviceTray::slotUpdateDeviceState(NMDeviceState state)
+{
+ updateTrayIcon(state);
+ updateActions(state);
+ updateActiveConnection(state);
+}
+
+void DeviceTray::slotUpdateDeviceState()
+{
+ slotUpdateDeviceState(d->dev->getState());
+}
+
+void DeviceTray::loadIcons() {
+ d->pixmaps[NM_DEVICE_STATE_UNKNOWN] = loadSizedIcon("nm_no_connection", width());
+ d->pixmaps[NM_DEVICE_STATE_UNMANAGED] = loadSizedIcon("nm_no_connection", width());
+ d->pixmaps[NM_DEVICE_STATE_UNAVAILABLE] = loadSizedIcon("nm_no_connection", width());
+ d->pixmaps[NM_DEVICE_STATE_DISCONNECTED] = loadSizedIcon("nm_no_connection", width());
+
+ d->movies[NM_DEVICE_STATE_PREPARE] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage01_connecting", KIcon::Panel));
+ d->movies[NM_DEVICE_STATE_PREPARE].pause();
+
+ d->movies[NM_DEVICE_STATE_CONFIG] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage02_connecting", KIcon::Panel));
+ d->movies[NM_DEVICE_STATE_CONFIG].pause();
+
+ d->movies[NM_DEVICE_STATE_IP_CONFIG] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage03_connecting", KIcon::Panel));
+ d->movies[NM_DEVICE_STATE_IP_CONFIG].pause();
+
+ d->movies[NM_DEVICE_STATE_NEED_AUTH] = d->movies[NM_DEVICE_STATE_CONFIG];
+ d->movies[NM_DEVICE_STATE_NEED_AUTH].pause();
+
+ d->pixmaps[NM_DEVICE_STATE_ACTIVATED] = loadSizedIcon("ok", width());
+
+ d->pixmaps[NM_DEVICE_STATE_FAILED] = loadSizedIcon("nm_no_connection", width());
+}
+
+DeviceTray::DeviceTray (Device* dev) : KSystemTray ()
+{
+ d = new DeviceTrayPrivate();
+ d->dev = dev;
+
+ m_currentIconState = NM_DEVICE_STATE_UNKNOWN;
+ loadIcons();
+
+ // get notified when the device state changes
+ connect(dev, TQT_SIGNAL(StateChanged(NMDeviceState)), this, TQT_SLOT(slotUpdateDeviceState(NMDeviceState)));
+
+ setMouseTracking (true);
+
+ // defer the initial call to slotUpdateDeviceState as it will crash knm when called directly from here
+ // virtual method calls are not allowed in constructor
+ TQTimer::singleShot(0, this, TQT_SLOT(slotUpdateDeviceState()));
+
+ // Actions used for plugging into the menu
+ new KAction (i18n ("Deactivate connection..."),
+ SmallIcon ("no", TQIconSet::Automatic), 0,
+ dev, TQT_SLOT (slotDeactivate()), actionCollection (), "deactivate_device");
+}
+
+DeviceTray::~DeviceTray ()
+{
+ delete d;
+}
+
+
+#include "knetworkmanager-device_tray.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-device_tray.h b/knetworkmanager-0.8/src/knetworkmanager-device_tray.h
new file mode 100644
index 0000000..c172b7b
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-device_tray.h
@@ -0,0 +1,90 @@
+/***************************************************************************
+ *
+ * knetworkmanager-device_tray.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_DEVICE_TRAY_H
+#define KNETWORKMANAGER_DEVICE_TRAY_H
+
+#include <tqmap.h>
+#include <tqtimer.h>
+
+#include <tqtooltip.h>
+#include <ksystemtray.h>
+#include <kuniqueapplication.h>
+#include <kpopupmenu.h>
+#include <kactionclasses.h>
+#include <kstdaction.h>
+#include <kstdguiitem.h>
+
+#include <tqlayout.h>
+#include <tqlabel.h>
+#include <tqcheckbox.h>
+#include <tqprogressbar.h>
+#include <tqguardedptr.h>
+
+#include <NetworkManager.h>
+#include "knetworkmanager.h"
+
+#define NM_DEVICE_STATE_VPN_PREPARE 100
+#define NM_DEVICE_STATE_VPN_ACTIVATED 101
+
+class Device;
+class DeviceTrayPrivate;
+
+class DeviceTray : public KSystemTray
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+ DeviceTray (Device*);
+ ~DeviceTray ();
+
+ void contextMenuAboutToShow (KPopupMenu* menu);
+ virtual void addMenuItems(KPopupMenu* menu) = 0;
+ Device* getDevice() const;
+
+ protected:
+ void setPixmapForState(NMDeviceState, TQMovie);
+ void setPixmapForState(NMDeviceState, TQPixmap);
+ void resizeEvent ( TQResizeEvent * );
+
+ virtual TQString getTooltipText();
+
+ public slots:
+ void setPixmap(const TQPixmap &);
+ void slotUpdateDeviceState(NMDeviceState);
+ void slotUpdateDeviceState();
+
+ private:
+ void updateTrayIcon(NMDeviceState);
+ void updateActions(NMDeviceState);
+ void updateActiveConnection(NMDeviceState);
+ void enterEvent (TQEvent*);
+ void loadIcons();
+
+ DeviceTrayPrivate* d;
+ NMDeviceState m_currentIconState;
+};
+
+#endif /* KNETWORKMANAGER_DEVICE_TRAY_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-devicestore.cpp b/knetworkmanager-0.8/src/knetworkmanager-devicestore.cpp
new file mode 100644
index 0000000..6f217c1
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-devicestore.cpp
@@ -0,0 +1,220 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include <NetworkManager.h>
+
+#include "knetworkmanager.h"
+#include "knetworkmanager-devicestore.h"
+#include "knetworkmanager-wired_device.h"
+#include "knetworkmanager-wireless_device.h"
+#include "knetworkmanager-gsm_device.h"
+#include "knetworkmanager-cdma_device.h"
+#include "knetworkmanager-device.h"
+#include "knetworkmanager-nm_proxy.h"
+#include "dbus/deviceproxy.h"
+
+#include <tqdbuserror.h>
+#include <tqdbusobjectpath.h>
+#include <tqdbusconnection.h>
+
+#include <kdebug.h>
+
+#if !defined(NM_CHECK_VERSION)
+#define NM_CHECK_VERSION(x,y,z) 0
+#endif
+
+class DeviceStorePrivate
+{
+ public:
+ DeviceStorePrivate() {}
+ ~DeviceStorePrivate() {}
+
+ TQMap<TQString, Device*> devices;
+ static DeviceStore* store;
+};
+
+DeviceStore* DeviceStorePrivate::store = NULL;
+
+DeviceStore* DeviceStore::getInstance()
+{
+ if (DeviceStorePrivate::store)
+ return DeviceStorePrivate::store;
+ return (DeviceStorePrivate::store = new DeviceStore());
+}
+
+void DeviceStore::slotDeviceRemoved(const TQT_DBusObjectPath & obj_path)
+{
+ kdDebug() << "DeviceStore::slotDeviceRemoved" << endl;
+ TQMap<TQString, Device*>::Iterator it = d->devices.find(TQString(obj_path));
+ if (it != d->devices.end())
+ {
+ // remove this device
+ Device* dev = it.data();
+
+ emit DeviceRemoved(dev);
+
+ d->devices.remove(it);
+ delete dev;
+ dev = NULL;
+ }
+}
+
+void DeviceStore::slotDeviceAdded(const TQT_DBusObjectPath & obj_path)
+{
+ // just start an update
+ Device* dev = createDevice(obj_path);
+ if (dev)
+ emit DeviceAdded(dev);
+}
+
+Device* DeviceStore::createDevice(const TQT_DBusObjectPath &obj_path)
+{
+ TQT_DBusError err;
+ // if we have this device already in our list goto the next one
+ TQMap<TQString, Device*>::Iterator it = d->devices.find(obj_path);
+ if ( it != d->devices.end())
+ return it.data();
+
+ // FIXME: ugly stuff is going on here, better pass the DeviceProxy to the Device's constructor instead of the object_path
+ DBus::DeviceProxy* dev = new DBus::DeviceProxy(NM_DBUS_SERVICE, obj_path);
+ Device* new_dev = NULL;
+
+ if (dev)
+ {
+ dev->setConnection(TQT_DBusConnection::systemBus());
+ TQ_UINT32 type = dev->getDeviceType(err);
+
+ //printf("Device obj_path: %s\n\r", obj_path->data());
+
+ // FIXME: This should not be hardcoded, it would be better if wireless, wired etc. modules register their device type
+ // select the right device type and create the appropriate objects
+ switch(type)
+ {
+#if NM_CHECK_VERSION(0,8,992)
+ case NM_DEVICE_TYPE_WIFI:
+#else
+ case DEVICE_TYPE_802_11_WIRELESS:
+#endif
+ new_dev = new WirelessDevice(obj_path);
+ break;
+#if NM_CHECK_VERSION(0,8,992)
+ case NM_DEVICE_TYPE_ETHERNET:
+#else
+ case DEVICE_TYPE_802_3_ETHERNET:
+#endif
+ new_dev = new WiredDevice(obj_path);
+ break;
+#if NM_CHECK_VERSION(0,8,992)
+ case NM_DEVICE_TYPE_MODEM:
+#else
+ case DEVICE_TYPE_GSM:
+#endif
+ new_dev = new GSMDevice(obj_path);
+ break;
+#if NM_CHECK_VERSION(0,8,992)
+#else
+ case DEVICE_TYPE_CDMA:
+#endif
+ new_dev = new CDMADevice(obj_path);
+ break;
+ default:
+ kdWarning() << k_funcinfo << "Unknown devicetype" << endl;
+ new_dev = new Device(obj_path);
+ break;
+ }
+
+ // insert the new device into our list
+ if (new_dev)
+ d->devices.insert(obj_path, new_dev);
+
+ delete dev;
+ }
+ else
+ kdWarning() << k_funcinfo << "Dev is Null" << endl;
+
+ return new_dev;
+}
+
+void DeviceStore::updateDevices()
+{
+ NMProxy* nm = NMProxy::getInstance();
+ TQValueList<TQT_DBusObjectPath> obj_paths;
+ TQT_DBusError err;
+
+ // get a list of NM devices
+ nm->GetDevices(obj_paths, err);
+
+ // create a list of KNM devices
+ for (TQValueList<TQT_DBusObjectPath>::Iterator it = obj_paths.begin(); it != obj_paths.end(); ++it)
+ {
+ createDevice((*it));
+ }
+}
+
+TQValueList<Device*> DeviceStore::getDevices(TQ_UINT32 type)
+{
+ updateDevices();
+
+ if (type == 0)
+ return d->devices.values();
+ else
+ {
+ // only return devices of a special type
+ TQValueList<Device*> devs;
+ for (TQMap<TQString, Device*>::Iterator it = d->devices.begin(); it != d->devices.end(); ++it)
+ {
+ if (it.data()->getDeviceType() == type)
+ devs.append(it.data());
+ }
+ return devs;
+ }
+}
+
+Device* DeviceStore::getDevice(TQT_DBusObjectPath objpath)
+{
+ return d->devices[objpath];
+}
+
+DeviceStore::DeviceStore ( TQObject * parent, const char * name ) : TQObject( parent, name )
+{
+ d = new DeviceStorePrivate();
+
+ // get notified from NM when devices are added or removed
+ NMProxy* nm = NMProxy::getInstance();
+ connect(nm, TQT_SIGNAL(DeviceAdded(const TQT_DBusObjectPath& )), this, TQT_SLOT(slotDeviceAdded(const TQT_DBusObjectPath&)));
+ connect(nm, TQT_SIGNAL(DeviceRemoved(const TQT_DBusObjectPath& )), this, TQT_SLOT(slotDeviceRemoved(const TQT_DBusObjectPath&)));
+}
+
+DeviceStore::~DeviceStore ()
+{
+ // delete all devicepointers
+ while (d->devices.begin() != d->devices.end())
+ delete d->devices.begin().data();
+
+ // delete private data
+ delete d;
+}
+
+
+#include "knetworkmanager-devicestore.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-devicestore.h b/knetworkmanager-0.8/src/knetworkmanager-devicestore.h
new file mode 100644
index 0000000..2c03c84
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-devicestore.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+ *
+ * knetworkmanager-devicestore.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_DEVICESTORE_H
+#define KNETWORKMANAGER_DEVICESTORE_H
+
+#include "knetworkmanager.h"
+
+class TQT_DBusObjectPath;
+class DeviceStorePrivate;
+class Device;
+
+class DeviceStore : public TQObject
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+ static DeviceStore* getInstance();
+ TQValueList<Device*> getDevices(TQ_UINT32 type = 0);
+ Device* getDevice(TQT_DBusObjectPath);
+
+ public slots:
+ void slotDeviceAdded(const TQT_DBusObjectPath&);
+ void slotDeviceRemoved(const TQT_DBusObjectPath&);
+
+ protected:
+ DeviceStore ( TQObject * parent = 0, const char * name = 0);
+ ~DeviceStore ();
+
+ signals:
+ void DeviceStoreChanged();
+ void DeviceAdded(Device*);
+ void DeviceRemoved(Device*);
+
+ private:
+ void updateDevices();
+ Device* createDevice(const TQT_DBusObjectPath&);
+
+ DeviceStorePrivate* d;
+};
+
+#endif /* KNETWORKMANAGER_DEVICESTORE_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-generic_connection.cpp b/knetworkmanager-0.8/src/knetworkmanager-generic_connection.cpp
new file mode 100644
index 0000000..9f9b12d
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-generic_connection.cpp
@@ -0,0 +1,91 @@
+/***************************************************************************
+ *
+ * knetworkmanager-generic_connection.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqhostaddress.h>
+#include <tqvariant.h>
+#include <tqvaluelist.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQDbus headers */
+#include <tqdbusconnection.h>
+#include <tqdbusobjectpath.h>
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+#include <tqdbusvariant.h>
+
+/* NM headers */
+#include <NetworkManager.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-generic_connection.h"
+#include "knetworkmanager-connection_setting.h"
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-nmsettings.h"
+
+using namespace ConnectionSettings;
+
+/*
+ class GenericConnection
+*/
+GenericConnection::GenericConnection(const TQString& type)
+ : Connection()
+{
+ // every connection needs an info-setting
+ appendSetting(new Info(this, type, ""));
+}
+
+TQString
+GenericConnection::getType()
+{
+ Info* info = dynamic_cast<Info*>(getSetting("connection"));
+ if (info)
+ return info->getDevType();
+ else
+ return TQString();
+}
+
+TQString
+GenericConnection::getID() const
+{
+ return getInfoSetting()->getUUID();
+}
+
+void
+GenericConnection::setID(const TQString& id)
+{
+ getInfoSetting()->setUUID(id);
+}
+
+Info* GenericConnection::getInfoSetting() const
+{
+ return dynamic_cast<Info*>(getSetting("connection"));
+}
+
+#include "knetworkmanager-generic_connection.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-generic_connection.h b/knetworkmanager-0.8/src/knetworkmanager-generic_connection.h
new file mode 100644
index 0000000..7eb7d62
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-generic_connection.h
@@ -0,0 +1,58 @@
+/***************************************************************************
+ *
+ * knetworkmanager-generic_connection.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_GENERIC_CONNECTION_H
+#define KNETWORKMANAGER_GENERIC_CONNECTION_H
+
+#include <tqmap.h>
+#include <tqobject.h>
+
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_setting.h"
+#include "dbus/connection.h"
+#include "dbus/connectionnode.h"
+
+class TQDBusObjectPath;
+
+namespace ConnectionSettings
+{
+
+ class ConnectionSetting;
+ class Info;
+
+ class GenericConnection : public Connection
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ GenericConnection(const TQString&);
+ TQString getType();
+
+ TQString getID() const;
+ void setID(const TQString& id);
+
+ Info* getInfoSetting() const;
+ };
+}
+#endif /* KNETWORKMANAGER_GENERIC_CONNECTION_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-gsm_connection.cpp b/knetworkmanager-0.8/src/knetworkmanager-gsm_connection.cpp
new file mode 100644
index 0000000..307f40f
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-gsm_connection.cpp
@@ -0,0 +1,60 @@
+/***************************************************************************
+ *
+ * knetworkmanager-gsm_connection.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Author: Will Stephenson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include "knetworkmanager-gsm_connection.h"
+
+#include <nm-setting-gsm.h>
+#include "knetworkmanager-connection_setting_serial.h"
+
+ConnectionSettings::GSMConnection::GSMConnection()
+ : PPPConnection(NM_SETTING_GSM_SETTING_NAME)
+{
+ appendSetting(new GSM(this));
+ appendSetting(new Serial(this));
+}
+
+ConnectionSettings::GSMConnection::~GSMConnection()
+{
+
+}
+
+ConnectionSettings::GSM* ConnectionSettings::GSMConnection::getGSMSetting() const
+{
+ return dynamic_cast<GSM*>(getSetting(NM_SETTING_GSM_SETTING_NAME));
+}
+
+ConnectionSettings::Serial* ConnectionSettings::GSMConnection::getSerialSetting() const
+{
+ return dynamic_cast<Serial*>(getSetting(NM_SETTING_SERIAL_SETTING_NAME));
+}
+
+ConnectionSettings::Connection* ConnectionSettings::GSMConnection::duplicate()
+{
+ GSMConnection* conn = new GSMConnection();
+ conn->updateSettings(this);
+ return conn;
+}
+#include "knetworkmanager-gsm_connection.moc"
+
+// vim: sw=4 sts=4 noet tw=100
diff --git a/knetworkmanager-0.8/src/knetworkmanager-gsm_connection.h b/knetworkmanager-0.8/src/knetworkmanager-gsm_connection.h
new file mode 100644
index 0000000..004840f
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-gsm_connection.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ *
+ * knetworkmanager-gsm_connection.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Author: Will Stephenson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_GSM_CONNECTION_H
+#define KNETWORKMANAGER_GSM_CONNECTION_H
+
+#include "knetworkmanager-ppp_connection.h"
+#include "knetworkmanager-connection_setting_gsm.h"
+
+namespace ConnectionSettings
+{
+ class GSM;
+ class Serial;
+
+ class GSMConnection : public PPPConnection
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ GSMConnection();
+ ~GSMConnection();
+ GSM* getGSMSetting() const;
+ Serial* getSerialSetting() const;
+ Connection* duplicate();
+ };
+}; // namespace ConnectionSettings
+
+#endif
+
diff --git a/knetworkmanager-0.8/src/knetworkmanager-gsm_device.cpp b/knetworkmanager-0.8/src/knetworkmanager-gsm_device.cpp
new file mode 100644
index 0000000..e978b49
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-gsm_device.cpp
@@ -0,0 +1,67 @@
+/***************************************************************************
+ *
+ * knetworkmanager-gsm_device.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// KDE includes
+#include <kdebug.h>
+
+// TQt includes
+#include <tqhostaddress.h>
+
+// TQT_DBus includes
+#include <tqdbuserror.h>
+#include <tqdbusconnection.h>
+
+// NM includes
+#include <NetworkManager.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "knetworkmanager-gsm_device.h"
+#include "dbus/gsmproxy.h"
+
+class GSMDevicePrivate
+{
+public:
+ GSMDevicePrivate(TQString service, TQString obj_path)
+ : nmGSM(service, obj_path)
+ {}
+ ~GSMDevicePrivate() {}
+
+ DBus::GSMDeviceProxy nmGSM;
+};
+
+GSMDevice::GSMDevice (const TQString & obj_path)
+ : CellularDevice(obj_path)
+{
+ d = new GSMDevicePrivate(NM_DBUS_SERVICE, obj_path);
+ d->nmGSM.setConnection(TQT_DBusConnection::systemBus());
+}
+
+GSMDevice::~GSMDevice ()
+{
+ delete d;
+}
+
+
+#include "knetworkmanager-gsm_device.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-gsm_device.h b/knetworkmanager-0.8/src/knetworkmanager-gsm_device.h
new file mode 100644
index 0000000..3d14288
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-gsm_device.h
@@ -0,0 +1,51 @@
+/***************************************************************************
+ *
+ * knetworkmanager-gsm_device.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_GSMDEVICE_H
+#define KNETWORKMANAGER_GSMDEVICE_H
+
+// std includes
+#include <stdint.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "knetworkmanager-cellular_device.h"
+
+class KNetworkManager;
+
+class GSMDevicePrivate;
+
+class GSMDevice : public CellularDevice
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ GSMDevice (const TQString & obj_path );
+ ~GSMDevice ();
+
+ private:
+ GSMDevicePrivate * d;
+};
+
+#endif /* KNETWORKMANAGER_GSMDEVICE_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-hal_device_proxy.cpp b/knetworkmanager-0.8/src/knetworkmanager-hal_device_proxy.cpp
new file mode 100644
index 0000000..dda50aa
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-hal_device_proxy.cpp
@@ -0,0 +1,126 @@
+/***************************************************************************
+ *
+ * knetworkmanager-device.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include "knetworkmanager.h"
+#include "knetworkmanager-hal_device_proxy.h"
+
+#include <kdebug.h>
+#include <tqhostaddress.h>
+
+class HalDeviceProxyPrivate
+{
+public:
+ HalDeviceProxyPrivate() {}
+ ~HalDeviceProxyPrivate() {}
+
+ void getHalProperty (const TQCString& udi, const TQCString& property, TQCString& result);
+
+ TQString udi;
+};
+
+HalDeviceProxy::HalDeviceProxy (const TQString & udi)
+{
+ d = new HalDeviceProxyPrivate;
+ d->udi = udi;
+}
+
+HalDeviceProxy::~HalDeviceProxy ()
+{
+ delete d;
+}
+
+bustype
+HalDeviceProxy::getBustype () const
+{
+ TQCString device_udi = d->udi.utf8();
+ TQCString parent_udi = "";
+ TQCString subsystem = "";
+
+ d->getHalProperty (device_udi, "info.parent", parent_udi);
+ d->getHalProperty (parent_udi, "linux.subsystem", subsystem);
+
+ if (TQString::compare (subsystem, "pci") == 0)
+ return BUS_PCI;
+ else if (TQString::compare (subsystem, "usb") == 0)
+ return BUS_USB;
+ else if (TQString::compare (subsystem, "pcmcia") == 0)
+ return BUS_PCMCIA;
+ else
+ return BUS_UNKNOWN;
+}
+
+TQString
+HalDeviceProxy::getProduct () const
+{
+ return "";
+}
+
+TQString
+HalDeviceProxy::getVendor () const
+{
+ return "";
+}
+
+void
+HalDeviceProxyPrivate::getHalProperty (const TQCString& udi, const TQCString& property, TQCString& result)
+{
+//FIXME: convert to qt3-dbus-api
+/*
+ DBusConnection* con = _ctx->getDBus ()->getConnection ();
+ LibHalContext* hal_ctx = NULL;
+ char* prop_val = NULL;
+
+ if (!con || !property) {
+ goto out;
+ }
+
+ if (!dbus_bus_name_has_owner (con, "org.freedesktop.Hal", NULL)) {
+ kdDebug() << "Error: HAL seems not to be running." << endl;
+ goto out;
+ }
+
+ hal_ctx = libhal_ctx_new ();
+
+ if (!libhal_ctx_set_dbus_connection (hal_ctx, con)) {
+ goto out;
+ }
+
+ if (!libhal_ctx_init (hal_ctx, NULL)) {
+ goto out;
+ }
+
+ prop_val = libhal_device_get_property_string (hal_ctx, udi, property, NULL);
+ result = prop_val;
+ libhal_free_string (prop_val);
+out:
+ if (hal_ctx) {
+ libhal_ctx_shutdown (hal_ctx, NULL);
+ libhal_ctx_free (hal_ctx);
+ }
+*/
+ return;
+}
+
+#include "knetworkmanager-hal_device_proxy.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-hal_device_proxy.h b/knetworkmanager-0.8/src/knetworkmanager-hal_device_proxy.h
new file mode 100644
index 0000000..f39e9f8
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-hal_device_proxy.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+ *
+ * knetworkmanager-device.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_HALDEVICEPROXY_H
+#define KNETWORKMANAGER_HALDEVICEPROXY_H
+
+// KNM includes
+#include "knetworkmanager.h"
+
+// HAL includes
+#include <hal/libhal.h>
+
+// std includes
+#include <stdint.h>
+
+class KNetworkManager;
+
+enum bustype {
+ BUS_PCI = 0,
+ BUS_USB = 1,
+ BUS_PCMCIA = 2,
+ BUS_UNKNOWN = 15
+};
+
+class HalDeviceProxyPrivate;
+
+class HalDeviceProxy : public TQObject
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ HalDeviceProxy (const TQString & udi);
+ ~HalDeviceProxy ();
+
+ bustype getBustype (void) const;
+ TQString getProduct (void) const;
+ TQString getVendor (void) const;
+
+ private:
+ HalDeviceProxyPrivate * d;
+};
+
+#endif /* KNETWORKMANAGER_HALDEVICEPROXY_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-menu_subhead.cpp b/knetworkmanager-0.8/src/knetworkmanager-menu_subhead.cpp
new file mode 100644
index 0000000..5a69cd5
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-menu_subhead.cpp
@@ -0,0 +1,76 @@
+/***************************************************************************
+ *
+ * knetworkmanager-tray.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ * Valentine Sinitsyn <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+class WirelessDialog;
+
+#include <tqevent.h>
+#include <tqvbox.h>
+#include <tqlayout.h>
+#include <tqpushbutton.h>
+#include <tqpixmap.h>
+#include <tqpixmapcache.h>
+#include <tqpainter.h>
+#include <tqstyle.h>
+#include <dcopclient.h>
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <knotifyclient.h>
+#include <knotifydialog.h>
+#include <klocale.h>
+#include <kstdguiitem.h>
+#include <khelpmenu.h>
+#include <kprocess.h>
+#include <kiconloader.h>
+#include <kconfig.h>
+#include <kmessagebox.h>
+
+#include "knetworkmanager-menu_subhead.h"
+
+Subhead::Subhead (TQWidget* parent, const char* name, const TQString & caption, const TQPixmap icon)
+ : TQWidget (parent, name)
+{
+ TQBoxLayout* l = new TQHBoxLayout (this);
+ TQLabel* lbl_icon = new TQLabel (NULL, this);
+ TQLabel* lbl_caption = new TQLabel (caption, this);
+ TQSpacerItem* sp_item = new TQSpacerItem (20, 10);
+ TQFont font;
+ font.setBold(true);
+ lbl_caption->setFont(font);
+
+ lbl_icon->setPixmap (icon);
+
+ l->addWidget (lbl_icon);
+ l->addWidget (lbl_caption);
+ l->addItem (sp_item);
+ l->activate ();
+}
+
+Subhead::~Subhead()
+{
+
+}
+
diff --git a/knetworkmanager-0.8/src/knetworkmanager-menu_subhead.h b/knetworkmanager-0.8/src/knetworkmanager-menu_subhead.h
new file mode 100644
index 0000000..8891fc4
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-menu_subhead.h
@@ -0,0 +1,56 @@
+/***************************************************************************
+ *
+ * knetworkmanager.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_MENU_SUBHEAD_H
+#define KNETWORKMANAGER_MENU_SUBHEAD_H
+
+#include <tqmap.h>
+#include <tqtimer.h>
+
+#include <tqtooltip.h>
+#include <ksystemtray.h>
+#include <kuniqueapplication.h>
+#include <kpopupmenu.h>
+#include <kactionclasses.h>
+#include <kstdaction.h>
+#include <kstdguiitem.h>
+
+#include <tqlayout.h>
+#include <tqlabel.h>
+#include <tqcheckbox.h>
+#include <tqprogressbar.h>
+#include <tqguardedptr.h>
+
+#include "knetworkmanager.h"
+
+class Subhead : public TQWidget
+{
+ public:
+ Subhead (TQWidget*, const char *, const TQString &, const TQPixmap);
+ ~Subhead ();
+};
+
+#endif /* KNETWORKMANAGER_MENU_SUBHEAD_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-menuitem.cpp b/knetworkmanager-0.8/src/knetworkmanager-menuitem.cpp
new file mode 100644
index 0000000..b13563e
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-menuitem.cpp
@@ -0,0 +1,140 @@
+/***************************************************************************
+ *
+ * knetworkmanager-menuitem.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006, 2008 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ * Valentine Sinitsyn <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include "knetworkmanager-menuitem.h"
+
+#include <tqevent.h>
+#include <tqguardedptr.h>
+#include <tqvbox.h>
+#include <tqlayout.h>
+#include <tqpushbutton.h>
+#include <tqpixmap.h>
+#include <tqpixmapcache.h>
+#include <tqpainter.h>
+#include <tqstyle.h>
+#include <dcopclient.h>
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <knotifyclient.h>
+#include <knotifydialog.h>
+#include <klocale.h>
+#include <kstdguiitem.h>
+#include <khelpmenu.h>
+#include <kprocess.h>
+#include <kiconloader.h>
+#include <kconfig.h>
+#include <kmessagebox.h>
+
+#include <tqdbusobjectpath.h>
+#include <tqdbuserror.h>
+
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-device.h"
+#include "knetworkmanager-nm_proxy.h"
+#include "knetworkmanager-vpn_plugin.h"
+
+#if !defined(NM_CHECK_VERSION)
+#define NM_CHECK_VERSION(x,y,z) 0
+#endif
+
+TQString currentVPNDevice;
+TQT_DBusObjectPath vpn_attempt_this_conn;
+
+using namespace ConnectionSettings;
+
+class NetworkMenuItemPrivate
+{
+ public:
+ NetworkMenuItemPrivate(Device* device, Connection* connection)
+ : dev(device), conn(connection)
+ {
+
+ }
+ ~NetworkMenuItemPrivate() {}
+
+ TQGuardedPtr<Device> dev;
+ TQGuardedPtr<Connection> conn;
+};
+
+void NetworkMenuItem::slotActivate()
+{
+ int id;
+ TQT_DBusError err;
+ kdDebug() << "NetworkMenuItem::slotActivate()" << endl;
+ NMProxy* nm = NMProxy::getInstance();
+
+ if (d->dev && d->conn)
+ {
+ NMProxy* nm = NMProxy::getInstance();
+ if (nm)
+ {
+ kdDebug() << "Activate Connection " << d->conn->getObjectPath().data() << " on Device " << d->dev->getObjectPath().ascii() << endl;
+ printf("Activate Connection %s on Device %s\n\r", d->conn->getObjectPath().data(), d->dev->getObjectPath().ascii());
+
+#if NM_CHECK_VERSION(0,8,992)
+ if (nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", d->conn->getObjectPath(), TQT_DBusObjectPath(QCString(d->dev->getObjectPath())), d->conn->getObjectPath(), err))
+#else
+ if (nm->ActivateConnectionAsync(id, NM_DBUS_SERVICE_USER_SETTINGS, d->conn->getObjectPath(), TQT_DBusObjectPath(TQCString(d->dev->getObjectPath())), d->conn->getObjectPath(), err))
+#endif
+ {
+
+ }
+ else
+ kdDebug() << "ActivateDevice failed" << endl;
+ }
+ }
+ else if (d->conn)
+ {
+ // no device given, just take the default device
+ printf("Activate Connection %s on default device\n\r", d->conn->getObjectPath().data());
+ TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection();
+ TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn);
+ vpn_attempt_this_conn = d->conn->getObjectPath();
+#if NM_CHECK_VERSION(0,8,992)
+ nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", d->conn->getObjectPath(), device, act_conn, err);
+#else
+ nm->ActivateConnectionAsync(id,NM_DBUS_SERVICE_USER_SETTINGS, d->conn->getObjectPath(), device, act_conn, err);
+#endif
+ }
+ else
+ kdDebug() << "Device or Connection invalid" << endl;
+}
+
+NetworkMenuItem::NetworkMenuItem (Device* dev, Connection* conn, TQObject* parent, const char* name)
+ : TQObject(parent, name)
+{
+ d = new NetworkMenuItemPrivate(dev, conn);
+}
+
+NetworkMenuItem::~NetworkMenuItem ()
+{
+ delete d;
+}
+
+
+
+#include "knetworkmanager-menuitem.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-menuitem.h b/knetworkmanager-0.8/src/knetworkmanager-menuitem.h
new file mode 100644
index 0000000..6f875d0
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-menuitem.h
@@ -0,0 +1,54 @@
+/***************************************************************************
+ *
+ * knetworkmanager-menuitem.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006, 2008 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_MENUITEM_H
+#define KNETWORKMANAGER_MENUITEM_H
+
+#include <tqobject.h>
+
+class Device;
+class NetworkMenuItemPrivate;
+
+namespace ConnectionSettings
+{
+ class Connection;
+}
+
+class NetworkMenuItem : public TQObject
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ NetworkMenuItem (Device* dev, ConnectionSettings::Connection* conn, TQObject* parent = 0, const char* name = 0);
+ ~NetworkMenuItem ();
+
+ public slots:
+ void slotActivate();
+
+ private:
+ NetworkMenuItemPrivate* d;
+};
+
+#endif /* KNETWORKMANAGER_MENUITEM_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-nm_proxy.cpp b/knetworkmanager-0.8/src/knetworkmanager-nm_proxy.cpp
new file mode 100644
index 0000000..3cfe642
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-nm_proxy.cpp
@@ -0,0 +1,329 @@
+/***************************************************************************
+ *
+ * knetworkmanager-device.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// KDE includes
+#include <kdebug.h>
+
+// TQtDBus includes
+#include <tqdbusconnection.h>
+#include <tqdbusproxy.h>
+#include <tqdbusdata.h>
+#include <tqdbusdatalist.h>
+#include <tqdbuserror.h>
+#include <tqdbusobjectpath.h>
+
+// NM includes
+#include <NetworkManager.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "knetworkmanager-nm_proxy.h"
+#include "knetworkmanager-device.h"
+#include "knetworkmanager-devicestore.h"
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_store.h"
+#include "dbus/activeconnectionproxy.h"
+
+class NMProxyPrivate
+{
+ public:
+ NMProxyPrivate()
+ {}
+
+ static NMProxy* nm;
+};
+
+NMProxy* NMProxyPrivate::nm = NULL;
+
+Device* NMProxy::getDefaultDevice()
+{
+ TQT_DBusObjectPath connpath = getDefaultActiveConnection();
+ if (!connpath.isEmpty())
+ {
+ TQT_DBusObjectPath devpath = getDeviceForActiveConnection(connpath);
+ if (!devpath.isEmpty())
+ return DeviceStore::getInstance()->getDevice(devpath);
+ }
+ return NULL;
+}
+
+TQT_DBusObjectPath NMProxy::getDeviceForActiveConnection(TQT_DBusObjectPath act_conn_path)
+{
+ TQT_DBusError err;
+
+ // we need a proxy for every active connection
+ DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, act_conn_path);
+ act_conn->setConnection(TQT_DBusConnection::systemBus());
+
+ if (act_conn)
+ {
+ // get details about the active connection
+ TQValueList<TQT_DBusObjectPath> devs = act_conn->getDevices(err);
+ if (!devs.isEmpty())
+ return devs.first();
+ delete act_conn;
+ }
+
+ return TQT_DBusObjectPath();
+
+}
+
+TQT_DBusObjectPath NMProxy::getDefaultActiveConnection()
+{
+ TQT_DBusError err;
+ TQValueList<TQT_DBusObjectPath> connections;
+
+ // get a list of all active connections from NM
+ connections = NetworkManagerProxy::getActiveConnections(err);
+
+ for (TQValueList<TQT_DBusObjectPath>::Iterator it = connections.begin(); it != connections.end(); ++it)
+ {
+ // we need a proxy for every active connection
+ DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, (*it));
+ act_conn->setConnection(TQT_DBusConnection::systemBus());
+
+ if (act_conn)
+ {
+ if (act_conn->getDefault(err))
+ {
+ delete act_conn;
+ return *it;
+ }
+ delete act_conn;
+ }
+
+ }
+
+ return TQT_DBusObjectPath();
+
+}
+
+ConnectionSettings::Connection* NMProxy::getActiveConnection(const Device* dev)
+{
+ TQT_DBusError err;
+ TQValueList<TQT_DBusObjectPath> connections;
+
+ // get a list of all active connections from NM
+ connections = NetworkManagerProxy::getActiveConnections(err);
+
+ for (TQValueList<TQT_DBusObjectPath>::Iterator it = connections.begin(); it != connections.end(); ++it)
+ {
+ // we need a proxy for every active connection
+ DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, (*it));
+ act_conn->setConnection(TQT_DBusConnection::systemBus());
+
+ if (act_conn)
+ {
+ // get details about the active connection
+ TQString service = act_conn->getServiceName(err);
+ TQT_DBusObjectPath conn = act_conn->getConnection(err);
+ TQT_DBusObjectPath specific_obj = act_conn->getSpecificObject(err);
+ TQValueList<TQT_DBusObjectPath> devs = act_conn->getDevices(err);
+ for (TQValueList<TQT_DBusObjectPath>::Iterator it2 = devs.begin(); it2 != devs.end(); ++it2)
+ {
+ if (TQString(*it2) == dev->getObjectPath())
+ {
+ // here is the connection we were looking for
+ ConnectionStore* cstore = ConnectionStore::getInstance();
+ if (cstore)
+ return cstore->getConnection(TQString(conn));
+ }
+ }
+ delete act_conn;
+ }
+
+ }
+
+ return NULL;
+}
+
+TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > NMProxy::getActiveConnectionsMap()
+{
+ TQT_DBusError err;
+ TQValueList<TQT_DBusObjectPath> connections;
+ TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > map;
+ ConnectionStore* cstore = ConnectionStore::getInstance();
+ DeviceStore* dstore = DeviceStore::getInstance();
+ bool found = false;
+
+ if (!dstore || !cstore)
+ return map;
+
+ // get a list of all active connections from NM
+ connections = NetworkManagerProxy::getActiveConnections(err);
+
+ for (TQValueList<TQT_DBusObjectPath>::Iterator it = connections.begin(); it != connections.end(); ++it)
+ {
+ // we need a proxy for every active connection
+ DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, (*it));
+ act_conn->setConnection(TQT_DBusConnection::systemBus());
+
+ if (act_conn)
+ {
+ // get details about the active connection
+ TQString service = act_conn->getServiceName(err);
+ TQT_DBusObjectPath conn = act_conn->getConnection(err);
+ TQT_DBusObjectPath specific_obj = act_conn->getSpecificObject(err);
+ TQValueList<TQT_DBusObjectPath> devs = act_conn->getDevices(err);
+ found = false;
+ for (TQValueList<TQT_DBusObjectPath>::Iterator it2 = devs.begin(); it2 != devs.end(); ++it2)
+ {
+ Device* device = dstore->getDevice(*it2);
+ ConnectionSettings::Connection* connection = cstore->getConnection(TQString(conn));
+ if (connection)
+ {
+ map.append(TQPair<ConnectionSettings::Connection*, Device*>(connection, device));
+ found = true;
+ }
+ }
+ if (!found)
+ {
+ // no device found for this connection -> just add it without device
+ ConnectionSettings::Connection* connection = cstore->getConnection(TQString(conn));
+ if (connection)
+ map.append(TQPair<ConnectionSettings::Connection*, Device*>(connection, NULL));
+ }
+ delete act_conn;
+ }
+
+ }
+
+ return map;
+}
+
+NMProxy::NMProxy()
+ : NetworkManagerProxy(NM_DBUS_SERVICE, NM_DBUS_PATH)
+{
+ d = new NMProxyPrivate();
+ NetworkManagerProxy::setConnection(TQT_DBusConnection::systemBus());
+}
+
+void NMProxy::deactivateConnection(const ConnectionSettings::Connection* conn, const Device* dev)
+{
+ TQT_DBusError err;
+ TQValueList<TQT_DBusObjectPath> connections;
+
+ // get a list of all active connections from NM
+ connections = NetworkManagerProxy::getActiveConnections(err);
+
+ for (TQValueList<TQT_DBusObjectPath>::Iterator it = connections.begin(); it != connections.end(); ++it)
+ {
+ // we need a proxy for every active connection
+ DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, (*it));
+ act_conn->setConnection(TQT_DBusConnection::systemBus());
+
+ if (act_conn)
+ {
+ if (act_conn->getConnection(err) == conn->getObjectPath())
+ {
+ if (dev)
+ {
+ // get details about the active connection
+ TQValueList<TQT_DBusObjectPath> devs = act_conn->getDevices(err);
+ for (TQValueList<TQT_DBusObjectPath>::Iterator it2 = devs.begin(); it2 != devs.end(); ++it2)
+ {
+ if (TQString(*it2) == dev->getObjectPath())
+ {
+ // this is the right one
+ DeactivateConnection(*it, err);
+ return;
+ }
+ }
+ }
+ else
+ {
+ DeactivateConnection(*it, err);
+ }
+ }
+ delete act_conn;
+ }
+ }
+
+}
+
+void NMProxy::deactivateConnectionPath(TQT_DBusObjectPath obj_path)
+{
+ TQT_DBusError err;
+ DeactivateConnection(obj_path, err);
+}
+
+void NMProxy::deactivateDevice(const Device* dev)
+{
+ TQT_DBusError err;
+ TQValueList<TQT_DBusObjectPath> connections;
+
+ // get a list of all active connections from NM
+ connections = NetworkManagerProxy::getActiveConnections(err);
+
+ for (TQValueList<TQT_DBusObjectPath>::Iterator it = connections.begin(); it != connections.end(); ++it)
+ {
+ // we need a proxy for every active connection
+ DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, (*it));
+ act_conn->setConnection(TQT_DBusConnection::systemBus());
+
+ if (act_conn)
+ {
+ // get details about the active connection
+ TQValueList<TQT_DBusObjectPath> devs = act_conn->getDevices(err);
+ for (TQValueList<TQT_DBusObjectPath>::Iterator it2 = devs.begin(); it2 != devs.end(); ++it2)
+ {
+ if (TQString(*it2) == dev->getObjectPath())
+ {
+ // this is the right one
+ DeactivateConnection(*it, err);
+ return;
+ }
+ }
+ delete act_conn;
+ }
+ }
+}
+
+bool NMProxy::isNMRunning()
+{
+ // Ask DBus if the NetworkManager service is available
+ TQT_DBusProxy* proxy = new TQT_DBusProxy("org.freedesktop.DBus", "/", "org.freedesktop.DBus", TQT_DBusConnection::systemBus());
+ TQValueList<TQT_DBusData> params;
+ params.append(TQT_DBusData::fromString(NM_DBUS_SERVICE));
+ TQT_DBusMessage reply = proxy->sendWithReply("NameHasOwner", params);
+ bool ret = reply.first().toBool();
+ delete proxy;
+ return ret;
+}
+
+NMProxy::~NMProxy()
+{
+ delete d;
+}
+
+NMProxy* NMProxy::getInstance()
+{
+ if (NMProxyPrivate::nm)
+ return NMProxyPrivate::nm;
+ return (NMProxyPrivate::nm = new NMProxy());
+}
+
+
+#include "knetworkmanager-nm_proxy.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-nm_proxy.h b/knetworkmanager-0.8/src/knetworkmanager-nm_proxy.h
new file mode 100644
index 0000000..c8af913
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-nm_proxy.h
@@ -0,0 +1,62 @@
+/***************************************************************************
+ *
+ * knetworkmanager-nm_proxy.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_NMPROXY_H
+#define KNETWORKMANAGER_NMPROXY_H
+
+#include "dbus/networkmanagerproxy.h"
+
+namespace ConnectionSettings
+{
+ class Connection;
+}
+class Device;
+class NMProxyPrivate;
+
+class NMProxy : public DBus::NetworkManagerProxy
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ static NMProxy* getInstance();
+
+ Device* getDefaultDevice();
+ TQT_DBusObjectPath getDeviceForActiveConnection(TQT_DBusObjectPath act_conn);
+ TQT_DBusObjectPath getDefaultActiveConnection();
+ ConnectionSettings::Connection* getActiveConnection(const Device* dev);
+ void deactivateDevice(const Device* dev);
+ void deactivateConnection(const ConnectionSettings::Connection* conn, const Device* dev);
+ void deactivateConnectionPath(TQT_DBusObjectPath obj_path);
+ TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > getActiveConnectionsMap();
+ bool isNMRunning();
+
+ protected:
+ NMProxy ();
+ ~NMProxy ();
+
+ private:
+ NMProxyPrivate * d;
+};
+
+#endif /* KNETWORKMANAGER_NMPROXY_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-nm_vpn_proxy.cpp b/knetworkmanager-0.8/src/knetworkmanager-nm_vpn_proxy.cpp
new file mode 100644
index 0000000..737f4ef
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-nm_vpn_proxy.cpp
@@ -0,0 +1,81 @@
+/***************************************************************************
+ *
+ * knetworkmanager-device.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// KDE includes
+#include <kdebug.h>
+
+// TQtDBus includes
+#include <tqdbusconnection.h>
+#include <tqdbusproxy.h>
+#include <tqdbusdata.h>
+#include <tqdbusdatalist.h>
+#include <tqdbuserror.h>
+#include <tqdbusobjectpath.h>
+
+// NM includes
+#include <NetworkManager.h>
+#include <NetworkManagerVPN.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "knetworkmanager-nm_vpn_proxy.h"
+#include "knetworkmanager-device.h"
+#include "knetworkmanager-devicestore.h"
+//#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_store.h"
+#include "dbus/vpnconnectionproxy.h"
+
+class NMVPNProxyPrivate
+{
+ public:
+ NMVPNProxyPrivate()
+ {}
+
+ static NMVPNProxy* nm;
+};
+
+NMVPNProxy* NMVPNProxyPrivate::nm = NULL;
+
+NMVPNProxy::NMVPNProxy()
+ : NetworkManagerVPNProxy(NM_DBUS_SERVICE, NM_DBUS_PATH_VPN_CONNECTION)
+{
+ d = new NMVPNProxyPrivate();
+ NetworkManagerVPNProxy::setConnection(TQDBusConnection::systemBus());
+}
+
+NMVPNProxy::~NMVPNProxy()
+{
+ delete d;
+}
+
+NMVPNProxy* NMVPNProxy::getInstance()
+{
+ if (NMVPNProxyPrivate::nm)
+ return NMVPNProxyPrivate::nm;
+ return (NMVPNProxyPrivate::nm = new NMVPNProxy());
+}
+
+
+#include "knetworkmanager-nm_vpn_proxy.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-nm_vpn_proxy.h b/knetworkmanager-0.8/src/knetworkmanager-nm_vpn_proxy.h
new file mode 100644
index 0000000..a86dfbf
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-nm_vpn_proxy.h
@@ -0,0 +1,52 @@
+/***************************************************************************
+ *
+ * knetworkmanager-nm_proxy.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_NMVPNPROXY_H
+#define KNETWORKMANAGER_NMVPNPROXY_H
+
+#include "dbus/networkmanagervpnproxy.h"
+
+namespace ConnectionSettings
+{
+ class Connection;
+}
+class Device;
+class NMVPNProxyPrivate;
+
+class NMVPNProxy : public DBus::NetworkManagerVPNProxy
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ static NMVPNProxy* getInstance();
+
+ protected:
+ NMVPNProxy ();
+ ~NMVPNProxy ();
+
+ private:
+ NMVPNProxyPrivate * d;
+};
+
+#endif /* KNETWORKMANAGER_NMVPNPROXY_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-nmsettings.cpp b/knetworkmanager-0.8/src/knetworkmanager-nmsettings.cpp
new file mode 100644
index 0000000..e0227c7
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-nmsettings.cpp
@@ -0,0 +1,162 @@
+/***************************************************************************
+ *
+ * knetworkmanager-nminfo_dbus.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Valentine Sinitsyn <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include <stdlib.h>
+#include <kdebug.h>
+
+#include <NetworkManager.h>
+
+#include <tqdbusobjectpath.h>
+#include <tqdbusconnection.h>
+
+#include "knetworkmanager.h"
+#include "knetworkmanager-nmsettings.h"
+#include "knetworkmanager-connection_setting.h"
+#include "knetworkmanager-connection_store.h"
+#include "knetworkmanager-connection.h"
+
+#if !defined(NM_CHECK_VERSION)
+#define NM_CHECK_VERSION(x,y,z) 0
+#endif
+
+class NMSettingsPrivate
+{
+ public:
+ NMSettingsPrivate()
+ : obj_path_index(0)
+ {
+
+ }
+
+ ~NMSettingsPrivate()
+ {
+
+ }
+
+ int obj_path_index;
+};
+
+
+NMSettings* NMSettings::_instance = NULL;
+
+NMSettings* NMSettings::getInstance()
+{
+ // return singleton instance
+ if (_instance)
+ return _instance;
+ return (_instance = new NMSettings());
+}
+
+NMSettings::NMSettings()
+{
+ d = new NMSettingsPrivate();
+ TQT_DBusConnection conn = TQT_DBusConnection::systemBus();
+
+ kdDebug() << "NMSettings::NMSettings" << endl;
+
+#if NM_CHECK_VERSION(0,8,992)
+ if (!conn.requestName("org.freedesktop.NetworkManagerUserSettings"))
+ kdError() << "req name failed for " << "org.freedesktop.NetworkManagerUserSettings" << endl;
+#else
+ // request the name for the settings interface
+ if (!conn.requestName(NM_DBUS_SERVICE_USER_SETTINGS))
+ kdError() << "req name failed for " << NM_DBUS_SERVICE_USER_SETTINGS << endl;
+#endif
+
+ // request the name for the connections here too
+ if (!conn.requestName(NM_DBUS_IFACE_SETTINGS_CONNECTION))
+ kdError() << "req name failed for " << NM_DBUS_IFACE_SETTINGS_CONNECTION << endl;
+
+ // request the name for the connections here too
+ if (!conn.requestName(NM_DBUS_IFACE_SETTINGS_CONNECTION_SECRETS))
+ kdError() << "req name failed for " << NM_DBUS_IFACE_SETTINGS_CONNECTION_SECRETS << endl;
+
+ // register on the DBus
+ if (!conn.registerObject(objectPath(), this))
+ kdError() << "registerobjectpath failed" << endl;
+
+
+ ConnectionStore* cstore = ConnectionStore::getInstance();
+
+ // we need to get informed about new connections...
+ connect(cstore, TQT_SIGNAL(signalConnectionAdded(ConnectionSettings::Connection*)), this, TQT_SLOT(slotNewConnection(ConnectionSettings::Connection*)));
+}
+
+NMSettings::~NMSettings()
+{
+ delete d;
+ TQT_DBusConnection conn = TQT_DBusConnection::systemBus();
+ conn.unregisterObject(NM_DBUS_PATH_SETTINGS);
+}
+
+
+bool NMSettings::handleSignalSend(const TQT_DBusMessage& reply)
+{
+ TQT_DBusConnection::systemBus().send(reply);
+ return true;
+}
+
+TQString NMSettings::objectPath() const
+{
+ return TQString(NM_DBUS_PATH_SETTINGS);
+}
+
+bool NMSettings::ListConnections(TQValueList<TQT_DBusObjectPath>& connections, TQT_DBusError& /*error*/)
+{
+ // return connections
+ ConnectionStore* cstore = ConnectionStore::getInstance();
+ TQValueList<ConnectionSettings::Connection*> conns = cstore->getConnections();
+
+ for (TQValueList<ConnectionSettings::Connection*>::Iterator it = conns.begin(); it != conns.end(); ++it)
+ {
+ ConnectionSettings::Connection* conn = (*it);
+ connections.append(conn->getObjectPath());
+ }
+
+ return true;
+}
+
+void NMSettings::handleMethodReply(const TQT_DBusMessage& reply)
+{
+ TQT_DBusConnection::systemBus().send(reply);
+}
+
+TQT_DBusObjectPath
+NMSettings::getObjPathForConnection()
+{
+ // just increase the number for this connection
+ TQT_DBusObjectPath obj_path(NM_DBUS_PATH_SETTINGS_CONNECTION"/");
+ obj_path += TQString::number(d->obj_path_index++);
+ return obj_path;
+}
+
+void
+NMSettings::slotNewConnection(ConnectionSettings::Connection* conn)
+{
+ emitNewConnection(conn->getObjectPath());
+}
+
+
+#include "knetworkmanager-nmsettings.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-nmsettings.h b/knetworkmanager-0.8/src/knetworkmanager-nmsettings.h
new file mode 100644
index 0000000..d1786dc
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-nmsettings.h
@@ -0,0 +1,77 @@
+/***************************************************************************
+ *
+ * knetworkmanager-nminfo_dbus.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_NMSETTINGS_H
+#define KNETWORKMANAGER_NMSETTINGS_H
+
+#include <tqobject.h>
+
+#include "knetworkmanager-connection_setting.h"
+#include "dbus/networkmanagersettings.h"
+
+class Network;
+class TQT_DBusObjectPath;
+class NMSettingsPrivate;
+
+class NMSettings : public TQObject, DBus::SettingsInterface
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ /* get singleton */
+ static NMSettings* getInstance();
+
+ ~NMSettings();
+ /* request the required interface from the DBus */
+// void requestName (DBusMessage*);
+
+ /* functions for handling method calls sended _by_ NetworkManager */
+// void getConnections (DBusMessage*);
+ bool handleSignalSend(const TQT_DBusMessage& reply);
+ TQString objectPath() const;
+ bool ListConnections(TQValueList<TQT_DBusObjectPath>& connections, TQT_DBusError& error);
+ void handleMethodReply(const TQT_DBusMessage& reply);
+
+ /* get Connection from obj_path */
+ TQT_DBusObjectPath getObjPathForConnection();
+
+ public slots:
+ /* notification about new connections */
+ void slotNewConnection (ConnectionSettings::Connection*);
+
+ private:
+ NMSettingsPrivate* d;
+
+ /* private constructor -> singleton */
+ NMSettings();
+
+ /* functions for sending signals/methodcalls _to_ NetworkManager */
+ void signalNewConnection (const char*);
+
+ /* pointer to the singleton class */
+ static NMSettings* _instance;
+
+};
+
+#endif /* KNETWORKMANAGER_NMSETTINGS_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-plugin.cpp b/knetworkmanager-0.8/src/knetworkmanager-plugin.cpp
new file mode 100644
index 0000000..cb1d2b7
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-plugin.cpp
@@ -0,0 +1,38 @@
+/***************************************************************************
+ *
+ * knetworkmanager-plugin.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include "knetworkmanager-plugin.h"
+
+Plugin::Plugin(TQObject* parent, const char* name, const TQStringList& )
+ : TQObject(parent, name)
+{
+
+}
+
+Plugin::~Plugin()
+{
+
+}
+
+#include "knetworkmanager-plugin.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-plugin.h b/knetworkmanager-0.8/src/knetworkmanager-plugin.h
new file mode 100644
index 0000000..d220989
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-plugin.h
@@ -0,0 +1,39 @@
+/***************************************************************************
+ *
+ * knetworkmanager-plugin.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_PLUGIN_H
+#define KNETWORKMANAGER_PLUGIN_H
+
+#include <tqobject.h>
+
+class Plugin : public TQObject
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ Plugin(TQObject*, const char*, const TQStringList&);
+ ~Plugin();
+};
+
+#endif /* KNETWORKMANAGER_PLUGIN_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-pluginmanager.cpp b/knetworkmanager-0.8/src/knetworkmanager-pluginmanager.cpp
new file mode 100644
index 0000000..8bd3f85
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-pluginmanager.cpp
@@ -0,0 +1,184 @@
+/***************************************************************************
+ *
+ * knetworkmanager-pluginmanager.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include <kplugininfo.h>
+#include <kparts/componentfactory.h>
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "knetworkmanager-pluginmanager.h"
+
+PluginManager* PluginManager::_instance;
+
+PluginManager* PluginManager::getInstance()
+{
+ if (_instance)
+ return _instance;
+ return new PluginManager(TQT_TQOBJECT(KNetworkManager::getInstance()), "pluginmanager");
+}
+
+PluginManager::PluginManager(TQObject* parent, const char* name)
+ : TQObject(parent, name)
+{
+ // get list of available plugins
+ this->_plugins = KPluginInfo::fromServices( KTrader::self()->query( TQString::tqfromLatin1( "KNetworkManager/Plugin" )));
+
+ // a bit debug output
+ for(TQValueList<KPluginInfo*>::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it)
+ kdDebug() << k_funcinfo << TQString("Found Plugin '%1'").tqarg((*it)->pluginName()) << endl;
+}
+
+PluginManager::~PluginManager()
+{
+ // delete all loaded plugins
+ while(!_loadedPlugins.empty())
+ {
+ PluginMap::Iterator it = _loadedPlugins.begin();
+ _loadedPlugins.remove(it);
+ }
+
+ // delete all available plugininfos
+ while(!_plugins.empty())
+ {
+ TQValueList<KPluginInfo*>::Iterator it = _plugins.begin();
+ delete *it;
+ _plugins.remove(it);
+ }
+}
+
+TQStringList PluginManager::getPluginList(const TQString& serviceType, const TQString& property, const TQString& value) const
+{
+ TQStringList ret;
+ // find a suitable plugin
+ for(TQValueList<KPluginInfo*>::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it)
+ {
+ if ((*it)->service()->serviceTypes().contains(serviceType) > 0)
+ if ((*it)->property(property).toString().contains(value))
+ ret.append( (*it)->pluginName() );
+ }
+ return ret;
+}
+
+Plugin* PluginManager::getPlugin(const TQString& pluginID)
+{
+ KPluginInfo* info = infoForPluginID(pluginID);
+ if (_loadedPlugins.contains(info))
+ {
+ return _loadedPlugins[info];
+ }
+ else
+ {
+ return loadPlugin(pluginID);
+ }
+ return NULL;
+}
+
+const KPluginInfo* PluginManager::getPluginInfo(const TQString& pluginID)
+{
+ return infoForPluginID(pluginID);
+}
+
+const KPluginInfo* PluginManager::getPluginInfo(const Plugin* plugin)
+{
+ for(PluginMap::ConstIterator it = _loadedPlugins.begin(); it != _loadedPlugins.end(); ++it)
+ {
+ if (it.data() == plugin)
+ return it.key();
+ }
+ return NULL;
+}
+
+void PluginManager::loadAllPlugins()
+{
+ // iterate over all plugins
+ for(TQValueList<KPluginInfo*>::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it)
+ {
+ // load Plugin
+ loadPlugin((*it)->pluginName());
+ }
+}
+
+
+Plugin* PluginManager::loadPlugin(const TQString& pluginID)
+{
+ // try to load Plugin
+ int error = 0;
+ KPluginInfo* info = infoForPluginID(pluginID);
+ Plugin *plugin = KParts::ComponentFactory::createInstanceFromQuery<Plugin>( TQString::tqfromLatin1( "KNetworkManager/Plugin" ),
+ TQString::tqfromLatin1( "[X-KDE-PluginInfo-Name]=='%1'" ).tqarg( pluginID ), this, 0, TQStringList(), &error );
+
+ // plugin loaded?
+ if (plugin)
+ {
+ kdDebug() << k_funcinfo << TQString(i18n("successfully loaded plugin '%1'")).tqarg(info->pluginName()) << endl;
+ _loadedPlugins.insert(info, plugin);
+ }
+ else
+ {
+ // error
+ switch( error )
+ {
+ case KParts::ComponentFactory::ErrNoServiceFound:
+ kdDebug( ) << k_funcinfo << "No service implementing the given mimetype "
+ << "and fullfilling the given constraint expression can be found." << endl;
+ break;
+
+ case KParts::ComponentFactory::ErrServiceProvidesNoLibrary:
+ kdDebug( ) << "the specified service provides no shared library." << endl;
+ break;
+
+ case KParts::ComponentFactory::ErrNoLibrary:
+ kdDebug( ) << "the specified library could not be loaded." << endl;
+ break;
+
+ case KParts::ComponentFactory::ErrNoFactory:
+ kdDebug( ) << "the library does not export a factory for creating components." << endl;
+ break;
+
+ case KParts::ComponentFactory::ErrNoComponent:
+ kdDebug( ) << "the factory does not support creating components of the specified type." << endl;
+ break;
+ }
+
+ kdDebug() << k_funcinfo << "Loading plugin '" << pluginID << "' failed, KLibLoader reported error: '" << endl
+ << KLibLoader::self()->lastErrorMessage() << "'" << endl;
+
+ }
+
+ return plugin;
+}
+
+KPluginInfo * PluginManager::infoForPluginID( const TQString& pluginID ) const
+{
+ TQValueList<KPluginInfo *>::ConstIterator it;
+ for ( it = this->_plugins.begin(); it != this->_plugins.end(); ++it )
+ {
+ if ( ( *it )->pluginName() == pluginID )
+ return *it;
+ }
+
+ return 0L;
+}
+
+#include "knetworkmanager-pluginmanager.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-pluginmanager.h b/knetworkmanager-0.8/src/knetworkmanager-pluginmanager.h
new file mode 100644
index 0000000..29fd703
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-pluginmanager.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+ *
+ * knetworkmanager-pluginmanager.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_PLUGINMANAGER_H
+#define KNETWORKMANAGER_PLUGINMANAGER_H
+
+#include <tqobject.h>
+#include <tqmap.h>
+#include <tqvaluelist.h>
+
+#include "knetworkmanager-plugin.h"
+#include "knetworkmanager.h"
+
+class KPluginInfo;
+
+typedef TQMap<KPluginInfo*, Plugin*> PluginMap;
+
+class PluginManager : public TQObject
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ PluginManager(TQObject*, const char*);
+ ~PluginManager();
+
+ TQStringList getPluginList(const TQString&, const TQString&, const TQString&) const;
+ Plugin* getPlugin(const TQString&);
+ const KPluginInfo* getPluginInfo(const TQString&);
+ const KPluginInfo* getPluginInfo(const Plugin*);
+
+ static PluginManager* getInstance (void);
+
+ public slots:
+ void loadAllPlugins();
+
+ private:
+ TQValueList<KPluginInfo*> _plugins;
+ PluginMap _loadedPlugins;
+
+ Plugin* loadPlugin(const TQString& pluginID);
+ KPluginInfo* infoForPluginID(const TQString& pluginID) const;
+
+ static PluginManager* _instance;
+};
+
+#endif /* KNETWORKMANAGER_PLUGINMANAGER_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-ppp_connection.cpp b/knetworkmanager-0.8/src/knetworkmanager-ppp_connection.cpp
new file mode 100644
index 0000000..9595c31
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-ppp_connection.cpp
@@ -0,0 +1,54 @@
+/***************************************************************************
+ *
+ * knetworkmanager-ppp_connection.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Author: Will Stephenson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include "knetworkmanager-ppp_connection.h"
+
+#include <nm-setting-ppp.h>
+#include <nm-setting-ip4-config.h>
+
+ConnectionSettings::PPPConnection::PPPConnection(const TQString & infoName)
+ : GenericConnection(infoName)
+{
+ appendSetting(new IPv4(this));
+ appendSetting(new PPP(this));
+}
+
+ConnectionSettings::PPPConnection::~PPPConnection()
+{
+
+}
+
+ConnectionSettings::IPv4* ConnectionSettings::PPPConnection::getIPv4Setting() const
+{
+ return dynamic_cast<ConnectionSettings::IPv4*>(getSetting(NM_SETTING_IP4_CONFIG_SETTING_NAME));
+}
+
+ConnectionSettings::PPP* ConnectionSettings::PPPConnection::getPPPSetting() const
+{
+ return dynamic_cast<PPP*>(getSetting(NM_SETTING_PPP_SETTING_NAME));
+}
+
+#include "knetworkmanager-ppp_connection.moc"
+
+// vim: sw=4 sts=4 noet tw=100
diff --git a/knetworkmanager-0.8/src/knetworkmanager-ppp_connection.h b/knetworkmanager-0.8/src/knetworkmanager-ppp_connection.h
new file mode 100644
index 0000000..0f37ba7
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-ppp_connection.h
@@ -0,0 +1,51 @@
+/***************************************************************************
+ *
+ * knetworkmanager-ppp_connection.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ *
+ * Author: Will Stephenson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_PPP_CONNECTION_H
+#define KNETWORKMANAGER_PPP_CONNECTION_H
+
+#include "knetworkmanager-generic_connection.h"
+#include "knetworkmanager-connection_setting_ipv4.h"
+#include "knetworkmanager-connection_setting_ppp.h"
+
+namespace ConnectionSettings
+{
+ class Info;
+ class IPv4;
+ class PPP;
+
+ class PPPConnection : public GenericConnection
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ PPPConnection(const TQString& infoName);
+ ~PPPConnection();
+ PPP* getPPPSetting() const;
+ IPv4* getIPv4Setting() const;
+ };
+} // namespace ConnectionSettings
+
+#endif
+
diff --git a/knetworkmanager-0.8/src/knetworkmanager-storage.cpp b/knetworkmanager-0.8/src/knetworkmanager-storage.cpp
new file mode 100644
index 0000000..553bd1f
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-storage.cpp
@@ -0,0 +1,634 @@
+/***************************************************************************
+ *
+ * knetworkmanager-storage.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ * Author: Timothy Pearson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include <tqtimer.h>
+
+#include <kglobal.h>
+#include <kconfig.h>
+#include <kstaticdeleter.h>
+#include <kdebug.h>
+
+#include "knetworkmanager-storage.h"
+#include "knetworkmanager-connection_store.h"
+#include "knetworkmanager-wireless_connection.h"
+#include "knetworkmanager-wired_connection.h"
+#include "knetworkmanager-cdma_connection.h"
+#include "knetworkmanager-gsm_connection.h"
+#include "knetworkmanager-vpn_connection.h"
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_setting.h"
+#include "xmlmarshaller.h"
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-connection_setting_wired.h"
+#include "knetworkmanager-connection_setting_wireless.h"
+#include "knetworkmanager-connection_setting_wireless_security.h"
+#include "knetworkmanager-connection_setting_ipv4.h"
+
+using namespace ConnectionSettings;
+
+static KStaticDeleter<Storage> sd2;
+
+// private stuff
+class StoragePrivate
+{
+ public:
+ StoragePrivate() {};
+ ~StoragePrivate() {};
+
+ static Storage* _instance;
+};
+
+Storage* StoragePrivate::_instance = NULL;
+
+Storage*
+Storage::getInstance()
+{
+ if (StoragePrivate::_instance)
+ return StoragePrivate::_instance;
+ return sd2.setObject(StoragePrivate::_instance, new Storage());
+}
+
+Storage::Storage()
+{
+ d = new StoragePrivate();
+
+ // defer the connection init a bit
+ TQTimer::singleShot(0, this, TQT_SLOT(slotInit()));
+}
+
+Storage::~Storage()
+{
+ delete d;
+}
+
+void
+Storage::slotInit()
+{
+ ConnectionStore* cstore = ConnectionStore::getInstance();
+
+ // we want to get notified whenever a new connection is created, edited or deleted
+ connect(cstore, TQT_SIGNAL(signalConnectionAdded(ConnectionSettings::Connection*)), this, TQT_SLOT(slotConnectionAdded(ConnectionSettings::Connection*)));
+ connect(cstore, TQT_SIGNAL(signalConnectionRemoved(ConnectionSettings::Connection*)), this, TQT_SLOT(slotConnectionRemoved(ConnectionSettings::Connection*)));
+}
+
+void
+Storage::slotConnectionAdded(Connection* con)
+{
+ // connection added, save it
+ saveConnection(con);
+ KGlobal::config()->sync();
+}
+
+void
+Storage::slotConnectionRemoved(Connection* con)
+{
+ // find the appropriate connection and delete it from the storage
+ deleteConnection(con);
+ KGlobal::config()->sync();
+}
+
+Connection*
+Storage::createConnectionByType(const TQString& cType)
+{
+ // TODO: use a factory class here
+ if (cType == NM_SETTING_WIRELESS_SETTING_NAME)
+ return new WirelessConnection();
+ else if (cType == NM_SETTING_WIRED_SETTING_NAME)
+ return new WiredConnection();
+ else if(cType == NM_SETTING_CDMA_SETTING_NAME)
+ return new CDMAConnection();
+ else if(cType == NM_SETTING_GSM_SETTING_NAME)
+ return new GSMConnection();
+ else if (cType == NM_SETTING_VPN_SETTING_NAME)
+ return new VPNConnection();
+ else
+ return NULL;
+}
+
+void
+Storage::restoreConnections()
+{
+ kdDebug() << k_funcinfo << endl;
+ // let's read all connections from the config-file and add them to the connection-store
+ ConnectionStore* store = ConnectionStore::getInstance();
+ TQStringList groups = KGlobal::config()->groupList();
+ const TQStringList::Iterator end = groups.end();
+ for ( TQStringList::Iterator it = groups.begin(); it != end; ++it )
+ {
+ if ( !(*it).startsWith( "Connection_" ) )
+ continue;
+
+ // restore that connection
+ Connection* conn = NULL;
+ if ( (conn = restoreConnection(*it)) != NULL)
+ {
+ // add the connection to the store
+ store->addConnection(conn);
+ }
+ }
+
+}
+
+Connection*
+Storage::restoreConnection(const TQString& grpname)
+{
+ Connection* conn = NULL;
+ kdDebug() << k_funcinfo << " " << grpname << endl;
+
+ // we have a connection to restore
+ KConfigGroup grp( KGlobal::config(), grpname);
+ TQString id = grp.readEntry("Id");
+ TQString cType = grp.readEntry("Type");
+
+ // ID is needed!
+ if (id.isEmpty() || cType.isEmpty())
+ return NULL;
+
+ // create a new connection object by its type
+ conn = createConnectionByType(cType);
+
+ // check if the connection was successfully created
+ if (!conn)
+ return NULL;
+
+ // set the connection ID
+ conn->setID(id);
+
+ // restore all appropriate settings
+ TQStringList settings = grp.readListEntry("Settings");
+
+ for (TQStringList::ConstIterator it = settings.begin(); it != settings.end(); ++it)
+ {
+ if ( !restoreSetting(conn, *it) )
+ {
+ // setting could not be restored -> Error
+ kdDebug() << " Connection " << id.ascii() << " could not be restored." << endl;
+ kdError() << k_funcinfo << " Connection " << id << " could not be restored." << endl;
+ delete conn;
+ conn = NULL;
+ return NULL;
+ }
+ }
+
+ // restore all appropriate secrets
+ TQStringList secrets = grp.readListEntry("Secrets");
+
+ for (TQStringList::ConstIterator it = secrets.begin(); it != secrets.end(); ++it)
+ {
+ if ( !restoreSecrets(conn, *it) )
+ {
+ // setting could not be restored -> Error
+ kdDebug() << " Connection " << id.ascii() << " could not be restored." << endl;
+ kdError() << k_funcinfo << " Connection " << id << " could not be restored." << endl;
+ delete conn;
+ conn = NULL;
+ return NULL;
+ }
+ }
+
+ return conn;
+}
+
+bool
+Storage::restoreSetting(Connection* conn, const TQString& setting_grp_name)
+{
+ kdDebug() << k_funcinfo << " " << setting_grp_name << endl;
+ kdDebug() << "restore setting: " << setting_grp_name.ascii() << endl;
+
+ KConfigGroup setting_grp(KGlobal::config(), setting_grp_name);
+ TQMap<TQString, TQString> config_map = KGlobal::config()->entryMap(setting_grp_name);
+ TQString type = setting_grp.readEntry("Type");
+
+ // get the appropriate setting from the connection
+ ConnectionSetting* setting = conn->getSetting(type);
+ if (!setting)
+ {
+ kdWarning() << k_funcinfo << "Connection " << conn->getID() << ": Setting " << type << " could not be restored" << endl;
+ return false;
+ }
+
+ // read the SettingsMap from kconfig
+ SettingsMap map;
+ for(TQMap<TQString, TQString>::ConstIterator it = config_map.begin(); it != config_map.end(); ++it)
+ {
+ if (!it.key().startsWith("Value_"))
+ continue;
+
+ TQString key = it.key();
+ // get the original name
+ key.replace("Value_", "");
+
+ TQString xmldata = it.data();
+ TQT_DBusData dbusdata = XMLMarshaller::toTQT_DBusData(xmldata);
+
+ map.insert(key, dbusdata);
+ }
+
+ // restore the setting from the generated map
+ setting->fromMap(map);
+ return true;
+}
+
+bool
+Storage::restoreSecrets(Connection* conn, const TQString& secrets_grp_name)
+{
+ kdDebug() << k_funcinfo << " " << secrets_grp_name << endl;
+ kdDebug() << "restore secret: " << secrets_grp_name.ascii() << endl;
+
+ KConfigGroup secrets_grp(KGlobal::config(), secrets_grp_name);
+ TQMap<TQString, TQString> config_map = KGlobal::config()->entryMap(secrets_grp_name);
+ TQString type = secrets_grp.readEntry("Type");
+
+ // get the appropriate setting from the connection
+ ConnectionSetting* setting = conn->getSetting(type);
+ if (!setting)
+ {
+ kdWarning() << k_funcinfo << "Connection " << conn->getID() << ": Secrets for setting " << type << " could not be restored" << endl;
+ return false;
+ }
+
+ // read the SettingsMap from kconfig
+ SettingsMap map;
+ for(TQMap<TQString, TQString>::ConstIterator it = config_map.begin(); it != config_map.end(); ++it)
+ {
+ if (!it.key().startsWith("Value_"))
+ continue;
+
+ TQString key = it.key();
+ // get the original name
+ key.replace("Value_", "");
+
+ TQString xmldata = it.data();
+ TQT_DBusData dbusdata = XMLMarshaller::toTQT_DBusData(xmldata);
+
+ map.insert(key, dbusdata);
+ }
+
+ // restore the setting from the generated map
+ setting->fromSecretsMap(map);
+ return true;
+}
+
+bool
+Storage::restoreVPNSecrets(Connection* conn, const TQString& secrets_grp_name)
+{
+ kdDebug() << k_funcinfo << " " << secrets_grp_name << endl;
+ kdDebug() << "restore secret: " << secrets_grp_name.ascii() << endl;
+
+ KConfigGroup secrets_grp(KGlobal::config(), secrets_grp_name);
+ TQMap<TQString, TQString> config_map = KGlobal::config()->entryMap(secrets_grp_name);
+ TQString type = secrets_grp.readEntry("Type");
+
+ // get the appropriate setting from the connection
+ ConnectionSetting* setting = conn->getSetting(type);
+ if (!setting)
+ {
+ kdWarning() << k_funcinfo << "Connection " << conn->getID() << ": Secrets for setting " << type << " could not be restored" << endl;
+ return false;
+ }
+
+ // read the SettingsMap from kconfig
+ SettingsMap map;
+ for(TQMap<TQString, TQString>::ConstIterator it = config_map.begin(); it != config_map.end(); ++it)
+ {
+ if (!it.key().startsWith("Value_"))
+ continue;
+
+ TQString key = it.key();
+ // get the original name
+ key.replace("Value_", "");
+
+ TQString xmldata = it.data();
+ TQT_DBusData dbusdata = XMLMarshaller::toTQT_DBusData(xmldata);
+
+ map.insert(key, dbusdata);
+ }
+
+ // restore the setting from the generated map
+ setting->fromSecretsMap(map);
+ return true;
+}
+
+void
+Storage::saveConnections()
+{
+ kdDebug() << k_funcinfo << endl;
+ kdDebug() << "Storage::saveConnections" << endl;
+ printf("Storage::saveConnections\n\r");
+ // write all connections we get from the connection-store to disk
+ ConnectionStore* store = ConnectionStore::getInstance();
+ TQValueList<ConnectionSettings::Connection*> connections = store->getConnections();
+
+ for (TQValueList<ConnectionSettings::Connection*>::ConstIterator it = connections.begin(); it != connections.end(); ++it)
+ {
+ // save this connection
+ saveConnection(*it);
+ }
+ KGlobal::config()->sync();
+}
+
+bool
+Storage::saveConnection(Connection* conn)
+{
+ KConfig* config = KGlobal::config();
+ TQString id = conn->getID();
+ TQString cType = conn->getType();
+
+ kdDebug() << k_funcinfo << " <" << id << ">" << endl;
+ kdDebug() << "Storage::saveConnection " << id.ascii() << endl;
+
+ // connections without id are evil
+ if (id.isEmpty() || cType.isEmpty())
+ return false;
+
+ // let's get the config group for this connection
+ KConfigGroup grp(config, TQString("Connection_%1").tqarg(id));
+ TQStringList settings_grps;
+ TQStringList secrets_grps;
+
+ // save the connections settings to the configfile
+ if (saveConnectionSettings(conn, settings_grps, secrets_grps))
+ {
+ grp.writeEntry("Type", cType);
+ grp.writeEntry("Id", id);
+ // save the list of settings groups
+ grp.writeEntry("Settings", settings_grps);
+ grp.writeEntry("Secrets", secrets_grps);
+ }
+ return false;
+}
+
+bool
+Storage::saveConnectionSettings(Connection* conn, TQStringList& settings_grps, TQStringList& secrets_grps)
+{
+ TQString id = conn->getID();
+
+ // connections without id are evil
+ if (id.isEmpty())
+ return false;
+
+ // iterate over all settings
+ TQValueList<ConnectionSetting*> settings = conn->getSettings();
+ TQString setting_grp;
+ TQString secrets_grp;
+
+ // save all settings
+ for (TQValueList<ConnectionSetting*>::ConstIterator it = settings.begin(); it != settings.end(); ++it)
+ {
+ if (!saveConnectionSetting(conn, *it, setting_grp))
+ return false;
+
+ if ((*it)->hasSecrets())
+ {
+ if (!saveConnectionSecrets(conn, *it, secrets_grp))
+ return false;
+ secrets_grps.append(secrets_grp);
+ }
+
+ settings_grps.append(setting_grp);
+ }
+
+ return true;
+}
+
+bool
+Storage::saveConnectionSetting(Connection* conn, ConnectionSetting* setting, TQString& setting_grp)
+{
+ KConfig* config = KGlobal::config();
+ TQString id = conn->getID();
+ TQString type = setting->getType();
+
+ kdDebug() << k_funcinfo << " <" << id << "> <" << type << ">" << endl;
+
+ // ID is necessary
+ if (id.isEmpty())
+ return false;
+
+ // get a group for this setting
+ setting_grp = TQString("ConnectionSetting_%1_%2").tqarg(id).tqarg(type);
+ KConfigGroup grp(config, setting_grp);
+
+ // write the type
+ grp.writeEntry("Type", type);
+
+ // write the values
+ SettingsMap map = setting->toMap();
+ for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
+ {
+ kdDebug() << k_funcinfo << " " << TQString("Value_%1").tqarg(it.key()) << " = " << XMLMarshaller::fromTQT_DBusData( it.data() )<< endl;
+ grp.writeEntry(TQString("Value_%1").tqarg(it.key()), XMLMarshaller::fromTQT_DBusData( it.data() ));
+ }
+ return true;
+}
+
+bool
+Storage::saveConnectionSecrets(Connection* conn, ConnectionSetting* setting, TQString& setting_grp)
+{
+ KConfig* config = KGlobal::config();
+ TQString id = conn->getID();
+ TQString type = setting->getType();
+ bool storage_requested;
+
+ kdDebug() << k_funcinfo << " <" << id << "> <" << type << ">" << endl;
+
+ // ID is necessary
+ if (id.isEmpty())
+ return false;
+
+ // see if permanent storage was requested by the user
+ SettingsMap setting_map = setting->toMap();
+ storage_requested = true;
+ for (SettingsMap::ConstIterator it = setting_map.begin(); it != setting_map.end(); ++it)
+ {
+ if (it.key() == "Commit to disk") {
+ if (XMLMarshaller::fromTQT_DBusData(it.data()) == TQString("true")) {
+ storage_requested = true;
+ }
+ if (XMLMarshaller::fromTQT_DBusData(it.data()) == TQString("false")) {
+ storage_requested = false;
+ }
+ }
+ }
+ printf("Secrets storage requested: %d\n\r", storage_requested);
+
+ // get a group for this setting
+ setting_grp = TQString("ConnectionSecrets_%1_%2").tqarg(id).tqarg(type);
+ KConfigGroup grp(config, setting_grp);
+
+ // write the type
+ grp.writeEntry("Type", type);
+
+ // write the values
+ SettingsMap map = setting->toSecretsMap(false);
+ for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
+ {
+ kdDebug() << k_funcinfo << " " << TQString("Value_%1").tqarg(it.key()) << " = " << XMLMarshaller::fromTQT_DBusData( it.data() )<< endl;
+ if (storage_requested == true) {
+ grp.writeEntry(TQString("Value_%1").tqarg(it.key()), XMLMarshaller::fromTQT_DBusData( it.data() ));
+ }
+ else {
+ grp.writeEntry(TQString("Value_%1").tqarg(it.key()), TQString("") );
+ }
+ }
+ return true;
+}
+
+bool
+Storage::hasSecretsStored(Connection* connection)
+{
+ TQString id = connection->getID();
+
+ // ID is necessary
+ if (id.isEmpty())
+ return false;
+
+ TQValueList<ConnectionSetting*> settings = connection->getSettings();
+ for (TQValueList<ConnectionSetting*>::Iterator it = settings.begin(); it != settings.end(); ++it)
+ {
+ if (hasSecretsStored(connection, *it))
+ return true;
+ }
+ return false;
+}
+
+
+bool
+Storage::hasSecretsStored(Connection* connection, ConnectionSetting* setting)
+{
+ TQString id = connection->getID();
+ TQString type = setting->getType();
+
+ kdDebug() << "Storage::hasSecretsStored" << endl;
+
+ // ID is necessary
+ if (id.isEmpty())
+ return false;
+
+ // get a group for this setting
+ TQString setting_grp_name = TQString("ConnectionSecrets_%1_%2").tqarg(id).tqarg(type);
+
+ TQMap<TQString, TQString> config_map = KGlobal::config()->entryMap(setting_grp_name);
+
+ return !(config_map.isEmpty());
+}
+
+bool
+Storage::restoreAllSecrets(Connection* connection)
+{
+ TQString id = connection->getID();
+ bool retval = true;
+
+ if (id.isEmpty())
+ return false;
+
+ TQValueList<ConnectionSetting*> settings = connection->getSettings();
+ for (TQValueList<ConnectionSetting*>::Iterator it = settings.begin(); it != settings.end(); ++it)
+ {
+ if (hasSecretsStored(connection, *it))
+ if (!restoreSecrets(connection, *it))
+ retval = false;
+ }
+ return retval;
+}
+
+bool
+Storage::restoreSecrets(Connection* connection, ConnectionSetting* setting)
+{
+ TQString id = connection->getID();
+ TQString type = setting->getType();
+
+ kdDebug() << "Storage::restoreSecrets" << endl;
+ // ID is necessary
+ if (id.isEmpty())
+ return false;
+
+ // get a group for this setting
+ TQString setting_grp = TQString("ConnectionSecrets_%1_%2").tqarg(id).tqarg(type);
+
+ // restore the setting
+ return restoreSecrets(connection, setting_grp);
+}
+
+bool
+Storage::restoreVPNSecrets(Connection* connection, ConnectionSetting* setting)
+{
+ TQString id = connection->getID();
+ TQString type = setting->getType();
+
+ printf("Storage::restoreVPNSecrets\n\r");
+ kdDebug() << "Storage::restoreVPNSecrets" << endl;
+ // ID is necessary
+ if (id.isEmpty())
+ return false;
+
+ // get a group for this setting
+ TQString setting_grp = TQString("ConnectionSecrets_%1_%2").tqarg(id).tqarg(type);
+
+ // restore the setting
+ return restoreVPNSecrets(connection, setting_grp);
+}
+
+bool
+Storage::deleteConnection(Connection* conn)
+{
+ KConfig* config = KGlobal::config();
+ TQString id = conn->getID();
+ TQString cType = conn->getType();
+
+ kdDebug() << k_funcinfo << " <" << id << ">" << endl;
+ kdDebug() << "Storage::deleteConnection " << id.ascii() << endl;
+
+ // connections without id are evil
+ if (id.isEmpty() || cType.isEmpty())
+ return false;
+
+ // let's get the config group for this connection
+ KConfigGroup grp(config, TQString("Connection_%1").tqarg(id));
+
+
+ // delete all associated settings
+ TQStringList settings = grp.readListEntry("Settings");
+
+ for (TQStringList::ConstIterator it = settings.begin(); it != settings.end(); ++it)
+ {
+ KConfigGroup setting(config, *it);
+ setting.deleteGroup();
+ }
+
+ // delete all associated secrets
+ TQStringList secrets = grp.readListEntry("Secrets");
+
+ for (TQStringList::ConstIterator it = secrets.begin(); it != secrets.end(); ++it)
+ {
+ KConfigGroup setting(config, *it);
+ setting.deleteGroup();
+ }
+
+ grp.deleteGroup();
+
+ return true;
+}
+
+#include "knetworkmanager-storage.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-storage.h b/knetworkmanager-0.8/src/knetworkmanager-storage.h
new file mode 100644
index 0000000..23b48c8
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-storage.h
@@ -0,0 +1,101 @@
+/***************************************************************************
+ *
+ * knetworkmanager-storage.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_STORAGE_H
+#define KNETWORKMANAGER_STORAGE_H
+
+#include <tqvaluelist.h>
+#include <tqobject.h>
+
+namespace ConnectionSettings
+{
+ class Connection;
+ class ConnectionSetting;
+}
+
+using namespace ConnectionSettings;
+
+class StoragePrivate;
+
+// This class abstracts the storage of settings and connections to the disk
+class Storage : public TQObject
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+ // Singleton
+ static Storage* getInstance();
+
+ // restore all available connections
+ void restoreConnections();
+
+ // save all connections to the config file
+ void saveConnections();
+
+ // restore all settings secrets as they are not restored automatically
+ bool restoreAllSecrets(Connection*);
+
+ // restore a settings secrets as they are not restored automatically
+ bool restoreSecrets(Connection*, ConnectionSetting*);
+
+ bool restoreVPNSecrets(Connection*, ConnectionSetting*);
+
+ // check whether we have the secrets stored, either in KWallet or in the configfile
+ bool hasSecretsStored(Connection*, ConnectionSetting*);
+ bool hasSecretsStored(Connection*);
+
+ ~Storage();
+ public slots:
+ void slotInit();
+
+ // called for every newly created connection
+ void slotConnectionAdded(ConnectionSettings::Connection*);
+
+ // called for every removed connection
+ void slotConnectionRemoved(ConnectionSettings::Connection*);
+
+ signals:
+
+ private:
+ Storage();
+
+ Connection* createConnectionByType(const TQString&);
+
+ Connection* restoreConnection(const TQString&);
+ bool restoreSecrets(Connection*, const TQString&);
+ bool restoreVPNSecrets(Connection*, const TQString&);
+ bool restoreSetting(Connection*, const TQString&);
+
+ bool saveConnection(Connection* conn);
+ bool saveConnectionSettings(Connection* conn, TQStringList&, TQStringList&);
+ bool saveConnectionSetting(Connection* conn, ConnectionSetting* setting, TQString& grp);
+ bool saveConnectionSecrets(Connection* conn, ConnectionSetting* setting, TQString& grp);
+
+ bool deleteConnection(Connection* conn);
+
+ StoragePrivate* d;
+};
+
+#endif /* KNETWORKMANAGER_STORAGE_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-tray.cpp b/knetworkmanager-0.8/src/knetworkmanager-tray.cpp
new file mode 100644
index 0000000..24a91a9
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-tray.cpp
@@ -0,0 +1,1127 @@
+/***************************************************************************
+ *
+ * knetworkmanager-tray.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ * Valentine Sinitsyn <[email protected]>
+ * Alexander Naumov <[email protected]>, <[email protected]>
+ * Author: Timothy Pearson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+class WirelessDialog;
+
+#include <tqsignalmapper.h>
+#include <tqevent.h>
+#include <tqvbox.h>
+#include <tqlayout.h>
+#include <tqpushbutton.h>
+#include <tqpixmap.h>
+#include <tqpixmapcache.h>
+#include <tqpainter.h>
+#include <tqstyle.h>
+#include <tqvaluelist.h>
+#include <dcopclient.h>
+#include <tqdbusobjectpath.h>
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <knotifyclient.h>
+#include <knotifydialog.h>
+#include <klocale.h>
+#include <kstdguiitem.h>
+#include <khelpmenu.h>
+#include <kprocess.h>
+#include <kiconloader.h>
+#include <kconfig.h>
+#include <kmessagebox.h>
+
+#include <tqpushbutton.h>
+#include <tqlayout.h>
+#include <tqlabel.h>
+#include <tqapplication.h>
+#include <tqdialog.h>
+
+#include <NetworkManager.h>
+#include <NetworkManagerVPN.h>
+
+#include <tqdbuserror.h>
+
+#include "xmlmarshaller.h"
+#include "vpn_tray_component.h"
+#include "devicetraycomponent.h"
+#include "knetworkmanager-cellular_device_tray.h"
+#include "knetworkmanager-cellular_device.h"
+#include "knetworkmanager-device.h"
+#include "knetworkmanager-devicestore.h"
+#include "knetworkmanager-tray.h"
+#include "knetworkmanager-menu_subhead.h"
+#include "knetworkmanager-nm_proxy.h"
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-connection_settings_dialog.h"
+#include "knetworkmanager-connection_store.h"
+#include "knetworkmanager-vpn_connection.h"
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-storage.h"
+#include "knetworkmanager-connection_editor.h"
+#include "knetworkmanager-vpnauthenticationdialog.h"
+#include "knetworkmanager-wired_device.h"
+#include "knetworkmanager-wired_device_tray.h"
+#include "knetworkmanager-wireless_device_tray.h"
+#include "knetworkmanager-wireless_device.h"
+
+#include <stdio.h>
+
+#define KDED_NETWORK_NAME "NMNetwork"
+
+#if !defined(NM_CHECK_VERSION)
+#define NM_CHECK_VERSION(x,y,z) 0
+#endif
+
+extern unsigned int current_vpn_state;
+NMDeviceState nm_device_state_global;
+extern unsigned char vpn_new_credentials_needed;
+
+NewSecretsDialog::NewSecretsDialog(ConnectionSettings::Connection *connection, TQWidget * parent, const char * name, bool modal, TQt::WFlags f)
+ : TQDialog(parent, name, modal, f)
+{
+ _connection = connection;
+ init();
+}
+
+NewSecretsDialog::~NewSecretsDialog ()
+{
+
+}
+
+void NewSecretsDialog::slotDialogEdit()
+{
+ ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(_connection, false, NULL, Tray::getInstance(), "Edit connection");
+ dlg->show();
+ close();
+}
+
+void NewSecretsDialog::reject()
+{
+ _connection->slotSecretsError();
+ TQDialog::reject();
+}
+
+void NewSecretsDialog::init()
+{
+ ConnectionSettings::GenericConnection* conn = dynamic_cast<ConnectionSettings::GenericConnection*>(_connection);
+
+ // if we do not have a connection bail out
+ if (!conn)
+ {
+ reject();
+ return;
+ }
+
+ // show a message to the user that the connection failed
+ // and allow edit or cancel
+
+ TQLabel* label = new TQLabel(tqtr(" The connection %1 could not be established ").tqarg(conn->getInfoSetting()->getName()), this);
+ TQPushButton* buttonEdit = new TQPushButton(tr("&Edit"), this);
+ TQPushButton* buttonCancel = new TQPushButton(tr("&Cancel"), this);
+
+ TQHBoxLayout *topLeftLayout = new TQHBoxLayout();
+ topLeftLayout->addWidget(buttonEdit);
+ topLeftLayout->addWidget(buttonCancel);
+
+ TQVBoxLayout *mainLayout = new TQVBoxLayout(this);
+ mainLayout->setMargin(15);
+ mainLayout->setSpacing(10);
+ mainLayout->addWidget(label);
+ mainLayout->addLayout(topLeftLayout);
+
+ connect(buttonEdit, TQT_SIGNAL(clicked()), TQT_SLOT(slotDialogEdit()));
+ connect(buttonCancel, TQT_SIGNAL(clicked()), this, TQT_SLOT(close()));
+}
+
+class TrayPrivate
+{
+ public:
+ TrayPrivate(TQObject* parent)
+ : foregroundTrayComponent(0)
+ , signalMapper(parent, "signal_mapper")
+ , current_idx(0)
+ {}
+ ~TrayPrivate() {}
+
+ static Tray* tray;
+ TQValueList<TrayComponent*> trayComponents;
+ DeviceTrayComponent * foregroundTrayComponent;
+ TQSignalMapper signalMapper;
+ TQMap<int, TQPair<ConnectionSettings::Connection*, Device*> > act_conn_map;
+ int current_idx;
+};
+
+Tray* TrayPrivate::tray = NULL;
+
+Tray* Tray::getInstance()
+{
+ if (TrayPrivate::tray)
+ return TrayPrivate::tray;
+ else return (TrayPrivate::tray = new Tray());
+}
+
+void Tray::slotEditConnections()
+{
+ ConnectionEditorImpl* dlg = new ConnectionEditorImpl(this);
+ dlg->show();
+}
+
+
+void Tray::slotEnableWireless()
+{
+ NMProxy* nm = NMProxy::getInstance();
+ TQT_DBusError err;
+ if (!nm) return;
+
+ nm->setWirelessEnabled(true, err);
+}
+
+void Tray::slotDisableWireless()
+{
+ NMProxy* nm = NMProxy::getInstance();
+ TQT_DBusError err;
+ if (!nm) return;
+
+ nm->setWirelessEnabled(false, err);
+}
+
+void Tray::slotOfflineMode()
+{
+ NMProxy* nm = NMProxy::getInstance();
+ TQT_DBusError err;
+ if (!nm) return;
+
+ nm->Sleep(true, err);
+}
+
+void Tray::slotOnlineMode()
+{
+ NMProxy* nm = NMProxy::getInstance();
+ TQT_DBusError err;
+ if (!nm) return;
+
+ nm->Sleep(false, err);
+}
+
+void Tray::slotNewVPNConnection()
+{
+ printf("Creating new VPN connection\n\r");
+ // create a new VPN connection
+ Connection* conn = new VPNConnection();
+
+ // edit the new connection
+ ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, this, "connect_something", false, TQt::WDestructiveClose);
+ dlg->show();
+}
+
+void Tray::contextMenuAboutToShow (KPopupMenu* menu)
+{
+ TQT_DBusError err;
+ NMProxy* nm = NMProxy::getInstance();
+
+ // clear menu
+ menu->clear();
+
+ if (nm->isNMRunning())
+ {
+
+ // actions for each Device
+ for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin();
+ it != d->trayComponents.end();
+ ++it)
+ {
+ (*it)->addMenuItems(menu);
+ }
+
+ // Submenu title
+ Subhead* subhead = new Subhead (menu, "subhead", TQString("Connection Management"), SmallIcon("knetworkmanager_disabled", TQIconSet::Automatic));
+ menu->insertItem (subhead, -1, -1);
+
+ // New connection
+ KAction * newConnAction = 0;
+ int devices = d->trayComponents.count();
+ if ( devices > 1 ) {
+ newConnAction = actionCollection ()->action ("new_connection_menu");
+ KActionMenu* newConnActionMenu = static_cast<KActionMenu*>(newConnAction);
+ newConnActionMenu->popupMenu()->clear();
+ TQValueList<TrayComponent*>::Iterator it;
+ for (it = d->trayComponents.begin();
+ it != d->trayComponents.end();
+ ++it)
+ {
+ DeviceTrayComponent* dev_comp = dynamic_cast<DeviceTrayComponent*> (*it);
+ KAction * deviceNewConnAction = 0;
+ if (dev_comp)
+ {
+ TQString actionName = TQString("new_connection_%1").tqarg(dev_comp->device()->getInterface());
+ TQString menuCaption = TQString("%1").tqarg(dev_comp->device()->getInterface());
+ if (menuCaption.contains("eth", FALSE) > 0) {
+ menuCaption = menuCaption.insert(0, "Wired Connection (");
+ }
+ else if (menuCaption.contains("wlan", FALSE) > 0) {
+ menuCaption = menuCaption.insert(0, "Wireless Connection (");
+ }
+ else if (menuCaption.contains("pan", FALSE) > 0) {
+ menuCaption = menuCaption.insert(0, "Private Area Connection (");
+ }
+ else {
+ menuCaption = menuCaption.insert(0, "Unknown Connection (");
+ }
+ menuCaption = menuCaption.append(")");
+ deviceNewConnAction = actionCollection ()->action (actionName);
+ if (!deviceNewConnAction) {
+ deviceNewConnAction = new KAction (menuCaption, 0, (*it), TQT_SLOT(newConnection()), actionCollection(), actionName);
+ }
+ newConnActionMenu->insert(deviceNewConnAction);
+ }
+ }
+ // New VPN connection option
+ ++it;
+ KAction * deviceNewConnAction = 0;
+ TQString menuCaption = "VPN Connection";
+ TQString actionName = TQString("new_connection_%1").tqarg("vpn");
+ deviceNewConnAction = new KAction (menuCaption, 0, TQT_TQOBJECT(this), TQT_SLOT(slotNewVPNConnection()), actionCollection(), actionName);
+ newConnActionMenu->insert(deviceNewConnAction);
+ } else if ( devices == 1 ) {
+ newConnAction = actionCollection ()->action ("new_connection");
+ TQT_BASE_OBJECT_NAME::disconnect( newConnAction, TQT_SIGNAL(activated()) );
+ TQT_BASE_OBJECT_NAME::connect( newConnAction, TQT_SIGNAL(activated()), d->trayComponents[0], TQT_SLOT(newConnection()));
+ }
+ if (newConnAction) {
+ newConnAction->plug(menu);
+ }
+
+ // turn things off
+ if (nm)
+ {
+ KActionMenu* disableStuffActionMenu = static_cast<KActionMenu*>(actionCollection ()->action ("deactivate_menu") );
+ disableStuffActionMenu->popupMenu()->clear();
+ TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > map = nm->getActiveConnectionsMap();
+ d->act_conn_map.clear();
+
+ for (TQValueList<TQPair<ConnectionSettings::Connection*, Device*> >::Iterator it = map.begin(); it != map.end(); ++it)
+ {
+ ConnectionSettings::GenericConnection* conn = dynamic_cast<ConnectionSettings::GenericConnection*>((*it).first);
+ Device* dev = (*it).second;
+
+ if (!conn)
+ continue;
+
+ TQString actionName = TQString("disable_connection_%1_%2").tqarg(conn->getID()).tqarg(dev ? dev->getInterface() : "");
+ KAction * deviceNewConnAction = actionCollection ()->action (actionName);
+ TQString actionText = conn->getInfoSetting()->getName();
+ if (dev)
+ actionText += TQString(" (%1)").tqarg(dev->getInterface());
+
+ if (!deviceNewConnAction) {
+ deviceNewConnAction = new KAction (actionText, 0, &d->signalMapper, TQT_SLOT(map()), actionCollection(), actionName);
+ }
+ d->signalMapper.setMapping(deviceNewConnAction, d->current_idx);
+ d->act_conn_map.insert(d->current_idx, TQPair<ConnectionSettings::Connection*, Device*> (conn, dev));
+ d->current_idx++;
+ disableStuffActionMenu->insert(deviceNewConnAction);
+ }
+
+ // disable wireless
+ if (nm->getWirelessHardwareEnabled(err))
+ {
+ KAction* wireless = NULL;
+ if (nm->getWirelessEnabled(err)) {
+ wireless = actionCollection ()->action ("disable_wireless");
+ } else {
+ wireless = actionCollection ()->action ("enable_wireless");
+ }
+ disableStuffActionMenu->insert(wireless);
+ }
+
+ // offline vs. online mode
+ KAction* switch_mode = NULL;
+ if (nm->getState(err) != NM_STATE_ASLEEP) {
+ switch_mode = actionCollection ()->action ("offline_mode");
+ }
+ else {
+ switch_mode = actionCollection ()->action ("online_mode");
+ }
+ disableStuffActionMenu->insert(switch_mode);
+
+ disableStuffActionMenu->plug(menu);
+ }
+ }
+ else
+ {
+ Subhead* subhead = new Subhead (menu, "subhead", i18n("NetworkManager is not running"), SmallIcon("stop", TQIconSet::Automatic));
+ menu->insertItem (subhead, -1, -1);
+ }
+
+ // Notifications
+ KAction* notif = actionCollection()->action("configure_notifications");
+ notif->plug(menu);
+
+ // Connection Editor
+ KAction* edit = actionCollection ()->action ("edit_connections");
+ edit->plug(menu);
+
+ // quit
+ menu->insertSeparator ();
+ KAction* quitAction = actionCollection ()->action (KStdAction::name (KStdAction::Quit));
+ if (quitAction)
+ quitAction->plug (menu);
+}
+
+
+void
+Tray::slotStateChanged(TQ_UINT32 state)
+{
+ NMState nm_state = (NMState) state;
+ // change tray icon according to NM's state
+ switch(nm_state)
+ {
+ case NM_STATE_UNKNOWN:
+ case NM_STATE_ASLEEP:
+ case NM_STATE_CONNECTING:
+ case NM_STATE_DISCONNECTED:
+ setPixmap (loadIcon ("knetworkmanager_disabled"));
+ break;
+ case NM_STATE_CONNECTED:
+ setPixmap (loadIcon ("knetworkmanager"));
+ break;
+ }
+ printf("NM state: %d\n\r", nm_state);
+}
+
+void
+Tray::enterEvent (TQEvent* /*e*/)
+{
+ // show tooltip
+ TQToolTip::remove (this);
+ TQString tooltip = "";
+
+ // build up the tooltip from all tray components
+ for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it)
+ {
+ TrayComponent* comp = *it;
+ if (comp->getToolTipText().isEmpty())
+ continue;
+ if (!tooltip.isEmpty())
+ tooltip += "\n\n";
+ tooltip += comp->getToolTipText().join("\n");
+ }
+ if (!tooltip.isEmpty())
+ TQToolTip::add (this, tooltip);
+}
+
+void
+Tray::slotVPNSecretsNeeded(ConnectionSettings::Connection* connection, ConnectionSettings::ConnectionSetting* setting, const TQStringList& hints, bool request_new)
+{
+#warning Implement Tray::slotVPNSecretsNeeded to handle parms properly
+ Q_UNUSED(hints);
+
+ Storage* storage = Storage::getInstance();
+ bool hasSecretsStored = storage->hasSecretsStored(connection, setting);
+
+ printf("Tray::slotVPNSecretsNeeded\n\r");
+ kdDebug() << "Tray::slotVPNSecretsNeeded" << endl;
+
+ // default secrets handling for all other connection types
+ // 1) if we have secrets stored, restore them and send them back to NM
+ // 2) if NM requests new secrets we should allow the user to retry the
+ // connection or to edit it
+
+ //if (hasSecretsStored && (!request_new))
+ if (hasSecretsStored)
+ {
+ printf("Tray::slotVPNSecretsNeeded: Restoring saved secrets\n\r");
+ // We have secrets stored, restore them
+// if (storage->restoreVPNSecrets(connection, setting))
+// {
+ int number_of_secrets_found = 0;
+ ConnectionSettings::VPNConnection* conn = dynamic_cast<ConnectionSettings::VPNConnection*>(connection);
+ TQString id = connection->getID();
+ TQString type = setting->getType();
+
+ printf("restoreVPNSecrets\n\r");
+ // ID is necessary
+ if (id.isEmpty()) {
+ printf("VPN connection ID is empty!\n\r");
+ }
+ else {
+ // Get a group for this setting
+ TQString setting_grp = TQString("ConnectionSecrets_%1_%2").tqarg(id).tqarg(type);
+
+ // Restore the settings
+ printf("Restoring VPN secret: %s\n\r", setting_grp.ascii());
+
+ KConfigGroup secrets_grp(KGlobal::config(), setting_grp);
+ TQMap<TQString, TQString> config_map = KGlobal::config()->entryMap(setting_grp);
+ TQString typetwo = secrets_grp.readEntry("Type");
+
+ // // get the appropriate setting from the connection
+ // ConnectionSetting* setting = conn->getSetting(typetwo);
+ // if (!setting)
+ // {
+ // printf("Secrets cannot be restored!\n\r");
+ // }
+
+ // Read the SettingsMap from kconfig
+ // This loop reads the secrets information map only
+ TQMap<TQString, TQString> map;
+ for(TQMap<TQString, TQString>::ConstIterator it = config_map.begin(); it != config_map.end(); ++it)
+ {
+ if (!it.key().startsWith("Value_"))
+ continue;
+
+ TQString key = it.key();
+ // Get the original key name
+ key.replace("Value_", "");
+
+ TQString xmldata = it.data();
+ // Remove the annoying XML <string> stuff
+ xmldata.replace("<string>", "");
+ xmldata.replace("</string>", "");
+ //printf("Got %s with value %s\n\r", key.ascii(), xmldata.ascii());
+ map.insert(key, xmldata);
+ number_of_secrets_found++;
+ }
+ if (number_of_secrets_found > 0) {
+ printf("Got secrets from file, continuing...\n\r");
+
+ // Good, we have new secrets now, update the settings
+ //map = _vpnAuthWidget->getPasswords();
+ ConnectionSetting* propcore = conn->getVPNSettingConnectionCore();
+ SettingsMap othersettingsmap = propcore->toMap();
+
+ // Pull the username and gateway out of map to stuff in the NM standard settings matrix
+ othersettingsmap.insert("user", TQT_DBusData::fromString(map["user"]));
+ map.erase("user");
+ othersettingsmap.insert("domain", TQT_DBusData::fromString(map["domain"]));
+ map.erase("domain");
+
+ if (!request_new) {
+ propcore->fromMap(othersettingsmap);
+ VPN* prop = dynamic_cast<VPN*>(propcore);
+ prop->setSecrets(map);
+ conn->slotSecretsProvided(prop);
+ }
+ else {
+ printf("Tray::slotVPNSecretsNeeded: New secrets requested\n\r");
+ // OK, NM requests new secrets...do something!
+ ConnectionSettings::VPNConnection* conn = dynamic_cast<ConnectionSettings::VPNConnection*>(connection);
+ VPNAuthenticationDialog* auth = new VPNAuthenticationDialog(conn, this, "vpnauth");
+ // Prefill the password dialog with cached credentials
+ TQString passdata;
+ for(TQMap<TQString, TQString>::ConstIterator it = map.begin(); it != map.end(); ++it)
+ {
+ passdata = it.data();
+ // Remove any non-typable characters from the string!
+ passdata.remove("\r");
+ passdata.remove("\n");
+ passdata.remove("\t");
+ //printf("Trying to set %s to value %s\n\r", it.key().ascii(), passdata.ascii());
+ auth->setPasswords(it.key(), passdata);
+ }
+ auth->show();
+ }
+
+ //connection->slotSecretsProvided(setting);
+ }
+ else {
+ printf("Tray::slotVPNSecretsNeeded: New secrets needed\n\r");
+ // OK, NM needs new secrets...do something!
+ ConnectionSettings::VPNConnection* conn = dynamic_cast<ConnectionSettings::VPNConnection*>(connection);
+ VPNAuthenticationDialog* auth = new VPNAuthenticationDialog(conn, this, "vpnauth");
+ auth->show();
+ }
+ }
+// }
+ }
+ else
+ {
+ printf("Tray::slotVPNSecretsNeeded: New secrets needed\n\r");
+ // OK, NM needs new secrets...do something!
+ ConnectionSettings::VPNConnection* conn = dynamic_cast<ConnectionSettings::VPNConnection*>(connection);
+ VPNAuthenticationDialog* auth = new VPNAuthenticationDialog(conn, this, "vpnauth");
+ auth->show();
+ }
+}
+
+void
+Tray::slotSecretsNeeded(ConnectionSettings::Connection* connection, ConnectionSettings::ConnectionSetting* setting, const TQStringList& hints, bool request_new)
+{
+ Storage* storage = Storage::getInstance();
+ bool hasSecretsStored = storage->hasSecretsStored(connection, setting);
+
+ // FIXME ugly secrets handling for VPN
+ if (connection->getType() == NM_SETTING_VPN_SETTING_NAME)
+ {
+ if (vpn_new_credentials_needed == 1) {
+ printf("VPN connection failed with bad credentials\n\r");
+ vpn_new_credentials_needed = 0;
+ request_new = 1;
+ }
+ slotVPNSecretsNeeded(connection, setting, hints, request_new);
+ return;
+ }
+
+ // default secrets handling for all other connection types
+ // 1) if we have secrets stored, restore them and send them back to NM
+ // 2) if NM requests new secrets we should allow the user to retry the
+ // connection or to edit it
+
+ if (hasSecretsStored && !request_new)
+ {
+ // We have secrets stored, restore them
+ if (storage->restoreSecrets(connection, setting))
+ {
+ connection->slotSecretsProvided(setting);
+ }
+ }
+ else
+ {
+ // ok, NM requests new secrets, let's ask the user if he wants to retry
+ // or edit the connection
+ NewSecretsDialog* dlg = new NewSecretsDialog(connection, this, "knetworkmanager");
+ dlg->show();
+ }
+}
+
+void Tray::slotAddDeviceTrayComponent(Device* dev)
+{
+ if (dev)
+ createDeviceTrayComponent(dev);
+}
+
+void Tray::slotRemoveDeviceTrayComponent(Device* dev)
+{
+ for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it)
+ {
+ DeviceTrayComponent* dev_comp = dynamic_cast<DeviceTrayComponent*>(*it);
+ if (!dev_comp)
+ continue;
+
+ if (dev_comp->device() == dev)
+ {
+ if (d->foregroundTrayComponent && dev_comp->device() == d->foregroundTrayComponent->device() ) {
+ d->foregroundTrayComponent = 0;
+ }
+
+ // remove the appropriate action
+ TQString actionName = TQString("new_connection_%1").tqarg(dev_comp->device()->getInterface());
+ KAction * deviceNewConnAction = actionCollection ()->action (actionName);
+
+ if (!deviceNewConnAction)
+ {
+ delete deviceNewConnAction;
+ deviceNewConnAction = NULL;
+ }
+ // remove device_tray and delete it
+ d->trayComponents.remove(it);
+ delete dev_comp;
+
+ if (contextMenu()->isVisible()) {
+ contextMenu()->hide();
+ }
+
+ break;
+ }
+ }
+}
+
+void Tray::createDeviceTrayComponent(Device* dev)
+{
+ bool trayExists = false;
+
+ if (!dev) return;
+
+ // check if we have already a trayicon for this device
+ for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it)
+ {
+ DeviceTrayComponent* dev_comp = dynamic_cast<DeviceTrayComponent*> (*it);
+ if (dev_comp)
+ if (dev_comp->device() == dev)
+ {
+ trayExists = true;
+ break;
+ }
+ }
+
+ // create the appropriate device tray icon
+ if (!trayExists)
+ {
+ DeviceTrayComponent* devTray = 0;
+ // different tray icons for different device types!
+ switch (dev->getDeviceType())
+ {
+#if NM_CHECK_VERSION(0,8,992)
+ case NM_DEVICE_TYPE_ETHERNET:
+#else
+ case DEVICE_TYPE_802_3_ETHERNET:
+#endif
+ devTray = new WiredDeviceTray(dynamic_cast<WiredDevice*>(dev), this, "wired_device_tray");
+ break;
+#if NM_CHECK_VERSION(0,8,992)
+ case NM_DEVICE_TYPE_WIFI:
+#else
+ case DEVICE_TYPE_802_11_WIRELESS:
+#endif
+ devTray = new WirelessDeviceTray(static_cast<WirelessDevice*>(dev), this, "wireless_device_tray");
+ break;
+#if NM_CHECK_VERSION(0,8,992)
+ case NM_DEVICE_TYPE_MODEM:
+#else
+ case DEVICE_TYPE_GSM:
+ case DEVICE_TYPE_CDMA:
+#endif
+ devTray = new CellularDeviceTray(static_cast<CellularDevice*>(dev), this, "cellular_device_tray");
+ break;
+ default:
+ kdWarning() << k_funcinfo << "UDI: " << dev->getUdi() << " has unknown devicetype: " << dev->getDeviceType() << endl;
+ }
+ if(devTray)
+ {
+ connect( devTray, TQT_SIGNAL(needsCenterStage(TrayComponent*,bool)),
+ TQT_SLOT(trayComponentNeedsCenterStage(TrayComponent*,bool)));
+ connect( devTray, TQT_SIGNAL(uiUpdated()), TQT_SLOT(trayUiChanged()));
+ d->trayComponents.append(devTray);
+ //WILLTODO: sort
+ }
+ }
+}
+
+void Tray::createVPNTrayComponent()
+{
+ bool trayExists = false;
+
+ // check if we have already a trayicon for this device
+ for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it)
+ {
+ VPNTrayComponent* vpn_comp = dynamic_cast<VPNTrayComponent*> (*it);
+ if (vpn_comp)
+ {
+ trayExists = true;
+ break;
+ }
+ }
+
+ // create the appropriate device tray icon
+ if (!trayExists)
+ {
+ TrayComponent* devTray = new VPNTrayComponent(this, "vpn_device_tray");
+ if(devTray)
+ {
+ d->trayComponents.append(devTray);
+ //WILLTODO: sort
+ }
+ }
+}
+
+void Tray::updateDeviceTrays()
+{
+ // create one tray-icon for each device
+ DeviceStore* store = DeviceStore::getInstance();
+ TQValueList<Device*> devices = store->getDevices();
+
+ // check for newly added devices
+ for (TQValueList<Device*>::iterator it = devices.begin(); it != devices.end(); ++it)
+ {
+ Device* dev = (*it);
+ if (dev)
+ createDeviceTrayComponent(dev);
+ else
+ kdWarning() << k_funcinfo << "got a NULL-Device" << endl;
+ }
+
+ // add the VPN componenet as it is not associated with a device
+ createVPNTrayComponent();
+}
+
+void Tray::mousePressEvent( TQMouseEvent *e )
+{
+ if ( !TQT_TQRECT_OBJECT(rect()).contains( e->pos() ) ) {
+ return;
+ }
+ switch ( e->button() ) {
+ case Qt::LeftButton:
+ contextMenuAboutToShow(contextMenu());
+ contextMenu()->popup(e->globalPos());
+ break;
+ default:
+ KSystemTray::mousePressEvent( e );
+ break;
+ }
+}
+
+void Tray::slotDeactivateConnection(int index)
+{
+ ConnectionSettings::Connection* conn = d->act_conn_map[index].first;
+ Device* dev = d->act_conn_map[index].second;
+ NMProxy* nm = NMProxy::getInstance();
+
+ if (conn) {
+ TQString actionText = conn->getObjectPath().data();
+ nm->deactivateConnection(conn, dev);
+ }
+}
+
+void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt)
+{
+ DeviceTrayComponent * dtc = dynamic_cast<DeviceTrayComponent*>(component);
+ if (dtc) {
+ kdDebug() << k_funcinfo << dtc->device()->getInterface() << " : " << needsIt << endl;
+ Device * device = dtc->device();
+ if (needsIt) {
+ if (d->foregroundTrayComponent) {
+ disconnect(d->foregroundTrayComponent->device(), TQT_SIGNAL(StateChanged(NMDeviceState)), this, 0 );
+ }
+ d->foregroundTrayComponent = dtc;
+ connect(device, TQT_SIGNAL(StateChanged(NMDeviceState)),
+ TQT_SLOT(slotUpdateDeviceState(NMDeviceState)));
+ } else {
+ disconnect(device, TQT_SIGNAL(StateChanged(NMDeviceState)), this, 0 );
+ //use active default
+ NMProxy* nm = NMProxy::getInstance();
+ device = nm->getDefaultDevice();
+ if ( device ) {
+ // identify the new foreground
+ for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it)
+ {
+ DeviceTrayComponent* newDtc = dynamic_cast<DeviceTrayComponent*> (*it);
+ if ( newDtc && newDtc->device() == device ) {
+ d->foregroundTrayComponent = newDtc;
+ break;
+ }
+ }
+ kdDebug() << " Device " << dtc->device()->getInterface() << " background, new foreground device: " << device->getInterface() << endl;
+ connect(device, TQT_SIGNAL(StateChanged(NMDeviceState)),
+ TQT_SLOT(slotUpdateDeviceState(NMDeviceState)));
+ slotUpdateDeviceState(device->getState());
+ }
+ }
+ }
+}
+
+void Tray::slotUpdateDeviceState()
+{
+ // FIXME
+}
+
+void Tray::slotUpdateDeviceState(NMDeviceState state)
+{
+ updateTrayIcon(state);
+ updateActiveConnection(state);
+}
+
+void Tray::trayUiChanged()
+{
+ DeviceTrayComponent * dtc = d->foregroundTrayComponent;
+ if (dtc) {
+ updateTrayIcon(dtc->device()->getState());
+ }
+}
+void Tray::updateTrayIcon(NMDeviceState state)
+{
+ // Get all active connections
+ char active_vpn=0;
+ char found_any_active_connection=0;
+
+ ConnectionStore* connectionStore = ConnectionStore::getInstance();
+ NMProxy* nm = NMProxy::getInstance();
+ TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > map = nm->getActiveConnectionsMap();
+
+ // get all available VPN Connections
+ TQValueList<Connection*> connections = connectionStore->getConnections(NM_SETTING_VPN_SETTING_NAME);
+ if (!connections.empty())
+ {
+ for (TQValueList<Connection*>::iterator it = connections.begin(); it != connections.end(); ++it)
+ {
+ VPNConnection* vpnconn = dynamic_cast<VPNConnection*>(*it);
+ if (vpnconn)
+ {
+ // VPN connection found :)
+ Info* info = vpnconn->getInfoSetting();
+
+ // lets create a nice name for this connection
+ if (info)
+ {
+ TQString title = info->getName();
+ for (TQValueList<TQPair<ConnectionSettings::Connection*, Device*> >::Iterator it = map.begin(); it != map.end(); ++it)
+ {
+ ConnectionSettings::GenericConnection* conn = dynamic_cast<ConnectionSettings::GenericConnection*>((*it).first);
+
+ if (conn) {
+ if (strcmp(info->getName(), conn->getInfoSetting()->getName()) == 0) {
+ active_vpn = 1;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ found_any_active_connection = 0;
+ // Get all active connections
+ TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > allconnmap = nm->getActiveConnectionsMap();
+ for (TQValueList<TQPair<ConnectionSettings::Connection*, Device*> >::Iterator it = allconnmap.begin(); it != allconnmap.end(); ++it)
+ {
+ ConnectionSettings::GenericConnection* conn = dynamic_cast<ConnectionSettings::GenericConnection*>((*it).first);
+
+ if (!conn)
+ continue;
+
+ // Found an active connection
+ found_any_active_connection = 1;
+ }
+
+// if (found_any_active_connection == 1) {
+// printf("Active connection found\n\r");
+// }
+
+ if ((current_vpn_state == NM_VPN_CONNECTION_STATE_FAILED) || (current_vpn_state == NM_VPN_CONNECTION_STATE_DISCONNECTED)) {
+ active_vpn = 0;
+ }
+
+ if (active_vpn == 0) {
+ // stop the old movie to avoid unnecessary wakups
+ DeviceTrayComponent * dtc = d->foregroundTrayComponent;
+
+ if (movie())
+ movie()->pause();
+
+ if ((dtc) && (found_any_active_connection == 1)) {
+
+ if (!dtc->movieForState(state).isNull())
+ {
+ // animation desired
+ int frame = -1;
+ if (movie())
+ frame = movie()->frameNumber();
+
+ // set the movie
+ setMovie(dtc->movieForState(state));
+
+ // start at the same frame as the movie before
+ if (frame > 0)
+ movie()->step(frame);
+
+ // start the animation
+ movie()->unpause();
+ }
+ else if (!dtc->pixmapForState(state).isNull())
+ setPixmap(dtc->pixmapForState(state));
+ else
+ setPixmap(loadIcon("knetworkmanager"));
+ }
+ else {
+ setPixmap(loadIcon("knetworkmanager"));
+ }
+ }
+ else {
+ printf("VPN state: %d\n\r", current_vpn_state);
+ //printf("Activated is: %d\n\r", NM_VPN_CONNECTION_STATE_ACTIVATED);
+ // stop the old movie to avoid unnecessary wakups
+ DeviceTrayComponent * dtc = d->foregroundTrayComponent;
+
+ if (movie())
+ movie()->pause();
+
+ if (dtc) {
+ if (current_vpn_state == NM_VPN_CONNECTION_STATE_ACTIVATED) {
+ setPixmap(loadIcon("nm_device_vpn"));
+ }
+ if ((current_vpn_state == NM_VPN_CONNECTION_STATE_PREPARE) || (current_vpn_state == NM_VPN_CONNECTION_STATE_NEED_AUTH) || (current_vpn_state == NM_VPN_CONNECTION_STATE_CONNECT) || (current_vpn_state == NM_VPN_CONNECTION_STATE_IP_CONFIG_GET)) {
+ int frame = -1;
+ if (movie())
+ frame = movie()->frameNumber();
+
+ // set the movie
+ if ((current_vpn_state == NM_VPN_CONNECTION_STATE_PREPARE) || (current_vpn_state == NM_VPN_CONNECTION_STATE_NEED_AUTH)) {
+ setMovie(TQMovie(KGlobal::iconLoader()->moviePath("nm_stage02_connecting_vpn", KIcon::Panel)));
+ }
+ if ((current_vpn_state == NM_VPN_CONNECTION_STATE_CONNECT) || (current_vpn_state == NM_VPN_CONNECTION_STATE_IP_CONFIG_GET)) {
+ setMovie(TQMovie(KGlobal::iconLoader()->moviePath("nm_stage03_connecting_vpn", KIcon::Panel)));
+ }
+
+ // start at the same frame as the movie before
+ if (frame > 0)
+ movie()->step(frame);
+
+ // start the animation
+ movie()->unpause();
+ }
+ }
+ }
+
+ nm_device_state_global = state;
+ //printf("Device state: %d\n\r", nm_device_state_global);
+}
+
+void Tray::updateActiveConnection(NMDeviceState state)
+{
+ if (state != NM_DEVICE_STATE_ACTIVATED)
+ return;
+
+ NMProxy* nm = NMProxy::getInstance();
+ if (d->foregroundTrayComponent) {
+ Connection* active_conn = nm->getActiveConnection(d->foregroundTrayComponent->device());
+ if (active_conn)
+ {
+ Info* info = dynamic_cast<Info*>(active_conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME));
+ if (info)
+ info->setTimestamp(TQDateTime::tqcurrentDateTime());
+ }
+ }
+}
+
+void Tray::slotDeviceAddedNotify(Device* dev)
+{
+ kdDebug() << "Tray::slotDeviceAddedNotify" << endl;
+ KNotifyClient::event( winId(), "knm-nm-device-added", i18n("New network device %1 found").tqarg(dev->getInterface()) );
+}
+
+void Tray::slotDeviceRemovedNotify(Device* dev)
+{
+ kdDebug() << "Tray::slotDeviceRemovedNotify" << endl;
+ KNotifyClient::event( winId(), "knm-nm-device-removed", i18n("Network device %1 removed").tqarg(dev->getInterface()) );
+}
+
+void Tray::slotVPNBannerShow(const TQString& vpnbanner)
+{
+ printf("VPN banner: %s\n\r", vpnbanner.ascii());
+ KNotifyClient::event(winId(), "knm-nm-vpn-banner", vpnbanner);
+}
+
+void Tray::slotStateChangedNotify(TQ_UINT32 state)
+{
+ NMState nm_state = (NMState) state;
+ // change tray icon according to NM's state
+ switch(nm_state)
+ {
+ case NM_STATE_CONNECTING:
+ KNotifyClient::event( winId(), "knm-nm-connecting", i18n("NetworkManager is connecting") );
+ break;
+ case NM_STATE_DISCONNECTED:
+ KNotifyClient::event( winId(), "knm-nm-disconnected", i18n("NetworkManager is now disconnected") );
+ break;
+ case NM_STATE_CONNECTED:
+ KNotifyClient::event( winId(), "knm-nm-connected", i18n("NetworkManager is now connected") );
+ break;
+ case NM_STATE_ASLEEP:
+ KNotifyClient::event( winId(), "knm-nm-sleeping", i18n("KNetworkManager Offline") );
+ break;
+ case NM_STATE_UNKNOWN:
+
+ default:
+ break;
+ }
+}
+
+void Tray::slotEditNotifications()
+{
+ KNotifyDialog::configure(this);
+}
+
+Tray::Tray () : KSystemTray ()
+{
+ d = new TrayPrivate(TQT_TQOBJECT(this));
+
+ connect(&d->signalMapper, TQT_SIGNAL(mapped(int)), this, TQT_SLOT(slotDeactivateConnection(int)));
+
+ setPixmap (loadIcon ("knetworkmanager"));
+ setMouseTracking (true);
+
+ // Actions used for plugging into the menu
+ new KAction (i18n ("Switch to offline mode"),
+ SmallIcon ("no", TQIconSet::Automatic), 0,
+ TQT_TQOBJECT(this), TQT_SLOT (slotOfflineMode()), actionCollection (), "offline_mode");
+
+ new KAction (i18n ("Switch to online mode"),
+ SmallIcon ("ok", TQIconSet::Automatic), 0,
+ TQT_TQOBJECT(this), TQT_SLOT (slotOnlineMode()), actionCollection (), "online_mode");
+
+ new KAction (i18n ("Disable Wireless"),
+ SmallIcon ("wireless_off", TQIconSet::Automatic), 0,
+ TQT_TQOBJECT(this), TQT_SLOT (slotDisableWireless()), actionCollection (), "disable_wireless");
+
+ new KAction (i18n ("Enable Wireless"),
+ SmallIcon ("wireless", TQIconSet::Automatic), 0,
+ TQT_TQOBJECT(this), TQT_SLOT (slotEnableWireless()), actionCollection (), "enable_wireless");
+
+ new KAction (i18n ("Edit Connections"),
+ SmallIcon ("edit", TQIconSet::Automatic), 0,
+ TQT_TQOBJECT(this), TQT_SLOT (slotEditConnections()), actionCollection (), "edit_connections");
+
+ new KAction (i18n ("Configure Notifications"),
+ SmallIcon ("knotify", TQIconSet::Automatic), 0,
+ TQT_TQOBJECT(this), TQT_SLOT (slotEditNotifications()), actionCollection (), "configure_notifications");
+
+ // this action is only connected when the menu is shown, hence the 0 receiver
+ new KAction (i18n ("New connection ..."),
+ SmallIcon ("filenew", TQIconSet::Automatic), 0,
+ TQT_TQOBJECT(this), 0, actionCollection (), "new_connection");
+
+ new KActionMenu (i18n ("New connection ..."),
+ SmallIcon ("filenew", TQIconSet::Automatic),
+ actionCollection(), "new_connection_menu");
+
+ new KActionMenu (i18n ("Deactivate connection..."),
+ SmallIcon ("no", TQIconSet::Automatic),
+ actionCollection (), "deactivate_menu");
+
+ // get notified when NM's state changes
+ NMProxy* nm = NMProxy::getInstance();
+ connect(nm, TQT_SIGNAL(StateChange(TQ_UINT32)), this, TQT_SLOT(slotStateChanged(TQ_UINT32)));
+
+ // get notifier when NM requests new secrets
+ ConnectionStore* cstore = ConnectionStore::getInstance();
+ connect(cstore, TQT_SIGNAL(SecretsNeeded(ConnectionSettings::Connection*, ConnectionSettings::ConnectionSetting*, const TQStringList&, bool)), this, TQT_SLOT(slotSecretsNeeded(ConnectionSettings::Connection*, ConnectionSettings::ConnectionSetting*, const TQStringList&, bool)));
+
+ // get notified about new/removed devices
+ DeviceStore* store = DeviceStore::getInstance();
+ connect(store, TQT_SIGNAL(DeviceStoreChanged()), this, TQT_SLOT(updateDeviceTrays()));
+ connect(store, TQT_SIGNAL(DeviceAdded(Device*)), this, TQT_SLOT(slotAddDeviceTrayComponent(Device*)));
+ connect(store, TQT_SIGNAL(DeviceRemoved(Device*)), this, TQT_SLOT(slotRemoveDeviceTrayComponent(Device*)));
+
+ // Notifications
+ connect(store, TQT_SIGNAL(DeviceAdded(Device*)), this, TQT_SLOT(slotDeviceAddedNotify(Device*)));
+ connect(store, TQT_SIGNAL(DeviceRemoved(Device*)), this, TQT_SLOT(slotDeviceRemovedNotify(Device*)));
+ connect(nm, TQT_SIGNAL(StateChange(TQ_UINT32)), this, TQT_SLOT(slotStateChangedNotify(TQ_UINT32)));
+
+
+ // initial setup of the device-trays
+ updateDeviceTrays();
+
+ TQT_DBusError err;
+ slotStateChanged(nm->getState(err));
+}
+
+Tray::~Tray ()
+{
+ delete d;
+}
+
+#include "knetworkmanager-tray.moc"
+
diff --git a/knetworkmanager-0.8/src/knetworkmanager-tray.h b/knetworkmanager-0.8/src/knetworkmanager-tray.h
new file mode 100644
index 0000000..d301386
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-tray.h
@@ -0,0 +1,140 @@
+/***************************************************************************
+ *
+ * knetworkmanager.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ * Alexander Naumov <[email protected]>, <[email protected]>
+ * Author: Timothy Pearson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_TRAY_H
+#define KNETWORKMANAGER_TRAY_H
+
+#include <tqmap.h>
+#include <tqtimer.h>
+
+#include <tqtooltip.h>
+#include <ksystemtray.h>
+#include <kuniqueapplication.h>
+#include <kpopupmenu.h>
+#include <kactionclasses.h>
+#include <kstdaction.h>
+#include <kstdguiitem.h>
+
+#include <tqdialog.h>
+#include <tqwidget.h>
+
+#include <tqlayout.h>
+#include <tqlabel.h>
+#include <tqcheckbox.h>
+#include <tqprogressbar.h>
+#include <tqguardedptr.h>
+
+#include "knetworkmanager.h"
+
+namespace ConnectionSettings
+{
+ class Connection;
+ class ConnectionSetting;
+}
+
+class TQMouseEvent;
+class TrayComponent;
+class TrayPrivate;
+class TQDialog;
+class TQPushButton;
+class TQLabel;
+
+class Tray : public KSystemTray
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+ Tray ();
+ ~Tray ();
+ static Tray* getInstance();
+ void contextMenuAboutToShow (KPopupMenu* menu);
+
+ signals:
+
+ public slots:
+ void slotOfflineMode();
+ void slotOnlineMode();
+ void slotEnableWireless();
+ void slotDisableWireless();
+ void slotEditConnections();
+
+ void slotStateChanged(TQ_UINT32 state);
+ void slotVPNSecretsNeeded(ConnectionSettings::Connection* connection, ConnectionSettings::ConnectionSetting* setting, const TQStringList& hints, bool request_new);
+ void slotSecretsNeeded(ConnectionSettings::Connection* connection, ConnectionSettings::ConnectionSetting* setting, const TQStringList& hints, bool request_new);
+
+ void slotDeviceAddedNotify(Device*);
+ void slotDeviceRemovedNotify(Device*);
+ void slotStateChangedNotify(TQ_UINT32 state);
+
+ void slotUpdateDeviceState();
+ void slotUpdateDeviceState(NMDeviceState);
+
+ void slotNewVPNConnection();
+ void slotVPNBannerShow(const TQString& vpnbanner);
+
+ protected slots:
+ void updateDeviceTrays();
+ void slotAddDeviceTrayComponent(Device*);
+ void slotRemoveDeviceTrayComponent(Device*);
+ void slotDeactivateConnection(int);
+ void trayComponentNeedsCenterStage(TrayComponent*, bool);
+ void trayUiChanged();
+ void slotEditNotifications();
+
+ private:
+ void updateTrayIcon(NMDeviceState);
+ void updateActiveConnection(NMDeviceState);
+ void mousePressEvent( TQMouseEvent *e );
+ void createVPNTrayComponent();
+ void createDeviceTrayComponent(Device*);
+ void enterEvent (TQEvent*);
+
+ TrayPrivate* d;
+
+};
+
+class NewSecretsDialog : public TQDialog
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+ NewSecretsDialog(ConnectionSettings::Connection* connection, TQWidget * parent, const char * name, bool modal = false, TQt::WFlags f = 0);
+ ~NewSecretsDialog();
+ void init();
+
+ public slots:
+ void slotDialogEdit();
+ void reject();
+
+ private:
+ ConnectionSettings::Connection* _connection;
+};
+
+#endif /* KNETWORKMANAGER_TRAY_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-vpn_connection.cpp b/knetworkmanager-0.8/src/knetworkmanager-vpn_connection.cpp
new file mode 100644
index 0000000..e15f2a9
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-vpn_connection.cpp
@@ -0,0 +1,85 @@
+/***************************************************************************
+ *
+ * knetworkmanager-vpn_connection.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqhostaddress.h>
+#include <tqvariant.h>
+#include <tqvaluelist.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQDbus headers */
+#include <tqdbusconnection.h>
+#include <tqdbusobjectpath.h>
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+#include <tqdbusvariant.h>
+
+/* NM headers */
+#include <NetworkManager.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-vpn_connection.h"
+#include "knetworkmanager-connection_setting.h"
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-connection_setting_ipv4.h"
+#include "knetworkmanager-connection_setting_vpn.h"
+#include "knetworkmanager-nmsettings.h"
+
+using namespace ConnectionSettings;
+
+/*
+ class VPNConnection
+*/
+VPNConnection::VPNConnection()
+ : GenericConnection(NM_SETTING_VPN_SETTING_NAME)
+{
+ // add all settings needed for a VPN connection
+ appendSetting(new VPN(this));
+
+ // TODO: Maybe IPv4 Setting?
+}
+
+VPN* VPNConnection::getVPNSetting() const
+{
+ return dynamic_cast<VPN*>(getSetting(NM_SETTING_VPN_SETTING_NAME));
+}
+
+ConnectionSetting* VPNConnection::getVPNSettingConnectionCore() const
+{
+ return getSetting(NM_SETTING_VPN_SETTING_NAME);
+}
+
+Connection* VPNConnection::duplicate()
+{
+ VPNConnection* conn = new VPNConnection();
+ conn->updateSettings(this);
+ return conn;
+}
+
+
+#include "knetworkmanager-vpn_connection.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-vpn_connection.h b/knetworkmanager-0.8/src/knetworkmanager-vpn_connection.h
new file mode 100644
index 0000000..af41b8f
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-vpn_connection.h
@@ -0,0 +1,54 @@
+/***************************************************************************
+ *
+ * knetworkmanager-vpn_connection.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_VPN_CONNECTION_H
+#define KNETWORKMANAGER_VPN_CONNECTION_H
+
+#include <tqmap.h>
+#include <tqobject.h>
+
+#include "knetworkmanager-generic_connection.h"
+#include "knetworkmanager-connection_setting.h"
+#include "knetworkmanager-connection_setting_vpn.h"
+
+class TQDBusObjectPath;
+
+namespace ConnectionSettings
+{
+
+ class VPN;
+
+ class VPNConnection : public GenericConnection
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ VPNConnection();
+
+ VPN* getVPNSetting() const;
+ ConnectionSetting* getVPNSettingConnectionCore() const;
+ Connection* duplicate();
+ };
+}
+#endif /* KNETWORKMANAGER_VPN_CONNECTION_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-vpn_device.cpp b/knetworkmanager-0.8/src/knetworkmanager-vpn_device.cpp
new file mode 100644
index 0000000..6093ecf
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-vpn_device.cpp
@@ -0,0 +1,75 @@
+/***************************************************************************
+ *
+ * knetworkmanager-vpn_device.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// KDE includes
+#include <kdebug.h>
+
+// TQt includes
+#include <tqhostaddress.h>
+
+// TQT_DBus includes
+#include <tqdbuserror.h>
+#include <tqdbusconnection.h>
+
+// NM includes
+#include <NetworkManager.h>
+#include <NetworkManagerVPN.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "knetworkmanager-vpn_device.h"
+#include "dbus/vpnconnectionproxy.h"
+#include "knetworkmanager-hal_device_proxy.h"
+
+class VPNDevicePrivate
+{
+public:
+ VPNDevicePrivate(TQString service, TQString obj_path)
+ : nmVPN(service, obj_path)
+ {}
+ ~VPNDevicePrivate() {}
+
+ DBus::VPNConnectionProxy nmVPN;
+};
+
+TQ_UINT32 VPNDevice::getState()
+{
+ TQT_DBusError err;
+ return d->nmVPN.getVpnState(err);
+}
+
+VPNDevice::VPNDevice (const TQString & obj_path)
+ : Device(obj_path)
+{
+ d = new VPNDevicePrivate(NM_DBUS_IFACE_SETTINGS_CONNECTION, obj_path);
+ d->nmVPN.setConnection(TQT_DBusConnection::systemBus());
+}
+
+VPNDevice::~VPNDevice ()
+{
+ delete d;
+}
+
+
+#include "knetworkmanager-vpn_device.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-vpn_device.h b/knetworkmanager-0.8/src/knetworkmanager-vpn_device.h
new file mode 100644
index 0000000..cf92d99
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-vpn_device.h
@@ -0,0 +1,53 @@
+/***************************************************************************
+ *
+ * knetworkmanager-wired_device.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_VPNDEVICE_H
+#define KNETWORKMANAGER_VPNDEVICE_H
+
+// std includes
+#include <stdint.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "knetworkmanager-device.h"
+
+class KNetworkManager;
+
+class VPNDevicePrivate;
+
+class VPNDevice : public Device
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ VPNDevice (const TQString & obj_path );
+ ~VPNDevice ();
+
+ TQ_UINT32 getState();
+
+ private:
+ VPNDevicePrivate * d;
+};
+
+#endif /* KNETWORKMANAGER_VPNDEVICE_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-vpn_plugin.cpp b/knetworkmanager-0.8/src/knetworkmanager-vpn_plugin.cpp
new file mode 100644
index 0000000..f56b221
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-vpn_plugin.cpp
@@ -0,0 +1,132 @@
+/***************************************************************************
+ *
+ * knetworkmanager-vpn_plugin.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ * Author: Timothy Pearson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// KDE includes
+#include <kdebug.h>
+
+// TQt includes
+#include <tqhostaddress.h>
+
+// TQT_DBus includes
+#include <tqdbuserror.h>
+#include <tqdbusconnection.h>
+#include <tqdbusobjectpath.h>
+
+// NM includes
+#include <NetworkManager.h>
+#include <NetworkManagerVPN.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "knetworkmanager-tray.h"
+#include "knetworkmanager-vpn_plugin.h"
+#include "dbus/vpnpluginproxy.h"
+#include "knetworkmanager-hal_device_proxy.h"
+#include "knetworkmanager-nm_proxy.h"
+
+#if !defined(NM_CHECK_VERSION)
+#define NM_CHECK_VERSION(x,y,z) 0
+#endif
+
+unsigned int current_vpn_state = 0;
+extern NMDeviceState nm_device_state_global;
+extern TQT_DBusObjectPath vpn_attempt_this_conn;
+unsigned char vpn_new_credentials_needed = 0;
+
+class VPNDBUSPluginPrivate
+{
+public:
+ VPNDBUSPluginPrivate(TQString service, TQString obj_path)
+ : nmVPNDBUS(service, obj_path)
+ {}
+ ~VPNDBUSPluginPrivate() {}
+
+ DBus::VPNPluginProxy nmVPNDBUS;
+};
+
+TQ_UINT32 VPNDBUSPlugin::getState()
+{
+ TQT_DBusError err;
+ return d->nmVPNDBUS.getState(err);
+}
+
+void VPNDBUSPlugin::slotStateChanged(TQ_UINT32 state)
+{
+ current_vpn_state = state+1;
+ Tray* tray = Tray::getInstance();
+ tray->slotUpdateDeviceState(nm_device_state_global);
+ //emit StateChanged((NMDeviceState)state);
+}
+
+void VPNDBUSPlugin::slotLoginBanner(const TQString& banner)
+{
+ Tray* tray = Tray::getInstance();
+ tray->slotVPNBannerShow(banner);
+}
+
+void VPNDBUSPlugin::slotFailure(TQ_UINT32 failure_reason)
+{
+ printf("VPN failure code %d\n\r", failure_reason);
+
+ if ((failure_reason == 0) || (failure_reason == 1) || (failure_reason == 2)) {
+ // Try to connect again using cached information; request new login though
+ printf("Reactivate VPN connection on default device\n\r");
+ vpn_new_credentials_needed = 1;
+ int id;
+ TQT_DBusError err;
+ NMProxy* nm = NMProxy::getInstance();
+ TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection();
+ TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn);
+#if NM_CHECK_VERSION(0,8,992)
+ nm->ActivateConnectionAsync(id,"org.freedesktop.NetworkManagerUserSettings", vpn_attempt_this_conn, device, act_conn, err);
+#else
+ nm->ActivateConnectionAsync(id,NM_DBUS_SERVICE_USER_SETTINGS, vpn_attempt_this_conn, device, act_conn, err);
+#endif
+ }
+}
+
+VPNDBUSPlugin::VPNDBUSPlugin ()
+ : TQObject()
+{
+ d = new VPNDBUSPluginPrivate(NM_VPN_DBUS_PLUGIN_INTERFACE, NM_VPN_DBUS_PLUGIN_PATH);
+ d->nmVPNDBUS.setConnection(TQT_DBusConnection::systemBus());
+
+ // Connect the state changed signal to the handler
+ connect(&(d->nmVPNDBUS), TQT_SIGNAL(StateChanged(TQ_UINT32)), this, TQT_SLOT(slotStateChanged(TQ_UINT32)));
+
+ // Connect the failure signal to the handler
+ connect(&(d->nmVPNDBUS), TQT_SIGNAL(Failure(TQ_UINT32)), this, TQT_SLOT(slotFailure(TQ_UINT32)));
+
+ // And the banner signal
+ connect(&(d->nmVPNDBUS), TQT_SIGNAL(LoginBanner(const TQString&)), this, TQT_SLOT(slotLoginBanner(const TQString&)));
+}
+
+VPNDBUSPlugin::~VPNDBUSPlugin ()
+{
+ delete d;
+}
+
+
+#include "knetworkmanager-vpn_plugin.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-vpn_plugin.h b/knetworkmanager-0.8/src/knetworkmanager-vpn_plugin.h
new file mode 100644
index 0000000..0b03d74
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-vpn_plugin.h
@@ -0,0 +1,62 @@
+/***************************************************************************
+ *
+ * knetworkmanager-wired_device.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ * Author: Timothy Pearson <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_VPNDBUSPLUGIN_H
+#define KNETWORKMANAGER_VPNDBUSPLUGIN_H
+
+// std includes
+#include <stdint.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+
+class KNetworkManager;
+
+class VPNDBUSPluginPrivate;
+
+class VPNDBUSPlugin : public TQObject
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ VPNDBUSPlugin ();
+ ~VPNDBUSPlugin ();
+
+ TQ_UINT32 getState();
+
+ private:
+ VPNDBUSPluginPrivate * d;
+
+// signals:
+// void StateChanged(NMDeviceState);
+
+ public slots:
+ void slotFailure(TQ_UINT32);
+ void slotStateChanged(TQ_UINT32);
+ void slotLoginBanner(const TQString&);
+// void slotDeactivate();
+};
+
+#endif /* KNETWORKMANAGER_VPNDBUSPLUGIN_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-vpnauthenticationdialog.cpp b/knetworkmanager-0.8/src/knetworkmanager-vpnauthenticationdialog.cpp
new file mode 100644
index 0000000..45ea830
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-vpnauthenticationdialog.cpp
@@ -0,0 +1,179 @@
+/***************************************************************************
+ *
+ * knetworkmanager-vpnauthenticationdialog.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include <stdlib.h>
+#include <kpushbutton.h>
+#include <tqbuttongroup.h>
+#include <tqcombobox.h>
+#include <tqmessagebox.h>
+#include <tqwidgetstack.h>
+#include <klineedit.h>
+#include <tqlabel.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <tqobjectlist.h>
+#include <tqcheckbox.h>
+#include <tqfocusdata.h>
+#include <kiconloader.h>
+#include <tqmap.h>
+
+#include <tqdbusobjectpath.h>
+#include <tqdbuserror.h>
+
+#include "knetworkmanager-vpnservice.h"
+#include "knetworkmanager-vpnmanager.h"
+#include "knetworkmanager-vpnauthenticationdialog.h"
+#include "knetworkmanager-vpn_connection.h"
+#include "knetworkmanager-nm_proxy.h"
+#include "knetworkmanager-connection_setting_vpn.h"
+#include "knetworkmanager-connection_setting_info.h"
+
+extern TQT_DBusObjectPath vpn_attempt_this_conn;
+
+using namespace ConnectionSettings;
+
+
+/*
+ * class VPNAuthenticationDialog
+ *
+ */
+VPNAuthenticationDialog::VPNAuthenticationDialog(VPNConnection* conn, TQWidget* parent, const char* name, bool modal, WFlags fl)
+ : AuthenticationDialog(parent, name, modal, fl)
+ , _conn(conn)
+{
+ this->setIcon(SmallIcon("encrypted", TQIconSet::Automatic));
+ this->setCaption(i18n("VPN Authentication for %1").tqarg(conn->getInfoSetting()->getName()));
+ labelPixmap->setPixmap(KGlobal::instance()->iconLoader()->loadIcon("encrypted", KIcon::Small, 32));
+
+ // nice icons
+ pushOK->setIconSet(SmallIcon("button_ok", TQIconSet::Automatic));
+ pushCancel->setIconSet(SmallIcon("button_cancel", TQIconSet::Automatic));
+
+ // we need the last widget in the focus queue
+ TQFocusData* foc = focusData();
+ TQWidget* lastFocusWidget = foc->last();
+
+ VPN* vpn = conn->getVPNSetting();
+ VPNService* vpnservice = VPNManager::getVPNService(vpn->getServiceType());
+
+ // get the appropriate plugin and create the authentication widget
+ VPNPlugin* vpnPlugin = vpnservice->getVPNPlugin();
+ if (vpnPlugin)
+ {
+ _vpnAuthWidget = vpnPlugin->CreateAuthenticationWidget(widgetStack);
+ if (_vpnAuthWidget)
+ {
+ _vpnAuthWidget->setVPNData(conn->getVPNSetting()->getRoutes(), conn->getVPNSetting()->getData());
+ widgetStack->raiseWidget(_vpnAuthWidget);
+ }
+ }
+
+ /*
+ the widgets inside the authenticationwidget are now in the focus queue
+ ==> we can now search the first widget inside the authenticationwidget
+ which has to get the focus
+ */
+ TQWidget* widget = foc->home();
+ for (int i = 0; i < foc->count(); ++i)
+ {
+ if (widget == lastFocusWidget)
+ {
+ // the next one is the first widget inside the authwidget
+ widget = foc->next();
+ break;
+ }
+ widget = foc->next();
+ }
+ if (widget)
+ widget->setFocus();
+
+ // resize
+ this->resize(tqminimumSizeHint());
+}
+
+VPNAuthenticationDialog::~VPNAuthenticationDialog()
+{
+
+}
+
+bool VPNAuthenticationDialog::close(bool alsoDelete)
+{
+ // no secrets provided, tell NM
+ _conn->slotSecretsError();
+ return AuthenticationDialog::close(alsoDelete);
+}
+
+void VPNAuthenticationDialog::ok()
+{
+ // Good, we have new secrets now, update the settings
+ TQMap<TQString, TQString> mypwds;
+
+ mypwds = _vpnAuthWidget->getPasswords();
+ ConnectionSetting* propcore = _conn->getVPNSettingConnectionCore();
+ SettingsMap othersettingsmap = propcore->toMap();
+
+ // Pull the username and gateway out of mypwds to stuff in the NM standard settings matrix
+ othersettingsmap.insert("user", TQT_DBusData::fromString(mypwds["user"]));
+ mypwds.erase("user");
+ othersettingsmap.insert("domain", TQT_DBusData::fromString(mypwds["domain"]));
+ mypwds.erase("domain");
+// othersettingsmap.erase("Commit to disk");
+// if (chkStorePasswordsPermanent->isChecked() == true) {
+// othersettingsmap.insert("Commit to disk", TQT_DBusData::fromString("true"));
+// }
+// else {
+// othersettingsmap.insert("Commit to disk", TQT_DBusData::fromString("false"));
+// }
+
+ propcore->fromMap(othersettingsmap);
+ VPN* prop = dynamic_cast<VPN*>(propcore);
+ prop->setSecrets(mypwds);
+ _conn->slotSecretsProvided(prop);
+ TQDialog::done(0);
+}
+
+void VPNAuthenticationDialog::setPasswords(TQString name, TQString value) {
+ if (value.length() > 0) {
+ chkStorePasswordsPermanent->setChecked(true);
+ _vpnAuthWidget->setPasswords(name, value);
+ }
+}
+
+void VPNAuthenticationDialog::cancel()
+{
+/*
+ TQStringList x;
+ emit done (true, x, false, false);
+ TQDialog::done(1);*/
+
+ printf("Attempting to deactivate VPN connection...\n\r");
+
+ // Disconnect the attempted connection
+ _conn->slotSecretsError();
+
+ // Quit the dialog
+ TQDialog::done(1);
+}
+
+#include "knetworkmanager-vpnauthenticationdialog.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-vpnauthenticationdialog.h b/knetworkmanager-0.8/src/knetworkmanager-vpnauthenticationdialog.h
new file mode 100644
index 0000000..59caf55
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-vpnauthenticationdialog.h
@@ -0,0 +1,69 @@
+/***************************************************************************
+ *
+ * knetworkmanager-authenticationdialog.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_VPNAUTHENTICATIONDIALOG_H
+#define KNETWORKMANAGER_VPNAUTHENTICATIONDIALOG_H
+
+#include <tqdir.h>
+#include <tqobject.h>
+#include <kprocess.h>
+#include <kconfig.h>
+
+#include "knetworkmanager.h"
+#include "vpnauthentication.h"
+#include "knetworkmanager-vpnplugin.h"
+#include "knetworkmanager-vpnmanager.h"
+
+class KNetworkManager;
+class ManageConnectionsDialog;
+class VPNService;
+
+namespace ConnectionSettings
+{
+ class VPNConnection;
+}
+
+class VPNAuthenticationDialog : public AuthenticationDialog
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ VPNAuthenticationDialog(ConnectionSettings::VPNConnection* conn = NULL, TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
+ ~VPNAuthenticationDialog();
+ void setPasswords(TQString name, TQString value);
+ virtual bool close(bool);
+
+ protected slots:
+ void ok();
+ void cancel();
+
+ private:
+ VPNAuthenticationWidget* _vpnAuthWidget;
+ ConnectionSettings::VPNConnection* _conn;
+
+ signals:
+ void done(bool, TQStringList &, bool, bool);
+};
+
+#endif /* KNETWORKMANAGER_VPNAUTHENTICATIONDIALOG_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-vpnmanager.cpp b/knetworkmanager-0.8/src/knetworkmanager-vpnmanager.cpp
new file mode 100644
index 0000000..5b7e64e
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-vpnmanager.cpp
@@ -0,0 +1,107 @@
+/***************************************************************************
+ *
+ * knetworkmanager-vpnmanager.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#define SERVICE_DIR "/etc/NetworkManager/VPN"
+
+#include <klocale.h>
+#include <tqdir.h>
+#include <kdebug.h>
+#include <kconfig.h>
+
+#include "knetworkmanager-vpnmanager.h"
+#include "knetworkmanager-vpnservice.h"
+#include "knetworkmanager-vpnplugin.h"
+
+/*
+ * class VPNManager
+ *
+ */
+VPNServiceList
+VPNManager::getVPNServices ()
+{
+ bool status = false;
+ VPNServiceList list;
+
+ TQDir serviceDir(SERVICE_DIR, TQString(), TQDir::Name|TQDir::IgnoreCase, TQDir::Files);
+ TQStringList services = serviceDir.entryList ().grep (".name", true);
+
+ if (services.count () > 0)
+ {
+ status = true;
+ // read in all available Services
+ for (TQStringList::Iterator i = services.begin (); i != services.end (); ++i) {
+ TQString service = SERVICE_DIR + TQString ("/") + *i;
+ KConfig* kconfig = new KConfig (service, true, true, "config");
+ kconfig->setGroup ("VPN Connection");
+
+kdDebug() << "VPN Service " << kconfig->readEntry ("name", TQString()).ascii() << endl;
+
+ // create new VPNService Object
+ VPNService* vpnservice = new VPNService(kconfig->readEntry ("name", TQString()), kconfig->readEntry ("service", TQString()), TQT_TQOBJECT(KNetworkManager::getInstance()));
+ if (!vpnservice->getVPNPlugin())
+ delete vpnservice;
+ else
+ list.push_back(vpnservice);
+ delete kconfig;
+ }
+ }
+
+ return list;
+}
+
+VPNService*
+VPNManager::getVPNService(TQString service_type)
+{
+ bool status = false;
+ VPNServiceList list;
+
+ TQDir serviceDir(SERVICE_DIR, TQString(), TQDir::Name|TQDir::IgnoreCase, TQDir::Files);
+ TQStringList services = serviceDir.entryList ().grep (".name", true);
+
+ if (services.count () > 0)
+ {
+ status = true;
+ // read in all available Services
+ for (TQStringList::Iterator i = services.begin (); i != services.end (); ++i) {
+ TQString service = SERVICE_DIR + TQString ("/") + *i;
+ KConfig* kconfig = new KConfig (service, true, true, "config");
+ kconfig->setGroup ("VPN Connection");
+
+ if (kconfig->readEntry ("service", TQString()) == service_type)
+ {
+ // create new VPNService Object
+ VPNService* vpnservice = new VPNService(kconfig->readEntry ("name", TQString()), kconfig->readEntry ("service", TQString()), TQT_TQOBJECT(KNetworkManager::getInstance()));
+ if (!vpnservice->getVPNPlugin())
+ delete vpnservice;
+ else
+ return vpnservice;
+ }
+ }
+ }
+ return NULL;
+
+}
+
+#include "knetworkmanager-vpnmanager.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-vpnmanager.h b/knetworkmanager-0.8/src/knetworkmanager-vpnmanager.h
new file mode 100644
index 0000000..2dfdb1b
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-vpnmanager.h
@@ -0,0 +1,53 @@
+/***************************************************************************
+ *
+ * knetworkmanager-vpnmanager.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Helmut Schaa <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_VPNMANAGER_H
+#define KNETWORKMANAGER_VPNMANAGER_H
+
+#include <NetworkManager/NetworkManager.h>
+#include <NetworkManager/NetworkManagerVPN.h>
+
+#include <tqobject.h>
+#include <tqguardedptr.h>
+
+#include "knetworkmanager.h"
+#include "knetworkmanager-vpnplugin.h"
+
+class KNetworkManager;
+class VPNService;
+
+typedef TQValueList<VPNService*> VPNServiceList;
+
+class VPNManager : public TQObject
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+ static VPNService* getVPNService(TQString);
+ static VPNServiceList getVPNServices ();
+};
+
+#endif /* KNETWORKMANAGER_VPNMANAGER_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-vpnplugin.cpp b/knetworkmanager-0.8/src/knetworkmanager-vpnplugin.cpp
new file mode 100644
index 0000000..02ef8fe
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-vpnplugin.cpp
@@ -0,0 +1,128 @@
+/***************************************************************************
+ *
+ * knetworkmanager-vpnplugin.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include <tqwidget.h>
+
+#include "knetworkmanager-vpnplugin.h"
+
+/***********************
+* class VPNConfigWidget
+***********************/
+
+VPNConfigWidget::~VPNConfigWidget()
+{
+
+}
+
+VPNConfigWidget::VPNConfigWidget(TQWidget* parent, const char* name)
+ : TQWidget(parent, name)
+{
+
+}
+
+void VPNConfigWidget::setVPNData(const TQStringList& /*routes*/, const TQMap<TQString, TQString>& /*properties*/)
+{
+
+}
+
+TQMap<TQString, TQString> VPNConfigWidget::getVPNProperties()
+{
+ return TQMap<TQString, TQString>();
+}
+
+TQStringList VPNConfigWidget::getVPNRoutes()
+{
+ return TQStringList();
+}
+
+bool VPNConfigWidget::hasChanged()
+{
+ return true;
+}
+
+bool VPNConfigWidget::isValid(TQStringList& /*err_msg*/)
+{
+ return true;
+}
+
+/******************************
+* class VPNAuthentiactionWidget
+******************************/
+
+VPNAuthenticationWidget::VPNAuthenticationWidget(TQWidget* parent, const char* name)
+ : TQWidget(parent, name)
+{
+
+}
+
+VPNAuthenticationWidget::~VPNAuthenticationWidget()
+{
+
+}
+
+TQMap<TQString, TQString> VPNAuthenticationWidget::getPasswords()
+{
+ return TQMap<TQString, TQString>();
+}
+
+void VPNAuthenticationWidget::setPasswords(TQString name, TQString value)
+{
+
+}
+
+void VPNAuthenticationWidget::setVPNData(const TQStringList& /*routes*/, const TQMap<TQString, TQString>& /*properties*/)
+{
+
+}
+
+bool VPNAuthenticationWidget::needsUserInteraction()
+{
+ return true;
+}
+
+/****************
+* class VPNPlugin
+****************/
+VPNPlugin::VPNPlugin(TQObject* parent, const char* name, const TQStringList& args)
+ : Plugin(parent, name, args)
+{
+
+}
+
+VPNPlugin::~VPNPlugin()
+{
+
+}
+
+VPNConfigWidget* VPNPlugin::CreateConfigWidget(TQWidget*)
+{
+ return NULL;
+}
+
+VPNAuthenticationWidget* VPNPlugin::CreateAuthenticationWidget(TQWidget*)
+{
+ return NULL;
+}
+
+#include "knetworkmanager-vpnplugin.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-vpnplugin.h b/knetworkmanager-0.8/src/knetworkmanager-vpnplugin.h
new file mode 100644
index 0000000..b8d91eb
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-vpnplugin.h
@@ -0,0 +1,79 @@
+/***************************************************************************
+ *
+ * knetworkmanager-vpnplugin.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_VPNPLUGIN_H
+#define KNETWORKMANAGER_VPNPLUGIN_H
+
+#include <tqwidget.h>
+#include <tqmap.h>
+#include <tqdbusdata.h>
+#include <tqdbusvariant.h>
+#include "knetworkmanager-plugin.h"
+
+#define KNETWORKMANAGER_VPNPLUGIN "KNetworkManager/VPNPlugin"
+
+class VPNConfigWidget : public TQWidget
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ virtual ~VPNConfigWidget();
+ VPNConfigWidget(TQWidget* parent = NULL, const char* name = NULL);
+
+ virtual void setVPNData(const TQStringList&, const TQMap<TQString,TQString>&);
+ virtual TQMap<TQString, TQString> getVPNProperties();
+ virtual TQStringList getVPNRoutes();
+ virtual bool hasChanged();
+ virtual bool isValid(TQStringList&);
+};
+
+class VPNAuthenticationWidget : public TQWidget
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ virtual ~VPNAuthenticationWidget();
+ VPNAuthenticationWidget(TQWidget* parent = NULL, const char* name = NULL);
+
+ virtual void setVPNData(const TQStringList&, const TQMap<TQString, TQString>&);
+ virtual TQMap<TQString, TQString> getPasswords();
+ virtual void setPasswords(TQString value, TQString data);
+ virtual bool needsUserInteraction();
+};
+
+class VPNPlugin : public Plugin
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ VPNPlugin(TQObject*, const char*, const TQStringList&);
+ virtual ~VPNPlugin();
+
+ virtual VPNConfigWidget* CreateConfigWidget(TQWidget* parent = 0);
+ virtual VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent = 0);
+};
+
+
+#endif /* KNETWORKMANAGER_VPNPLUGIN_H */
+
diff --git a/knetworkmanager-0.8/src/knetworkmanager-vpnservice.cpp b/knetworkmanager-0.8/src/knetworkmanager-vpnservice.cpp
new file mode 100644
index 0000000..b81a3db
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-vpnservice.cpp
@@ -0,0 +1,123 @@
+/***************************************************************************
+ *
+ * knetworkmanager-vpnservice.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#define SERVICE_DIR "/etc/NetworkManager/VPN"
+
+#include <stdlib.h>
+#include <kconfig.h>
+#include <tqdom.h>
+#include <tqdir.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kstddirs.h>
+#include <kprocess.h>
+#include <kconfig.h>
+#include <kplugininfo.h>
+
+#include "knetworkmanager-pluginmanager.h"
+#include "knetworkmanager-vpnservice.h"
+#include "knetworkmanager-vpnplugin.h"
+
+/*
+ * class VPNService
+ *
+ */
+
+VPNService::VPNService(const TQString& serviceName, const TQString& service, TQObject* parent, const char* name)
+ : TQObject(parent, name)
+{
+ _name = serviceName;
+ _service = service;
+ _vpnPlugin = NULL;
+
+ // query if a plugin for this vpn service is available
+ PluginManager* plugMan = PluginManager::getInstance();
+ if (plugMan)
+ {
+ TQStringList list = plugMan->getPluginList("KNetworkManager/VPNPlugin", "X-NetworkManager-Services", serviceName);
+ if (list.size() > 0)
+ {
+ // get the first VPN Plugin handling our VPNService
+ VPNPlugin* vpnPlugin = dynamic_cast<VPNPlugin*>( plugMan->getPlugin(list.first()) );
+ if (vpnPlugin)
+ {
+ kdDebug() << k_funcinfo << i18n("Using VPN plugin '%1' for service '%2'").tqarg(list.first()).tqarg(serviceName) << endl;
+ _vpnPlugin = vpnPlugin;
+ }
+ }
+ }
+}
+
+VPNService::~VPNService()
+{
+
+}
+
+TQString VPNService::getIcon()
+{
+ if (!_vpnPlugin.isNull())
+ {
+ PluginManager* plugMan = PluginManager::getInstance();
+ if (plugMan)
+ {
+ const KPluginInfo* info = plugMan->getPluginInfo(_vpnPlugin);
+ if (info)
+ {
+ TQString icon = info->icon();
+ if (!icon.isEmpty())
+ return icon;
+ }
+ }
+ }
+ return "encrypted";
+}
+
+VPNPlugin* VPNService::getVPNPlugin()
+{
+ return _vpnPlugin;
+}
+
+TQString VPNService::getService() const
+{
+ return _service;
+}
+
+TQString VPNService::getDisplayName() const
+{
+ const KPluginInfo* info = NULL;
+ PluginManager* plugMan = PluginManager::getInstance();
+ if (_vpnPlugin && plugMan)
+ if ( (info = plugMan->getPluginInfo(_vpnPlugin)) )
+ if (!info->name().isEmpty())
+ return info->name();
+ return _name;
+}
+
+TQString VPNService::getName() const
+{
+ return _name;
+}
+
+#include "knetworkmanager-vpnservice.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-vpnservice.h b/knetworkmanager-0.8/src/knetworkmanager-vpnservice.h
new file mode 100644
index 0000000..5c6eeb3
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-vpnservice.h
@@ -0,0 +1,63 @@
+/***************************************************************************
+ *
+ * knetworkmanager-vpnservice.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Helmut Schaa <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_VPN_SERVICE_H
+#define KNETWORKMANAGER_VPN_SERVICE_H
+
+#include <NetworkManager/NetworkManager.h>
+#include <NetworkManager/NetworkManagerVPN.h>
+
+#include <tqobject.h>
+#include <tqguardedptr.h>
+
+#include "knetworkmanager.h"
+#include "knetworkmanager-vpnplugin.h"
+
+class KNetworkManager;
+class VPNService;
+class KConfigGroup;
+
+class VPNService : public TQObject
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+ VPNService(const TQString& serviceName, const TQString& service, TQObject* parent, const char* name = 0);
+ ~VPNService();
+
+ TQString getDisplayName() const;
+ TQString getName() const;
+ TQString getService() const;
+ VPNPlugin* getVPNPlugin();
+ TQString getIcon();
+
+ private:
+ TQString _name;
+ TQString _service;
+ TQGuardedPtr<VPNPlugin> _vpnPlugin;
+};
+
+#endif /* KNETWORKMANAGER_VPN_SERVICE_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wired_connection.cpp b/knetworkmanager-0.8/src/knetworkmanager-wired_connection.cpp
new file mode 100644
index 0000000..6eff4ee
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wired_connection.cpp
@@ -0,0 +1,84 @@
+/***************************************************************************
+ *
+ * knetworkmanager-wired_connection.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqhostaddress.h>
+#include <tqvariant.h>
+#include <tqvaluelist.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQDbus headers */
+#include <tqdbusconnection.h>
+#include <tqdbusobjectpath.h>
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+#include <tqdbusvariant.h>
+
+/* NM headers */
+#include <NetworkManager.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-wired_connection.h"
+#include "knetworkmanager-connection_setting.h"
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-connection_setting_ipv4.h"
+#include "knetworkmanager-connection_setting_wired.h"
+#include "knetworkmanager-connection_setting_8021x.h"
+#include "knetworkmanager-nmsettings.h"
+
+using namespace ConnectionSettings;
+
+/*
+ class WiredConnection
+*/
+WiredConnection::WiredConnection()
+ : GenericConnection(NM_SETTING_WIRED_SETTING_NAME)
+{
+ // add all settings needed for a wired connection
+ appendSetting(new Wired(this));
+ appendSetting(new IPv4(this));
+}
+
+Wired* WiredConnection::getWiredSetting() const
+{
+ return dynamic_cast<Wired*>(getSetting(NM_SETTING_WIRED_SETTING_NAME));
+}
+
+IPv4* WiredConnection::getIPv4Setting() const
+{
+ return dynamic_cast<IPv4*>(getSetting("ipv4"));
+}
+
+Connection* WiredConnection::duplicate()
+{
+ WiredConnection* conn = new WiredConnection();
+ conn->updateSettings(this);
+ return conn;
+}
+
+#include "knetworkmanager-wired_connection.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wired_connection.h b/knetworkmanager-0.8/src/knetworkmanager-wired_connection.h
new file mode 100644
index 0000000..bf31212
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wired_connection.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ *
+ * knetworkmanager-wired_connection.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_WIRED_CONNECTION_H
+#define KNETWORKMANAGER_WIRED_CONNECTION_H
+
+#include <tqmap.h>
+#include <tqobject.h>
+#include <nm-setting-wired.h>
+
+#include "knetworkmanager-generic_connection.h"
+#include "knetworkmanager-connection_setting.h"
+
+class TQDBusObjectPath;
+
+namespace ConnectionSettings
+{
+
+ class Wired;
+ class IPv4;
+
+ class WiredConnection : public GenericConnection
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ WiredConnection();
+
+ Wired* getWiredSetting() const;
+ IPv4* getIPv4Setting() const;
+ Connection* duplicate();
+ };
+}
+#endif /* KNETWORKMANAGER_WIRED_CONNECTION_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wired_device.cpp b/knetworkmanager-0.8/src/knetworkmanager-wired_device.cpp
new file mode 100644
index 0000000..2a59d3d
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wired_device.cpp
@@ -0,0 +1,86 @@
+/***************************************************************************
+ *
+ * knetworkmanager-wired_device.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// KDE includes
+#include <kdebug.h>
+
+// TQt includes
+#include <tqhostaddress.h>
+
+// TQT_DBus includes
+#include <tqdbuserror.h>
+#include <tqdbusconnection.h>
+
+// NM includes
+#include <NetworkManager.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "knetworkmanager-wired_device.h"
+#include "dbus/wiredproxy.h"
+#include "knetworkmanager-hal_device_proxy.h"
+
+class WiredDevicePrivate
+{
+public:
+ WiredDevicePrivate(TQString service, TQString obj_path)
+ : nmWired(service, obj_path)
+ {}
+ ~WiredDevicePrivate() {}
+
+ DBus::WiredDeviceProxy nmWired;
+};
+
+TQString WiredDevice::getHwAddress()
+{
+ TQT_DBusError err;
+ return d->nmWired.getHwAddress(err);
+}
+
+TQ_UINT32 WiredDevice::getSpeed()
+{
+ TQT_DBusError err;
+ return d->nmWired.getSpeed(err);
+}
+
+bool WiredDevice::getCarrier() const
+{
+ TQT_DBusError err;
+ return d->nmWired.getCarrier(err);
+}
+
+WiredDevice::WiredDevice (const TQString & obj_path)
+ : Device(obj_path)
+{
+ d = new WiredDevicePrivate(NM_DBUS_SERVICE, obj_path);
+ d->nmWired.setConnection(TQT_DBusConnection::systemBus());
+}
+
+WiredDevice::~WiredDevice ()
+{
+ delete d;
+}
+
+
+#include "knetworkmanager-wired_device.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wired_device.h b/knetworkmanager-0.8/src/knetworkmanager-wired_device.h
new file mode 100644
index 0000000..98d3d3f
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wired_device.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ *
+ * knetworkmanager-wired_device.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_WIREDDEVICE_H
+#define KNETWORKMANAGER_WIREDDEVICE_H
+
+// std includes
+#include <stdint.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "knetworkmanager-device.h"
+
+class KNetworkManager;
+
+class WiredDevicePrivate;
+
+class WiredDevice : public Device
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ WiredDevice (const TQString & obj_path );
+ ~WiredDevice ();
+
+ TQString getHwAddress();
+ TQ_UINT32 getSpeed();
+ bool getCarrier() const;
+
+ private:
+ WiredDevicePrivate * d;
+};
+
+#endif /* KNETWORKMANAGER_WIREDDEVICE_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wired_device_tray.cpp b/knetworkmanager-0.8/src/knetworkmanager-wired_device_tray.cpp
new file mode 100644
index 0000000..328b01d
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wired_device_tray.cpp
@@ -0,0 +1,162 @@
+/***************************************************************************
+ *
+ * knetworkmanager-wired_device_tray.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// TQt includes
+#include <tqevent.h>
+#include <tqvbox.h>
+#include <tqlayout.h>
+#include <tqpushbutton.h>
+#include <tqbitmap.h>
+#include <tqimage.h>
+#include <tqpixmap.h>
+#include <tqpixmapcache.h>
+#include <tqpainter.h>
+#include <tqstyle.h>
+#include <tqstring.h>
+
+// KDE includes
+#include <kdebug.h>
+#include <klocale.h>
+#include <kiconloader.h>
+
+// TQt DBus
+#include <tqdbusobjectpath.h>
+
+
+// KNM includes
+#include "knetworkmanager-wired_device_tray.h"
+#include "knetworkmanager-wired_device.h"
+#include "knetworkmanager-menuitem.h"
+#include "knetworkmanager-menu_subhead.h"
+#include "knetworkmanager-connection_store.h"
+#include "knetworkmanager-wired_connection.h"
+#include "knetworkmanager-nm_proxy.h"
+
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-connection_setting_ipv4.h"
+#include "knetworkmanager-connection_setting_wired.h"
+#include "knetworkmanager-connection_settings_dialog.h"
+
+using namespace ConnectionSettings;
+
+class WiredDeviceTrayPrivate
+{
+ public:
+ WiredDeviceTrayPrivate() {}
+ ~WiredDeviceTrayPrivate() {}
+
+ WiredDevice* dev;
+};
+
+void WiredDeviceTray::newConnection()
+{
+ // create a new wired connection
+ Connection* conn = new WiredConnection();
+
+ // edit the new connection
+ ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, tray(), "connect_something", false, TQt::WDestructiveClose);
+ dlg->show();
+}
+
+
+void WiredDeviceTray::addMenuItems(KPopupMenu* menu)
+{
+ ConnectionStore* connectionStore = ConnectionStore::getInstance();
+
+ // device title
+ Subhead* subhead = new Subhead (menu, "subhead", TQString("Wired Connection (%1)").tqarg(d->dev->getInterface()), SmallIcon("wired", TQIconSet::Automatic));
+ menu->insertItem (subhead, -1, -1);
+
+ // bolding subhead instead
+ //menu->insertSeparator();
+
+ if (!d->dev->getCarrier())
+ {
+ // no carrier -> do not show any connections
+ subhead = new Subhead(menu, "subhead2", i18n("Cable disconnected"), SmallIcon("no", TQIconSet::Automatic));
+ menu->insertItem(subhead, -1, -1);
+ }
+ else
+ {
+ NMProxy* nm = NMProxy::getInstance();
+ Connection* active_conn = nm->getActiveConnection(d->dev);
+ if (active_conn)
+ kdDebug() << active_conn->getObjectPath().data() << endl;
+
+ // get all available Connections for wired devices
+ TQValueList<Connection*> connections = connectionStore->getConnections(NM_SETTING_WIRED_SETTING_NAME);
+ int connectionItems = 0;
+ for (TQValueList<Connection*>::iterator it = connections.begin(); it != connections.end(); ++it)
+ {
+ WiredConnection* wiredconn = dynamic_cast<WiredConnection*>(*it);
+ if (wiredconn)
+ {
+ // wired connection found :)
+ Info* info = wiredconn->getInfoSetting();
+ IPv4* ip = wiredconn->getIPv4Setting();
+
+ // lets create a nice name for this connection
+ if (info)
+ {
+ TQString title = info->getName();
+ if (ip)
+ title += TQString(" (%1)").tqarg(ip->getMethod() == IPv4::METHOD_DHCP ? i18n("DHCP") : i18n("Manual IP config"));
+
+ NetworkMenuItem* item = new NetworkMenuItem(d->dev, wiredconn, TQT_TQOBJECT(menu));
+ connectionItems += 1;
+
+ int id = menu->insertItem(title, item, TQT_SLOT(slotActivate()));
+ menu->setItemChecked(id, ((*it) == active_conn));
+ }
+ }
+ }
+
+ if ( connectionItems == 0) {
+ // menu->insertSeparator();
+ int id = menu->insertItem(SmallIcon("filenew", TQIconSet::Automatic), i18n("Create new wired connection"), this, TQT_SLOT(newConnection()));
+ }
+ // bring the device down
+ KAction* deactivate = tray()->actionCollection()->action("deactivate_device");
+ if (deactivate)
+ deactivate->plug(menu);
+
+ }
+}
+
+WiredDeviceTray::WiredDeviceTray (WiredDevice* dev, KSystemTray * parent, const char * name )
+ : DeviceTrayComponent (dev, parent, name)
+{
+ d = new WiredDeviceTrayPrivate();
+ d->dev = dev;
+
+ setPixmapForState(NM_DEVICE_STATE_ACTIVATED, "nm_device_wired");
+
+}
+
+WiredDeviceTray::~WiredDeviceTray ()
+{
+ delete d;
+}
+
+#include "knetworkmanager-wired_device_tray.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wired_device_tray.h b/knetworkmanager-0.8/src/knetworkmanager-wired_device_tray.h
new file mode 100644
index 0000000..113f684
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wired_device_tray.h
@@ -0,0 +1,57 @@
+/***************************************************************************
+ *
+ * knetworkmanager.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_WIRED_DEVICE_TRAY_H
+#define KNETWORKMANAGER_WIRED_DEVICE_TRAY_H
+
+// KNM includes
+#include "devicetraycomponent.h"
+
+#include "knetworkmanager.h"
+
+// predefs
+class WiredDevice;
+class WiredDeviceTrayPrivate;
+
+class WiredDeviceTray : public DeviceTrayComponent
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+ WiredDeviceTray (WiredDevice*, KSystemTray * parent = 0, const char * name = 0);
+ ~WiredDeviceTray ();
+
+ void addMenuItems(KPopupMenu* menu);
+
+ public slots:
+ void newConnection();
+
+ private:
+ WiredDeviceTrayPrivate* d;
+};
+
+#endif /* KNETWORKMANAGER_WIRED_DEVICE_TRAY_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wireless_connection.cpp b/knetworkmanager-0.8/src/knetworkmanager-wireless_connection.cpp
new file mode 100644
index 0000000..b11879f
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wireless_connection.cpp
@@ -0,0 +1,94 @@
+/***************************************************************************
+ *
+ * knetworkmanager-wireless_connection.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+/* qt headers */
+#include <tqhostaddress.h>
+#include <tqvariant.h>
+#include <tqvaluelist.h>
+
+/* kde headers */
+#include <kdebug.h>
+#include <klocale.h>
+
+/* TQDbus headers */
+#include <tqdbusconnection.h>
+#include <tqdbusobjectpath.h>
+#include <tqdbusdata.h>
+#include <tqdbusdatamap.h>
+#include <tqdbusvariant.h>
+
+/* NM headers */
+#include <NetworkManager.h>
+
+/* knetworkmanager headers */
+#include "knetworkmanager.h"
+#include "knetworkmanager-wireless_connection.h"
+#include "knetworkmanager-connection_dbus.h"
+#include "knetworkmanager-connection_secrets_dbus.h"
+#include "knetworkmanager-connection_setting.h"
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-connection_setting_ipv4.h"
+#include "knetworkmanager-connection_setting_wireless.h"
+#include "knetworkmanager-connection_setting_wireless_security.h"
+#include "knetworkmanager-connection_setting_8021x.h"
+#include "knetworkmanager-nmsettings.h"
+
+using namespace ConnectionSettings;
+
+/*
+ class WirelessConnection
+*/
+WirelessConnection::WirelessConnection()
+ : GenericConnection(NM_SETTING_WIRELESS_SETTING_NAME)
+{
+ // create all settings needed for a wireless connection
+ appendSetting(new IPv4(this));
+ appendSetting(new Wireless(this));
+ appendSetting(new WirelessSecurity(this));
+ appendSetting(new IEEE8021x(this));
+}
+
+Wireless* WirelessConnection::getWirelessSetting() const
+{
+ return dynamic_cast<Wireless*>(getSetting(NM_SETTING_WIRELESS_SETTING_NAME));
+}
+
+WirelessSecurity* WirelessConnection::getWirelessSecuritySetting() const
+{
+ return dynamic_cast<WirelessSecurity*>(getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME));
+}
+
+IPv4* WirelessConnection::getIPv4Setting() const
+{
+ return dynamic_cast<IPv4*>(getSetting(NM_SETTING_IP4_CONFIG_SETTING_NAME));
+}
+
+Connection* WirelessConnection::duplicate()
+{
+ WirelessConnection* conn = new WirelessConnection();
+ conn->updateSettings(this);
+ return conn;
+}
+
+#include "knetworkmanager-wireless_connection.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wireless_connection.h b/knetworkmanager-0.8/src/knetworkmanager-wireless_connection.h
new file mode 100644
index 0000000..b57815f
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wireless_connection.h
@@ -0,0 +1,59 @@
+/***************************************************************************
+ *
+ * knetworkmanager-wireless_connection.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_WIRELESS_CONNECTION_H
+#define KNETWORKMANAGER_WIRELESS_CONNECTION_H
+
+#include <tqmap.h>
+#include <tqobject.h>
+#include <nm-setting-wireless.h>
+
+#include "knetworkmanager-generic_connection.h"
+#include "knetworkmanager-connection_setting.h"
+
+class TQDBusObjectPath;
+namespace ConnectionSettings
+{
+
+ class Info;
+ class Wireless;
+ class WirelessSecurity;
+ class IPv4;
+
+ typedef TQMap<TQString, SettingsMap> ConnectionMap;
+
+ class WirelessConnection : public GenericConnection
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ WirelessConnection();
+
+ Wireless* getWirelessSetting() const;
+ WirelessSecurity* getWirelessSecuritySetting() const;
+ IPv4* getIPv4Setting() const;
+ Connection* duplicate();
+ };
+}
+#endif /* KNETWORKMANAGER_WIRELESS_CONNECTION_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wireless_device.cpp b/knetworkmanager-0.8/src/knetworkmanager-wireless_device.cpp
new file mode 100644
index 0000000..554f797
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wireless_device.cpp
@@ -0,0 +1,207 @@
+/***************************************************************************
+ *
+ * knetworkmanager-device.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// NM includes
+#include <NetworkManager.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "knetworkmanager-wireless_device.h"
+#include "dbus/accesspointproxy.h"
+#include "dbus/wirelessproxy.h"
+#include "knetworkmanager-accesspoint.h"
+
+// KDE includes
+#include <kdebug.h>
+
+// TQt includes
+#include <tqhostaddress.h>
+#include <tqmap.h>
+#include <tqvaluelist.h>
+
+// TQt-Dbus includes
+#include <tqdbusconnection.h>
+#include <tqdbuserror.h>
+#include <tqdbusobjectpath.h>
+
+class WirelessDevicePrivate
+{
+public:
+ WirelessDevicePrivate(TQString service, TQString obj_path)
+ : nmWireless(service, obj_path)
+ {}
+
+ ~WirelessDevicePrivate()
+ {
+ // cleanup the AP-list
+ for (TQMap<TQT_DBusObjectPath, AccessPoint*>::Iterator it = aps.begin(); it != aps.end(); ++it)
+ {
+ AccessPoint* p = it.data();
+ delete p;
+ }
+ }
+
+ DBus::WirelessDeviceProxy nmWireless;
+ TQMap<TQT_DBusObjectPath, AccessPoint *> aps;
+};
+
+WirelessDevice::WirelessDevice (const TQString & obj_path)
+ : Device(obj_path)
+{
+ d = new WirelessDevicePrivate(NM_DBUS_SERVICE, obj_path);
+ d->nmWireless.setConnection(TQT_DBusConnection::systemBus());
+
+ // get notified when the devices properties change
+ connect(&(d->nmWireless), TQT_SIGNAL(PropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)), this, TQT_SLOT(slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)));
+ connect(&(d->nmWireless), TQT_SIGNAL(AccessPointAdded(const TQT_DBusObjectPath&)), this, TQT_SLOT(slotAccessPointAdded(const TQT_DBusObjectPath&)));
+ connect(&(d->nmWireless), TQT_SIGNAL(AccessPointRemoved(const TQT_DBusObjectPath&)), this, TQT_SLOT(slotAccessPointRemoved(const TQT_DBusObjectPath&)));
+}
+
+WirelessDevice::~WirelessDevice ()
+{
+ delete d;
+}
+
+void WirelessDevice::slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>& properties)
+{
+ // TODO: optimization: emit different signals for each property
+ emit propertiesChanged();
+}
+
+void WirelessDevice::slotAccessPointAdded(const TQT_DBusObjectPath& obj_path)
+{
+ AccessPoint* ap = 0;
+
+ if ( !d->aps.contains(obj_path)) {
+ // we do not know this AP yet, add it to the list
+ ap = new AccessPoint(obj_path, this, "access_point_object");
+ d->aps.insert(obj_path, ap);
+ }
+ else
+ ap = d->aps[obj_path];
+
+ // notify about the new accesspoint
+ emit accessPointAdded(ap);
+}
+
+void WirelessDevice::slotAccessPointRemoved(const TQT_DBusObjectPath& obj_path)
+{
+ AccessPoint* ap = 0;
+
+ if ( d->aps.contains(obj_path)) {
+ ap = d->aps[obj_path];
+
+ // notify about the AP removal
+ emit accessPointRemoved(obj_path);
+
+ // remove the appropriate AP from our list
+ d->aps.remove(obj_path);
+ delete ap;
+ }
+ else
+ {
+ // nothing we can do here
+ kdDebug() << k_funcinfo << "NM requests removal of unknown AP " << obj_path << endl;
+ }
+}
+
+TQValueList<AccessPoint*> WirelessDevice::accessPoints()
+{
+ // update our AP list
+ if (d->aps.isEmpty()) {
+ updateAPList();
+ }
+
+ return d->aps.values();
+}
+
+void WirelessDevice::updateAPList()
+{
+ TQT_DBusError err;
+ TQValueList<TQT_DBusObjectPath> aps;
+
+ // get the APs from NM
+ if (d->nmWireless.GetAccessPoints(aps, err))
+ {
+ // for each AP
+ for (TQValueList<TQT_DBusObjectPath>::iterator it = aps.begin(); it != aps.end(); ++it)
+ {
+ // create an AP-object for each objectpath
+ if (d->aps.contains(*it)) {
+ continue;
+ }
+ AccessPoint* ap = new AccessPoint(*it, this, "access_point_object");
+ d->aps.insert(*it, ap);
+ }
+ }
+ else
+ kdWarning() << k_funcinfo << "Could not get a list of wireless accesspoints over DBus." << endl;
+
+}
+
+TQValueList<AccessPoint*> WirelessDevice::accessPointsForEssid( TQByteArray essid)
+{
+ TQValueList<AccessPoint*> aps;
+ // the DBus proxy is shared
+ for (TQMap<TQT_DBusObjectPath, AccessPoint*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
+ {
+ AccessPoint * ap = it.data();
+ if (essid.isNull() || (ap && ap->getSsidByteArray() == essid))
+ aps.append(ap);
+ }
+ return aps;
+}
+
+AccessPoint * WirelessDevice::getActiveAccessPoint()
+{
+ TQT_DBusError err;
+ TQT_DBusObjectPath obj_path;
+
+ AccessPoint * ap = 0;
+ //fixme, listen to signal and use cached value
+ obj_path = d->nmWireless.getActiveAccessPoint(err);
+ if (!obj_path.isEmpty()) {
+ if (d->aps.contains(obj_path)) {
+ ap = d->aps[obj_path];
+ } else {
+ kdWarning() << k_funcinfo << "No object for active access point found!" << endl;
+ }
+ }
+ return ap;
+}
+
+TQ_UINT32 WirelessDevice::getWirelessCapabilities() const
+{
+ TQT_DBusError err;
+ return d->nmWireless.getWirelessCapabilities(err);
+}
+
+TQ_UINT32 WirelessDevice::getBitrate() const
+{
+ TQT_DBusError err;
+ return d->nmWireless.getBitrate(err);
+}
+
+#include "knetworkmanager-wireless_device.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wireless_device.h b/knetworkmanager-0.8/src/knetworkmanager-wireless_device.h
new file mode 100644
index 0000000..4cfe9ce
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wireless_device.h
@@ -0,0 +1,70 @@
+/***************************************************************************
+ *
+ * knetworkmanager-device.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_WIRELESS_DEVICE_H
+#define KNETWORKMANAGER_WIRELESS_DEVICE_H
+
+#include "knetworkmanager.h"
+#include "knetworkmanager-device.h"
+
+#include <stdint.h>
+
+#include <tqdbusvariant.h>
+
+class KNetworkManager;
+class AccessPoint;
+class WirelessDevicePrivate;
+
+class WirelessDevice : public Device
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ WirelessDevice (const TQString & obj_path );
+ ~WirelessDevice ();
+
+ TQ_UINT32 getWirelessCapabilities() const;
+ TQValueList<AccessPoint*> accessPointsForEssid(TQByteArray essid = TQByteArray());
+ TQValueList<AccessPoint*> accessPoints();
+ AccessPoint * getActiveAccessPoint();
+ TQ_UINT32 getBitrate() const;
+
+ public slots:
+ void slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>& properties);
+ void slotAccessPointAdded(const TQT_DBusObjectPath&);
+ void slotAccessPointRemoved(const TQT_DBusObjectPath&);
+
+ signals:
+ void propertiesChanged();
+ void accessPointAdded(AccessPoint *);
+ void accessPointRemoved(const TQString &);
+
+ private:
+ void updateAPList();
+
+ WirelessDevicePrivate * d;
+};
+
+#endif /* KNETWORKMANAGER_WIRELESS_DEVICE_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wireless_device_tray.cpp b/knetworkmanager-0.8/src/knetworkmanager-wireless_device_tray.cpp
new file mode 100644
index 0000000..9bf44ed
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wireless_device_tray.cpp
@@ -0,0 +1,391 @@
+/***************************************************************************
+ *
+ * knetworkmanager-wireless_device_tray.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// TQt includes
+#include <tqevent.h>
+#include <tqvbox.h>
+#include <tqlayout.h>
+#include <tqpushbutton.h>
+#include <tqbitmap.h>
+#include <tqimage.h>
+#include <tqpixmap.h>
+#include <tqpixmapcache.h>
+#include <tqpainter.h>
+#include <tqstyle.h>
+#include <tqstring.h>
+#include <tqguardedptr.h>
+
+// KDE includes
+#include <kdebug.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <knotifyclient.h>
+
+// QT DBus
+#include <tqdbuserror.h>
+#include <tqdbusobjectpath.h>
+
+// KNM includes
+#include "knetworkmanager-wireless_device_tray.h"
+#include "knetworkmanager-wireless_device.h"
+#include "knetworkmanager-wireless_menuitem.h"
+#include "knetworkmanager-wireless_network.h"
+#include "knetworkmanager-accesspoint.h"
+#include "knetworkmanager-menu_subhead.h"
+#include "knetworkmanager-connection_store.h"
+#include "knetworkmanager-wireless_connection.h"
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-connection_setting_wireless.h"
+#include "knetworkmanager-connection_setting_wireless_security.h"
+#include "knetworkmanager-nm_proxy.h"
+#include "knetworkmanager-wireless_manager.h"
+#include "knetworkmanager-connection_settings_dialog.h"
+
+using namespace ConnectionSettings;
+
+extern char use_new_wireless_essid;
+extern TQByteArray new_wireless_essid;
+
+class WirelessDeviceTrayPrivate
+{
+ public:
+ WirelessDeviceTrayPrivate() :dev(0), activeAccessPoint(0) { }
+ ~WirelessDeviceTrayPrivate() {}
+
+ WirelessDevice* dev;
+ TQGuardedPtr<AccessPoint> activeAccessPoint;
+};
+
+TQStringList WirelessDeviceTray::getToolTipText()
+{
+ TQStringList tooltip = DeviceTrayComponent::getToolTipText();
+
+ AccessPoint * ap = d->dev->getActiveAccessPoint();
+ if (ap)
+ tooltip.append(i18n("Network: %1").tqarg(ap->getDisplaySsid()));
+
+ return tooltip;
+}
+
+void WirelessDeviceTray::newConnection()
+{
+ // create a new wireless connection
+ Connection* conn = new WirelessConnection();
+
+ // open a dialog for editing the connection
+ use_new_wireless_essid = 0; // deactivate autofill for now
+ ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, tray(), "connect_something", false, TQt::WDestructiveClose);
+ dlg->show();
+}
+
+bool WirelessDeviceTray::findMatchingNetwork(const WirelessConnection* conn, const TQValueList<WirelessNetwork>& nets, WirelessNetwork& net)
+{
+ Wireless* wireless = conn->getWirelessSetting();
+ WirelessSecurity* security = conn->getWirelessSecuritySetting();
+
+ if (!wireless && !security)
+ return false;
+
+ for (TQValueList<WirelessNetwork>::ConstIterator it = nets.begin(); it != nets.end(); ++it)
+ {
+ if (wireless->getEssid() == (*it).getSsid())
+ {
+ net = *it;
+ return true;
+ }
+ }
+ return false;
+}
+
+WirelessConnection* WirelessDeviceTray::findMatchingConnection(const WirelessNetwork& net, const TQValueList<WirelessConnection*>& connections)
+{
+ // try to find a connection matching this network
+ for (TQValueList<WirelessConnection*>::ConstIterator it = connections.begin(); it != connections.end(); ++it)
+ {
+ Wireless* wireless = (*it)->getWirelessSetting();
+ WirelessSecurity* security = (*it)->getWirelessSecuritySetting();
+
+ // should not happen but its ever better to check
+ if (!wireless || !security)
+ continue;
+
+ if (wireless->getEssid() == net.getSsid())
+ {
+ return *it;
+ }
+ }
+
+ return NULL;
+}
+
+void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu)
+{
+ printf("Updating wireless network list\n\r");
+
+ // get all wireless networks
+ TQValueList<WirelessNetwork> nets = WirelessManager::getWirelessNetworks(d->dev);
+
+ // get all wireless connections
+ TQValueList<WirelessConnection*> conns = WirelessManager::getWirelessConnections();
+
+ // get the currently active connection
+ NMProxy* nm = NMProxy::getInstance();
+ Connection* active_conn = nm->getActiveConnection(d->dev);
+ if (active_conn)
+ kdDebug() << active_conn->getObjectPath().data() << endl;
+
+ // add all wireless connections in range
+ // (we may have more then one connection per network)
+ for (TQValueList<WirelessConnection*>::iterator it = conns.begin(); it != conns.end(); ++it)
+ {
+ WirelessNetworkItem* wirelessNetworkItem;
+ WirelessNetwork net;
+
+ // only show connections which are in range
+ if ( !findMatchingNetwork(*it, nets, net) )
+ continue;
+
+ wirelessNetworkItem = new WirelessNetworkItem (menu,
+ d->dev,
+ net,
+ *it,
+ false);
+ int id = menu->insertItem (wirelessNetworkItem, -1, -1);
+ menu->setItemChecked(id, ((Connection*)(*it) == active_conn));
+ menu->connectItem(id, wirelessNetworkItem, TQT_SLOT(slotActivate()));
+ }
+
+ // now add all connections which are not in range to a submenu
+ TQPopupMenu* popup = new TQPopupMenu(menu);
+
+ uint networkItemsAdded = 0;
+ for (TQValueList<WirelessConnection*>::iterator it = conns.begin(); it != conns.end(); ++it)
+ {
+ WirelessNetworkItem* wirelessNetworkItem;
+ WirelessNetwork net;
+
+ // only show connections which are out of range
+ if ( findMatchingNetwork(*it, nets, net) )
+ continue;
+
+ Info* info = (*it)->getInfoSetting();
+ Wireless* wireless = (*it)->getWirelessSetting();
+
+ if (!info || !wireless)
+ continue;
+
+ wirelessNetworkItem = new WirelessNetworkItem (menu,
+ d->dev,
+ net,
+ *it,
+ false);
+
+ int id = popup->insertItem (wirelessNetworkItem, -1, -1);
+ popup->connectItem(id, wirelessNetworkItem, TQT_SLOT(slotActivate()));
+ networkItemsAdded += 1;
+ }
+
+ if (networkItemsAdded) {
+ menu->insertSeparator();
+ menu->insertItem(i18n("Connect to saved network"), popup);
+ }
+
+// // List available unsaved networks
+ TQPopupMenu* newpopup = new TQPopupMenu(menu);
+ WirelessConnection* newconn;
+ uint newnetworkItemsAdded = 0;
+ TQValueList<WirelessNetwork> newnets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID);
+
+ for (TQValueList<WirelessNetwork>::Iterator it = newnets.begin(); it != newnets.end(); ++it)
+ {
+ // Only display networks with no existing connnection
+ if ( findMatchingConnection(*it, conns) != NULL)
+ continue;
+
+ WirelessNetworkItem* wirelessNetworkItem;
+ wirelessNetworkItem = new WirelessNetworkItem (menu,
+ d->dev,
+ *it,
+ NULL,
+ false);
+
+ int id = newpopup->insertItem (wirelessNetworkItem, -1, -1);
+ newpopup->connectItem(id, this, TQT_SLOT(newConnection()));
+
+ newnetworkItemsAdded += 1;
+ }
+
+ if (newnetworkItemsAdded) {
+ menu->insertSeparator();
+ menu->insertItem(i18n("Connect to new network"), newpopup);
+ }
+ // Signal done with wireless menu
+ //menu->insertSeparator();
+}
+
+void WirelessDeviceTray::addMenuItems(KPopupMenu* menu)
+{
+ NMProxy* nm = NMProxy::getInstance();
+ TQT_DBusError err;
+
+ // device title
+ Subhead* subhead = new Subhead (menu, "subhead", TQString("Wireless Connection (%1)").tqarg(d->dev->getInterface()), SmallIcon("wireless", TQIconSet::Automatic));
+ menu->insertItem (subhead, -1, -1);
+
+ // bolding subhead instead
+ //menu->insertSeparator();
+
+ if (!nm->getWirelessEnabled(err))
+ {
+ // wireless disabled -> do not show any connections
+ subhead = new Subhead(menu, "subhead2", i18n("Wireless disabled"), SmallIcon("no", TQIconSet::Automatic));
+ menu->insertItem(subhead, -1, -1);
+ }
+ else if (!nm->getWirelessHardwareEnabled(err))
+ {
+ // wireless disabled -> do not show any connections
+ subhead = new Subhead(menu, "subhead2", i18n("Wireless disabled by Killswitch"), SmallIcon("no", TQIconSet::Automatic));
+ menu->insertItem(subhead, -1, -1);
+ }
+ else
+ {
+ // networks
+ addWirelessNetworks(menu);
+
+ // bring the device down
+ KAction* deactivate = tray()->actionCollection()->action("deactivate_device");
+ if (deactivate)
+ deactivate->plug(menu);
+ }
+ menu->insertSeparator();
+}
+
+void WirelessDeviceTray::slotUpdateDeviceState(NMDeviceState state)
+{
+ slotCheckActiveAccessPoint();
+ if (state == NM_DEVICE_STATE_ACTIVATED)
+ {
+ // trigger an update of the connections seen bssids property
+
+ AccessPoint * ap = d->dev->getActiveAccessPoint();
+ if (ap) {
+ int strength = ap->getStrength();
+
+ if (strength > 80)
+ setPixmapForState((NMDeviceState)state, "nm_signal_100");
+ else if (strength > 55)
+ setPixmapForState((NMDeviceState)state, "nm_signal_75");
+ else if (strength > 30)
+ setPixmapForState((NMDeviceState)state, "nm_signal_50");
+ else if (strength > 5)
+ setPixmapForState((NMDeviceState)state, "nm_signal_25");
+ else
+ setPixmapForState((NMDeviceState)state, "nm_signal_00");
+ }
+ }
+}
+
+void WirelessDeviceTray::slotCheckActiveAccessPoint()
+{
+ // the active AP changed, if a connection is already active we have roamed
+ // thus add the bssid to the list of seen bssids
+ NMProxy* nm = NMProxy::getInstance();
+ if (!nm)
+ return;
+
+ WirelessConnection* active_conn = dynamic_cast<WirelessConnection*>(nm->getActiveConnection(d->dev));
+ if (active_conn && d->dev->getState() == NM_DEVICE_STATE_ACTIVATED)
+ {
+ if ( d->dev->getActiveAccessPoint() != d->activeAccessPoint) {
+ if (!d->activeAccessPoint.isNull())
+ disconnect( d->activeAccessPoint, TQT_SIGNAL(strengthChanged(TQ_UINT8)), this, TQT_SLOT(apStrengthChanged(TQ_UINT8)));
+
+ d->activeAccessPoint = d->dev->getActiveAccessPoint();
+ if ( d->activeAccessPoint ) {
+ connect( d->activeAccessPoint, TQT_SIGNAL(strengthChanged(TQ_UINT8)), this, TQT_SLOT(apStrengthChanged(TQ_UINT8)));
+ ConnectionSettings::Wireless* wireless = active_conn->getWirelessSetting();
+ wireless->addSeenBssid(d->activeAccessPoint->getHwAddress());
+ }
+ }
+ }
+}
+
+void WirelessDeviceTray::apStrengthChanged(TQ_UINT8 strength)
+{
+ kdDebug() << k_funcinfo << (uint)strength << endl;
+ NMDeviceState state = device()->getState();
+ if (strength > 80)
+ setPixmapForState(state, "nm_signal_100");
+ else if (strength > 55)
+ setPixmapForState(state, "nm_signal_75");
+ else if (strength > 30)
+ setPixmapForState(state, "nm_signal_50");
+ else if (strength > 5)
+ setPixmapForState(state, "nm_signal_25");
+ else
+ setPixmapForState(state, "nm_signal_00");
+ emit uiUpdated();
+}
+
+void WirelessDeviceTray::slotAccessPointAdded(AccessPoint* ap)
+{
+ KNotifyClient::event( tray()->winId(), "knm-nm-network-found", i18n("KNetworkManager New Wireless Network Found") );
+}
+
+void WirelessDeviceTray::slotAccessPointRemoved(const TQString&)
+{
+ KNotifyClient::event( tray()->winId(), "knm-nm-network-gone", i18n("KNetworkManager Wireless Network Disappeared") );
+}
+
+WirelessDeviceTray::WirelessDeviceTray (WirelessDevice* dev, KSystemTray * parent, const char * name)
+ : DeviceTrayComponent (dev, parent, name)
+{
+ d = new WirelessDeviceTrayPrivate();
+ d->dev = dev;
+
+ // we want other icons for wireless devices
+ setPixmapForState(NM_DEVICE_STATE_UNKNOWN, "wireless_off");
+ setPixmapForState(NM_DEVICE_STATE_UNAVAILABLE, "wireless_off");
+ setPixmapForState(NM_DEVICE_STATE_UNMANAGED, "wireless_off");
+ setPixmapForState(NM_DEVICE_STATE_DISCONNECTED, "wireless");
+ setPixmapForState(NM_DEVICE_STATE_ACTIVATED, "nm_signal_50");
+
+ // get notified when the device state changes
+ connect(dev, TQT_SIGNAL(StateChanged(NMDeviceState)), this, TQT_SLOT(slotUpdateDeviceState(NMDeviceState)));
+
+ // if the active access point changed but not the connection we roamed to a new AP
+ connect(dev, TQT_SIGNAL(propertiesChanged()), this, TQT_SLOT(slotCheckActiveAccessPoint()));
+
+ // get notified of all AP changes
+ connect(dev, TQT_SIGNAL(accessPointAdded(AccessPoint*)), this, TQT_SLOT(slotAccessPointAdded(AccessPoint*)));
+ connect(dev, TQT_SIGNAL(accessPointRemoved(const TQString&)), this, TQT_SLOT(slotAccessPointRemoved(const TQString&)));
+}
+
+WirelessDeviceTray::~WirelessDeviceTray ()
+{
+ delete d;
+}
+
+
+#include "knetworkmanager-wireless_device_tray.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wireless_device_tray.h b/knetworkmanager-0.8/src/knetworkmanager-wireless_device_tray.h
new file mode 100644
index 0000000..e0c93dd
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wireless_device_tray.h
@@ -0,0 +1,82 @@
+/***************************************************************************
+ *
+ * knetworkmanager.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_WIRELESS_DEVICE_TRAY_H
+#define KNETWORKMANAGER_WIRELESS_DEVICE_TRAY_H
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "devicetraycomponent.h"
+#include "knetworkmanager-wireless_network.h"
+
+// predefinitions
+class WirelessDevice;
+class WirelessDeviceTrayPrivate;
+
+namespace ConnectionSettings
+{
+ class Connection;
+ class WirelessConnection;
+}
+
+class WirelessDeviceTray : public DeviceTrayComponent
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+ WirelessDeviceTray (WirelessDevice*, KSystemTray * parent = 0, const char * name = 0);
+ ~WirelessDeviceTray ();
+
+ void addMenuItems(KPopupMenu* menu);
+
+ protected:
+ /**
+ * Reimplementation
+ */
+ TQStringList getToolTipText();
+
+ public slots:
+ void slotUpdateDeviceState(NMDeviceState);
+ void slotCheckActiveAccessPoint();
+ void newConnection();
+ protected slots:
+ void apStrengthChanged(TQ_UINT8 strength);
+ void slotAccessPointAdded(AccessPoint*);
+ void slotAccessPointRemoved(const TQString&);
+
+ private:
+ void addWirelessNetworks (KPopupMenu* menu);
+ TQValueList<WirelessNetwork> getWirelessNetworks();
+ TQValueList<ConnectionSettings::WirelessConnection*> getWirelessConnections();
+ ConnectionSettings::WirelessConnection* findMatchingConnection(const WirelessNetwork& net, const TQValueList<ConnectionSettings::WirelessConnection*>& connection);
+ bool findMatchingNetwork(const ConnectionSettings::WirelessConnection* conn, const TQValueList<WirelessNetwork>& nets, WirelessNetwork& net);
+
+ WirelessDeviceTrayPrivate* d;
+
+};
+
+#endif /* KNETWORKMANAGER_WIRELESS_DEVICE_TRAY_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wireless_manager.cpp b/knetworkmanager-0.8/src/knetworkmanager-wireless_manager.cpp
new file mode 100644
index 0000000..c77d2ad
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wireless_manager.cpp
@@ -0,0 +1,179 @@
+/***************************************************************************
+ *
+ * knetworkmanager-wireless_manager.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// other includes
+#include <time.h>
+
+// QT DBus
+#include <tqdbusobjectpath.h>
+
+// KNM includes
+#include "knetworkmanager-wireless_manager.h"
+#include "knetworkmanager-wireless_device.h"
+#include "knetworkmanager-wireless_network.h"
+#include "knetworkmanager-accesspoint.h"
+#include "knetworkmanager-connection_store.h"
+#include "knetworkmanager-wireless_connection.h"
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-connection_setting_wireless.h"
+#include "knetworkmanager-connection_setting_wireless_security.h"
+#include "knetworkmanager-nm_proxy.h"
+#include "knetworkmanager-devicestore.h"
+
+#if !defined(NM_CHECK_VERSION)
+#define NM_CHECK_VERSION(x,y,z) 0
+#endif
+
+TQValueList<WirelessNetwork> WirelessManager::getWirelessNetworks(WirelessDevice* dev, TQ_UINT32 match)
+{
+ TQValueList<WirelessNetwork> nets;
+ TQValueList<AccessPoint*> aps;
+ // fetch all APs
+ aps = WirelessManager::getAccessPoints(dev);
+
+ // now group the APs together according to their security settings
+ for (TQValueList<AccessPoint*>::Iterator apit = aps.begin(); apit != aps.end(); ++apit)
+ {
+ bool found = false;
+
+ // no hidden APs
+ AccessPoint * ap = *apit;
+ if ( ap ) {
+ if (!ap->isValid())
+ continue;
+
+ if (ap->getSsid().count() == 0)
+ continue;
+
+ // check if we have a network matching this AP
+ for (TQValueList<WirelessNetwork>::Iterator netIt = nets.begin(); netIt != nets.end(); ++netIt)
+ {
+ if ((*netIt).contains(ap) )
+ {
+ // we alread have a network where this AP belongs to
+ found = true;
+
+ // attach this ap to the network
+ (*netIt).addAP(ap);
+
+ /* // FIXME active?
+ if (active_ap)
+ {
+ // here is the active_ap
+ if (!(*net).getActive() && ((*ap) == *active_ap))
+ (*net).setActive(true);
+ }*/
+ break;
+ }
+ }
+
+ if (!found)
+ {
+ // create a new network-descriptor according to this ap
+ WirelessNetwork net(match);
+ net.addAP(ap);
+ nets.append(net);
+ }
+ }
+ }
+ return nets;
+}
+
+TQValueList<AccessPoint*> WirelessManager::getAccessPoints(WirelessDevice* dev)
+{
+ // build up AP list depending on one device or on all devices
+ if (dev) {
+ return dev->accessPoints();
+ }
+ else {
+ TQValueList<AccessPoint *> aps;
+ DeviceStore* store = DeviceStore::getInstance();
+ if (store)
+ {
+#if NM_CHECK_VERSION(0,8,992)
+ TQValueList<Device*> devs = store->getDevices(NM_DEVICE_TYPE_WIFI);
+#else
+ TQValueList<Device*> devs = store->getDevices(DEVICE_TYPE_802_11_WIRELESS);
+#endif
+ for (TQValueList<Device*>::Iterator it = devs.begin(); it != devs.end(); ++it)
+ {
+ WirelessDevice* wdev = dynamic_cast<WirelessDevice*>(*it);
+ if (!wdev)
+ continue;
+ // add all APs from this device
+ aps +=wdev->accessPoints();
+ }
+ }
+ return aps;
+ }
+}
+
+TQValueList<WirelessConnection*> WirelessManager::getWirelessConnections()
+{
+ TQValueList<WirelessConnection*> conns;
+ ConnectionStore* store = ConnectionStore::getInstance();
+
+ // get all wireless connections
+ TQValueList<Connection*> connections = store->getConnections(NM_SETTING_WIRELESS_SETTING_NAME);
+ for (TQValueList<Connection*>::Iterator it = connections.begin(); it != connections.end(); ++it)
+ {
+ // cast to WirelessConnection*
+ WirelessConnection* wireless_conn = dynamic_cast<WirelessConnection*>(*it);
+ if (!wireless_conn)
+ continue;
+ conns.append(wireless_conn);
+ }
+ return conns;
+}
+
+TQValueList<AccessPoint*> WirelessManager::getAccessPointsForEssid(TQByteArray essid, WirelessDevice* dev)
+{
+ // build up AP list depending on one device or on all devices
+ if (dev)
+ return dev->accessPointsForEssid(essid);
+ else
+ {
+ TQValueList<AccessPoint*> aps;
+ DeviceStore* store = DeviceStore::getInstance();
+ if (store)
+ {
+#if NM_CHECK_VERSION(0,8,992)
+ TQValueList<Device*> devs = store->getDevices(NM_DEVICE_TYPE_WIFI);
+#else
+ TQValueList<Device*> devs = store->getDevices(DEVICE_TYPE_802_11_WIRELESS);
+#endif
+ for (TQValueList<Device*>::Iterator it = devs.begin(); it != devs.end(); ++it)
+ {
+ WirelessDevice* wdev = dynamic_cast<WirelessDevice*>(*it);
+ if (!wdev)
+ continue;
+ // add all APs from this device
+ aps += wdev->accessPointsForEssid(essid);
+ }
+ }
+ return aps;
+ }
+}
+
+
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wireless_manager.h b/knetworkmanager-0.8/src/knetworkmanager-wireless_manager.h
new file mode 100644
index 0000000..f90fce7
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wireless_manager.h
@@ -0,0 +1,62 @@
+/***************************************************************************
+ *
+ * knetworkmanager-wireless_manager.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_WIRELESS_MANAGER_H
+#define KNETWORKMANAGER_WIRELESS_MANAGER_H
+
+// TQt includes
+#include <tqguardedptr.h>
+#include <tqmap.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "knetworkmanager-device_tray.h"
+#include "knetworkmanager-accesspoint.h"
+#include "knetworkmanager-wireless_device.h"
+#include "knetworkmanager-wireless_network.h"
+
+namespace ConnectionSettings
+{
+ class WirelessConnection;
+}
+
+class WirelessManager
+{
+ public:
+ // get all accesspoints from device dev or from all devices if dev is NULL
+ // and group them together using all properties specified in match
+ static TQValueList<WirelessNetwork> getWirelessNetworks(WirelessDevice* dev = 0, TQ_UINT32 match = WirelessNetwork::MATCH_SSID);
+
+ // get all aps from either one device or from all available devices
+ static TQValueList<AccessPoint*> getAccessPoints(WirelessDevice* dev = 0);
+
+ // get a list of all known wireless connections
+ static TQValueList<ConnectionSettings::WirelessConnection*> getWirelessConnections();
+
+ // get a list of all APs with a specific SSID
+ static TQValueList<AccessPoint*> getAccessPointsForEssid(TQByteArray, WirelessDevice* dev = 0);
+
+};
+
+#endif /* KNETWORKMANAGER_WIRELESS_MANAGER_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wireless_menuitem.cpp b/knetworkmanager-0.8/src/knetworkmanager-wireless_menuitem.cpp
new file mode 100644
index 0000000..387d052
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wireless_menuitem.cpp
@@ -0,0 +1,238 @@
+/***************************************************************************
+ *
+ * knetworkmanager-tray.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ * Will Stephenson <[email protected]>, <[email protected]>
+ * Valentine Sinitsyn <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include <tqevent.h>
+#include <tqvbox.h>
+#include <tqlayout.h>
+#include <tqpushbutton.h>
+#include <tqpixmap.h>
+#include <tqpixmapcache.h>
+#include <tqpainter.h>
+#include <tqstyle.h>
+#include <dcopclient.h>
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <knotifyclient.h>
+#include <knotifydialog.h>
+#include <klocale.h>
+#include <kstdguiitem.h>
+#include <khelpmenu.h>
+#include <kprocess.h>
+#include <kiconloader.h>
+#include <kconfig.h>
+#include <kmessagebox.h>
+#include <NetworkManager.h>
+
+#include <tqdbusobjectpath.h>
+#include <tqdbuserror.h>
+
+#include "knetworkmanager-wireless_menuitem.h"
+#include "knetworkmanager-wireless_network.h"
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-wireless_connection.h"
+#include "knetworkmanager-nm_proxy.h"
+
+#if !defined(NM_CHECK_VERSION)
+#define NM_CHECK_VERSION(x,y,z) 0
+#endif
+
+using namespace ConnectionSettings;
+
+void WirelessNetworkItem::slotActivate()
+{
+ NMProxy* nm = NMProxy::getInstance();
+ int id;
+ TQT_DBusError err;
+ printf("slotActivate\n\r");
+ if (_dev && nm)
+ {
+ if ( _conn )
+ {
+ kdDebug() << "Activate Connection " << _conn->getObjectPath().data() << " on Device " << _dev->getObjectPath().ascii() << endl;
+#if NM_CHECK_VERSION(0,8,992)
+ if (!nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), TQT_DBusObjectPath(QCString(_dev->getObjectPath())), _conn->getObjectPath(), err))
+#else
+ if (!nm->ActivateConnectionAsync(id, NM_DBUS_SERVICE_USER_SETTINGS, _conn->getObjectPath(), TQT_DBusObjectPath(TQCString(_dev->getObjectPath())), _conn->getObjectPath(), err))
+#endif
+ kdDebug() << "ActivateDevice failed" << endl;
+
+ }
+ else
+ {
+ // TODO: create new connection based upon the network and show the dialog
+ printf("New network support not implemented yet\n\r");
+ }
+ }
+}
+
+
+TQString WirelessNetworkItem::getDisplayText()
+{
+ TQString security = "";
+ if (_net.getWpaFlags() != NM_802_11_AP_SEC_NONE && _net.getRsnFlags() != NM_802_11_AP_SEC_NONE)
+ security = TQString("(%1/%2)").tqarg(i18n("WPA")).tqarg(i18n("RSN"));
+ else if (_net.getWpaFlags() != NM_802_11_AP_SEC_NONE)
+ security = TQString("(%1)").tqarg(i18n("WPA"));
+ else if (_net.getRsnFlags() != NM_802_11_AP_SEC_NONE)
+ security = TQString("(%2)").tqarg(i18n("RSN"));
+
+ Info* info = NULL;
+ if (_conn)
+ info = _conn->getInfoSetting();
+
+ if (info && info->getName() != _net.getDisplaySsid())
+ return TQString("%2/%1 %3").tqarg(TQString::fromUtf8(_net.getDisplaySsid())).tqarg(info->getName()).tqarg(security);
+ else
+ return TQString("%1 %2").tqarg(TQString::fromUtf8(_net.getDisplaySsid())).tqarg(security);
+}
+
+void
+WirelessNetworkItem::paint (TQPainter *p, const TQColorGroup &/*cg*/, bool highlighted, bool /*enabled*/, int x, int y, int w, int h)
+{
+ int spacer = 0;
+ pbarStrength->setTotalSteps (100);
+ pbarStrength->tqsetSizePolicy (TQSizePolicy ((TQSizePolicy::SizeType) 0, (TQSizePolicy::SizeType) 0, 0, 0, pbarStrength->sizePolicy ().hasHeightForWidth ()));
+ pbarStrength->setFixedHeight (_height - 2);
+ pbarStrength->setProgress (_net.getStrength());
+ pbarStrength->setPercentageVisible (false);
+
+ if (highlighted) {
+ p->setPen(parent->tqpalette ().active ().highlightedText ());
+ pbarStrength->setBackgroundMode( TQt::PaletteHighlight, TQt::PaletteHighlight );
+ } else {
+ p->setPen(parent->tqpalette ().active ().text ());
+ }
+ p->drawText (x, y, w, h, AlignLeft | AlignVCenter | DontClip | ShowPrefix, getDisplayText());
+
+ if (_net.isEncrypted()) {
+ TQPixmap pmLock = SmallIcon ("lock", TQIconSet::Automatic);
+ p->drawPixmap (parent->tqsizeHint ().width () - pbarStrength->width () - _space - pmLock.size ().width () - 6, y + _border, pmLock);
+ spacer = pmLock.size ().width () + 4;
+ }
+
+ if (_adhoc) {
+ TQPixmap pmAdHoc = SmallIcon ("system", TQIconSet::Automatic);
+ p->drawPixmap (parent->tqsizeHint ().width () - pbarStrength->width () - _space - pmAdHoc.size ().width () - spacer - 6, y + _border, pmAdHoc);
+ }
+
+ p->drawPixmap (parent->tqsizeHint ().width () - pbarStrength->width () - _space, y +_border, TQPixmap::grabWidget (pbarStrength));
+}
+
+TQSize
+WirelessNetworkItem::tqsizeHint ()
+{
+ return TQSize (_width, _height);
+}
+
+WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, Device* dev, WirelessNetwork& net, WirelessConnection* conn, bool adhoc)
+ : NetworkMenuItem(dev, conn, 0, 0 ), TQCustomMenuItem ()
+{
+ parent = p;
+ _adhoc = adhoc;
+ _net = net;
+ _dev = dev;
+ _conn = conn;
+
+ pbarStrength = new TQProgressBar (this->parent, "pbarStrength");
+ pbarStrength->hide();
+ // TODO make all this neat or at least static
+ /* px between pmLock and pbarStrength */
+ _space = 5;
+
+ /* the following code should not be used as teaching material in any kind */
+ // set the widget height to that of a small icon
+ _widgetHeight = SmallIcon (NULL, TQIconSet::Automatic).height ();
+ // figure out the height of the text
+ _textHeight = kapp->fontMetrics ().size (AlignLeft | AlignVCenter | DontClip | ShowPrefix, _net.getDisplaySsid()).height ();
+ // the item is height of the text plus the default frame width
+ _height = _textHeight + kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth);
+ /* _height needs to be at least the height of a SmallIcon plus a border of one px (top & bottom)*/
+ if (_height < _widgetHeight) {
+ _height = _widgetHeight + 2;
+ }
+
+ /* border required for pmLock and pbarStrength */
+ _border = 1;
+ if (_border == kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth))
+ _border += 2 * kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth);
+ if (_border == 0)
+ _border ++;
+
+ _width = kapp->fontMetrics().size(AlignLeft | AlignVCenter | DontClip | ShowPrefix, getDisplayText()).width(); /* essid */
+ _width += SmallIcon (NULL, TQIconSet::Automatic).width (); /* pmLock */
+ _width += _space; /* pmLock <-> pbarStrength */
+ _width += 100; /* pbarStrength */
+ _width += _space; /* pbarStrength -> contextMenu */
+}
+
+WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, Device* dev, WirelessNetwork& net, bool adhoc)
+ : NetworkMenuItem(dev, NULL, 0, 0 ), TQCustomMenuItem ()
+{
+ parent = p;
+ _adhoc = adhoc;
+ _net = net;
+ _dev = dev;
+
+ pbarStrength = new TQProgressBar (this->parent, "pbarStrength");
+ pbarStrength->hide();
+ // TODO make all this neat or at least static
+ /* px between pmLock and pbarStrength */
+ _space = 5;
+
+ /* the following code should not be used as teaching material in any kind */
+ // set the widget height to that of a small icon
+ _widgetHeight = SmallIcon (NULL, TQIconSet::Automatic).height ();
+ // figure out the height of the text
+ _textHeight = kapp->fontMetrics ().size (AlignLeft | AlignVCenter | DontClip | ShowPrefix, _net.getDisplaySsid()).height ();
+ // the item is height of the text plus the default frame width
+ _height = _textHeight + kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth);
+ /* _height needs to be at least the height of a SmallIcon plus a border of one px (top & bottom)*/
+ if (_height < _widgetHeight) {
+ _height = _widgetHeight + 2;
+ }
+
+ /* border required for pmLock and pbarStrength */
+ _border = 1;
+ if (_border == kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth))
+ _border += 2 * kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth);
+ if (_border == 0)
+ _border ++;
+
+ _width = kapp->fontMetrics().size(AlignLeft | AlignVCenter | DontClip | ShowPrefix, getDisplayText()).width(); /* essid */
+ _width += SmallIcon (NULL, TQIconSet::Automatic).width (); /* pmLock */
+ _width += _space; /* pmLock <-> pbarStrength */
+ _width += 100; /* pbarStrength */
+ _width += _space; /* pbarStrength -> contextMenu */
+}
+
+WirelessNetworkItem::~WirelessNetworkItem ()
+{
+}
+
+
+
+#include "knetworkmanager-wireless_menuitem.moc"
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wireless_menuitem.h b/knetworkmanager-0.8/src/knetworkmanager-wireless_menuitem.h
new file mode 100644
index 0000000..c66c694
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wireless_menuitem.h
@@ -0,0 +1,88 @@
+/***************************************************************************
+ *
+ * knetworkmanager.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_WIRELESSMENUITEM_H
+#define KNETWORKMANAGER_WIRELESSMENUITEM_H
+
+#include "knetworkmanager-menuitem.h"
+
+#include <tqmap.h>
+#include <tqtimer.h>
+
+#include <tqtooltip.h>
+#include <ksystemtray.h>
+#include <kuniqueapplication.h>
+#include <kpopupmenu.h>
+#include <kactionclasses.h>
+#include <kstdaction.h>
+#include <kstdguiitem.h>
+
+#include <tqlayout.h>
+#include <tqlabel.h>
+#include <tqcheckbox.h>
+#include <tqprogressbar.h>
+#include <tqguardedptr.h>
+
+#include "knetworkmanager-wireless_network.h"
+#include "knetworkmanager-connection.h"
+
+class WirelessNetworkItem : public NetworkMenuItem, public TQCustomMenuItem
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ WirelessNetworkItem (TQWidget*, Device* dev, WirelessNetwork& net, ConnectionSettings::WirelessConnection* conn, bool adhoc);
+ WirelessNetworkItem (TQWidget*, Device* dev, WirelessNetwork& net, bool adhoc);
+ ~WirelessNetworkItem ();
+
+ TQWidget* parent;
+ TQProgressBar* pbarStrength;
+
+ void paint (TQPainter*, const TQColorGroup&, bool, bool, int, int, int, int);
+ TQSize tqsizeHint ();
+
+ public slots:
+ void slotActivate();
+
+ private:
+ TQString getDisplayText();
+
+ bool _adhoc;
+ WirelessNetwork _net;
+ Device* _dev;
+ ConnectionSettings::WirelessConnection* _conn;
+
+ /* menu item */
+ int _width;
+ int _height;
+ int _border;
+
+ /* elements */
+ int _textHeight;
+ int _widgetHeight;
+
+ int _space;
+};
+
+#endif /* KNETWORKMANAGER_WIRELESSMENUITEM_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wireless_network.cpp b/knetworkmanager-0.8/src/knetworkmanager-wireless_network.cpp
new file mode 100644
index 0000000..ba509dd
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wireless_network.cpp
@@ -0,0 +1,179 @@
+/***************************************************************************
+ *
+ * knetworkmanager-wireless_network.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// NM includes
+#include <NetworkManager.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "knetworkmanager-connection.h"
+#include "knetworkmanager-accesspoint.h"
+#include "knetworkmanager-wireless_network.h"
+
+// KDE includes
+#include <kdebug.h>
+
+// TQt includes
+#include <tqhostaddress.h>
+#include <tqvaluelist.h>
+
+using namespace ConnectionSettings;
+
+class WirelessNetworkPrivate
+{
+ public:
+ WirelessNetworkPrivate()
+ : active(false)
+ {
+ }
+
+ ~WirelessNetworkPrivate()
+ {
+ }
+
+ bool active;
+
+ TQ_UINT32 match;
+ TQValueList<const AccessPoint*> aps;
+};
+
+WirelessNetwork::WirelessNetwork(const WirelessNetwork& other)
+{
+ d = new WirelessNetworkPrivate(*other.d);
+}
+
+WirelessNetwork::WirelessNetwork(TQ_UINT32 match)
+{
+ d = new WirelessNetworkPrivate();
+
+ // which attributes have to match
+ d->match = match;
+}
+
+WirelessNetwork::~WirelessNetwork()
+{
+ delete d;
+}
+
+WirelessNetwork& WirelessNetwork::operator= (const WirelessNetwork& other)
+{
+ if (d)
+ delete d;
+ d = new WirelessNetworkPrivate(*other.d);
+ return *this;
+}
+
+bool WirelessNetwork::contains (const AccessPoint * const ap)
+{
+ if ( (d->match & MATCH_SSID) && getSsid() != ap->getSsidByteArray())
+ return false;
+
+ // AP matches
+ return true;
+}
+
+bool WirelessNetwork::addAP(const AccessPoint * const ap)
+{
+ if ( this->contains( ap ) || d->aps.isEmpty())
+ {
+ d->aps.append(ap);
+ return true;
+ }
+ return false;
+}
+
+const TQByteArray WirelessNetwork::getSsid() const
+{
+ if ( !d->aps.isEmpty() ) {
+ return (*(d->aps.begin()))->getSsidByteArray();
+ } else {
+ return TQByteArray();
+ }
+}
+
+TQString WirelessNetwork::getDisplaySsid() const
+{
+ if (!d->aps.isEmpty()) {
+ return (*(d->aps.begin()))->getDisplaySsid();
+ } else {
+ return TQString();
+ }
+}
+
+TQ_UINT32 WirelessNetwork::getFlags() const
+{
+ TQ_UINT32 flags = NM_802_11_AP_FLAGS_NONE;
+ for (TQValueList<const AccessPoint*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
+ {
+ flags |= (*it)->getFlags();
+ }
+ return flags;
+}
+
+TQ_UINT32 WirelessNetwork::getWpaFlags() const
+{
+ TQ_UINT32 flags = NM_802_11_AP_SEC_NONE;
+ for (TQValueList<const AccessPoint*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
+ {
+ flags |= (*it)->getWpaFlags();
+ }
+ return flags;
+}
+
+TQ_UINT32 WirelessNetwork::getRsnFlags() const
+{
+ TQ_UINT32 flags = NM_802_11_AP_SEC_NONE;
+ for (TQValueList<const AccessPoint*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
+ {
+ flags |= (*it)->getRsnFlags();
+ }
+ return flags;
+}
+
+bool WirelessNetwork::isEncrypted() const
+{
+ return (getFlags() && NM_802_11_AP_FLAGS_PRIVACY);
+}
+
+TQ_UINT8 WirelessNetwork::getStrength() const
+{
+ TQ_UINT8 strength = 0;
+ for (TQValueList<const AccessPoint*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
+ {
+ if ((*it)->getStrength() > strength)
+ strength = (*it)->getStrength();
+ }
+ return strength;
+}
+
+void WirelessNetwork::setActive(bool a)
+{
+ d->active=a;
+}
+
+bool WirelessNetwork::getActive() const
+{
+ return d->active;
+}
+
diff --git a/knetworkmanager-0.8/src/knetworkmanager-wireless_network.h b/knetworkmanager-0.8/src/knetworkmanager-wireless_network.h
new file mode 100644
index 0000000..addce7a
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager-wireless_network.h
@@ -0,0 +1,96 @@
+/***************************************************************************
+ *
+ * knetworkmanager-wireless_network.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_WIRELESS_NETWORK_H
+#define KNETWORKMANAGER_WIRELESS_NETWORK_H
+
+#include "knetworkmanager.h"
+#include "knetworkmanager-device.h"
+
+#include <stdint.h>
+
+class KNetworkManager;
+class AccessPoint;
+class WirelessNetworkPrivate;
+
+namespace ConnectionSettings
+{
+ class WirelessConnection;
+}
+
+/*
+ A wireless network represents multiple accesspoints
+ that share the same essid and security-caps
+*/
+class WirelessNetwork
+{
+ public:
+ // bitwise encoded enum
+ // allows the specification on how multiple APs get grouped together
+ enum MATCH_ATTRIBUTES
+ {
+ // only match APs with the same ssid
+ MATCH_SSID = 1
+ };
+
+ WirelessNetwork(const WirelessNetwork& other);
+ WirelessNetwork (TQ_UINT32 match = MATCH_SSID);
+ ~WirelessNetwork ();
+
+ WirelessNetwork& operator= (const WirelessNetwork&);
+
+ // check if the AccessPoint represents the same net
+ bool contains(const AccessPoint * const);
+
+ // add an AP to the Network
+ bool addAP(const AccessPoint * const);
+
+ // combined flags of all APs
+ TQ_UINT32 getFlags() const;
+
+ // combined wpa-flags of all APs
+ TQ_UINT32 getWpaFlags() const;
+
+ // combined rsn-flags of all APs
+ TQ_UINT32 getRsnFlags() const;
+
+ // ssid of all APs
+ const TQByteArray getSsid() const;
+
+ TQString getDisplaySsid() const;
+ bool isEncrypted() const;
+
+ // strength of the best AP
+ TQ_UINT8 getStrength() const;
+
+ void setActive(bool active);
+ bool getActive() const;
+
+ bool operator==(const WirelessNetwork&);
+
+ private:
+ WirelessNetworkPrivate * d;
+};
+
+#endif /* KNETWORKMANAGER_WIRELESS_NETWORK_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager.cpp b/knetworkmanager-0.8/src/knetworkmanager.cpp
new file mode 100644
index 0000000..81532e0
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager.cpp
@@ -0,0 +1,142 @@
+/***************************************************************************
+ *
+ * knetworkmanager.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// KDE includes
+#include <kdebug.h>
+#include <klocale.h>
+
+// NM includes
+#include <NetworkManager.h>
+#include <NetworkManagerVPN.h>
+
+// TQDBus includes
+#include <tqdbusdata.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+#include "knetworkmanager-tray.h"
+#include "knetworkmanager-devicestore.h"
+#include "knetworkmanager-device.h"
+#include "knetworkmanager-cellular_device.h"
+#include "knetworkmanager-wireless_device.h"
+#include "knetworkmanager-wired_device.h"
+#include "knetworkmanager-vpn_device.h"
+#include "knetworkmanager-cellular_device_tray.h"
+#include "knetworkmanager-wireless_device_tray.h"
+#include "knetworkmanager-wired_device_tray.h"
+#include "knetworkmanager-nmsettings.h"
+#include "knetworkmanager-storage.h"
+#include "xmlmarshaller.h"
+
+// KNM includes
+#include "vpn_tray_component.h"
+#include "knetworkmanager-connection_store.h"
+#include "knetworkmanager-vpn_connection.h"
+#include "knetworkmanager-nm_proxy.h"
+#include "knetworkmanager-vpn_plugin.h"
+
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-connection_setting_vpn.h"
+#include "knetworkmanager-connection_settings_dialog.h"
+
+#include <stdio.h>
+
+// TQt includes
+#include <tqstring.h>
+#include <tqobject.h>
+
+// KDE includes
+#include <kglobal.h>
+#include <kiconloader.h>
+
+char active_vpn_prev = 0;
+extern NMDeviceState nm_device_state_global;
+VPNDBUSPlugin* vpnproxy;
+
+class KNetworkManagerPrivate
+{
+ public:
+ KNetworkManagerPrivate() {}
+ ~KNetworkManagerPrivate() {}
+ static KNetworkManager* _ctx;
+};
+
+KNetworkManager* KNetworkManagerPrivate::_ctx = NULL;
+
+KNetworkManager* KNetworkManager::getInstance()
+{
+ return KNetworkManagerPrivate::_ctx;
+}
+
+void
+KNetworkManager::slotShutDown()
+{
+ // cleanup code
+ Storage* storage = Storage::getInstance();
+
+ // save all connections (if not done already)
+ storage->saveConnections();
+}
+
+void KNetworkManager::timerEvent( TQTimerEvent *e )
+{
+ Tray* tray = Tray::getInstance();
+ tray->slotUpdateDeviceState(nm_device_state_global);
+}
+
+KNetworkManager::KNetworkManager () : KUniqueApplication ()
+{
+ d = new KNetworkManagerPrivate();
+ d->_ctx = this;
+
+ // we need to get informed when shutting down
+ connect(this, TQT_SIGNAL(shutDown()), this, TQT_SLOT(slotShutDown()));
+
+ // Start the VPN icon timer
+ // startTimer( 1000 ); // 1-second timer
+
+ // Connect to the VPN bus
+ vpnproxy = new VPNDBUSPlugin();
+
+ // create the main-tray-icon
+ Tray* tray = Tray::getInstance();
+ tray->show();
+ setMainWidget(tray);
+
+ // create the settings interface
+ NMSettings::getInstance();
+
+ // restore all known connections first
+ Storage* storage = Storage::getInstance();
+ storage->restoreConnections();
+}
+
+KNetworkManager::~KNetworkManager()
+{
+ delete vpnproxy;
+ delete d;
+}
+
+#include "knetworkmanager.moc"
+
diff --git a/knetworkmanager-0.8/src/knetworkmanager.desktop b/knetworkmanager-0.8/src/knetworkmanager.desktop
new file mode 100644
index 0000000..ef6aa17
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager.desktop
@@ -0,0 +1,47 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=KNetworkManager
+Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার
+Name[sv]=Knetworkmanager
+GenericName=Network Manager
+GenericName[bn]=নেটওয়ার্ক ম্যানেজার
+GenericName[br]=Merour rouedad
+GenericName[da]=Netværkshåndtering
+GenericName[de]=Netzwerkverwaltung
+GenericName[el]=Διαχειριστής δικτύου
+GenericName[es]=Gestor de red
+GenericName[et]=Võrguhaldur
+GenericName[it]=Gestore di rete
+GenericName[ja]=ネットワークマネージャ
+GenericName[nl]=Netwerkbeheer
+GenericName[pt]=Gestor de Redes
+GenericName[sr]=Управник мреже
+GenericName[sr@Latn]=Upravnik mreže
+GenericName[sv]=Nätverksverktyg
+GenericName[tr]=Ağ Yöneticisi
+Exec=knetworkmanager
+Icon=knetworkmanager
+Type=Application
+Comment=A KDE frontend for NetworkManager
+Comment[bg]=Интерфейс за NetworkManager (KDE)
+Comment[bn]=নেটওয়ার্ক-ম্যানেজারের জন্য একটি কেডিই ফ্রন্ট-এন্ড
+Comment[ca]=Un frontal del KDE per al NetworkManager
+Comment[da]=En KDE-grænseflade for Networkmanager
+Comment[de]=Eine KDE-Oberfläche für NetworkManager
+Comment[el]=Μια διασύνδεση περιβάλλοντος για το NetworkManager
+Comment[es]=Una interfaz de KDE a NetworkManager
+Comment[et]=KDE NetworkManageri kasutajaliides
+Comment[it]=Un front-end di NetworkManager per KDE
+Comment[ja]=NetworkManager の KDE フロントエンド
+Comment[nl]=Een KDE-schil voor NetworkManager
+Comment[pt]=Uma interface para KDE do NetworkManager
+Comment[sr]=KDE програм за NetworkManager
+Comment[sr@Latn]=KDE program za NetworkManager
+Comment[sv]=Ett gränssnitt till Networkmanager för KDE
+Comment[tr]=NetworkManager için bir KDE ön yüzü
+X-KDE-autostart-after=panel
+X-KDE-StartupNotify=false
+X-KDE-UniqueApplet=true
+X-DCOP-ServiceType=Unique
+X-KDE-autostart-condition=knetworkmanagerrc:General:Autostart:true
+Categories=Qt;KDE;Network;Applet;
diff --git a/knetworkmanager-0.8/src/knetworkmanager.h b/knetworkmanager-0.8/src/knetworkmanager.h
new file mode 100644
index 0000000..3a2bf50
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager.h
@@ -0,0 +1,57 @@
+/***************************************************************************
+ *
+ * knetworkmanager.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_H
+#define KNETWORKMANAGER_H
+
+// KDE includes
+#include <kuniqueapplication.h>
+
+// KNM includes
+#include "config.h"
+
+class KNetworkManagerPrivate;
+class Device;
+
+class KNetworkManager : public KUniqueApplication
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+ KNetworkManager ();
+ ~KNetworkManager ();
+
+ static KNetworkManager* getInstance (void);
+
+ public slots:
+ void slotShutDown();
+ private:
+ KNetworkManagerPrivate* d;
+
+ protected:
+ void timerEvent( TQTimerEvent *e );
+};
+
+#endif /* KNETWORKMANAGER_H */
diff --git a/knetworkmanager-0.8/src/knetworkmanager.la.cpp b/knetworkmanager-0.8/src/knetworkmanager.la.cpp
new file mode 100644
index 0000000..3d480c4
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager.la.cpp
@@ -0,0 +1,2 @@
+extern "C" int kdemain(int argc, char* argv[]);
+int main(int argc, char* argv[]) { return kdemain(argc,argv); }
diff --git a/knetworkmanager-0.8/src/knetworkmanager_dummy.cpp b/knetworkmanager-0.8/src/knetworkmanager_dummy.cpp
new file mode 100644
index 0000000..68be1e7
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager_dummy.cpp
@@ -0,0 +1,3 @@
+#include <kdemacros.h>
+extern "C" int kdemain(int argc, char* argv[]);
+extern "C" KDE_EXPORT int kdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); }
diff --git a/knetworkmanager-0.8/src/knetworkmanager_plugin.desktop b/knetworkmanager-0.8/src/knetworkmanager_plugin.desktop
new file mode 100644
index 0000000..56ae845
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager_plugin.desktop
@@ -0,0 +1,31 @@
+[Desktop Entry]
+Encoding=UTF-8
+Type=ServiceType
+X-KDE-ServiceType=KNetworkManager/Plugin
+X-KDE-Derived=KPluginInfo
+Name=KNetworkManager Plugin
+Name[et]=KNetworkManageri plugin
+Name[ja]=KNetworkManager プラグイン
+Name[sr]=Прикључак KNetworkManager-а
+Name[sr@Latn]=Прикључак KNetworkManager-а
+Name[sv]=Nätverkshantering insticksprogram
+Comment=KNetworkManager Plugin
+Comment[bg]=Приставка за KNetworkManager
+Comment[bn]=কে-নেটওয়ার্ক-ম্যানেজার প্লাগিন
+Comment[br]=Lugent KNetworkManager
+Comment[ca]=Connector del KNetworkManager
+Comment[da]=Netværkshåndtering-plugin
+Comment[de]=KNetworkManager-Modul
+Comment[el]=Πρόσθετο του KNetworkManager
+Comment[es]=Complemento de KNetworkManager
+Comment[et]=KNetworkManageri plugin
+Comment[it]=Plugin di KNetworkManager
+Comment[ja]=KNetworkManager プラグイン
+Comment[nl]=KNetworkManager-plugin
+Comment[pt]='Plugin' do KNetworkManager
+Comment[sr]=Прикључак KNetworkManager-а
+Comment[sr@Latn]=Priključak KNetworkManager-a
+Comment[sv]=Nätverkshantering insticksprogram
+Comment[tr]=KNetworkManager Eklentisi
+Comment[xx]=xxKNetworkManager Pluginxx
+
diff --git a/knetworkmanager-0.8/src/knetworkmanager_vpnplugin.desktop b/knetworkmanager-0.8/src/knetworkmanager_vpnplugin.desktop
new file mode 100644
index 0000000..9ec58ce
--- /dev/null
+++ b/knetworkmanager-0.8/src/knetworkmanager_vpnplugin.desktop
@@ -0,0 +1,33 @@
+[Desktop Entry]
+Encoding=UTF-8
+Type=ServiceType
+X-KDE-ServiceType=KNetworkManager/VPNPlugin
+X-KDE-Derived=KNetworkManager/Plugin
+Name=KNetworkManager VPN Plugin
+Name[et]=KNetworkManageri VPN-plugin
+Name[ja]=KNetworkManager VPN プラグイン
+Name[sr]=Прикључак KNetworkManager-а за VPN
+Name[sr@Latn]=Прикључак KNetworkManager-а за VPN
+Name[sv]=Nätverkshantering VPN-insticksprogram
+Comment=KNetworkManager VPN Plugin
+Comment[bg]=VPN приставка за KNetworkManager
+Comment[bn]=কে-নেটওয়ার্ক-ম্যানেজার ভিপিএন প্লাগিন
+Comment[br]=Lugent VPN evit KNetworkManager
+Comment[ca]=Connector VPN del KNetworkManager
+Comment[da]=KNetworkManager VPN-plugin
+Comment[de]=KNetworkManager-VPN-Modul
+Comment[el]=Πρόσθετο VPN του KNetworkManager
+Comment[es]=Complemento de VPN de KNetworkManager
+Comment[et]=KNetworkManageri VPN-plugin
+Comment[it]=Plugin VPN di KNetworkManager
+Comment[ja]=KNetworkManager VPN プラグイン
+Comment[nl]=KNetworkManager VPN-plugin
+Comment[pt]='Plugin' de VPN do KNetworkManager
+Comment[sr]=Прикључак KNetworkManager-а за VPN
+Comment[sr@Latn]=Priključak KNetworkManager-a za VPN
+Comment[sv]=Nätverkshantering VPN-insticksprogram
+Comment[tr]=KNetworkManager VPN Eklentisi
+Comment[xx]=xxKNetworkManager VPN Pluginxx
+
+[PropertyDef::X-NetworkManager-Services]
+Type=QString
diff --git a/knetworkmanager-0.8/src/main.cpp b/knetworkmanager-0.8/src/main.cpp
new file mode 100644
index 0000000..f28a38b
--- /dev/null
+++ b/knetworkmanager-0.8/src/main.cpp
@@ -0,0 +1,64 @@
+/***************************************************************************
+ *
+ * main.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// KDE includes
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <dcopclient.h>
+#include <dcopref.h>
+
+// TQt includes
+#include <tqtimer.h>
+
+// KNM includes
+#include "knetworkmanager.h"
+
+
+static const char* knm_version = I18N_NOOP(KNETWORKMANAGER_VERSION_STRING);
+static const char* knm_descr = I18N_NOOP("A NetworkManager front-end for KDE");
+static const char* knm_copy = I18N_NOOP("Copyright (C) 2005, 2006 Novell, Inc.");
+static const char* knm_webpage = I18N_NOOP("http://opensuse.org/Projects/KNetworkManager");
+
+extern "C" KDE_EXPORT int
+kdemain (int argc, char* argv[])
+{
+ KAboutData aboutData ("knetworkmanager", I18N_NOOP("KNetworkManager"),
+ knm_version, knm_descr, KAboutData::License_GPL,
+ knm_copy, 0, knm_webpage );
+
+ aboutData.addAuthor ("Helmut Schaa", I18N_NOOP("Maintainer"), "[email protected]");
+ aboutData.addAuthor ("Timo Hoenig", I18N_NOOP("Maintainer"), "[email protected]");
+ aboutData.addAuthor ("Will Stephenson", I18N_NOOP("Additional code"), "[email protected]");
+ aboutData.addAuthor ("Valentine Sinitsyn", I18N_NOOP("Additional code"), "[email protected]");
+ aboutData.addAuthor ("Stefan Bogner", I18N_NOOP("KWallet integration"), "[email protected]");
+
+ KCmdLineArgs::init (argc, argv, &aboutData);
+
+ if (KNetworkManager::start ()) {
+ KNetworkManager app;
+ app.disableSessionManagement ();
+ return app.exec ();
+ }
+ return 0;
+}
diff --git a/knetworkmanager-0.8/src/md5.cpp b/knetworkmanager-0.8/src/md5.cpp
new file mode 100644
index 0000000..e8e1f02
--- /dev/null
+++ b/knetworkmanager-0.8/src/md5.cpp
@@ -0,0 +1,292 @@
+/*
+ * This code implements the MD5 message-digest algorithm.
+ * The algorithm is due to Ron Rivest. This code was
+ * written by Colin Plumb in 1993, no copyright is claimed.
+ * This code is in the public domain; do with it what you wish.
+ *
+ * Equivalent code is available from RSA Data Security, Inc.
+ * This code has been tested against that, and is equivalent,
+ * except that you don't need to include two pages of legalese
+ * with every copy.
+ *
+ * To compute the message digest of a chunk of bytes, declare an
+ * GnomeKeyringMD5Context structure, pass it to gnome_keyring_md5_init, call
+ * gnome_keyring_md5_update as needed on buffers full of bytes, and then call
+ * gnome_keyring_md5_final, which will fill a supplied 32-byte array with the
+ * digest in ascii form.
+ *
+ */
+
+#include "md5.h"
+#include <string.h>
+#include <stdlib.h>
+
+static void gnome_keyring_md5_transform (guint32 buf[4],
+ guint32 const in[16]);
+
+void
+gnome_keyring_md5_string (const char *string, unsigned char digest[16])
+{
+ struct GnomeKeyringMD5Context md5_context;
+
+ gnome_keyring_md5_init (&md5_context);
+ gnome_keyring_md5_update (&md5_context, (const unsigned char *)string, strlen (string));
+ gnome_keyring_md5_final (digest, &md5_context);
+}
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define byteReverse(buf, len) /* Nothing */
+#else
+
+/*
+ * Note: this code is harmless on little-endian machines.
+ */
+static void
+byteReverse(unsigned char *buf, unsigned longs)
+{
+ guint32 t;
+ do {
+ t = (guint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
+ ((unsigned) buf[1] << 8 | buf[0]);
+ *(guint32 *) buf = t;
+ buf += 4;
+ } while (--longs);
+}
+
+#endif
+
+char *
+gnome_keyring_md5_digest_to_ascii (unsigned char digest[16])
+{
+ static char hex_digits[] = "0123456789abcdef";
+ char *res;
+ int i;
+
+ res = (char*) malloc (33);
+
+ for (i = 0; i < 16; i++) {
+ res[2*i] = hex_digits[digest[i] >> 4];
+ res[2*i+1] = hex_digits[digest[i] & 0xf];
+ }
+
+ res[32] = 0;
+
+ return res;
+}
+
+
+/*
+ * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
+ * initialization constants.
+ */
+void
+gnome_keyring_md5_init (struct GnomeKeyringMD5Context *ctx)
+{
+ ctx->buf[0] = 0x67452301;
+ ctx->buf[1] = 0xefcdab89;
+ ctx->buf[2] = 0x98badcfe;
+ ctx->buf[3] = 0x10325476;
+
+ ctx->bits[0] = 0;
+ ctx->bits[1] = 0;
+}
+
+/*
+ * Update context to reflect the concatenation of another buffer full
+ * of bytes.
+ */
+void
+gnome_keyring_md5_update (struct GnomeKeyringMD5Context *ctx,
+ unsigned char const *buf,
+ unsigned len)
+{
+ guint32 t;
+
+ /* Update bitcount */
+
+ t = ctx->bits[0];
+ if ((ctx->bits[0] = t + ((guint32) len << 3)) < t)
+ ctx->bits[1]++; /* Carry from low to high */
+ ctx->bits[1] += len >> 29;
+
+ t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
+
+ /* Handle any leading odd-sized chunks */
+
+ if (t) {
+ unsigned char *p = (unsigned char *) ctx->in + t;
+
+ t = 64 - t;
+ if (len < t) {
+ memcpy (p, buf, len);
+ return;
+ }
+ memcpy (p, buf, t);
+ byteReverse (ctx->in, 16);
+ gnome_keyring_md5_transform (ctx->buf, (guint32 *) ctx->in);
+ buf += t;
+ len -= t;
+ }
+
+ /* Process data in 64-byte chunks */
+
+ while (len >= 64) {
+ memcpy (ctx->in, buf, 64);
+ byteReverse (ctx->in, 16);
+ gnome_keyring_md5_transform (ctx->buf, (guint32 *) ctx->in);
+ buf += 64;
+ len -= 64;
+ }
+
+ /* Handle any remaining bytes of data. */
+
+ memcpy(ctx->in, buf, len);
+}
+
+/*
+ * Final wrapup - pad to 64-byte boundary with the bit pattern
+ * 1 0* (64-bit count of bits processed, MSB-first)
+ */
+void
+gnome_keyring_md5_final (unsigned char digest[16], struct GnomeKeyringMD5Context *ctx)
+{
+ unsigned count;
+ unsigned char *p;
+
+ /* Compute number of bytes mod 64 */
+ count = (ctx->bits[0] >> 3) & 0x3F;
+
+ /* Set the first char of padding to 0x80. This is safe since there is
+ always at least one byte free */
+ p = ctx->in + count;
+ *p++ = 0x80;
+
+ /* Bytes of padding needed to make 64 bytes */
+ count = 64 - 1 - count;
+
+ /* Pad out to 56 mod 64 */
+ if (count < 8) {
+ /* Two lots of padding: Pad the first block to 64 bytes */
+ memset (p, 0, count);
+ byteReverse (ctx->in, 16);
+ gnome_keyring_md5_transform (ctx->buf, (guint32 *) ctx->in);
+
+ /* Now fill the next block with 56 bytes */
+ memset(ctx->in, 0, 56);
+ } else {
+ /* Pad block to 56 bytes */
+ memset(p, 0, count - 8);
+ }
+ byteReverse(ctx->in, 14);
+
+ /* Append length in bits and transform */
+ ((guint32 *) ctx->in)[14] = ctx->bits[0];
+ ((guint32 *) ctx->in)[15] = ctx->bits[1];
+
+ gnome_keyring_md5_transform (ctx->buf, (guint32 *) ctx->in);
+ byteReverse ((unsigned char *) ctx->buf, 4);
+ memcpy (digest, ctx->buf, 16);
+ memset (ctx, 0, sizeof(ctx)); /* In case it's sensitive */
+}
+
+
+/* The four core functions - F1 is optimized somewhat */
+
+#define F1(x, y, z) (z ^ (x & (y ^ z)))
+#define F2(x, y, z) F1 (z, x, y)
+#define F3(x, y, z) (x ^ y ^ z)
+#define F4(x, y, z) (y ^ (x | ~z))
+
+/* This is the central step in the MD5 algorithm. */
+#define gnome_keyring_md5_step(f, w, x, y, z, data, s) \
+ ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
+
+/*
+ * The core of the MD5 algorithm, this alters an existing MD5 hash to
+ * reflect the addition of 16 longwords of new data. GnomeKeyringMD5Update blocks
+ * the data and converts bytes into longwords for this routine.
+ */
+static void
+gnome_keyring_md5_transform (guint32 buf[4], guint32 const in[16])
+{
+ register guint32 a, b, c, d;
+
+ a = buf[0];
+ b = buf[1];
+ c = buf[2];
+ d = buf[3];
+
+ gnome_keyring_md5_step(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
+ gnome_keyring_md5_step(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
+ gnome_keyring_md5_step(F1, c, d, a, b, in[2] + 0x242070db, 17);
+ gnome_keyring_md5_step(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
+ gnome_keyring_md5_step(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
+ gnome_keyring_md5_step(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
+ gnome_keyring_md5_step(F1, c, d, a, b, in[6] + 0xa8304613, 17);
+ gnome_keyring_md5_step(F1, b, c, d, a, in[7] + 0xfd469501, 22);
+ gnome_keyring_md5_step(F1, a, b, c, d, in[8] + 0x698098d8, 7);
+ gnome_keyring_md5_step(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
+ gnome_keyring_md5_step(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
+ gnome_keyring_md5_step(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
+ gnome_keyring_md5_step(F1, a, b, c, d, in[12] + 0x6b901122, 7);
+ gnome_keyring_md5_step(F1, d, a, b, c, in[13] + 0xfd987193, 12);
+ gnome_keyring_md5_step(F1, c, d, a, b, in[14] + 0xa679438e, 17);
+ gnome_keyring_md5_step(F1, b, c, d, a, in[15] + 0x49b40821, 22);
+
+ gnome_keyring_md5_step(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
+ gnome_keyring_md5_step(F2, d, a, b, c, in[6] + 0xc040b340, 9);
+ gnome_keyring_md5_step(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
+ gnome_keyring_md5_step(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
+ gnome_keyring_md5_step(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
+ gnome_keyring_md5_step(F2, d, a, b, c, in[10] + 0x02441453, 9);
+ gnome_keyring_md5_step(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
+ gnome_keyring_md5_step(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
+ gnome_keyring_md5_step(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
+ gnome_keyring_md5_step(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
+ gnome_keyring_md5_step(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
+ gnome_keyring_md5_step(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
+ gnome_keyring_md5_step(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
+ gnome_keyring_md5_step(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
+ gnome_keyring_md5_step(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
+ gnome_keyring_md5_step(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
+
+ gnome_keyring_md5_step(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
+ gnome_keyring_md5_step(F3, d, a, b, c, in[8] + 0x8771f681, 11);
+ gnome_keyring_md5_step(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
+ gnome_keyring_md5_step(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
+ gnome_keyring_md5_step(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
+ gnome_keyring_md5_step(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
+ gnome_keyring_md5_step(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
+ gnome_keyring_md5_step(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
+ gnome_keyring_md5_step(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
+ gnome_keyring_md5_step(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
+ gnome_keyring_md5_step(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
+ gnome_keyring_md5_step(F3, b, c, d, a, in[6] + 0x04881d05, 23);
+ gnome_keyring_md5_step(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
+ gnome_keyring_md5_step(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
+ gnome_keyring_md5_step(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
+ gnome_keyring_md5_step(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
+
+ gnome_keyring_md5_step(F4, a, b, c, d, in[0] + 0xf4292244, 6);
+ gnome_keyring_md5_step(F4, d, a, b, c, in[7] + 0x432aff97, 10);
+ gnome_keyring_md5_step(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
+ gnome_keyring_md5_step(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
+ gnome_keyring_md5_step(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
+ gnome_keyring_md5_step(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
+ gnome_keyring_md5_step(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
+ gnome_keyring_md5_step(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
+ gnome_keyring_md5_step(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
+ gnome_keyring_md5_step(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
+ gnome_keyring_md5_step(F4, c, d, a, b, in[6] + 0xa3014314, 15);
+ gnome_keyring_md5_step(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
+ gnome_keyring_md5_step(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
+ gnome_keyring_md5_step(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
+ gnome_keyring_md5_step(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
+ gnome_keyring_md5_step(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
+
+ buf[0] += a;
+ buf[1] += b;
+ buf[2] += c;
+ buf[3] += d;
+}
+
diff --git a/knetworkmanager-0.8/src/md5.h b/knetworkmanager-0.8/src/md5.h
new file mode 100644
index 0000000..f3fd5be
--- /dev/null
+++ b/knetworkmanager-0.8/src/md5.h
@@ -0,0 +1,22 @@
+#ifndef GNOME_KEYRING_MD5_H
+#define GNOME_KEYRING_MD5_H
+
+#include <glib.h>
+
+struct GnomeKeyringMD5Context {
+ guint32 buf[4];
+ guint32 bits[2];
+ unsigned char in[64];
+};
+
+char *gnome_keyring_md5_digest_to_ascii (unsigned char digest[16]);
+void gnome_keyring_md5_string (const char *string,
+ unsigned char digest[16]);
+void gnome_keyring_md5_init (struct GnomeKeyringMD5Context *ctx);
+void gnome_keyring_md5_update (struct GnomeKeyringMD5Context *ctx,
+ unsigned char const *buf,
+ unsigned len);
+void gnome_keyring_md5_final (unsigned char digest[16],
+ struct GnomeKeyringMD5Context *ctx);
+
+#endif /* GNOME_KEYRING_MD5_H */
diff --git a/knetworkmanager-0.8/src/qbidirectionalmap.h b/knetworkmanager-0.8/src/qbidirectionalmap.h
new file mode 100644
index 0000000..530c6cc
--- /dev/null
+++ b/knetworkmanager-0.8/src/qbidirectionalmap.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+ *
+ * qbidiractionalmap.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef TQBIDIRECTIONALMAP_H
+#define TQBIDIRECTIONALMAP_H
+
+#include <tqmap.h>
+
+template<class Key, class T> class TQBiDirectionalMap : public TQMap<Key, T>
+{
+ public:
+ TQMapIterator<Key, T> findData(const T & data)
+ {
+ for (TQMapIterator<Key,T> it = TQMap<Key, T>::begin(); it != TQMap<Key, T>::end(); ++it)
+ {
+ if(it.data() == data)
+ {
+ return it;
+ }
+ }
+ return TQMap<Key,T>::end();
+ }
+};
+
+#endif
+
diff --git a/knetworkmanager-0.8/src/secret_storage_plugin.cpp b/knetworkmanager-0.8/src/secret_storage_plugin.cpp
new file mode 100644
index 0000000..db051c4
--- /dev/null
+++ b/knetworkmanager-0.8/src/secret_storage_plugin.cpp
@@ -0,0 +1,54 @@
+/***************************************************************************
+ *
+ * secret_storage_plugin.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include <tqobject.h>
+
+#include "secret_storage_plugin.h"
+
+SecretStoragePlugin::SecretStoragePlugin(TQObject* parent, const char* name, const TQStringList& args)
+ : Plugin(parent, name, args)
+{
+
+}
+
+SecretStoragePlugin::~SecretStoragePlugin()
+{
+
+}
+
+bool SecretStoragePlugin::saveSecret(TQString& key, TQMap<TQString, TQString>& secrets)
+{
+ return false;
+}
+
+void SecretStoragePlugin::restoreSecretsAsync(TQString& key)
+{
+ // just emit an error
+ TQMap<TQString, TQString> empty;
+ emit signalSecretsRestored(key, empty, false);
+}
+
+
+
+#include "secret_storage_plugin.moc"
diff --git a/knetworkmanager-0.8/src/secret_storage_plugin.h b/knetworkmanager-0.8/src/secret_storage_plugin.h
new file mode 100644
index 0000000..ab4e54c
--- /dev/null
+++ b/knetworkmanager-0.8/src/secret_storage_plugin.h
@@ -0,0 +1,53 @@
+/***************************************************************************
+ *
+ * secret_storage_plugin.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef KNETWORKMANAGER_SECRET_STORAGE_PLUGIN_H
+#define KNETWORKMANAGER_SECRET_STORAGE_PLUGIN_H
+
+#include <tqwidget.h>
+#include <tqmap.h>
+#include <tqdbusdata.h>
+#include <tqdbusvariant.h>
+#include "knetworkmanager-plugin.h"
+
+#define KNETWORKMANAGER_SECRET_STORAGE_PLUGIN "KNetworkManager/SecretStoragePlugin"
+
+class SecretStoragePlugin : public Plugin
+{
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ SecretStoragePlugin(TQObject*, const char*, const TQStringList&);
+ virtual ~SecretStoragePlugin();
+
+ virtual bool saveSecret(TQString& key, TQMap<TQString, TQString>& secrets);
+ virtual void restoreSecretsAsync(TQString& key);
+
+ signals:
+ void signalSecretsRestored(TQString& key, TQMap<TQString, TQString>, bool);
+};
+
+
+#endif /* KNETWORKMANAGER_SECRET_STORAGE_PLUGIN_H */
+
diff --git a/knetworkmanager-0.8/src/settings.kcfgc b/knetworkmanager-0.8/src/settings.kcfgc
new file mode 100644
index 0000000..35e7882
--- /dev/null
+++ b/knetworkmanager-0.8/src/settings.kcfgc
@@ -0,0 +1,6 @@
+# Code generation options for kconfig_compiler
+File=knetworkmanager.kcfg
+ClassName=Settings
+Singleton=true
+Mutators=true
+# will create the necessary code for setting those variables
diff --git a/knetworkmanager-0.8/src/sha1.cpp b/knetworkmanager-0.8/src/sha1.cpp
new file mode 100644
index 0000000..8525ed2
--- /dev/null
+++ b/knetworkmanager-0.8/src/sha1.cpp
@@ -0,0 +1,684 @@
+/*
+ * SHA1 hash implementation and interface functions
+ * Copyright (c) 2003-2005, Jouni Malinen <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "sha1.h"
+
+
+/* Define types for stupid code. Userspace should
+ * be using u_*_t rather than kernel-space u* types.
+ */
+typedef u_int8_t u8;
+typedef u_int16_t u16;
+typedef u_int32_t u32;
+typedef u_int64_t u64;
+
+void sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac);
+void sha1_transform(u8 *state, const u8 data[64]);
+
+void sha1_mac(const u8 *key, size_t key_len, const u8 *data, size_t data_len,
+ u8 *mac)
+{
+ const u8 *addr[3];
+ size_t len[3];
+ addr[0] = key;
+ len[0] = key_len;
+ addr[1] = data;
+ len[1] = data_len;
+ addr[2] = key;
+ len[2] = key_len;
+ sha1_vector(3, addr, len, mac);
+}
+
+
+/* HMAC code is based on RFC 2104 */
+void hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem,
+ const u8 *addr[], const size_t *len, u8 *mac)
+{
+ unsigned char k_pad[64]; /* padding - key XORd with ipad/opad */
+ unsigned char tk[20];
+ const u8 *_addr[6];
+ size_t _len[6], i;
+
+ if (num_elem > 5) {
+ /*
+ * Fixed limit on the number of fragments to avoid having to
+ * allocate memory (which could fail).
+ */
+ return;
+ }
+
+ /* if key is longer than 64 bytes reset it to key = SHA1(key) */
+ if (key_len > 64) {
+ sha1_vector(1, &key, &key_len, tk);
+ key = tk;
+ key_len = 20;
+ }
+
+ /* the HMAC_SHA1 transform looks like:
+ *
+ * SHA1(K XOR opad, SHA1(K XOR ipad, text))
+ *
+ * where K is an n byte key
+ * ipad is the byte 0x36 repeated 64 times
+ * opad is the byte 0x5c repeated 64 times
+ * and text is the data being protected */
+
+ /* start out by storing key in ipad */
+ memset(k_pad, 0, sizeof(k_pad));
+ memcpy(k_pad, key, key_len);
+ /* XOR key with ipad values */
+ for (i = 0; i < 64; i++)
+ k_pad[i] ^= 0x36;
+
+ /* perform inner SHA1 */
+ _addr[0] = k_pad;
+ _len[0] = 64;
+ for (i = 0; i < num_elem; i++) {
+ _addr[i + 1] = addr[i];
+ _len[i + 1] = len[i];
+ }
+ sha1_vector(1 + num_elem, _addr, _len, mac);
+
+ memset(k_pad, 0, sizeof(k_pad));
+ memcpy(k_pad, key, key_len);
+ /* XOR key with opad values */
+ for (i = 0; i < 64; i++)
+ k_pad[i] ^= 0x5c;
+
+ /* perform outer SHA1 */
+ _addr[0] = k_pad;
+ _len[0] = 64;
+ _addr[1] = mac;
+ _len[1] = SHA1_MAC_LEN;
+ sha1_vector(2, _addr, _len, mac);
+}
+
+
+void hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len,
+ u8 *mac)
+{
+ hmac_sha1_vector(key, key_len, 1, &data, &data_len, mac);
+}
+
+
+void sha1_prf(const u8 *key, size_t key_len, const char *label,
+ const u8 *data, size_t data_len, u8 *buf, size_t buf_len)
+{
+ u8 zero = 0, counter = 0;
+ size_t pos, plen;
+ u8 hash[SHA1_MAC_LEN];
+ size_t label_len = strlen(label);
+ const unsigned char *addr[4];
+ size_t len[4];
+
+ addr[0] = (u8 *) label;
+ len[0] = label_len;
+ addr[1] = &zero;
+ len[1] = 1;
+ addr[2] = data;
+ len[2] = data_len;
+ addr[3] = &counter;
+ len[3] = 1;
+
+ pos = 0;
+ while (pos < buf_len) {
+ plen = buf_len - pos;
+ if (plen >= SHA1_MAC_LEN) {
+ hmac_sha1_vector(key, key_len, 4, addr, len,
+ &buf[pos]);
+ pos += SHA1_MAC_LEN;
+ } else {
+ hmac_sha1_vector(key, key_len, 4, addr, len,
+ hash);
+ memcpy(&buf[pos], hash, plen);
+ break;
+ }
+ counter++;
+ }
+}
+
+
+static void pbkdf2_sha1_f(const char *passphrase, const char *ssid,
+ size_t ssid_len, int iterations, int count,
+ u8 *digest)
+{
+ unsigned char tmp[SHA1_MAC_LEN], tmp2[SHA1_MAC_LEN];
+ int i, j;
+ unsigned char count_buf[4];
+ const u8 *addr[2];
+ size_t len[2];
+ size_t passphrase_len = strlen(passphrase);
+
+ addr[0] = (u8 *) ssid;
+ len[0] = ssid_len;
+ addr[1] = count_buf;
+ len[1] = 4;
+
+ /* F(P, S, c, i) = U1 xor U2 xor ... Uc
+ * U1 = PRF(P, S || i)
+ * U2 = PRF(P, U1)
+ * Uc = PRF(P, Uc-1)
+ */
+
+ count_buf[0] = (count >> 24) & 0xff;
+ count_buf[1] = (count >> 16) & 0xff;
+ count_buf[2] = (count >> 8) & 0xff;
+ count_buf[3] = count & 0xff;
+ hmac_sha1_vector((u8 *) passphrase, passphrase_len, 2, addr, len, tmp);
+ memcpy(digest, tmp, SHA1_MAC_LEN);
+
+ for (i = 1; i < iterations; i++) {
+ hmac_sha1((u8 *) passphrase, passphrase_len, tmp, SHA1_MAC_LEN,
+ tmp2);
+ memcpy(tmp, tmp2, SHA1_MAC_LEN);
+ for (j = 0; j < SHA1_MAC_LEN; j++)
+ digest[j] ^= tmp2[j];
+ }
+}
+
+
+void pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len,
+ int iterations, u8 *buf, size_t buflen)
+{
+ int count = 0;
+ unsigned char *pos = buf;
+ size_t left = buflen;
+ size_t plen;
+ unsigned char digest[SHA1_MAC_LEN];
+
+ while (left > 0) {
+ count++;
+ pbkdf2_sha1_f(passphrase, ssid, ssid_len, iterations, count,
+ digest);
+ plen = left > SHA1_MAC_LEN ? SHA1_MAC_LEN : left;
+ memcpy(pos, digest, plen);
+ pos += plen;
+ left -= plen;
+ }
+}
+
+
+#ifndef EAP_TLS_FUNCS
+
+typedef struct {
+ u32 state[5];
+ u32 count[2];
+ unsigned char buffer[64];
+} SHA1_CTX;
+
+static void SHA1Init(SHA1_CTX *context);
+static void SHA1Update(SHA1_CTX *context, const void *data, u32 len);
+static void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
+static void SHA1Transform(u32 state[5], const unsigned char buffer[64]);
+
+
+/**
+ * sha1_vector - SHA-1 hash for data vector
+ * @num_elem: Number of elements in the data vector
+ * @addr: Pointers to the data areas
+ * @len: Lengths of the data blocks
+ * @mac: Buffer for the hash
+ */
+void sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len,
+ u8 *mac)
+{
+ SHA1_CTX ctx;
+ size_t i;
+
+ SHA1Init(&ctx);
+ for (i = 0; i < num_elem; i++)
+ SHA1Update(&ctx, addr[i], len[i]);
+ SHA1Final(mac, &ctx);
+}
+
+
+/**
+ * sha1_transform - Perform one SHA-1 transform step
+ * @state: SHA-1 state
+ * @data: Input data for the SHA-1 transform
+ *
+ * This function is used to implement random number generation specified in
+ * NIST FIPS Publication 186-2 for EAP-SIM. This PRF uses a function that is
+ * similar to SHA-1, but has different message padding and as such, access to
+ * just part of the SHA-1 is needed.
+ */
+void sha1_transform(u8 *state, const u8 data[64])
+{
+ SHA1Transform((u32 *) state, data);
+}
+
+
+/* ===== start - public domain SHA1 implementation ===== */
+
+/*
+SHA-1 in C
+By Steve Reid <[email protected]>
+100% Public Domain
+
+-----------------
+Modified 7/98
+By James H. Brown <[email protected]>
+Still 100% Public Domain
+
+Corrected a problem which generated improper hash values on 16 bit machines
+Routine SHA1Update changed from
+ void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int
+len)
+to
+ void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned
+long len)
+
+The 'len' parameter was declared an int which works fine on 32 bit machines.
+However, on 16 bit machines an int is too small for the shifts being done
+against
+it. This caused the hash function to generate incorrect values if len was
+greater than 8191 (8K - 1) due to the 'len << 3' on line 3 of SHA1Update().
+
+Since the file IO in main() reads 16K at a time, any file 8K or larger would
+be guaranteed to generate the wrong hash (e.g. Test Vector #3, a million
+"a"s).
+
+I also changed the declaration of variables i & j in SHA1Update to
+unsigned long from unsigned int for the same reason.
+
+These changes should make no difference to any 32 bit implementations since
+an
+int and a long are the same size in those environments.
+
+--
+I also corrected a few compiler warnings generated by Borland C.
+1. Added #include <process.h> for exit() prototype
+2. Removed unused variable 'j' in SHA1Final
+3. Changed exit(0) to return(0) at end of main.
+
+ALL changes I made can be located by searching for comments containing 'JHB'
+-----------------
+Modified 8/98
+By Steve Reid <[email protected]>
+Still 100% public domain
+
+1- Removed #include <process.h> and used return() instead of exit()
+2- Fixed overwriting of finalcount in SHA1Final() (discovered by Chris Hall)
+3- Changed email address from [email protected] to [email protected]
+
+-----------------
+Modified 4/01
+By Saul Kravitz <[email protected]>
+Still 100% PD
+Modified to run on Compaq Alpha hardware.
+
+-----------------
+Modified 4/01
+By Jouni Malinen <[email protected]>
+Minor changes to match the coding style used in Dynamics.
+
+Modified September 24, 2004
+By Jouni Malinen <[email protected]>
+Fixed tqalignment issue in SHA1Transform when SHA1HANDSOFF is defined.
+
+*/
+
+/*
+Test Vectors (from FIPS PUB 180-1)
+"abc"
+ A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
+"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
+ 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
+A million repetitions of "a"
+ 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
+*/
+
+#define SHA1HANDSOFF
+
+#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
+
+/* blk0() and blk() perform the initial expand. */
+/* I got the idea of expanding during the round function from SSLeay */
+#ifndef WORDS_BIGENDIAN
+#define blk0(i) (block->l[i] = (rol(block->l[i], 24) & 0xFF00FF00) | \
+ (rol(block->l[i], 8) & 0x00FF00FF))
+#else
+#define blk0(i) block->l[i]
+#endif
+#define blk(i) (block->l[i & 15] = rol(block->l[(i + 13) & 15] ^ \
+ block->l[(i + 8) & 15] ^ block->l[(i + 2) & 15] ^ block->l[i & 15], 1))
+
+/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
+#define R0(v,w,x,y,z,i) \
+ z += ((w & (x ^ y)) ^ y) + blk0(i) + 0x5A827999 + rol(v, 5); \
+ w = rol(w, 30);
+#define R1(v,w,x,y,z,i) \
+ z += ((w & (x ^ y)) ^ y) + blk(i) + 0x5A827999 + rol(v, 5); \
+ w = rol(w, 30);
+#define R2(v,w,x,y,z,i) \
+ z += (w ^ x ^ y) + blk(i) + 0x6ED9EBA1 + rol(v, 5); w = rol(w, 30);
+#define R3(v,w,x,y,z,i) \
+ z += (((w | x) & y) | (w & x)) + blk(i) + 0x8F1BBCDC + rol(v, 5); \
+ w = rol(w, 30);
+#define R4(v,w,x,y,z,i) \
+ z += (w ^ x ^ y) + blk(i) + 0xCA62C1D6 + rol(v, 5); \
+ w=rol(w, 30);
+
+
+#ifdef VERBOSE /* SAK */
+void SHAPrintContext(SHA1_CTX *context, char *msg)
+{
+ kdDebug() << msg << " (" << context->count[0] << "," << context->count[1] << ") " << context->state[0] << " " << context->state[1] << " " << context->state[2] << " " << context->state[3] << " " << context->state[4] << endl;
+}
+#endif
+
+/* Hash a single 512-bit block. This is the core of the algorithm. */
+
+void SHA1Transform(u32 state[5], const unsigned char buffer[64])
+{
+ u32 a, b, c, d, e;
+ typedef union {
+ unsigned char c[64];
+ u32 l[16];
+ } CHAR64LONG16;
+ CHAR64LONG16* block;
+#ifdef SHA1HANDSOFF
+ u32 workspace[16];
+ block = (CHAR64LONG16 *) workspace;
+ memcpy(block, buffer, 64);
+#else
+ block = (CHAR64LONG16 *) buffer;
+#endif
+ /* Copy context->state[] to working vars */
+ a = state[0];
+ b = state[1];
+ c = state[2];
+ d = state[3];
+ e = state[4];
+ /* 4 rounds of 20 operations each. Loop unrolled. */
+ R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
+ R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
+ R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
+ R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
+ R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
+ R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
+ R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
+ R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
+ R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
+ R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
+ R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
+ R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
+ R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
+ R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
+ R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
+ R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
+ R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
+ R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
+ R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
+ R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
+ /* Add the working vars back into context.state[] */
+ state[0] += a;
+ state[1] += b;
+ state[2] += c;
+ state[3] += d;
+ state[4] += e;
+ /* Wipe variables */
+ a = b = c = d = e = 0;
+#ifdef SHA1HANDSOFF
+ memset(block, 0, 64);
+#endif
+}
+
+
+/* SHA1Init - Initialize new context */
+
+static void SHA1Init(SHA1_CTX* context)
+{
+ /* SHA1 initialization constants */
+ context->state[0] = 0x67452301;
+ context->state[1] = 0xEFCDAB89;
+ context->state[2] = 0x98BADCFE;
+ context->state[3] = 0x10325476;
+ context->state[4] = 0xC3D2E1F0;
+ context->count[0] = context->count[1] = 0;
+}
+
+
+/* Run your data through this. */
+
+static void SHA1Update(SHA1_CTX* context, const void *_data, u32 len)
+{
+ u32 i, j;
+ const unsigned char *data = (const unsigned char*) _data;
+
+#ifdef VERBOSE
+ SHAPrintContext(context, "before");
+#endif
+ j = (context->count[0] >> 3) & 63;
+ if ((context->count[0] += len << 3) < (len << 3))
+ context->count[1]++;
+ context->count[1] += (len >> 29);
+ if ((j + len) > 63) {
+ memcpy(&context->buffer[j], data, (i = 64-j));
+ SHA1Transform(context->state, context->buffer);
+ for ( ; i + 63 < len; i += 64) {
+ SHA1Transform(context->state, &data[i]);
+ }
+ j = 0;
+ }
+ else i = 0;
+ memcpy(&context->buffer[j], &data[i], len - i);
+#ifdef VERBOSE
+ SHAPrintContext(context, "after ");
+#endif
+}
+
+
+/* Add padding and return the message digest. */
+
+static void SHA1Final(unsigned char digest[20], SHA1_CTX* context)
+{
+ u32 i;
+ unsigned char finalcount[8];
+
+ for (i = 0; i < 8; i++) {
+ finalcount[i] = (unsigned char)
+ ((context->count[(i >= 4 ? 0 : 1)] >>
+ ((3-(i & 3)) * 8) ) & 255); /* Endian independent */
+ }
+ SHA1Update(context, (unsigned char *) "\200", 1);
+ while ((context->count[0] & 504) != 448) {
+ SHA1Update(context, (unsigned char *) "\0", 1);
+ }
+ SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform()
+ */
+ for (i = 0; i < 20; i++) {
+ digest[i] = (unsigned char)
+ ((context->state[i >> 2] >> ((3 - (i & 3)) * 8)) &
+ 255);
+ }
+ /* Wipe variables */
+ i = 0;
+ memset(context->buffer, 0, 64);
+ memset(context->state, 0, 20);
+ memset(context->count, 0, 8);
+ memset(finalcount, 0, 8);
+}
+
+/* ===== end - public domain SHA1 implementation ===== */
+
+#endif /* EAP_TLS_FUNCS */
+
+
+#ifdef TEST_MAIN
+
+static u8 key0[] =
+{
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b
+};
+static u8 data0[] = "Hi There";
+static u8 prf0[] =
+{
+ 0xbc, 0xd4, 0xc6, 0x50, 0xb3, 0x0b, 0x96, 0x84,
+ 0x95, 0x18, 0x29, 0xe0, 0xd7, 0x5f, 0x9d, 0x54,
+ 0xb8, 0x62, 0x17, 0x5e, 0xd9, 0xf0, 0x06, 0x06,
+ 0xe1, 0x7d, 0x8d, 0xa3, 0x54, 0x02, 0xff, 0xee,
+ 0x75, 0xdf, 0x78, 0xc3, 0xd3, 0x1e, 0x0f, 0x88,
+ 0x9f, 0x01, 0x21, 0x20, 0xc0, 0x86, 0x2b, 0xeb,
+ 0x67, 0x75, 0x3e, 0x74, 0x39, 0xae, 0x24, 0x2e,
+ 0xdb, 0x83, 0x73, 0x69, 0x83, 0x56, 0xcf, 0x5a
+};
+
+static u8 key1[] = "Jefe";
+static u8 data1[] = "what do ya want for nothing?";
+static u8 prf1[] =
+{
+ 0x51, 0xf4, 0xde, 0x5b, 0x33, 0xf2, 0x49, 0xad,
+ 0xf8, 0x1a, 0xeb, 0x71, 0x3a, 0x3c, 0x20, 0xf4,
+ 0xfe, 0x63, 0x14, 0x46, 0xfa, 0xbd, 0xfa, 0x58,
+ 0x24, 0x47, 0x59, 0xae, 0x58, 0xef, 0x90, 0x09,
+ 0xa9, 0x9a, 0xbf, 0x4e, 0xac, 0x2c, 0xa5, 0xfa,
+ 0x87, 0xe6, 0x92, 0xc4, 0x40, 0xeb, 0x40, 0x02,
+ 0x3e, 0x7b, 0xab, 0xb2, 0x06, 0xd6, 0x1d, 0xe7,
+ 0xb9, 0x2f, 0x41, 0x52, 0x90, 0x92, 0xb8, 0xfc
+};
+
+
+static u8 key2[] =
+{
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa
+};
+static u8 data2[] =
+{
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd
+};
+static u8 prf2[] =
+{
+ 0xe1, 0xac, 0x54, 0x6e, 0xc4, 0xcb, 0x63, 0x6f,
+ 0x99, 0x76, 0x48, 0x7b, 0xe5, 0xc8, 0x6b, 0xe1,
+ 0x7a, 0x02, 0x52, 0xca, 0x5d, 0x8d, 0x8d, 0xf1,
+ 0x2c, 0xfb, 0x04, 0x73, 0x52, 0x52, 0x49, 0xce,
+ 0x9d, 0xd8, 0xd1, 0x77, 0xea, 0xd7, 0x10, 0xbc,
+ 0x9b, 0x59, 0x05, 0x47, 0x23, 0x91, 0x07, 0xae,
+ 0xf7, 0xb4, 0xab, 0xd4, 0x3d, 0x87, 0xf0, 0xa6,
+ 0x8f, 0x1c, 0xbd, 0x9e, 0x2b, 0x6f, 0x76, 0x07
+};
+
+
+struct passphrase_test {
+ char *passphrase;
+ char *ssid;
+ char psk[32];
+};
+
+static struct passphrase_test passphrase_tests[] =
+{
+ {
+ "password",
+ "IEEE",
+ {
+ 0xf4, 0x2c, 0x6f, 0xc5, 0x2d, 0xf0, 0xeb, 0xef,
+ 0x9e, 0xbb, 0x4b, 0x90, 0xb3, 0x8a, 0x5f, 0x90,
+ 0x2e, 0x83, 0xfe, 0x1b, 0x13, 0x5a, 0x70, 0xe2,
+ 0x3a, 0xed, 0x76, 0x2e, 0x97, 0x10, 0xa1, 0x2e
+ }
+ },
+ {
+ "ThisIsAPassword",
+ "ThisIsASSID",
+ {
+ 0x0d, 0xc0, 0xd6, 0xeb, 0x90, 0x55, 0x5e, 0xd6,
+ 0x41, 0x97, 0x56, 0xb9, 0xa1, 0x5e, 0xc3, 0xe3,
+ 0x20, 0x9b, 0x63, 0xdf, 0x70, 0x7d, 0xd5, 0x08,
+ 0xd1, 0x45, 0x81, 0xf8, 0x98, 0x27, 0x21, 0xaf
+ }
+ },
+ {
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ",
+ {
+ 0xbe, 0xcb, 0x93, 0x86, 0x6b, 0xb8, 0xc3, 0x83,
+ 0x2c, 0xb7, 0x77, 0xc2, 0xf5, 0x59, 0x80, 0x7c,
+ 0x8c, 0x59, 0xaf, 0xcb, 0x6e, 0xae, 0x73, 0x48,
+ 0x85, 0x00, 0x13, 0x00, 0xa9, 0x81, 0xcc, 0x62
+ }
+ },
+};
+
+#define NUM_PASSPHRASE_TESTS \
+(sizeof(passphrase_tests) / sizeof(passphrase_tests[0]))
+
+
+int main(int argc, char *argv[])
+{
+ u8 res[512];
+ int ret = 0, i;
+
+ kdDebug() << "PRF-SHA1 test cases:" << endl;
+
+ sha1_prf(key0, sizeof(key0), "prefix", data0, sizeof(data0) - 1,
+ res, sizeof(prf0));
+ if (memcmp(res, prf0, sizeof(prf0)) == 0)
+ kdDebug() << "Test case 0 - OK" << endl;
+ else {
+ kdDebug() << "Test case 0 - FAILED!" << endl;
+ ret++;
+ }
+
+ sha1_prf(key1, sizeof(key1) - 1, "prefix", data1, sizeof(data1) - 1,
+ res, sizeof(prf1));
+ if (memcmp(res, prf1, sizeof(prf1)) == 0)
+ kdDebug() << "Test case 1 - OK" << endl;
+ else {
+ kdDebug() << "Test case 1 - FAILED!" << endl;
+ ret++;
+ }
+
+ sha1_prf(key2, sizeof(key2), "prefix", data2, sizeof(data2),
+ res, sizeof(prf2));
+ if (memcmp(res, prf2, sizeof(prf2)) == 0)
+ kdDebug() << "Test case 2 - OK" << endl;
+ else {
+ kdDebug() << "Test case 2 - FAILED!" << endl;
+ ret++;
+ }
+
+ ret += test_eap_fast();
+
+ kdDebug() << "PBKDF2-SHA1 Passphrase test cases:" << endl;
+ for (i = 0; i < NUM_PASSPHRASE_TESTS; i++) {
+ u8 psk[32];
+ struct passphrase_test *test = &passphrase_tests[i];
+ pbkdf2_sha1(test->passphrase,
+ test->ssid, strlen(test->ssid),
+ 4096, psk, 32);
+ if (memcmp(psk, test->psk, 32) == 0)
+ kdDebug() << "Test case " << i << " - OK" << endl;
+ else {
+ kdDebug() << "Test case " << i << " - FAILED!" << endl;
+ ret++;
+ }
+ }
+
+ return ret;
+}
+#endif /* TEST_MAIN */
diff --git a/knetworkmanager-0.8/src/sha1.h b/knetworkmanager-0.8/src/sha1.h
new file mode 100644
index 0000000..40863c8
--- /dev/null
+++ b/knetworkmanager-0.8/src/sha1.h
@@ -0,0 +1,34 @@
+/*
+ * SHA1 hash implementation and interface functions
+ * Copyright (c) 2003-2005, Jouni Malinen <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#ifndef SHA1_H
+#define SHA1_H
+
+#include <sys/types.h>
+
+
+#define SHA1_MAC_LEN 20
+
+void sha1_mac(const u_int8_t *key, size_t key_len, const u_int8_t *data, size_t data_len,
+ u_int8_t *mac);
+void hmac_sha1_vector(const u_int8_t *key, size_t key_len, size_t num_elem,
+ const u_int8_t *addr[], const size_t *len, u_int8_t *mac);
+void hmac_sha1(const u_int8_t *key, size_t key_len, const u_int8_t *data, size_t data_len,
+ u_int8_t *mac);
+void sha1_prf(const u_int8_t *key, size_t key_len, const char *label,
+ const u_int8_t *data, size_t data_len, u_int8_t *buf, size_t buf_len);
+void pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len,
+ int iterations, u_int8_t *buf, size_t buflen);
+
+#endif /* SHA1_H */
diff --git a/knetworkmanager-0.8/src/traycomponent.cpp b/knetworkmanager-0.8/src/traycomponent.cpp
new file mode 100644
index 0000000..26f31b7
--- /dev/null
+++ b/knetworkmanager-0.8/src/traycomponent.cpp
@@ -0,0 +1,46 @@
+/*
+Copyright 2008 Helmut Schaa <[email protected]>, <[email protected]>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "traycomponent.h"
+
+#include <klocale.h>
+#include <ksystemtray.h>
+
+TrayComponent::TrayComponent(KSystemTray * parent, const char * name )
+ : TQObject(parent, name), m_tray(parent)
+{
+
+}
+
+TrayComponent::~TrayComponent()
+{
+}
+
+KSystemTray * TrayComponent::tray() const
+{
+ return m_tray;
+}
+
+TQStringList TrayComponent::getToolTipText()
+{
+ return TQStringList();
+}
+
+#include "traycomponent.moc"
diff --git a/knetworkmanager-0.8/src/traycomponent.h b/knetworkmanager-0.8/src/traycomponent.h
new file mode 100644
index 0000000..d6607e8
--- /dev/null
+++ b/knetworkmanager-0.8/src/traycomponent.h
@@ -0,0 +1,49 @@
+/*
+Copyright 2008 Helmut Schaa <[email protected]>, <[email protected]>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef TRAY_COMPONENT_H
+#define TRAY_COMPONENT_H
+
+#include <NetworkManager.h>
+
+#include <tqmap.h>
+#include <tqmovie.h>
+#include <tqobject.h>
+#include <tqpixmap.h>
+
+class KPopupMenu;
+class KSystemTray;
+
+class TrayComponent : public TQObject
+{
+Q_OBJECT
+ TQ_OBJECT
+public:
+ TrayComponent(KSystemTray * parent, const char * name );
+ virtual ~TrayComponent();
+ virtual void addMenuItems(KPopupMenu* menu) = 0;
+ KSystemTray * tray() const;;
+ virtual TQStringList getToolTipText();
+signals:
+ void uiUpdated();
+private:
+ KSystemTray * m_tray;
+};
+#endif // TRAY_COMPONENT_H
diff --git a/knetworkmanager-0.8/src/vpn_tray_component.cpp b/knetworkmanager-0.8/src/vpn_tray_component.cpp
new file mode 100644
index 0000000..68ad8a1
--- /dev/null
+++ b/knetworkmanager-0.8/src/vpn_tray_component.cpp
@@ -0,0 +1,150 @@
+/***************************************************************************
+ *
+ * vpn_tray_componenet.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+// KDE includes
+#include <kdebug.h>
+#include <klocale.h>
+#include <kiconloader.h>
+
+// TQt DBus
+#include <tqdbusobjectpath.h>
+
+
+// KNM includes
+#include "vpn_tray_component.h"
+#include "knetworkmanager-menuitem.h"
+#include "knetworkmanager-menu_subhead.h"
+#include "knetworkmanager-connection_store.h"
+#include "knetworkmanager-vpn_connection.h"
+#include "knetworkmanager-nm_proxy.h"
+
+#include "knetworkmanager-connection_setting_info.h"
+#include "knetworkmanager-connection_setting_vpn.h"
+#include "knetworkmanager-connection_settings_dialog.h"
+#include <stdio.h>
+
+using namespace ConnectionSettings;
+
+void VPNTrayComponent::slotShowNewConnectionDialog()
+{
+ // create a new VPN connection
+ Connection* conn = new VPNConnection();
+
+ // edit the new connection
+ ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, tray(), "connect_something", false, TQt::WDestructiveClose);
+ dlg->show();
+}
+
+
+void VPNTrayComponent::addMenuItems(KPopupMenu* menu)
+{
+ int inactive_vpn_connections = 0;
+ char vpn_found;
+ char any_vpn_found = 0;
+ ConnectionStore* connectionStore = ConnectionStore::getInstance();
+
+ // Get all active connections
+ NMProxy* nm = NMProxy::getInstance();
+ TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > map = nm->getActiveConnectionsMap();
+
+ // get all available VPN Connections
+ TQValueList<Connection*> connections = connectionStore->getConnections(NM_SETTING_VPN_SETTING_NAME);
+ if (!connections.empty())
+ {
+ TQPopupMenu* popup = new TQPopupMenu(menu);
+ for (TQValueList<Connection*>::iterator it = connections.begin(); it != connections.end(); ++it)
+ {
+ VPNConnection* vpnconn = dynamic_cast<VPNConnection*>(*it);
+ if (vpnconn)
+ {
+ // VPN connection found :)
+ Info* info = vpnconn->getInfoSetting();
+
+ // lets create a nice name for this connection
+ if (info)
+ {
+ TQString title = info->getName();
+
+ NetworkMenuItem* item = new NetworkMenuItem(NULL, vpnconn, TQT_TQOBJECT(menu));
+
+ vpn_found = 0;
+ for (TQValueList<TQPair<ConnectionSettings::Connection*, Device*> >::Iterator it = map.begin(); it != map.end(); ++it)
+ {
+ ConnectionSettings::GenericConnection* conn = dynamic_cast<ConnectionSettings::GenericConnection*>((*it).first);
+
+ if (conn) {
+ if (strcmp(info->getName(), conn->getInfoSetting()->getName()) == 0) {
+ vpn_found = 1;
+ any_vpn_found = 1;
+ }
+ }
+ }
+
+ if (vpn_found == 1) {
+ printf("Active VPN connection found\n\r");
+ }
+ else {
+ int id = popup->insertItem(SmallIcon ("encrypted", TQIconSet::Automatic), title, item, TQT_SLOT(slotActivate()));
+ inactive_vpn_connections++;
+ }
+
+ //menu->setItemChecked(id, ((*it) == active_conn));
+ }
+ }
+ }
+
+ TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection();
+ TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn);
+
+ if (any_vpn_found == 1) {
+ inactive_vpn_connections = 0;
+ }
+
+ if (device.isNull()) {
+ inactive_vpn_connections = 0;
+ }
+
+ if (inactive_vpn_connections > 0) {
+ menu->insertItem(SmallIcon ("encrypted", TQIconSet::Automatic), i18n("Start VPN connection"), popup);
+ menu->insertSeparator();
+ }
+ }
+}
+
+VPNTrayComponent::VPNTrayComponent (KSystemTray * parent, const char * name )
+ : TrayComponent (parent, name)
+{
+ //Actions used for plugging into the menu
+ new KAction (i18n ("New connection ..."),
+ SmallIcon ("encrypted", TQIconSet::Automatic), 0,
+ this, TQT_SLOT (slotShowNewConnectionDialog()), parent->actionCollection (), "create_new_vpn_connection");
+}
+
+VPNTrayComponent::~VPNTrayComponent ()
+{
+
+}
+
+
+#include "vpn_tray_component.moc"
diff --git a/knetworkmanager-0.8/src/vpn_tray_component.h b/knetworkmanager-0.8/src/vpn_tray_component.h
new file mode 100644
index 0000000..ad78081
--- /dev/null
+++ b/knetworkmanager-0.8/src/vpn_tray_component.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ *
+ * knetworkmanager.h - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2005, 2006 Novell, Inc.
+ *
+ * Author: Helmut Schaa <[email protected]>, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef VPN_TRAY_COMPONENT_H
+#define VPN_TRAY_COMPONENT_H
+
+// KNM includes
+#include "traycomponent.h"
+
+#include "knetworkmanager.h"
+
+class VPNTrayComponent : public TrayComponent
+{
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+ VPNTrayComponent (KSystemTray * parent = 0, const char * name = 0);
+ ~VPNTrayComponent ();
+
+ void addMenuItems(KPopupMenu* menu);
+
+ public slots:
+ void slotShowNewConnectionDialog();
+
+ private:
+};
+
+#endif /* VPN_TRAY_COMPONENT_H */
diff --git a/knetworkmanager-0.8/src/vpnauthentication.ui b/knetworkmanager-0.8/src/vpnauthentication.ui
new file mode 100644
index 0000000..0c49472
--- /dev/null
+++ b/knetworkmanager-0.8/src/vpnauthentication.ui
@@ -0,0 +1,149 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>AuthenticationDialog</class>
+<widget class="TQDialog">
+ <property name="name">
+ <cstring>AuthenticationDialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>426</width>
+ <height>224</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="caption">
+ <string>AuthenticationDialog</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton" row="4" column="1">
+ <property name="name">
+ <cstring>pushOK</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="3" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>chkStorePasswordsPermanent</cstring>
+ </property>
+ <property name="text">
+ <string>Save passwords permanent</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="4" column="2">
+ <property name="name">
+ <cstring>pushCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ <spacer row="4" column="0">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQLabel" row="1" column="0" rowspan="4" colspan="1">
+ <property name="name">
+ <cstring>labelPixmap</cstring>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ <property name="tqalignment">
+ <set>AlignTop</set>
+ </property>
+ </widget>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQWidgetStack" row="1" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>widgetStack</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>WStackPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>0</number>
+ </attribute>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>pushCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>AuthenticationDialog</receiver>
+ <slot>cancel()</slot>
+ </connection>
+ <connection>
+ <sender>pushOK</sender>
+ <signal>clicked()</signal>
+ <receiver>AuthenticationDialog</receiver>
+ <slot>ok()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>pushOK</tabstop>
+ <tabstop>pushCancel</tabstop>
+ <tabstop>chkStorePasswordsPermanent</tabstop>
+ <tabstop>widgetStack</tabstop>
+</tabstops>
+<Q_SLOTS>
+ <slot access="protected">ok()</slot>
+ <slot access="protected">cancel()</slot>
+</Q_SLOTS>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/knetworkmanager-0.8/src/xmlmarshaller.cpp b/knetworkmanager-0.8/src/xmlmarshaller.cpp
new file mode 100644
index 0000000..a826e39
--- /dev/null
+++ b/knetworkmanager-0.8/src/xmlmarshaller.cpp
@@ -0,0 +1,1109 @@
+/***************************************************************************
+ *
+ * Copyright (C) 2008 by Kevin Krammer <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#include "xmlmarshaller.h"
+
+#include <tqdbusdata.h>
+#include <tqdbusdatalist.h>
+#include <tqdbusdatamap.h>
+#include <tqdbusobjectpath.h>
+#include <tqdbusvariant.h>
+
+#include <tqdom.h>
+#include <tqvaluelist.h>
+
+#include <kdebug.h>
+
+static TQDomElement fromBool(bool value, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("bool");
+ TQDomText text = doc.createTextNode((value ? "true" : "false"));
+
+ element.appendChild(text);
+
+ return element;
+}
+
+static TQDomElement fromByte(TQ_UINT8 value, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("byte");
+ TQDomText text = doc.createTextNode(TQString::number(value));
+
+ element.appendChild(text);
+
+ return element;
+}
+
+static TQDomElement fromInt16(TQ_INT16 value, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("int16");
+ TQDomText text = doc.createTextNode(TQString::number(value));
+
+ element.appendChild(text);
+
+ return element;
+}
+
+static TQDomElement fromUInt16(TQ_UINT16 value, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("uin16");
+ TQDomText text = doc.createTextNode(TQString::number(value));
+
+ element.appendChild(text);
+
+ return element;
+}
+
+static TQDomElement fromInt32(TQ_INT32 value, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("int32");
+ TQDomText text = doc.createTextNode(TQString::number(value));
+
+ element.appendChild(text);
+
+ return element;
+}
+
+static TQDomElement fromUInt32(TQ_UINT32 value, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("uint32");
+ TQDomText text = doc.createTextNode(TQString::number(value));
+
+ element.appendChild(text);
+
+ return element;
+}
+
+static TQDomElement fromInt64(TQ_INT64 value, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("int64");
+ TQDomText text = doc.createTextNode(TQString::number(value));
+
+ element.appendChild(text);
+
+ return element;
+}
+
+static TQDomElement fromUInt64(TQ_UINT64 value, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("uint64");
+ TQDomText text = doc.createTextNode(TQString::number(value));
+
+ element.appendChild(text);
+
+ return element;
+}
+
+static TQDomElement fromDouble(double value, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("double");
+ TQDomText text = doc.createTextNode(TQString::number(value));
+
+ element.appendChild(text);
+
+ return element;
+}
+
+static TQDomElement fromString(const TQString& value, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("string");
+ TQDomText text = doc.createTextNode(value); // TODO: espace
+
+ element.appendChild(text);
+
+ return element;
+}
+
+static TQDomElement fromObjectPath(const TQT_DBusObjectPath& value, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("objectpath");
+ TQDomText text = doc.createTextNode(value);
+
+ element.appendChild(text);
+
+ return element;
+}
+
+static TQDomElement fromByteKeyMap(const TQT_DBusDataMap<TQ_UINT8>& map, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("map");
+
+ if (map.isEmpty()) return element;
+
+ TQT_DBusDataMap<TQ_UINT8>::const_iterator it = map.begin();
+ TQT_DBusDataMap<TQ_UINT8>::const_iterator endIt = map.end();
+ for (; it != endIt; ++it)
+ {
+ TQDomElement entryElement = doc.createElement("entry");
+
+ entryElement.appendChild(fromByte(it.key(), ownerDoc));
+ entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc));
+
+ element.appendChild(entryElement);
+ }
+
+ return element;
+}
+
+static TQDomElement fromInt16KeyMap(const TQT_DBusDataMap<TQ_INT16>& map, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("map");
+
+ if (map.isEmpty()) return element;
+
+ TQT_DBusDataMap<TQ_INT16>::const_iterator it = map.begin();
+ TQT_DBusDataMap<TQ_INT16>::const_iterator endIt = map.end();
+ for (; it != endIt; ++it)
+ {
+ TQDomElement entryElement = doc.createElement("entry");
+
+ entryElement.appendChild(fromInt16(it.key(), ownerDoc));
+ entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc));
+
+ element.appendChild(entryElement);
+ }
+
+ return element;
+}
+
+static TQDomElement fromUInt16KeyMap(const TQT_DBusDataMap<TQ_UINT16>& map, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("map");
+
+ if (map.isEmpty()) return element;
+
+ TQT_DBusDataMap<TQ_UINT16>::const_iterator it = map.begin();
+ TQT_DBusDataMap<TQ_UINT16>::const_iterator endIt = map.end();
+ for (; it != endIt; ++it)
+ {
+ TQDomElement entryElement = doc.createElement("entry");
+
+ entryElement.appendChild(fromUInt16(it.key(), ownerDoc));
+ entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc));
+
+ element.appendChild(entryElement);
+ }
+
+ return element;
+}
+
+static TQDomElement fromInt32KeyMap(const TQT_DBusDataMap<TQ_INT32>& map, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("map");
+
+ if (map.isEmpty()) return element;
+
+ TQT_DBusDataMap<TQ_INT32>::const_iterator it = map.begin();
+ TQT_DBusDataMap<TQ_INT32>::const_iterator endIt = map.end();
+ for (; it != endIt; ++it)
+ {
+ TQDomElement entryElement = doc.createElement("entry");
+
+ entryElement.appendChild(fromInt32(it.key(), ownerDoc));
+ entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc));
+
+ element.appendChild(entryElement);
+ }
+
+ return element;
+}
+
+static TQDomElement fromUInt32KeyMap(const TQT_DBusDataMap<TQ_UINT32>& map, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("map");
+
+ if (map.isEmpty()) return element;
+
+ TQT_DBusDataMap<TQ_UINT32>::const_iterator it = map.begin();
+ TQT_DBusDataMap<TQ_UINT32>::const_iterator endIt = map.end();
+ for (; it != endIt; ++it)
+ {
+ TQDomElement entryElement = doc.createElement("entry");
+
+ entryElement.appendChild(fromUInt32(it.key(), ownerDoc));
+ entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc));
+
+ element.appendChild(entryElement);
+ }
+
+ return element;
+}
+
+static TQDomElement fromInt64KeyMap(const TQT_DBusDataMap<TQ_INT64>& map, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("map");
+
+ if (map.isEmpty()) return element;
+
+ TQT_DBusDataMap<TQ_INT64>::const_iterator it = map.begin();
+ TQT_DBusDataMap<TQ_INT64>::const_iterator endIt = map.end();
+ for (; it != endIt; ++it)
+ {
+ TQDomElement entryElement = doc.createElement("entry");
+
+ entryElement.appendChild(fromInt16(it.key(), ownerDoc));
+ entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc));
+
+ element.appendChild(entryElement);
+ }
+
+ return element;
+}
+
+static TQDomElement fromUInt64KeyMap(const TQT_DBusDataMap<TQ_UINT64>& map, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("map");
+
+ if (map.isEmpty()) return element;
+
+ TQT_DBusDataMap<TQ_UINT64>::const_iterator it = map.begin();
+ TQT_DBusDataMap<TQ_UINT64>::const_iterator endIt = map.end();
+ for (; it != endIt; ++it)
+ {
+ TQDomElement entryElement = doc.createElement("entry");
+
+ entryElement.appendChild(fromUInt64(it.key(), ownerDoc));
+ entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc));
+
+ element.appendChild(entryElement);
+ }
+
+ return element;
+}
+
+static TQDomElement fromStringKeyMap(const TQT_DBusDataMap<TQString>& map, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("map");
+
+ if (map.isEmpty()) return element;
+
+ TQT_DBusDataMap<TQString>::const_iterator it = map.begin();
+ TQT_DBusDataMap<TQString>::const_iterator endIt = map.end();
+ for (; it != endIt; ++it)
+ {
+ TQDomElement entryElement = doc.createElement("entry");
+
+ entryElement.appendChild(fromString(it.key(), ownerDoc));
+ entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc));
+
+ element.appendChild(entryElement);
+ }
+
+ return element;
+}
+
+static TQDomElement fromObjectPathKeyMap(const TQT_DBusDataMap<TQT_DBusObjectPath>& map, const TQDomDocument& ownerDoc)
+{
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("map");
+
+ if (map.isEmpty()) return element;
+
+ TQT_DBusDataMap<TQT_DBusObjectPath>::const_iterator it = map.begin();
+ TQT_DBusDataMap<TQT_DBusObjectPath>::const_iterator endIt = map.end();
+ for (; it != endIt; ++it)
+ {
+ TQDomElement entryElement = doc.createElement("entry");
+
+ entryElement.appendChild(fromObjectPath(it.key(), ownerDoc));
+ entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc));
+
+ element.appendChild(entryElement);
+ }
+
+ return element;
+}
+
+static bool toBool(const TQDomElement& element)
+{
+ return element.text() == "true";
+}
+
+static TQ_UINT8 toByte(const TQDomElement& element)
+{
+ uint number = element.text().toUInt();
+ if (number > 255) return 0;
+ return number;
+}
+
+static TQ_INT16 toInt16(const TQDomElement& element)
+{
+ return element.text().toShort();
+}
+
+static TQ_UINT16 toUInt16(const TQDomElement& element)
+{
+ return element.text().toUShort();
+}
+
+static TQ_INT32 toInt32(const TQDomElement& element)
+{
+ return element.text().toInt();
+}
+
+static TQ_UINT32 toUInt32(const TQDomElement& element)
+{
+ return element.text().toUInt();
+}
+
+static TQ_INT64 toInt64(const TQDomElement& element)
+{
+ return element.text().toLongLong();
+}
+
+static TQ_UINT64 toUInt64(const TQDomElement& element)
+{
+ return element.text().toULongLong();
+}
+
+static double toDouble(const TQDomElement& element)
+{
+ return element.text().toDouble();
+}
+
+static TQString toString(const TQDomElement& element)
+{
+ return element.text();
+}
+
+static TQT_DBusObjectPath toObjectPath(const TQDomElement& element)
+{
+ return TQCString(element.text().ascii());
+}
+
+static TQT_DBusData::Type typeFromEntry(const TQDomElement& element)
+{
+ for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling())
+ {
+ if (!child.isElement()) continue;
+
+ TQDomElement childElement = child.toElement();
+
+ if (childElement.tagName() == "byte") return TQT_DBusData::Byte;
+ if (childElement.tagName() == "int16") return TQT_DBusData::Int16;
+ if (childElement.tagName() == "uint16") return TQT_DBusData::UInt16;
+ if (childElement.tagName() == "int32") return TQT_DBusData::Int32;
+ if (childElement.tagName() == "uint32") return TQT_DBusData::UInt32;
+ if (childElement.tagName() == "int64") return TQT_DBusData::Int64;
+ if (childElement.tagName() == "uint64") return TQT_DBusData::UInt64;
+ if (childElement.tagName() == "string") return TQT_DBusData::String;
+ if (childElement.tagName() == "objectpath") return TQT_DBusData::ObjectPath;
+ }
+
+ return TQT_DBusData::Invalid;
+}
+
+static TQT_DBusData toByteKeyMap(const TQDomElement& element)
+{
+ TQT_DBusDataMap<TQ_UINT8> map;
+
+ for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling())
+ {
+ if (!child.isElement()) continue;
+
+ TQDomElement entryElement = child.toElement();
+ if (entryElement.tagName() != "entry") continue;
+
+ for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ TQDomElement childElement = entryChild.toElement();
+ if (childElement.tagName() != "byte") continue;
+
+ TQ_UINT8 key = toByte(childElement);
+
+ TQT_DBusData data;
+ for (entryChild = entryChild.nextSibling(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ data = XMLMarshaller::toTQT_DBusData(entryChild.toElement());
+ if (data.isValid()) break;
+ }
+
+ if (!data.isValid()) return TQT_DBusData();
+
+ map.insert(key, data);
+ break;
+ }
+ }
+
+ return TQT_DBusData::fromByteKeyMap(map);
+}
+
+static TQT_DBusData toInt16KeyMap(const TQDomElement& element)
+{
+ TQT_DBusDataMap<TQ_INT16> map;
+
+ for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling())
+ {
+ if (!child.isElement()) continue;
+
+ TQDomElement entryElement = child.toElement();
+ if (entryElement.tagName() != "entry") continue;
+
+ for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ TQDomElement childElement = entryChild.toElement();
+ if (childElement.tagName() != "int16") continue;
+
+ TQ_INT16 key = toInt16(childElement);
+
+ TQT_DBusData data;
+ for (entryChild = entryChild.nextSibling(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ data = XMLMarshaller::toTQT_DBusData(entryChild.toElement());
+ if (data.isValid()) break;
+ }
+
+ if (!data.isValid()) return TQT_DBusData();
+
+ map.insert(key, data);
+ break;
+ }
+ }
+
+ return TQT_DBusData::fromInt16KeyMap(map);
+}
+
+static TQT_DBusData toUInt16KeyMap(const TQDomElement& element)
+{
+ TQT_DBusDataMap<TQ_UINT16> map;
+
+ for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling())
+ {
+ if (!child.isElement()) continue;
+
+ TQDomElement entryElement = child.toElement();
+ if (entryElement.tagName() != "entry") continue;
+
+ for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ TQDomElement childElement = entryChild.toElement();
+ if (childElement.tagName() != "uint16") continue;
+
+ TQ_UINT16 key = toUInt16(childElement);
+
+ TQT_DBusData data;
+ for (entryChild = entryChild.nextSibling(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ data = XMLMarshaller::toTQT_DBusData(entryChild.toElement());
+ if (data.isValid()) break;
+ }
+
+ if (!data.isValid()) return TQT_DBusData();
+
+ map.insert(key, data);
+ break;
+ }
+ }
+
+ return TQT_DBusData::fromUInt16KeyMap(map);
+}
+
+static TQT_DBusData toInt32KeyMap(const TQDomElement& element)
+{
+ TQT_DBusDataMap<TQ_INT32> map;
+
+ for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling())
+ {
+ if (!child.isElement()) continue;
+
+ TQDomElement entryElement = child.toElement();
+ if (entryElement.tagName() != "entry") continue;
+
+ for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ TQDomElement childElement = entryChild.toElement();
+ if (childElement.tagName() != "int32") continue;
+
+ TQ_INT32 key = toInt32(childElement);
+
+ TQT_DBusData data;
+ for (entryChild = entryChild.nextSibling(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ data = XMLMarshaller::toTQT_DBusData(entryChild.toElement());
+ if (data.isValid()) break;
+ }
+
+ if (!data.isValid()) return TQT_DBusData();
+
+ map.insert(key, data);
+ break;
+ }
+ }
+
+ return TQT_DBusData::fromInt32KeyMap(map);
+}
+
+static TQT_DBusData toUInt32KeyMap(const TQDomElement& element)
+{
+ TQT_DBusDataMap<TQ_UINT32> map;
+
+ for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling())
+ {
+ if (!child.isElement()) continue;
+
+ TQDomElement entryElement = child.toElement();
+ if (entryElement.tagName() != "entry") continue;
+
+ for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ TQDomElement childElement = entryChild.toElement();
+ if (childElement.tagName() != "uint32") continue;
+
+ TQ_UINT32 key = toUInt32(childElement);
+
+ TQT_DBusData data;
+ for (entryChild = entryChild.nextSibling(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ data = XMLMarshaller::toTQT_DBusData(entryChild.toElement());
+ if (data.isValid()) break;
+ }
+
+ if (!data.isValid()) return TQT_DBusData();
+
+ map.insert(key, data);
+ break;
+ }
+ }
+
+ return TQT_DBusData::fromUInt32KeyMap(map);
+}
+
+static TQT_DBusData toInt64KeyMap(const TQDomElement& element)
+{
+ TQT_DBusDataMap<TQ_INT64> map;
+
+ for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling())
+ {
+ if (!child.isElement()) continue;
+
+ TQDomElement entryElement = child.toElement();
+ if (entryElement.tagName() != "entry") continue;
+
+ for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ TQDomElement childElement = entryChild.toElement();
+ if (childElement.tagName() != "int64") continue;
+
+ TQ_INT64 key = toInt64(childElement);
+
+ TQT_DBusData data;
+ for (entryChild = entryChild.nextSibling(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ data = XMLMarshaller::toTQT_DBusData(entryChild.toElement());
+ if (data.isValid()) break;
+ }
+
+ if (!data.isValid()) return TQT_DBusData();
+
+ map.insert(key, data);
+ break;
+ }
+ }
+
+ return TQT_DBusData::fromInt64KeyMap(map);
+}
+
+static TQT_DBusData toUInt64KeyMap(const TQDomElement& element)
+{
+ TQT_DBusDataMap<TQ_UINT64> map;
+
+ for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling())
+ {
+ if (!child.isElement()) continue;
+
+ TQDomElement entryElement = child.toElement();
+ if (entryElement.tagName() != "entry") continue;
+
+ for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ TQDomElement childElement = entryChild.toElement();
+ if (childElement.tagName() != "uint64") continue;
+
+ TQ_UINT64 key = toUInt64(childElement);
+
+ TQT_DBusData data;
+ for (entryChild = entryChild.nextSibling(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ data = XMLMarshaller::toTQT_DBusData(entryChild.toElement());
+ if (data.isValid()) break;
+ }
+
+ if (!data.isValid()) return TQT_DBusData();
+
+ map.insert(key, data);
+ break;
+ }
+ }
+
+ return TQT_DBusData::fromUInt64KeyMap(map);
+}
+
+static TQT_DBusData toStringKeyMap(const TQDomElement& element)
+{
+ TQT_DBusDataMap<TQString> map;
+
+ for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling())
+ {
+ if (!child.isElement()) continue;
+
+ TQDomElement entryElement = child.toElement();
+ if (entryElement.tagName() != "entry") continue;
+
+ for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ TQDomElement childElement = entryChild.toElement();
+ if (childElement.tagName() != "string") continue;
+
+ TQString key = toString(childElement);
+
+ TQT_DBusData data;
+ for (entryChild = entryChild.nextSibling(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ data = XMLMarshaller::toTQT_DBusData(entryChild.toElement());
+ if (data.isValid()) break;
+ }
+
+ if (!data.isValid()) return TQT_DBusData();
+
+ map.insert(key, data);
+ break;
+ }
+ }
+
+ return TQT_DBusData::fromStringKeyMap(map);
+}
+
+static TQT_DBusData toObjectPathKeyMap(const TQDomElement& element)
+{
+ TQT_DBusDataMap<TQT_DBusObjectPath> map;
+
+ for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling())
+ {
+ if (!child.isElement()) continue;
+
+ TQDomElement entryElement = child.toElement();
+ if (entryElement.tagName() != "entry") continue;
+
+ for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ TQDomElement childElement = entryChild.toElement();
+ if (childElement.tagName() != "objectpath") continue;
+
+ TQT_DBusObjectPath key = toObjectPath(childElement);
+
+ TQT_DBusData data;
+ for (entryChild = entryChild.nextSibling(); !entryChild.isNull();
+ entryChild = entryChild.nextSibling())
+ {
+ if (!entryChild.isElement()) continue;
+
+ data = XMLMarshaller::toTQT_DBusData(entryChild.toElement());
+ if (data.isValid()) break;
+ }
+
+ if (!data.isValid()) return TQT_DBusData();
+
+ map.insert(key, data);
+ break;
+ }
+ }
+
+ return TQT_DBusData::fromObjectPathKeyMap(map);
+}
+
+TQDomElement XMLMarshaller::fromTQT_DBusData(const TQT_DBusData& data, const TQDomDocument& ownerDoc)
+{
+ switch (data.type())
+ {
+ case TQT_DBusData::Invalid:
+ kdWarning() << "XMLMarsaller::fromTQT_DBusData: data is invalid" << endl;
+ return TQDomElement();
+
+ case TQT_DBusData::Bool:
+ return fromBool(data.toBool(), ownerDoc);
+
+ case TQT_DBusData::Byte:
+ return fromByte(data.toByte(), ownerDoc);
+
+ case TQT_DBusData::Int16:
+ return fromInt16(data.toInt16(), ownerDoc);
+
+ case TQT_DBusData::UInt16:
+ return fromUInt16(data.toUInt16(), ownerDoc);
+
+ case TQT_DBusData::Int32:
+ return fromInt32(data.toInt32(), ownerDoc);
+
+ case TQT_DBusData::UInt32:
+ return fromUInt32(data.toUInt32(), ownerDoc);
+
+ case TQT_DBusData::Int64:
+ return fromInt64(data.toInt64(), ownerDoc);
+
+ case TQT_DBusData::UInt64:
+ return fromUInt64(data.toUInt64(), ownerDoc);
+
+ case TQT_DBusData::Double:
+ return fromDouble(data.toDouble(), ownerDoc);
+
+ case TQT_DBusData::String:
+ return fromString(data.toString(), ownerDoc);
+
+ case TQT_DBusData::ObjectPath:
+ return fromObjectPath(data.toObjectPath(), ownerDoc);
+
+ case TQT_DBusData::List:
+ {
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("list");
+ TQT_DBusDataList list = data.toList();
+ if (list.isEmpty())
+ {
+ element.setAttribute("signature", data.buildDBusSignature().data());
+ }
+ else
+ {
+ TQValueList<TQT_DBusData> items = list.toTQValueList();
+ TQValueList<TQT_DBusData>::const_iterator it = items.begin();
+ TQValueList<TQT_DBusData>::const_iterator endIt = items.end();
+ for (; it != endIt; ++it)
+ {
+ TQDomElement itemElement = fromTQT_DBusData(*it, ownerDoc);
+
+ if (!itemElement.isNull()) element.appendChild(itemElement);
+ }
+ }
+
+ return element;
+ }
+
+ case TQT_DBusData::Struct:
+ {
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("struct");
+
+ TQValueList<TQT_DBusData> members = data.toStruct();
+ TQValueList<TQT_DBusData>::const_iterator it = members.begin();
+ TQValueList<TQT_DBusData>::const_iterator endIt = members.end();
+ for (; it != endIt; ++it)
+ {
+ TQDomElement memberElement = fromTQT_DBusData(*it, ownerDoc);
+
+ if (!memberElement.isNull()) element.appendChild(memberElement);
+ }
+ return element;
+ }
+
+ case TQT_DBusData::Variant:
+ {
+ TQDomDocument doc = ownerDoc;
+ TQDomElement element = doc.createElement("variant");
+
+ TQT_DBusVariant variant = data.toVariant();
+
+ element.setAttribute("signature", variant.signature);
+
+ TQDomElement dataElement = fromTQT_DBusData(variant.value, ownerDoc);
+ if (!dataElement.isNull()) element.appendChild(dataElement);
+
+ return element;
+ }
+
+ case TQT_DBusData::Map:
+ {
+ TQDomElement mapElement;
+
+ switch (data.keyType())
+ {
+ case TQT_DBusData::Byte:
+ mapElement = fromByteKeyMap(data.toByteKeyMap(), ownerDoc);
+ break;
+
+ case TQT_DBusData::Int16:
+ mapElement = fromInt16KeyMap(data.toInt16KeyMap(), ownerDoc);
+ break;
+
+ case TQT_DBusData::UInt16:
+ mapElement = fromUInt16KeyMap(data.toUInt16KeyMap(), ownerDoc);
+ break;
+
+ case TQT_DBusData::Int32:
+ mapElement = fromInt32KeyMap(data.toInt32KeyMap(), ownerDoc);
+ break;
+
+ case TQT_DBusData::UInt32:
+ mapElement = fromUInt32KeyMap(data.toUInt32KeyMap(), ownerDoc);
+ break;
+
+ case TQT_DBusData::Int64:
+ mapElement = fromInt64KeyMap(data.toInt64KeyMap(), ownerDoc);
+ break;
+
+ case TQT_DBusData::UInt64:
+ mapElement = fromUInt64KeyMap(data.toUInt64KeyMap(), ownerDoc);
+ break;
+
+ case TQT_DBusData::String:
+ mapElement = fromStringKeyMap(data.toStringKeyMap(), ownerDoc);
+ break;
+
+ case TQT_DBusData::ObjectPath:
+ mapElement = fromObjectPathKeyMap(data.toObjectPathKeyMap(), ownerDoc);
+ break;
+
+ default:
+ return TQDomElement();
+ }
+
+ if (!mapElement.hasChildNodes())
+ {
+ mapElement.setAttribute("signature", data.buildDBusSignature().data());
+ }
+
+ return mapElement;
+ }
+ }
+
+ return TQDomElement();
+}
+
+TQT_DBusData XMLMarshaller::toTQT_DBusData(const TQDomElement& element)
+{
+ if (element.isNull()) return TQT_DBusData();
+
+ if (element.tagName() == "bool") return TQT_DBusData::fromBool(toBool(element));
+ if (element.tagName() == "byte") return TQT_DBusData::fromByte(toByte(element));
+ if (element.tagName() == "int16") return TQT_DBusData::fromInt16(toInt16(element));
+ if (element.tagName() == "uint16") return TQT_DBusData::fromUInt16(toUInt16(element));
+ if (element.tagName() == "int32") return TQT_DBusData::fromInt32(toInt32(element));
+ if (element.tagName() == "uint32") return TQT_DBusData::fromUInt32(toUInt32(element));
+ if (element.tagName() == "int64") return TQT_DBusData::fromInt64(toInt64(element));
+ if (element.tagName() == "uint64") return TQT_DBusData::fromUInt64(toUInt64(element));
+ if (element.tagName() == "double") return TQT_DBusData::fromDouble(toDouble(element));
+ if (element.tagName() == "string") return TQT_DBusData::fromString(toString(element));
+ if (element.tagName() == "objectpath") return TQT_DBusData::fromObjectPath(toObjectPath(element));
+
+ if (element.tagName() == "list")
+ {
+ if (element.hasChildNodes())
+ {
+ TQValueList<TQT_DBusData> list;
+
+ for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling())
+ {
+ if (!child.isElement()) continue;
+
+ TQT_DBusData itemData = toTQT_DBusData(child.toElement());
+ if (itemData.isValid()) list << itemData;
+ }
+
+ return TQT_DBusData::fromList(list);
+ }
+
+ // TODO handle empty list with signatures as hint
+ }
+
+ if (element.tagName() == "struct")
+ {
+ TQValueList<TQT_DBusData> members;
+
+ for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling())
+ {
+ if (!child.isElement()) continue;
+
+ TQT_DBusData memberData = toTQT_DBusData(child.toElement());
+ if (memberData.isValid()) members << memberData;
+ }
+
+ return TQT_DBusData::fromStruct(members);
+ }
+
+ if (element.tagName() == "variant")
+ {
+ TQT_DBusData data;
+ for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling())
+ {
+ if (!child.isElement()) continue;
+
+ TQT_DBusData childData = toTQT_DBusData(child.toElement());
+ if (childData.isValid())
+ {
+ data = childData;
+ break;
+ }
+ }
+
+ if (!data.isValid()) return TQT_DBusData();
+
+ TQT_DBusVariant variant;
+ variant.signature = element.attribute("signature");
+ variant.value = data;
+
+ return TQT_DBusData::fromVariant(variant);
+ }
+
+ if (element.tagName() == "map")
+ {
+ TQDomElement entryElement;
+ for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling())
+ {
+ if (!child.isElement()) continue;
+
+ TQDomElement childElement = child.toElement();
+ if (childElement.tagName() == "entry")
+ {
+ entryElement = childElement;
+ break;
+ }
+ }
+
+ if (entryElement.isNull())
+ {
+ // TODO: empty map
+ return TQT_DBusData();
+ }
+
+ switch (typeFromEntry(entryElement))
+ {
+ case TQT_DBusData::Byte:
+ return toByteKeyMap(element);
+
+ case TQT_DBusData::Int16:
+ return toInt16KeyMap(element);
+
+ case TQT_DBusData::UInt16:
+ return toUInt16KeyMap(element);
+
+ case TQT_DBusData::Int32:
+ return toInt32KeyMap(element);
+
+ case TQT_DBusData::UInt32:
+ return toUInt32KeyMap(element);
+
+ case TQT_DBusData::Int64:
+ return toInt64KeyMap(element);
+
+ case TQT_DBusData::UInt64:
+ return toUInt64KeyMap(element);
+
+ case TQT_DBusData::String:
+ return toStringKeyMap(element);
+
+ case TQT_DBusData::ObjectPath:
+ return toObjectPathKeyMap(element);
+
+ default:
+ return TQT_DBusData();
+ }
+ }
+
+ return TQT_DBusData();
+}
+
+TQString XMLMarshaller::fromTQT_DBusData(const TQT_DBusData& data)
+{
+ TQDomDocument doc;
+
+ TQDomElement element = fromTQT_DBusData(data, doc);
+ if (element.isNull()) return TQString();
+
+ doc.appendChild(element);
+ return doc.toString();
+}
+
+TQT_DBusData XMLMarshaller::toTQT_DBusData(const TQString& xmlString)
+{
+ TQDomDocument doc;
+
+ if (!doc.setContent(xmlString)) return TQT_DBusData();
+
+ return toTQT_DBusData(doc.documentElement());
+}
+
diff --git a/knetworkmanager-0.8/src/xmlmarshaller.h b/knetworkmanager-0.8/src/xmlmarshaller.h
new file mode 100644
index 0000000..f86ef92
--- /dev/null
+++ b/knetworkmanager-0.8/src/xmlmarshaller.h
@@ -0,0 +1,42 @@
+/***************************************************************************
+ *
+ * Copyright (C) 2008 by Kevin Krammer <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ **************************************************************************/
+
+#ifndef XMLMARSHALLER_H
+#define XMLMARSHALLER_H
+
+class TQT_DBusData;
+class TQDomDocument;
+class TQDomElement;
+class TQString;
+
+class XMLMarshaller
+{
+public:
+ static TQDomElement fromTQT_DBusData(const TQT_DBusData& data, const TQDomDocument& ownerDoc);
+
+ static TQT_DBusData toTQT_DBusData(const TQDomElement& element);
+
+ static TQString fromTQT_DBusData(const TQT_DBusData& data);
+
+ static TQT_DBusData toTQT_DBusData(const TQString& xmlString);
+};
+
+#endif
+