From 082adfa55004e0e1fe5fc5c68881fa00832b3128 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 3 Sep 2012 02:18:59 -0500 Subject: Attempt to reorganize the directory structure --- tdenetworkmanager/src/CMakeLists.txt | 34 +- ...tworkmanager-connection_setting_cdma_widget.cpp | 89 ++ ...networkmanager-connection_setting_cdma_widget.h | 67 ++ ...etworkmanager-connection_setting_gsm_widget.cpp | 108 +++ ...knetworkmanager-connection_setting_gsm_widget.h | 67 ++ ...tworkmanager-connection_setting_info_widget.cpp | 79 ++ ...networkmanager-connection_setting_info_widget.h | 65 ++ ...tworkmanager-connection_setting_ipv4_widget.cpp | 175 ++++ ...networkmanager-connection_setting_ipv4_widget.h | 65 ++ ...etworkmanager-connection_setting_ppp_widget.cpp | 130 +++ ...knetworkmanager-connection_setting_ppp_widget.h | 65 ++ ...orkmanager-connection_setting_serial_widget.cpp | 97 ++ ...tworkmanager-connection_setting_serial_widget.h | 65 ++ ...etworkmanager-connection_setting_vpn_widget.cpp | 206 +++++ ...knetworkmanager-connection_setting_vpn_widget.h | 69 ++ ...manager-connection_setting_widget_interface.cpp | 37 + ...rkmanager-connection_setting_widget_interface.h | 47 + ...connection_setting_wireless_security_widget.cpp | 999 +++++++++++++++++++++ ...r-connection_setting_wireless_security_widget.h | 238 +++++ ...kmanager-connection_setting_wireless_widget.cpp | 231 +++++ ...orkmanager-connection_setting_wireless_widget.h | 71 ++ tdenetworkmanager/src/connection_setting_cdma.ui | 131 --- tdenetworkmanager/src/connection_setting_gsm.ui | 294 ------ tdenetworkmanager/src/connection_setting_info.ui | 71 -- tdenetworkmanager/src/connection_setting_ipv4.ui | 116 --- tdenetworkmanager/src/connection_setting_ppp.ui | 320 ------- tdenetworkmanager/src/connection_setting_serial.ui | 185 ---- tdenetworkmanager/src/connection_setting_vpn.ui | 51 -- .../src/connection_setting_wireless.ui | 140 --- .../src/connection_setting_wireless_security.ui | 87 -- .../connection_setting_wireless_security_auth.ui | 51 -- .../connection_setting_wireless_security_eap.ui | 163 ---- .../connection_setting_wireless_security_phase2.ui | 54 -- .../connection_setting_wireless_security_wep.ui | 146 --- ...tion_setting_wireless_security_wepencryption.ui | 46 - ...nnection_setting_wireless_security_wpacipher.ui | 128 --- .../connection_setting_wireless_security_wpapsk.ui | 46 - ...nection_setting_wireless_security_wpaversion.ui | 80 -- tdenetworkmanager/src/connection_settings.ui | 137 --- .../src/knetworkmanager-connection.cpp | 3 - tdenetworkmanager/src/knetworkmanager-connection.h | 2 - .../src/knetworkmanager-connection_setting.cpp | 106 --- .../src/knetworkmanager-connection_setting.h | 94 -- .../knetworkmanager-connection_setting_8021x.cpp | 380 -------- .../src/knetworkmanager-connection_setting_8021x.h | 195 ---- .../knetworkmanager-connection_setting_cdma.cpp | 138 --- .../src/knetworkmanager-connection_setting_cdma.h | 75 -- ...tworkmanager-connection_setting_cdma_widget.cpp | 89 -- ...networkmanager-connection_setting_cdma_widget.h | 67 -- .../src/knetworkmanager-connection_setting_gsm.cpp | 251 ------ .../src/knetworkmanager-connection_setting_gsm.h | 99 -- ...etworkmanager-connection_setting_gsm_widget.cpp | 108 --- ...knetworkmanager-connection_setting_gsm_widget.h | 67 -- .../knetworkmanager-connection_setting_info.cpp | 163 ---- .../src/knetworkmanager-connection_setting_info.h | 79 -- ...tworkmanager-connection_setting_info_widget.cpp | 79 -- ...networkmanager-connection_setting_info_widget.h | 65 -- .../knetworkmanager-connection_setting_ipv4.cpp | 318 ------- .../src/knetworkmanager-connection_setting_ipv4.h | 112 --- ...tworkmanager-connection_setting_ipv4_widget.cpp | 175 ---- ...networkmanager-connection_setting_ipv4_widget.h | 65 -- .../src/knetworkmanager-connection_setting_ppp.cpp | 376 -------- .../src/knetworkmanager-connection_setting_ppp.h | 136 --- ...etworkmanager-connection_setting_ppp_widget.cpp | 130 --- ...knetworkmanager-connection_setting_ppp_widget.h | 65 -- .../knetworkmanager-connection_setting_serial.cpp | 168 ---- .../knetworkmanager-connection_setting_serial.h | 89 -- ...orkmanager-connection_setting_serial_widget.cpp | 97 -- ...tworkmanager-connection_setting_serial_widget.h | 65 -- .../src/knetworkmanager-connection_setting_vpn.cpp | 206 ----- .../src/knetworkmanager-connection_setting_vpn.h | 83 -- ...etworkmanager-connection_setting_vpn_widget.cpp | 206 ----- ...knetworkmanager-connection_setting_vpn_widget.h | 69 -- ...manager-connection_setting_widget_interface.cpp | 37 - ...rkmanager-connection_setting_widget_interface.h | 47 - .../knetworkmanager-connection_setting_wired.cpp | 99 -- .../src/knetworkmanager-connection_setting_wired.h | 62 -- ...knetworkmanager-connection_setting_wireless.cpp | 220 ----- .../knetworkmanager-connection_setting_wireless.h | 97 -- ...anager-connection_setting_wireless_security.cpp | 451 ---------- ...kmanager-connection_setting_wireless_security.h | 156 ---- ...connection_setting_wireless_security_widget.cpp | 999 --------------------- ...r-connection_setting_wireless_security_widget.h | 238 ----- ...kmanager-connection_setting_wireless_widget.cpp | 231 ----- ...orkmanager-connection_setting_wireless_widget.h | 71 -- .../knetworkmanager-connection_settings_dialog.cpp | 530 ----------- .../knetworkmanager-connection_settings_dialog.h | 86 -- tdenetworkmanager/src/knetworkmanager-device.h | 2 - .../src/settings/connection_setting_cdma.ui | 131 +++ .../src/settings/connection_setting_gsm.ui | 294 ++++++ .../src/settings/connection_setting_info.ui | 71 ++ .../src/settings/connection_setting_ipv4.ui | 116 +++ .../src/settings/connection_setting_ppp.ui | 320 +++++++ .../src/settings/connection_setting_serial.ui | 185 ++++ .../src/settings/connection_setting_vpn.ui | 51 ++ .../src/settings/connection_setting_wireless.ui | 140 +++ .../connection_setting_wireless_security.ui | 87 ++ .../connection_setting_wireless_security_auth.ui | 51 ++ .../connection_setting_wireless_security_eap.ui | 163 ++++ .../connection_setting_wireless_security_phase2.ui | 54 ++ .../connection_setting_wireless_security_wep.ui | 146 +++ ...tion_setting_wireless_security_wepencryption.ui | 46 + ...nnection_setting_wireless_security_wpacipher.ui | 128 +++ .../connection_setting_wireless_security_wpapsk.ui | 46 + ...nection_setting_wireless_security_wpaversion.ui | 80 ++ .../src/settings/connection_settings.ui | 137 +++ .../knetworkmanager-connection_setting.cpp | 106 +++ .../settings/knetworkmanager-connection_setting.h | 94 ++ .../knetworkmanager-connection_setting_8021x.cpp | 380 ++++++++ .../knetworkmanager-connection_setting_8021x.h | 195 ++++ .../knetworkmanager-connection_setting_cdma.cpp | 138 +++ .../knetworkmanager-connection_setting_cdma.h | 75 ++ .../knetworkmanager-connection_setting_gsm.cpp | 251 ++++++ .../knetworkmanager-connection_setting_gsm.h | 99 ++ .../knetworkmanager-connection_setting_info.cpp | 163 ++++ .../knetworkmanager-connection_setting_info.h | 79 ++ .../knetworkmanager-connection_setting_ipv4.cpp | 318 +++++++ .../knetworkmanager-connection_setting_ipv4.h | 112 +++ .../knetworkmanager-connection_setting_ppp.cpp | 376 ++++++++ .../knetworkmanager-connection_setting_ppp.h | 136 +++ .../knetworkmanager-connection_setting_serial.cpp | 168 ++++ .../knetworkmanager-connection_setting_serial.h | 89 ++ .../knetworkmanager-connection_setting_vpn.cpp | 206 +++++ .../knetworkmanager-connection_setting_vpn.h | 83 ++ .../knetworkmanager-connection_setting_wired.cpp | 99 ++ .../knetworkmanager-connection_setting_wired.h | 62 ++ ...knetworkmanager-connection_setting_wireless.cpp | 220 +++++ .../knetworkmanager-connection_setting_wireless.h | 97 ++ ...anager-connection_setting_wireless_security.cpp | 451 ++++++++++ ...kmanager-connection_setting_wireless_security.h | 156 ++++ .../knetworkmanager-connection_settings_dialog.cpp | 530 +++++++++++ .../knetworkmanager-connection_settings_dialog.h | 86 ++ 132 files changed, 9994 insertions(+), 10017 deletions(-) create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.h create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.h create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.h create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.h create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.h create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.h create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_vpn_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_vpn_widget.h create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_widget_interface.cpp create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_widget_interface.h create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.h create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.h delete mode 100644 tdenetworkmanager/src/connection_setting_cdma.ui delete mode 100644 tdenetworkmanager/src/connection_setting_gsm.ui delete mode 100644 tdenetworkmanager/src/connection_setting_info.ui delete mode 100644 tdenetworkmanager/src/connection_setting_ipv4.ui delete mode 100644 tdenetworkmanager/src/connection_setting_ppp.ui delete mode 100644 tdenetworkmanager/src/connection_setting_serial.ui delete mode 100644 tdenetworkmanager/src/connection_setting_vpn.ui delete mode 100644 tdenetworkmanager/src/connection_setting_wireless.ui delete mode 100644 tdenetworkmanager/src/connection_setting_wireless_security.ui delete mode 100644 tdenetworkmanager/src/connection_setting_wireless_security_auth.ui delete mode 100644 tdenetworkmanager/src/connection_setting_wireless_security_eap.ui delete mode 100644 tdenetworkmanager/src/connection_setting_wireless_security_phase2.ui delete mode 100644 tdenetworkmanager/src/connection_setting_wireless_security_wep.ui delete mode 100644 tdenetworkmanager/src/connection_setting_wireless_security_wepencryption.ui delete mode 100644 tdenetworkmanager/src/connection_setting_wireless_security_wpacipher.ui delete mode 100644 tdenetworkmanager/src/connection_setting_wireless_security_wpapsk.ui delete mode 100644 tdenetworkmanager/src/connection_setting_wireless_security_wpaversion.ui delete mode 100644 tdenetworkmanager/src/connection_settings.ui delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_8021x.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_8021x.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_cdma.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_cdma.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_cdma_widget.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_cdma_widget.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_gsm.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_gsm.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_gsm_widget.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_gsm_widget.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_info.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_info.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_info_widget.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_info_widget.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4_widget.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4_widget.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_ppp.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_ppp.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_ppp_widget.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_ppp_widget.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_serial.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_serial.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_serial_widget.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_serial_widget.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_vpn.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_vpn.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_vpn_widget.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_vpn_widget.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_widget_interface.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_widget_interface.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_wired.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_wired.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_wireless.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_wireless.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security_widget.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security_widget.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_widget.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_widget.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_settings_dialog.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_settings_dialog.h create mode 100644 tdenetworkmanager/src/settings/connection_setting_cdma.ui create mode 100644 tdenetworkmanager/src/settings/connection_setting_gsm.ui create mode 100644 tdenetworkmanager/src/settings/connection_setting_info.ui create mode 100644 tdenetworkmanager/src/settings/connection_setting_ipv4.ui create mode 100644 tdenetworkmanager/src/settings/connection_setting_ppp.ui create mode 100644 tdenetworkmanager/src/settings/connection_setting_serial.ui create mode 100644 tdenetworkmanager/src/settings/connection_setting_vpn.ui create mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless.ui create mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security.ui create mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security_auth.ui create mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security_eap.ui create mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security_phase2.ui create mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security_wep.ui create mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security_wepencryption.ui create mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security_wpacipher.ui create mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security_wpapsk.ui create mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security_wpaversion.ui create mode 100644 tdenetworkmanager/src/settings/connection_settings.ui create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting.cpp create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting.h create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.cpp create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.h create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.cpp create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.h create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.cpp create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.h create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.cpp create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.h create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.cpp create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.h create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.cpp create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.h create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.cpp create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.h create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.cpp create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.h create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.cpp create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.h create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.cpp create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.h create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.cpp create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.h create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp create mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.h diff --git a/tdenetworkmanager/src/CMakeLists.txt b/tdenetworkmanager/src/CMakeLists.txt index 320ec32..cef1cd7 100644 --- a/tdenetworkmanager/src/CMakeLists.txt +++ b/tdenetworkmanager/src/CMakeLists.txt @@ -11,9 +11,14 @@ add_definitions( -UQT_NO_ASCII_CAST ) +add_subdirectory( settings ) +add_subdirectory( configwidgets ) + include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/tdenetworkmanager/src/settings + ${CMAKE_SOURCE_DIR}/tdenetworkmanager/src/configwidgets ${TDE_INCLUDE_DIR} ${TQT_INCLUDE_DIRS} ${DBUS_TQT_INCLUDE_DIRS} @@ -43,14 +48,7 @@ install( FILES knetworkmanager_plugin.desktop knetworkmanager_vpnplugin.desktop tde_add_tdeinit_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 + 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 @@ -59,33 +57,19 @@ tde_add_tdeinit_executable( knetworkmanager AUTOMOC 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-menu_subhead.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 + knetworkmanager-connection_store.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 + EMBED tdenetwork-connection-configwidgets-static tdenetwork-connection-settings-static LINK tdecore-shared tdeui-shared kutils-shared ${DBUS_TQT_LIBRARIES} ) diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp new file mode 100644 index 0000000..b09fea9 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 , + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include + +// 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 (conn->getSetting(NM_SETTING_CDMA_SETTING_NAME)); + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingCdmaWidget(this); + layout->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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.h new file mode 100644 index 0000000..6ee8a37 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 + * + * 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 +#include + +// 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 + + 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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.cpp new file mode 100644 index 0000000..88af9bb --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 , + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// 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 (conn->getSetting(NM_SETTING_GSM_SETTING_NAME)); + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingGsmWidget(this); + layout->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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.h new file mode 100644 index 0000000..df77606 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 + * + * 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 +#include + +// 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 + + 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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.cpp new file mode 100644 index 0000000..e0982e8 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 , + * Valentine Sinitsyn + * + * 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 +#include +#include +#include + +// 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 (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME)); + + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingInfoWidget(this); + layout->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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.h new file mode 100644 index 0000000..16a7ace --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 , + * Valentine Sinitsyn + * + * 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 +#include + +// 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 + + 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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.cpp new file mode 100644 index 0000000..ca00a49 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 , + * Valentine Sinitsyn + * + * 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 +#include +#include +#include +#include + +#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 (conn->getSetting(NM_SETTING_IP4_CONFIG_SETTING_NAME)); + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingIPv4Widget(this); + layout->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 hosts = _ipv4_setting->getDNS(); + TQStringList list; + for (TQValueList::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 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 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 addrs = _ipv4_setting->getAddresses(); + addrs[0].netmask = TQHostAddress(ip); + _ipv4_setting->setAddresses(addrs); +} + +void +IPv4WidgetImpl::slotGatewayChanged(const TQString& ip) +{ + TQValueList addrs = _ipv4_setting->getAddresses(); + addrs[0].gateway = TQHostAddress(ip); + _ipv4_setting->setAddresses(addrs); +} + +#include "knetworkmanager-connection_setting_ipv4_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.h new file mode 100644 index 0000000..4fabdce --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 , + * + * 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 + + + 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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.cpp new file mode 100644 index 0000000..e735969 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 + * + * 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 + +// qt headers +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// 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 (conn->getSetting(NM_SETTING_PPP_SETTING_NAME)); + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingPppWidget(this); + layout->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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.h new file mode 100644 index 0000000..acdc2a2 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 + * + * 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 +#include + +// 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 + + 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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.cpp new file mode 100644 index 0000000..87b92db --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 + * + * 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 +// qt headers +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// 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 (conn->getSetting(NM_SETTING_SERIAL_SETTING_NAME)); + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingSerialWidget(this); + layout->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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.h new file mode 100644 index 0000000..5b3bf28 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 + * + * 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 +#include + +// 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 + + 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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_vpn_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_vpn_widget.cpp new file mode 100644 index 0000000..0e9ac95 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 , + * Author: Timothy Pearson + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include + +// 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 (conn->getSetting(NM_SETTING_VPN_SETTING_NAME)); + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingVPNWidget(this); + layout->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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_vpn_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_vpn_widget.h new file mode 100644 index 0000000..f7c16cd --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 , + * + * 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 +#include + +// 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 + + 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 _mapServiceCombo; + TQMap _mapServiceWidget; +}; + +} +#endif /* KNETWORKMANAGER_CONNECTION_SETTING_VPN_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_widget_interface.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_widget_interface.cpp new file mode 100644 index 0000000..2c00288 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 , + * + * 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 +#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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_widget_interface.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_widget_interface.h new file mode 100644 index 0000000..13ea65e --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 , + * + * 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 + +namespace ConnectionSettings +{ + + class WidgetInterface : public TQWidget + { + Q_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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.cpp new file mode 100644 index 0000000..1adea03 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 , + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include + +/* kde headers */ +#include +#include +#include +#include + +/* 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::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::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::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& 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 (conn->getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)); + _wireless_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); + _ieee8021x_setting = dynamic_cast (conn->getSetting(NM_SETTING_802_1X_SETTING_NAME)); + _new_conn = new_conn; + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingWirelessSecurityWidget(this); + layout->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 allowed_methods; + _mainWid->cboSecurity->clear(); + + // TODO: Preselect the right security method + // We should have an Essid already, fetch all possible APs + TQValueList 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::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::iterator it = _widgets[i].begin(); it != _widgets[i].end(); ++it) + { + _mainWid->groupUseEncryption->layout()->remove(*it); + (*it)->hide(); + } + // remove extra widgets too + for (TQValueList::iterator it = _extra_widgets[i].begin(); it != _extra_widgets[i].end(); ++it) + { + _mainWid->groupUseEncryption->layout()->remove(*it); + (*it)->hide(); + } + } + } + + // show all widgets widgets for the selected security method + for (TQValueList::iterator it = _widgets[method].begin(); it != _widgets[method].end(); ++it) + { + _mainWid->groupUseEncryption->layout()->add(*it); + (*it)->show(); + } + + if (_mainWid->pbExtra->isOn()) + for (TQValueList::iterator it = _extra_widgets[method].begin(); it != _extra_widgets[method].end(); ++it) + { + _mainWid->groupUseEncryption->layout()->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::iterator it = _extra_widgets[_currentMethod].begin(); it != _extra_widgets[_currentMethod].end(); ++it) + { + _mainWid->groupUseEncryption->layout()->add(*it); + (*it)->show(); + } + else + for (TQValueList::iterator it = _extra_widgets[_currentMethod].begin(); it != _extra_widgets[_currentMethod].end(); ++it) + { + _mainWid->groupUseEncryption->layout()->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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.h new file mode 100644 index 0000000..7e90694 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 , + * + * 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 _eapIndexMap; + WirelessSecurityPhase2Impl* _phase2_widget; + }; + + class WirelessSecurityPhase2Impl : public ConnectionSettingWirelessSecurityPhase2 + { + Q_OBJECT + + public: + WirelessSecurityPhase2Impl(IEEE8021x* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + public slots: + void setAllowedPhase2Methods(const TQValueList&); + void slotPhase2MethodChanged(int index); + private: + void updateMethodComboBox(); + + IEEE8021x* _security_setting; + TQBiDirectionalMap _eapIndexMap; + TQValueList _allowed_methods; + }; + + class WirelessSecurityWidgetImpl : public WidgetInterface + { + Q_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 _widgets[SECURITY_COUNT]; + TQValueList _extra_widgets[SECURITY_COUNT]; + WirelessSecurity* _security_setting; + Wireless* _wireless_setting; + IEEE8021x* _ieee8021x_setting; + ConnectionSettingWirelessSecurityWidget* _mainWid; + bool _new_conn; + TQMap _securityComboMap; + }; +} + +#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.cpp new file mode 100644 index 0000000..e6bd9c2 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 , + * Valentine Sinitsyn + * + * 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 +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#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\%").arg(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 (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); + _info_setting = dynamic_cast (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME)); + _security_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)); + _hasName = !_info_setting->getName().isEmpty(); + _new_conn = new_conn; + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingWirelessWidget(this); + layout->addWidget(_mainWid); + + // FIXME hide this button until it is implemented + _mainWid->pbExpert->hide(); + + Init(); +} + +void +WirelessWidgetImpl::Init() +{ + TQVBoxLayout* layout = new TQVBoxLayout(_mainWid->framePlaceholder, 1, 1); + _searchLine = new KListViewSearchLineWidget(_mainWid->lvEssids, _mainWid->framePlaceholder); + layout->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 nets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID); + + _mainWid->lvEssids->clear(); + + for (TQValueList::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(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(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(bytes[i]); + } + return tmp; +} + +#include "knetworkmanager-connection_setting_wireless_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.h new file mode 100644 index 0000000..0baba65 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/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 , + * Valentine Sinitsyn + * + * 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 + + 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/tdenetworkmanager/src/connection_setting_cdma.ui b/tdenetworkmanager/src/connection_setting_cdma.ui deleted file mode 100644 index 5674468..0000000 --- a/tdenetworkmanager/src/connection_setting_cdma.ui +++ /dev/null @@ -1,131 +0,0 @@ - -ConnectionSettingCdmaWidget - - - ConnectionSettingCdmaWidget - - - - 0 - 0 - 381 - 102 - - - - Form1 - - - - unnamed - - - 0 - - - - layout10 - - - - unnamed - - - - mPassword - - - Password needed to access the service - - - - - textLabel1 - - - &Number: - - - mNumber - - - - - mUsername - - - Username needed to access the service - - - - - textLabel2 - - - &Username: - - - mUsername - - - - - textLabel2_2 - - - &Password: - - - mUsername - - - - - mNumber - - - - - spacer2 - - - Horizontal - - - Expanding - - - - 146 - 20 - - - - - - - - spacer1 - - - Vertical - - - Expanding - - - - 20 - 16 - - - - - - - mNumber - mUsername - mPassword - - - diff --git a/tdenetworkmanager/src/connection_setting_gsm.ui b/tdenetworkmanager/src/connection_setting_gsm.ui deleted file mode 100644 index c89a749..0000000 --- a/tdenetworkmanager/src/connection_setting_gsm.ui +++ /dev/null @@ -1,294 +0,0 @@ - -ConnectionSettingGsmWidget - - - ConnectionSettingGsmWidget - - - - 0 - 0 - 381 - 245 - - - - Form1 - - - - unnamed - - - 0 - - - - layout9 - - - - unnamed - - - - textLabel4 - - - Network &ID: - - - mNetworkId - - - - - textLabel2_2_2 - - - PU&K: - - - mUsername - - - - - textLabel1 - - - &Number: - - - mNumber - - - - - mPassword - - - Password needed to access the service - - - - - - Any - - - - - GPRS - - - - - GSM - - - - - Prefer GPRS - - - - - Prefer GSM - - - - mNetworkType - - - Select the type of cellular data network the connection should use - - - 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 - - - - - textLabel6 - - - Network &Type: - - - mNetworkType - - - - - textLabel2 - - - &Username: - - - mUsername - - - - - mApn - - - Access Point Name - - - The hostname of the machine providing network access - - - - - textLabel5 - - - &Band: - - - mBand - - - - - mPuk - - - Personal Unblocking Code - - - A code used to unblock a blocked SIM card - - - - - mBand - - - 5 - - - -1 - - - -1 - - - - - spacer4 - - - Horizontal - - - Expanding - - - - 171 - 20 - - - - - - mPin - - - Personal Identification Number - - - A code used for all GSM-based phones to establish authorisation for access to certain functions or information - - - - - mUsername - - - Username needed to access the service - - - - - mNumber - - - - - mNetworkId - - - The GSM network to connect to - - - - - textLabel2_3 - - - &PIN: - - - mUsername - - - - - textLabel2_2 - - - Pass&word: - - - mUsername - - - - - textLabel3 - - - &APN: - - - mApn - - - - - - - spacer5 - - - Vertical - - - Expanding - - - - 20 - 51 - - - - - - - mUsername - mPassword - mPin - mPuk - mNumber - mApn - mNetworkId - mNetworkType - mBand - - - diff --git a/tdenetworkmanager/src/connection_setting_info.ui b/tdenetworkmanager/src/connection_setting_info.ui deleted file mode 100644 index 72a6e87..0000000 --- a/tdenetworkmanager/src/connection_setting_info.ui +++ /dev/null @@ -1,71 +0,0 @@ - -ConnectionSettingInfoWidget - - - ConnectionSettingInfoWidget - - - - 0 - 0 - 591 - 151 - - - - Form1 - - - - unnamed - - - - textLabel1 - - - Connection Name: - - - - - txtConnectionName - - - - - spacer1 - - - Vertical - - - Expanding - - - - 20 - 30 - - - - - - textLabel1_2 - - - Autoconnect: - - - - - chkAutoConnect - - - - - - - - - diff --git a/tdenetworkmanager/src/connection_setting_ipv4.ui b/tdenetworkmanager/src/connection_setting_ipv4.ui deleted file mode 100644 index 0f08a00..0000000 --- a/tdenetworkmanager/src/connection_setting_ipv4.ui +++ /dev/null @@ -1,116 +0,0 @@ - -ConnectionSettingIPv4Widget - - - ConnectionSettingIPv4Widget - - - - 0 - 0 - 534 - 330 - - - - Form3 - - - - unnamed - - - - groupIPConfig - - - Use manual IP configuration - - - true - - - false - - - - unnamed - - - - textLabel1 - - - DNS Addresses: - - - - - textLabel2_2 - - - DNS Search: - - - - - textLabel2 - - - IP Address: - - - - - txtIP - - - - - txtDNSAddresses - - - - - txtDNSSearch - - - - - textLabel2_3 - - - Netmask: - - - - - txtNetmask - - - - - textLabel1_2 - - - Gateway: - - - - - txtGateway - - - - - - - - txtIP - txtNetmask - txtGateway - txtDNSAddresses - txtDNSSearch - - - diff --git a/tdenetworkmanager/src/connection_setting_ppp.ui b/tdenetworkmanager/src/connection_setting_ppp.ui deleted file mode 100644 index 7db6e5e..0000000 --- a/tdenetworkmanager/src/connection_setting_ppp.ui +++ /dev/null @@ -1,320 +0,0 @@ - -ConnectionSettingPppWidget - - - ConnectionSettingPppWidget - - - - 0 - 0 - 472 - 284 - - - - Form2 - - - - unnamed - - - 0 - - - - layout9 - - - - unnamed - - - - mRequireMppe128 - - - Require MPPE128 - - - - - spacer6 - - - Vertical - - - Expanding - - - - 20 - 50 - - - - - - layout11 - - - - unnamed - - - - mLcpEchoInterval - - - - - textLabel11 - - - LCP Echo Interval - - - - - - - layout12 - - - - unnamed - - - - mLcpEchoFailure - - - - - textLabel10 - - - LCP Echo Failure - - - - - - - layout15 - - - - unnamed - - - - mBaudRate - - - - - textLabel7 - - - Baud rate - - - - - - - layout13 - - - - unnamed - - - - mMtu - - - - - textLabel9 - - - MTU - - - - - - - mRefusePap - - - Refuse PAP - - - - - mNoAuth - - - No Authorization - - - - - mNoVjComp - - - No VJ Compression - - - - - mRefuseMschap - - - Refuse MSCHAP - - - - - layout14 - - - - unnamed - - - - mMru - - - - - textLabel8 - - - MRU - - - - - - - mRequireMppe - - - Require MPPE - - - - - mRequireMppc - - - Require MPPC - - - - - mRefuseMschapV2 - - - Refuse MSCHAPv2 - - - - - mNoBsd - - - No BSD - - - - - mStatefulMppe - - - Stateful MPPE - - - - - mCrtscts - - - CRTSCTS - - - - - mNoDeflate - - - No Deflate - - - - - mRefuseChap - - - Refuse CHAP - - - - - mRefuseEap - - - Refuse EAP - - - - - - - spacer2 - - - Vertical - - - Expanding - - - - 20 - 41 - - - - - - - mNoAuth - mRefuseEap - mRefusePap - mRefuseChap - mRefuseMschap - mRefuseMschapV2 - mNoBsd - mNoDeflate - mNoVjComp - mRequireMppe - mRequireMppe128 - mStatefulMppe - mRequireMppc - mCrtscts - mBaudRate - mMru - mMtu - mLcpEchoFailure - mLcpEchoInterval - - - diff --git a/tdenetworkmanager/src/connection_setting_serial.ui b/tdenetworkmanager/src/connection_setting_serial.ui deleted file mode 100644 index 2a3b9ad..0000000 --- a/tdenetworkmanager/src/connection_setting_serial.ui +++ /dev/null @@ -1,185 +0,0 @@ - -ConnectionSettingSerialWidget - - - ConnectionSettingSerialWidget - - - - 0 - 0 - 170 - 187 - - - - Form2 - - - - unnamed - - - 0 - - - - layout23 - - - - unnamed - - - - mSendDelay - - - - - textLabel11 - - - &Send delay - - - mSendDelay - - - - - - None - - - - - Even - - - - - Odd - - - - mParity - - - - - - 0 - - - - - 1 - - - - mStopBits - - - 1 - - - - - - 7 - - - - - 8 - - - - - 9 - - - - mDataBits - - - 1 - - - - - mBaudRate - - - - - textLabel12_3 - - - &Stop bits: - - - mStopBits - - - - - textLabel7 - - - Baud rate - - - - - textLabel12_2 - - - &Parity: - - - mParity - - - - - textLabel12 - - - &Data bits: - - - mDataBits - - - - - - - spacer6 - - - Vertical - - - Expanding - - - - 20 - 141 - - - - - - - mBaudRate - mDataBits - mParity - mStopBits - mSendDelay - - - diff --git a/tdenetworkmanager/src/connection_setting_vpn.ui b/tdenetworkmanager/src/connection_setting_vpn.ui deleted file mode 100644 index 976fc25..0000000 --- a/tdenetworkmanager/src/connection_setting_vpn.ui +++ /dev/null @@ -1,51 +0,0 @@ - -ConnectionSettingVPNWidget - - - VPN - - - - 0 - 0 - 331 - 155 - - - - VPN - - - - unnamed - - - - cboServices - - - - - textLabel2 - - - Service - - - - - widgetStack - - - - WStackPage - - - 0 - - - - - - - diff --git a/tdenetworkmanager/src/connection_setting_wireless.ui b/tdenetworkmanager/src/connection_setting_wireless.ui deleted file mode 100644 index 9415ce4..0000000 --- a/tdenetworkmanager/src/connection_setting_wireless.ui +++ /dev/null @@ -1,140 +0,0 @@ - -ConnectionSettingWirelessWidget - - - ConnectionSettingWirelessWidget - - - - 0 - 0 - 506 - 418 - - - - Form6 - - - - unnamed - - - - textLabel1 - - - Essid: - - - - - txtEssid - - - - - pbExpert - - - Expert options - - - - - spacer1 - - - Horizontal - - - Expanding - - - - 282 - 20 - - - - - - - Essid - - - true - - - true - - - - - Quality - - - true - - - true - - - - - Security - - - true - - - true - - - - lvEssids - - - StyledPanel - - - Sunken - - - true - - - true - - - - - framePlaceholder - - - NoFrame - - - Raised - - - - - chkAutoRefresh - - - Refresh automatically - - - true - - - - - - - klineedit.h - kpushbutton.h - klistview.h - - diff --git a/tdenetworkmanager/src/connection_setting_wireless_security.ui b/tdenetworkmanager/src/connection_setting_wireless_security.ui deleted file mode 100644 index 5fce58f..0000000 --- a/tdenetworkmanager/src/connection_setting_wireless_security.ui +++ /dev/null @@ -1,87 +0,0 @@ - -ConnectionSettingWirelessSecurityWidget - - - Form1 - - - - 0 - 0 - 522 - 158 - - - - Form1 - - - - unnamed - - - - groupUseEncryption - - - Use Wireless Security - - - true - - - false - - - - unnamed - - - - cboSecurity - - - - - textLabel1 - - - Security: - - - - - buttonGroup5 - - - NoFrame - - - - - - - unnamed - - - 0 - - - - - - pbExtra - - - Expert settings - - - true - - - - - - - - diff --git a/tdenetworkmanager/src/connection_setting_wireless_security_auth.ui b/tdenetworkmanager/src/connection_setting_wireless_security_auth.ui deleted file mode 100644 index ce88e51..0000000 --- a/tdenetworkmanager/src/connection_setting_wireless_security_auth.ui +++ /dev/null @@ -1,51 +0,0 @@ - -Form1 - - - Form1 - - - - 0 - 0 - 342 - 97 - - - - Form1 - - - - unnamed - - - - groupBox1 - - - Authentication - - - - unnamed - - - - textLabel1 - - - Method: - - - - - cboAuthAlg - - - - - - - - diff --git a/tdenetworkmanager/src/connection_setting_wireless_security_eap.ui b/tdenetworkmanager/src/connection_setting_wireless_security_eap.ui deleted file mode 100644 index a851a93..0000000 --- a/tdenetworkmanager/src/connection_setting_wireless_security_eap.ui +++ /dev/null @@ -1,163 +0,0 @@ - -ConnectionSettingWirelessSecurityEAP - - - ConnectionSettingWirelessSecurityEAP - - - - 0 - 0 - 583 - 174 - - - - Form2 - - - - unnamed - - - 0 - - - - groupBox2 - - - EAP - - - - unnamed - - - - textLabel8 - - - Method: - - - - - textLabel9 - - - Identity: - - - - - cboMethod - - - - - txtIdentity - - - - - txtAnonIdentity - - - - - textLabel10 - - - Anonymous Identity: - - - - - textLabel11 - - - Password: - - - - - txtPassword - - - - - textLabel16 - - - Private Secret Key: - - - - - txtPrivateSecretKey - - - - - textLabel12 - - - Client Certificate: - - - - - kURLClientCert - - - - - kURLPrivateKey - - - - - textLabel15 - - - Private Keyfile: - - - - - textLabel14 - - - CA Certificate: - - - - - kURLCACert - - - - - textLabel1 - - - Use System CA Certificates - - - - - chkCAStore - - - - - - - - - - - - - diff --git a/tdenetworkmanager/src/connection_setting_wireless_security_phase2.ui b/tdenetworkmanager/src/connection_setting_wireless_security_phase2.ui deleted file mode 100644 index b3237d4..0000000 --- a/tdenetworkmanager/src/connection_setting_wireless_security_phase2.ui +++ /dev/null @@ -1,54 +0,0 @@ - -ConnectionSettingWirelessSecurityPhase2 - - - ConnectionSettingWirelessSecurityPhase2 - - - - 0 - 0 - 225 - 135 - - - - Form4 - - - - unnamed - - - 0 - - - - groupBox4 - - - Phase 2 - - - - unnamed - - - - textLabel17 - - - Method: - - - - - cboPhase2Method - - - - - - - - diff --git a/tdenetworkmanager/src/connection_setting_wireless_security_wep.ui b/tdenetworkmanager/src/connection_setting_wireless_security_wep.ui deleted file mode 100644 index c07033e..0000000 --- a/tdenetworkmanager/src/connection_setting_wireless_security_wep.ui +++ /dev/null @@ -1,146 +0,0 @@ - -ConnectionSettingWirelessSecurityWEP - - - ConnectionSettingWirelessSecurityWEP - - - - 0 - 0 - 333 - 238 - - - - Form1 - - - - unnamed - - - 0 - - - - WEP - - - WEP - - - - unnamed - - - - buttonGroup1 - - - NoFrame - - - - - - - unnamed - - - 0 - - - - txtWEPKey2 - - - - - rbKeyIdx1 - - - Key 2: - - - - - rbKeyIdx3 - - - Key 4: - - - - - textLabel1 - - - Type: - - - - - rbKeyIdx0 - - - Key 1: - - - - - txtWEPKey3 - - - - - rbKeyIdx2 - - - Key 3: - - - - - txtWEPKey1 - - - - - txtWEPKey0 - - - - - cbKeyType - - - - 7 - 0 - 0 - 0 - - - - - - textLabel1_2 - - - Authentication: - - - - - cboAuthentication - - - - - - - - - - diff --git a/tdenetworkmanager/src/connection_setting_wireless_security_wepencryption.ui b/tdenetworkmanager/src/connection_setting_wireless_security_wepencryption.ui deleted file mode 100644 index 50c149d..0000000 --- a/tdenetworkmanager/src/connection_setting_wireless_security_wepencryption.ui +++ /dev/null @@ -1,46 +0,0 @@ - -ConnectionSettingWirelessSecurityWEPEncryption - - - ConnectionSettingWirelessSecurityWEPEncryption - - - - 0 - 0 - 288 - 64 - - - - Form1 - - - - unnamed - - - 0 - - - - groupBox2 - - - Encryption - - - - unnamed - - - - cboEncryption - - - - - - - - diff --git a/tdenetworkmanager/src/connection_setting_wireless_security_wpacipher.ui b/tdenetworkmanager/src/connection_setting_wireless_security_wpacipher.ui deleted file mode 100644 index a402e66..0000000 --- a/tdenetworkmanager/src/connection_setting_wireless_security_wpacipher.ui +++ /dev/null @@ -1,128 +0,0 @@ - -ConnectionSettingWirelessSecurityWPACipher - - - ConnectionSettingWirelessSecurityWPACipher - - - - 0 - 0 - 600 - 99 - - - - Form1 - - - - unnamed - - - 0 - - - - grpUseCipher - - - Use specific cipher - - - true - - - false - - - - unnamed - - - - textLabel18 - - - Group Cipher: - - - - - textLabel1 - - - Pairwise Cipher: - - - - - chkGroupCipherCCMP - - - CCMP - - - - - chkGroupCipherTKIP - - - TKIP - - - - - chkPairwiseCipherTKIP - - - TKIP - - - - - chkPairwiseCipherCCMP - - - CCMP - - - - - chkGroupCipherWEP40 - - - WEP 40 - - - - - spacer2 - - - Horizontal - - - Expanding - - - - 60 - 20 - - - - - - chkGroupCipherWEP104 - - - WEP 104 - - - - - - - - diff --git a/tdenetworkmanager/src/connection_setting_wireless_security_wpapsk.ui b/tdenetworkmanager/src/connection_setting_wireless_security_wpapsk.ui deleted file mode 100644 index 4df8eea..0000000 --- a/tdenetworkmanager/src/connection_setting_wireless_security_wpapsk.ui +++ /dev/null @@ -1,46 +0,0 @@ - -ConnectionSettingWirelessSecurityWPAPSK - - - ConnectionSettingWirelessSecurityWPAPSK - - - - 0 - 0 - 600 - 480 - - - - Form2 - - - - unnamed - - - 0 - - - - groupBox3 - - - Shared Key - - - - unnamed - - - - txtPSK - - - - - - - - diff --git a/tdenetworkmanager/src/connection_setting_wireless_security_wpaversion.ui b/tdenetworkmanager/src/connection_setting_wireless_security_wpaversion.ui deleted file mode 100644 index 11b1655..0000000 --- a/tdenetworkmanager/src/connection_setting_wireless_security_wpaversion.ui +++ /dev/null @@ -1,80 +0,0 @@ - -ConnectionSettingWirelessSecurityWPAVersion - - - ConnectionSettingWirelessSecurityWPAVersion - - - - 0 - 0 - 308 - 64 - - - - Form3 - - - - unnamed - - - 0 - - - - grpUseWPAVersion - - - Use specific WPA Version - - - true - - - false - - - - unnamed - - - - cbRSN - - - WPA 2/RSN - - - - - cbWPA - - - WPA 1 - - - - - spacer7 - - - Horizontal - - - Expanding - - - - 50 - 20 - - - - - - - - - diff --git a/tdenetworkmanager/src/connection_settings.ui b/tdenetworkmanager/src/connection_settings.ui deleted file mode 100644 index c7994de..0000000 --- a/tdenetworkmanager/src/connection_settings.ui +++ /dev/null @@ -1,137 +0,0 @@ - -ConnectionSettingsDialog - - - ConnectionSettingsDialog - - - - 0 - 0 - 644 - 318 - - - - Connections - - - - unnamed - - - - pbBack - - - Back - - - - - lblInfo - - - - 1 - - - - New Connection - - - - - wstackSettings - - - - 5 - 7 - 0 - 0 - - - - TabWidgetPanel - - - - WStackPage - - - 0 - - - - - - pbCancel - - - Cancel - - - - - spacer2 - - - Horizontal - - - Expanding - - - - 180 - 20 - - - - - - pbNext - - - Next - - - true - - - - - pbSave - - - Save - - - - - btnConnect - - - Connect && Save - - - - - - true - - - false - - - - - - - kpushbutton.h - kpushbutton.h - kpushbutton.h - kpushbutton.h - - diff --git a/tdenetworkmanager/src/knetworkmanager-connection.cpp b/tdenetworkmanager/src/knetworkmanager-connection.cpp index f0da309..2c6ea8b 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection.cpp +++ b/tdenetworkmanager/src/knetworkmanager-connection.cpp @@ -36,9 +36,6 @@ #include #include -/* NM headers */ -#include - /* knetworkmanager headers */ #include "knetworkmanager.h" #include "knetworkmanager-connection.h" diff --git a/tdenetworkmanager/src/knetworkmanager-connection.h b/tdenetworkmanager/src/knetworkmanager-connection.h index a370700..695408c 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection.h +++ b/tdenetworkmanager/src/knetworkmanager-connection.h @@ -29,8 +29,6 @@ #include #include "knetworkmanager-connection_setting.h" -#include "dbus/connection.h" -#include "dbus/connectionnode.h" class AccessPoint; class TQT_DBusObjectPath; diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting.cpp deleted file mode 100644 index 50d7423..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -/* kde headers */ -#include -#include - -/* TQT_DBus headers*/ -#include -#include - -/* 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/tdenetworkmanager/src/knetworkmanager-connection_setting.h b/tdenetworkmanager/src/knetworkmanager-connection_setting.h deleted file mode 100644 index f189117..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting.h +++ /dev/null @@ -1,94 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include - -namespace ConnectionSettings -{ - -/* - Annotation: hopefully we can convert these to - TQMap when switching to TQt4 -*/ -typedef TQMap SettingsMap; - -class Connection; - -// the base class for all settings -class ConnectionSetting : public TQObject -{ - Q_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/tdenetworkmanager/src/knetworkmanager-connection_setting_8021x.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_8021x.cpp deleted file mode 100644 index 4904f01..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_8021x.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_8021x.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -/* kde headers */ -#include -#include - -/* TQT_DBus headers*/ -#include -#include - -/* 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 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 eap_methods = it.data().toTQValueList(); - if (!eap_methods.isEmpty()) - { - TQString eap = eap_methods.first().toString(); - TQBiDirectionalMap::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 eap = it.data().toString(); - if (!eap.isEmpty()) - { - TQBiDirectionalMap::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::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::getAllowedPhase2Methods() const -{ - TQValueList 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/tdenetworkmanager/src/knetworkmanager-connection_setting_8021x.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_8021x.h deleted file mode 100644 index a5c593e..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_8021x.h +++ /dev/null @@ -1,195 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_8021x.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include - -#include - -#include "knetworkmanager-connection_setting.h" -#include "qbidirectionalmap.h" -/* NM */ -#include -#include - - -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 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 _eapMap; -}; - -} -#endif /* KNETWORKMANAGER_CONNECTION_SETTING_8021X_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_cdma.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_cdma.cpp deleted file mode 100644 index 854590c..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_cdma.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_serial.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -/* kde headers */ -#include -#include - -/* TQT_DBus headers*/ -#include -#include - -/* 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/tdenetworkmanager/src/knetworkmanager-connection_setting_cdma.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_cdma.h deleted file mode 100644 index c0825b3..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_cdma.h +++ /dev/null @@ -1,75 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_cdma.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include - -#include - -#include "knetworkmanager-connection_setting.h" - -/* NM headers */ -#include - -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/tdenetworkmanager/src/knetworkmanager-connection_setting_cdma_widget.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_cdma_widget.cpp deleted file mode 100644 index b09fea9..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_cdma_widget.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_cdma_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include - -// 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 (conn->getSetting(NM_SETTING_CDMA_SETTING_NAME)); - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingCdmaWidget(this); - layout->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/tdenetworkmanager/src/knetworkmanager-connection_setting_cdma_widget.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_cdma_widget.h deleted file mode 100644 index 6ee8a37..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_cdma_widget.h +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_cdma_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 -#include - -// 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 - - 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/tdenetworkmanager/src/knetworkmanager-connection_setting_gsm.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_gsm.cpp deleted file mode 100644 index cd38c3f..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_gsm.cpp +++ /dev/null @@ -1,251 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_gsm.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -/* kde headers */ -#include -#include - -/* TQT_DBus headers*/ -#include -#include - -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting_gsm.h" - -/* network-manager headers */ -#include - -#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/tdenetworkmanager/src/knetworkmanager-connection_setting_gsm.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_gsm.h deleted file mode 100644 index ac912ae..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_gsm.h +++ /dev/null @@ -1,99 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_gsm.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include - -#include - -#include "knetworkmanager-connection_setting.h" - -/* NM headers */ -#include - -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/tdenetworkmanager/src/knetworkmanager-connection_setting_gsm_widget.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_gsm_widget.cpp deleted file mode 100644 index 88af9bb..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_gsm_widget.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_gsm_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// 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 (conn->getSetting(NM_SETTING_GSM_SETTING_NAME)); - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingGsmWidget(this); - layout->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/tdenetworkmanager/src/knetworkmanager-connection_setting_gsm_widget.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_gsm_widget.h deleted file mode 100644 index df77606..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_gsm_widget.h +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_gsm_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 -#include - -// 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 - - 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/tdenetworkmanager/src/knetworkmanager-connection_setting_info.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_info.cpp deleted file mode 100644 index 225d002..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_info.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -/* kde headers */ -#include -#include - -/* TQT_DBus headers*/ -#include -#include - -/* 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/tdenetworkmanager/src/knetworkmanager-connection_setting_info.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_info.h deleted file mode 100644 index 705387b..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_info.h +++ /dev/null @@ -1,79 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include - -#include -#include "knetworkmanager-connection_setting.h" - -/* NM headers */ -#include - -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/tdenetworkmanager/src/knetworkmanager-connection_setting_info_widget.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_info_widget.cpp deleted file mode 100644 index e0982e8..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_info_widget.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Valentine Sinitsyn - * - * 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 -#include -#include -#include - -// 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 (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME)); - - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingInfoWidget(this); - layout->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/tdenetworkmanager/src/knetworkmanager-connection_setting_info_widget.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_info_widget.h deleted file mode 100644 index 16a7ace..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_info_widget.h +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Valentine Sinitsyn - * - * 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 -#include - -// 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 - - 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/tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4.cpp deleted file mode 100644 index 15f8978..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4.cpp +++ /dev/null @@ -1,318 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -/* kde headers */ -#include -#include - -/* TQT_DBus headers*/ -#include -#include - -/* 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 IPv4::getAddresses() const -{ - return _addresses; -} - -void IPv4::setAddresses(const TQValueList & adr) -{ - _addresses = adr; - emitValidityChanged(); -} - -TQValueList IPv4::getDNS() const -{ - return _dns; -} - -void IPv4::setDNS(const TQValueList& 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::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::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 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 dns; - TQValueList::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 ips; - for (TQValueList::ConstIterator it = _addresses.begin(); it != _addresses.end(); ++it) - { - TQValueList 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 dns_search = it.data().toTQValueList(); - for (TQValueList::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 dns = it.data().toTQValueList(); - for (TQValueList::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 ips = it.data().toTQValueList(); - for (TQValueList::Iterator it2 = ips.begin(); it2 != ips.end(); ++it2) - { - TQValueList 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/tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4.h deleted file mode 100644 index 7788769..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4.h +++ /dev/null @@ -1,112 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include - -#include - -#include "knetworkmanager-connection_setting.h" - -/* NM headers */ -#include - -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 getAddresses() const; - void setAddresses(const TQValueList&); - - TQValueList getDNS() const; - void setDNS(const TQValueList&); - - 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 _dns; - TQStringList _dns_search; - TQValueList _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/tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4_widget.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4_widget.cpp deleted file mode 100644 index ca00a49..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4_widget.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Valentine Sinitsyn - * - * 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 -#include -#include -#include -#include - -#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 (conn->getSetting(NM_SETTING_IP4_CONFIG_SETTING_NAME)); - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingIPv4Widget(this); - layout->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 hosts = _ipv4_setting->getDNS(); - TQStringList list; - for (TQValueList::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 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 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 addrs = _ipv4_setting->getAddresses(); - addrs[0].netmask = TQHostAddress(ip); - _ipv4_setting->setAddresses(addrs); -} - -void -IPv4WidgetImpl::slotGatewayChanged(const TQString& ip) -{ - TQValueList addrs = _ipv4_setting->getAddresses(); - addrs[0].gateway = TQHostAddress(ip); - _ipv4_setting->setAddresses(addrs); -} - -#include "knetworkmanager-connection_setting_ipv4_widget.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4_widget.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4_widget.h deleted file mode 100644 index 4fabdce..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4_widget.h +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * - * 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 - - - 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/tdenetworkmanager/src/knetworkmanager-connection_setting_ppp.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_ppp.cpp deleted file mode 100644 index 257a012..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_ppp.cpp +++ /dev/null @@ -1,376 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_ppp.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -/* qt headers */ -#include -#include - -/* kde headers */ -#include -#include - -/* TQT_DBus headers*/ -#include -#include - -/* 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/tdenetworkmanager/src/knetworkmanager-connection_setting_ppp.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_ppp.h deleted file mode 100644 index 9f72e42..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_ppp.h +++ /dev/null @@ -1,136 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_ppp.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include - -#include - -#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/tdenetworkmanager/src/knetworkmanager-connection_setting_ppp_widget.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_ppp_widget.cpp deleted file mode 100644 index e735969..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_ppp_widget.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_ppp_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 - -// qt headers -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// 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 (conn->getSetting(NM_SETTING_PPP_SETTING_NAME)); - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingPppWidget(this); - layout->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/tdenetworkmanager/src/knetworkmanager-connection_setting_ppp_widget.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_ppp_widget.h deleted file mode 100644 index acdc2a2..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_ppp_widget.h +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_ppp_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 -#include - -// 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 - - 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/tdenetworkmanager/src/knetworkmanager-connection_setting_serial.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_serial.cpp deleted file mode 100644 index 4861e7b..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_serial.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_serial.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -/* kde headers */ -#include -#include - -/* TQT_DBus headers*/ -#include -#include - -/* 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/tdenetworkmanager/src/knetworkmanager-connection_setting_serial.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_serial.h deleted file mode 100644 index 40099a7..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_serial.h +++ /dev/null @@ -1,89 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_serial.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include - -#include - -#include "knetworkmanager-connection_setting.h" - -/* NM headers */ -#include -#include - -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/tdenetworkmanager/src/knetworkmanager-connection_setting_serial_widget.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_serial_widget.cpp deleted file mode 100644 index 87b92db..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_serial_widget.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_serial_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 -// qt headers -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// 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 (conn->getSetting(NM_SETTING_SERIAL_SETTING_NAME)); - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingSerialWidget(this); - layout->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/tdenetworkmanager/src/knetworkmanager-connection_setting_serial_widget.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_serial_widget.h deleted file mode 100644 index 5b3bf28..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_serial_widget.h +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_serial_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 -#include - -// 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 - - 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/tdenetworkmanager/src/knetworkmanager-connection_setting_vpn.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_vpn.cpp deleted file mode 100644 index 22e8b20..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_vpn.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_vpn.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -/* kde headers */ -#include -#include - -/* TQT_DBus headers*/ -#include -#include - -/* 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 VPN::getRoutes() const -{ - return _routes; -} - -void VPN::setRoutes(const TQValueList& r) -{ - _routes = r; - emitValidityChanged(); -} - -void VPN::setData(TQMap data) -{ - _data = data; - emitValidityChanged(); -} - -TQMap VPN::getData() const -{ - return _data; -} - -void VPN::setSecrets(const TQMap& data) -{ - _secrets = data; - emitValidityChanged(); -} - -TQMap 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 list; - for (TQValueList::ConstIterator it = _routes.begin(); it != _routes.end(); ++it) - { - list.append(TQT_DBusData::fromString(*it)); - } - } - - // NM expects a String/String map -> convert - TQT_DBusDataMap data; - - for (TQMap::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 data; - _data.clear(); - - if ((it = map.find(NM_SETTING_VPN_DATA)) != map.end()) - { - data = it.data().toStringKeyMap(); - for (TQMap::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::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 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/tdenetworkmanager/src/knetworkmanager-connection_setting_vpn.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_vpn.h deleted file mode 100644 index 6850fc2..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_vpn.h +++ /dev/null @@ -1,83 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_vpn.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include - -#include -#include "knetworkmanager-connection_setting.h" - -/* NM headers */ -#include - -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 getRoutes() const; - void setRoutes(const TQValueList&); - - TQMap getData() const; - void setData(TQMap data); - - // Ugh, that is ugly - TQMap getSecrets() const; - void setSecrets(const TQMap& secrets); - - bool isValid() const; - - private: - TQString _userName; - TQString _serviceType; - TQValueList _routes; - TQMap _data; - TQMap _secrets; -}; - -} -#endif /* KNETWORKMANAGER_CONNECTION_SETTING_VPN_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_vpn_widget.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_vpn_widget.cpp deleted file mode 100644 index 0e9ac95..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_vpn_widget.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_vpn_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * Author: Timothy Pearson - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include - -// 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 (conn->getSetting(NM_SETTING_VPN_SETTING_NAME)); - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingVPNWidget(this); - layout->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/tdenetworkmanager/src/knetworkmanager-connection_setting_vpn_widget.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_vpn_widget.h deleted file mode 100644 index f7c16cd..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_vpn_widget.h +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_vpn_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -// 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 - - 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 _mapServiceCombo; - TQMap _mapServiceWidget; -}; - -} -#endif /* KNETWORKMANAGER_CONNECTION_SETTING_VPN_WIDGET_H*/ diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_widget_interface.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_widget_interface.cpp deleted file mode 100644 index 2c00288..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_widget_interface.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_widget_interface.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#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/tdenetworkmanager/src/knetworkmanager-connection_setting_widget_interface.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_widget_interface.h deleted file mode 100644 index 13ea65e..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_widget_interface.h +++ /dev/null @@ -1,47 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_widget_interface.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -namespace ConnectionSettings -{ - - class WidgetInterface : public TQWidget - { - Q_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/tdenetworkmanager/src/knetworkmanager-connection_setting_wired.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_wired.cpp deleted file mode 100644 index 03aa61f..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_wired.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -/* kde headers */ -#include -#include - -/* TQT_DBus headers*/ -#include -#include - -/* NM headers */ -#include - -/* 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/tdenetworkmanager/src/knetworkmanager-connection_setting_wired.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_wired.h deleted file mode 100644 index 9da930e..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_wired.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include - -#include -#include "knetworkmanager-connection_setting.h" -#include - -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/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless.cpp deleted file mode 100644 index 2e1db8e..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include - -/* kde headers */ -#include -#include - -/* TQT_DBus headers*/ -#include -#include - -/* 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 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 bssids; - for (TQValueList::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::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 dbus_essid = (*it).toTQValueList(); - TQByteArray essid(dbus_essid.size()); - - int index = 0; - for (TQValueList::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 bssids = (*it).toTQValueList(); - _seenBssids.clear(); - - for(TQValueList::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::Iterator it = _seenBssids.begin(); it != _seenBssids.end(); ++it) - { - if ((*it) == bssid) - return; - } - - // insert this bssid - _seenBssids.append(bssid); - emitValidityChanged(); -} diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless.h deleted file mode 100644 index acdec94..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless.h +++ /dev/null @@ -1,97 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include - -#include -#include "knetworkmanager-connection_setting.h" -#include "qbidirectionalmap.h" -/* NM headers */ -#include - - -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 _seenBssids; - TQString _security; - - TQBiDirectionalMap _modeMap; -}; - -} -#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security.cpp deleted file mode 100644 index a01f8f6..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security.cpp +++ /dev/null @@ -1,451 +0,0 @@ -/************************************************************************** - * - * knetworkmanager-connection_setting_wireless_security.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -/* kde headers */ -#include -#include - -/* TQT_DBus headers*/ -#include -#include - -/* 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(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 protos; - for (TQMap::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 ciphers; - for (TQMap::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 ciphers; - - for (TQMap::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::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::Iterator it2; - if (_authAlgMap.end() != (it2 = _authAlgMap.findData(it.data().toString()))) - setAuthAlg(it2.key()); - } - else if(it.key() == NM_SETTING_WIRELESS_SECURITY_PROTO) - { - TQValueList proto_list = it.data().toTQValueList(); - uint32_t protos = PROTO_NONE; - for (TQValueList::Iterator proto_it = proto_list.begin(); proto_it != proto_list.end(); ++proto_it) - { - TQBiDirectionalMap::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 cipher_list = it.data().toTQValueList(); - uint32_t ciphers = CIPHER_NONE; - for (TQValueList::Iterator cipher_it = cipher_list.begin(); cipher_it != cipher_list.end(); ++cipher_it) - { - TQBiDirectionalMap::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 cipher_list = it.data().toTQValueList(); - uint32_t ciphers = CIPHER_NONE; - for (TQValueList::Iterator cipher_it = cipher_list.begin(); cipher_it != cipher_list.end(); ++cipher_it) - { - TQBiDirectionalMap::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/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security.h deleted file mode 100644 index 187fd37..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security.h +++ /dev/null @@ -1,156 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include - -#include - -#include "knetworkmanager-connection_setting.h" -#include "qbidirectionalmap.h" -/* NM */ -#include -#include - - -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 _keyMgmtMap; - TQBiDirectionalMap _authAlgMap; - TQBiDirectionalMap _protoMap; - TQBiDirectionalMap _cipherMap; -}; - -} -#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security_widget.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security_widget.cpp deleted file mode 100644 index 1adea03..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security_widget.cpp +++ /dev/null @@ -1,999 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_wireless_security_widget.cpp - * - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include - -/* kde headers */ -#include -#include -#include -#include - -/* 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::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::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::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& 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 (conn->getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)); - _wireless_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); - _ieee8021x_setting = dynamic_cast (conn->getSetting(NM_SETTING_802_1X_SETTING_NAME)); - _new_conn = new_conn; - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingWirelessSecurityWidget(this); - layout->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 allowed_methods; - _mainWid->cboSecurity->clear(); - - // TODO: Preselect the right security method - // We should have an Essid already, fetch all possible APs - TQValueList 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::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::iterator it = _widgets[i].begin(); it != _widgets[i].end(); ++it) - { - _mainWid->groupUseEncryption->layout()->remove(*it); - (*it)->hide(); - } - // remove extra widgets too - for (TQValueList::iterator it = _extra_widgets[i].begin(); it != _extra_widgets[i].end(); ++it) - { - _mainWid->groupUseEncryption->layout()->remove(*it); - (*it)->hide(); - } - } - } - - // show all widgets widgets for the selected security method - for (TQValueList::iterator it = _widgets[method].begin(); it != _widgets[method].end(); ++it) - { - _mainWid->groupUseEncryption->layout()->add(*it); - (*it)->show(); - } - - if (_mainWid->pbExtra->isOn()) - for (TQValueList::iterator it = _extra_widgets[method].begin(); it != _extra_widgets[method].end(); ++it) - { - _mainWid->groupUseEncryption->layout()->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::iterator it = _extra_widgets[_currentMethod].begin(); it != _extra_widgets[_currentMethod].end(); ++it) - { - _mainWid->groupUseEncryption->layout()->add(*it); - (*it)->show(); - } - else - for (TQValueList::iterator it = _extra_widgets[_currentMethod].begin(); it != _extra_widgets[_currentMethod].end(); ++it) - { - _mainWid->groupUseEncryption->layout()->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/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security_widget.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security_widget.h deleted file mode 100644 index 7e90694..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security_widget.h +++ /dev/null @@ -1,238 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - - 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 - - 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 - - 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 - - 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 - - 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 - - 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 _eapIndexMap; - WirelessSecurityPhase2Impl* _phase2_widget; - }; - - class WirelessSecurityPhase2Impl : public ConnectionSettingWirelessSecurityPhase2 - { - Q_OBJECT - - public: - WirelessSecurityPhase2Impl(IEEE8021x* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); - public slots: - void setAllowedPhase2Methods(const TQValueList&); - void slotPhase2MethodChanged(int index); - private: - void updateMethodComboBox(); - - IEEE8021x* _security_setting; - TQBiDirectionalMap _eapIndexMap; - TQValueList _allowed_methods; - }; - - class WirelessSecurityWidgetImpl : public WidgetInterface - { - Q_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 _widgets[SECURITY_COUNT]; - TQValueList _extra_widgets[SECURITY_COUNT]; - WirelessSecurity* _security_setting; - Wireless* _wireless_setting; - IEEE8021x* _ieee8021x_setting; - ConnectionSettingWirelessSecurityWidget* _mainWid; - bool _new_conn; - TQMap _securityComboMap; - }; -} - -#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H*/ diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_widget.cpp b/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_widget.cpp deleted file mode 100644 index e6bd9c2..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_widget.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Valentine Sinitsyn - * - * 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 -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#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\%").arg(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 (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); - _info_setting = dynamic_cast (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME)); - _security_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)); - _hasName = !_info_setting->getName().isEmpty(); - _new_conn = new_conn; - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingWirelessWidget(this); - layout->addWidget(_mainWid); - - // FIXME hide this button until it is implemented - _mainWid->pbExpert->hide(); - - Init(); -} - -void -WirelessWidgetImpl::Init() -{ - TQVBoxLayout* layout = new TQVBoxLayout(_mainWid->framePlaceholder, 1, 1); - _searchLine = new KListViewSearchLineWidget(_mainWid->lvEssids, _mainWid->framePlaceholder); - layout->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 nets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID); - - _mainWid->lvEssids->clear(); - - for (TQValueList::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(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(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(bytes[i]); - } - return tmp; -} - -#include "knetworkmanager-connection_setting_wireless_widget.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_widget.h b/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_widget.h deleted file mode 100644 index 0baba65..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_widget.h +++ /dev/null @@ -1,71 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Valentine Sinitsyn - * - * 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 - - 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/tdenetworkmanager/src/knetworkmanager-connection_settings_dialog.cpp b/tdenetworkmanager/src/knetworkmanager-connection_settings_dialog.cpp deleted file mode 100644 index 97f8350..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_settings_dialog.cpp +++ /dev/null @@ -1,530 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * Author: Timothy Pearson - * - * 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 -#include -#include -#include -#include -#include -#include - -// kde headers -#include -#include -#include - -// TQt DBus headers -#include -#include - -// NM headers -#include - -// 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 -ConnectionSettingsDialogImpl::createWidgetsForWireless(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) -{ - TQValueList 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 -ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting, const TQByteArray& essid) -{ - TQValueList ret; - - // Set ESSID -// _wireless_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); -// _info_setting = dynamic_cast (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 -ConnectionSettingsDialogImpl::createWidgetsForWired(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) -{ - TQValueList ret; - - // widgetlist for wired connection - ret.append(new ConnectionSettings::IPv4WidgetImpl(conn)); - ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); - - return ret; -} - -TQValueList -ConnectionSettingsDialogImpl::createWidgetsForVPN(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) -{ - TQValueList ret; - - // widgetlist for wired connection - ret.append(new ConnectionSettings::VPNWidgetImpl(conn, new_conn)); - ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); - - return ret; -} - -TQValueList -ConnectionSettingsDialogImpl::createWidgetsForCDMA(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) -{ - TQValueList 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 -ConnectionSettingsDialogImpl::createWidgetsForGSM(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) -{ - TQValueList 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 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::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::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(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::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(wstackSettings->widget(*current)); - if (widget) - deactivateWidget(widget); - - // next widget - current++; - - // let the widget know about it being the active one - widget = dynamic_cast(wstackSettings->widget(*current)); - if (widget) - activateWidget(widget); - } - slotEnableButtons(); -} - -void -ConnectionSettingsDialogImpl::slotBack() -{ - TQValueList::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(wstackSettings->widget(*current)); - if (widget) - deactivateWidget(widget); - - // one back - current--; - - // let the widget know about it being the active one - widget = dynamic_cast(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::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/tdenetworkmanager/src/knetworkmanager-connection_settings_dialog.h b/tdenetworkmanager/src/knetworkmanager-connection_settings_dialog.h deleted file mode 100644 index 9cedc69..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_settings_dialog.h +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -// 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 - - 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 createWidgetsForWired(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); - TQValueList createWidgetsForWireless(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); - TQValueList createWidgetsForWirelessKnownESSID(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting, const TQByteArray& essid); - TQValueList createWidgetsForVPN(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); - TQValueList createWidgetsForCDMA(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); - TQValueList createWidgetsForGSM(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); - - ConnectionSettings::Connection* _conn; - ConnectionSettings::ConnectionSetting* _setting; - TQValueList _widgetIds; - bool _new_conn; -}; - -#endif /* KNETWORKMANAGER_CONNECTION_SETTINGS_DIALOG_H*/ diff --git a/tdenetworkmanager/src/knetworkmanager-device.h b/tdenetworkmanager/src/knetworkmanager-device.h index 2a12ec8..bd6e863 100644 --- a/tdenetworkmanager/src/knetworkmanager-device.h +++ b/tdenetworkmanager/src/knetworkmanager-device.h @@ -26,8 +26,6 @@ #ifndef KNETWORKMANAGER_DEVICE_H #define KNETWORKMANAGER_DEVICE_H -#include - #include "knetworkmanager.h" #include diff --git a/tdenetworkmanager/src/settings/connection_setting_cdma.ui b/tdenetworkmanager/src/settings/connection_setting_cdma.ui new file mode 100644 index 0000000..5674468 --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_setting_cdma.ui @@ -0,0 +1,131 @@ + +ConnectionSettingCdmaWidget + + + ConnectionSettingCdmaWidget + + + + 0 + 0 + 381 + 102 + + + + Form1 + + + + unnamed + + + 0 + + + + layout10 + + + + unnamed + + + + mPassword + + + Password needed to access the service + + + + + textLabel1 + + + &Number: + + + mNumber + + + + + mUsername + + + Username needed to access the service + + + + + textLabel2 + + + &Username: + + + mUsername + + + + + textLabel2_2 + + + &Password: + + + mUsername + + + + + mNumber + + + + + spacer2 + + + Horizontal + + + Expanding + + + + 146 + 20 + + + + + + + + spacer1 + + + Vertical + + + Expanding + + + + 20 + 16 + + + + + + + mNumber + mUsername + mPassword + + + diff --git a/tdenetworkmanager/src/settings/connection_setting_gsm.ui b/tdenetworkmanager/src/settings/connection_setting_gsm.ui new file mode 100644 index 0000000..c89a749 --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_setting_gsm.ui @@ -0,0 +1,294 @@ + +ConnectionSettingGsmWidget + + + ConnectionSettingGsmWidget + + + + 0 + 0 + 381 + 245 + + + + Form1 + + + + unnamed + + + 0 + + + + layout9 + + + + unnamed + + + + textLabel4 + + + Network &ID: + + + mNetworkId + + + + + textLabel2_2_2 + + + PU&K: + + + mUsername + + + + + textLabel1 + + + &Number: + + + mNumber + + + + + mPassword + + + Password needed to access the service + + + + + + Any + + + + + GPRS + + + + + GSM + + + + + Prefer GPRS + + + + + Prefer GSM + + + + mNetworkType + + + Select the type of cellular data network the connection should use + + + 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 + + + + + textLabel6 + + + Network &Type: + + + mNetworkType + + + + + textLabel2 + + + &Username: + + + mUsername + + + + + mApn + + + Access Point Name + + + The hostname of the machine providing network access + + + + + textLabel5 + + + &Band: + + + mBand + + + + + mPuk + + + Personal Unblocking Code + + + A code used to unblock a blocked SIM card + + + + + mBand + + + 5 + + + -1 + + + -1 + + + + + spacer4 + + + Horizontal + + + Expanding + + + + 171 + 20 + + + + + + mPin + + + Personal Identification Number + + + A code used for all GSM-based phones to establish authorisation for access to certain functions or information + + + + + mUsername + + + Username needed to access the service + + + + + mNumber + + + + + mNetworkId + + + The GSM network to connect to + + + + + textLabel2_3 + + + &PIN: + + + mUsername + + + + + textLabel2_2 + + + Pass&word: + + + mUsername + + + + + textLabel3 + + + &APN: + + + mApn + + + + + + + spacer5 + + + Vertical + + + Expanding + + + + 20 + 51 + + + + + + + mUsername + mPassword + mPin + mPuk + mNumber + mApn + mNetworkId + mNetworkType + mBand + + + diff --git a/tdenetworkmanager/src/settings/connection_setting_info.ui b/tdenetworkmanager/src/settings/connection_setting_info.ui new file mode 100644 index 0000000..72a6e87 --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_setting_info.ui @@ -0,0 +1,71 @@ + +ConnectionSettingInfoWidget + + + ConnectionSettingInfoWidget + + + + 0 + 0 + 591 + 151 + + + + Form1 + + + + unnamed + + + + textLabel1 + + + Connection Name: + + + + + txtConnectionName + + + + + spacer1 + + + Vertical + + + Expanding + + + + 20 + 30 + + + + + + textLabel1_2 + + + Autoconnect: + + + + + chkAutoConnect + + + + + + + + + diff --git a/tdenetworkmanager/src/settings/connection_setting_ipv4.ui b/tdenetworkmanager/src/settings/connection_setting_ipv4.ui new file mode 100644 index 0000000..0f08a00 --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_setting_ipv4.ui @@ -0,0 +1,116 @@ + +ConnectionSettingIPv4Widget + + + ConnectionSettingIPv4Widget + + + + 0 + 0 + 534 + 330 + + + + Form3 + + + + unnamed + + + + groupIPConfig + + + Use manual IP configuration + + + true + + + false + + + + unnamed + + + + textLabel1 + + + DNS Addresses: + + + + + textLabel2_2 + + + DNS Search: + + + + + textLabel2 + + + IP Address: + + + + + txtIP + + + + + txtDNSAddresses + + + + + txtDNSSearch + + + + + textLabel2_3 + + + Netmask: + + + + + txtNetmask + + + + + textLabel1_2 + + + Gateway: + + + + + txtGateway + + + + + + + + txtIP + txtNetmask + txtGateway + txtDNSAddresses + txtDNSSearch + + + diff --git a/tdenetworkmanager/src/settings/connection_setting_ppp.ui b/tdenetworkmanager/src/settings/connection_setting_ppp.ui new file mode 100644 index 0000000..7db6e5e --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_setting_ppp.ui @@ -0,0 +1,320 @@ + +ConnectionSettingPppWidget + + + ConnectionSettingPppWidget + + + + 0 + 0 + 472 + 284 + + + + Form2 + + + + unnamed + + + 0 + + + + layout9 + + + + unnamed + + + + mRequireMppe128 + + + Require MPPE128 + + + + + spacer6 + + + Vertical + + + Expanding + + + + 20 + 50 + + + + + + layout11 + + + + unnamed + + + + mLcpEchoInterval + + + + + textLabel11 + + + LCP Echo Interval + + + + + + + layout12 + + + + unnamed + + + + mLcpEchoFailure + + + + + textLabel10 + + + LCP Echo Failure + + + + + + + layout15 + + + + unnamed + + + + mBaudRate + + + + + textLabel7 + + + Baud rate + + + + + + + layout13 + + + + unnamed + + + + mMtu + + + + + textLabel9 + + + MTU + + + + + + + mRefusePap + + + Refuse PAP + + + + + mNoAuth + + + No Authorization + + + + + mNoVjComp + + + No VJ Compression + + + + + mRefuseMschap + + + Refuse MSCHAP + + + + + layout14 + + + + unnamed + + + + mMru + + + + + textLabel8 + + + MRU + + + + + + + mRequireMppe + + + Require MPPE + + + + + mRequireMppc + + + Require MPPC + + + + + mRefuseMschapV2 + + + Refuse MSCHAPv2 + + + + + mNoBsd + + + No BSD + + + + + mStatefulMppe + + + Stateful MPPE + + + + + mCrtscts + + + CRTSCTS + + + + + mNoDeflate + + + No Deflate + + + + + mRefuseChap + + + Refuse CHAP + + + + + mRefuseEap + + + Refuse EAP + + + + + + + spacer2 + + + Vertical + + + Expanding + + + + 20 + 41 + + + + + + + mNoAuth + mRefuseEap + mRefusePap + mRefuseChap + mRefuseMschap + mRefuseMschapV2 + mNoBsd + mNoDeflate + mNoVjComp + mRequireMppe + mRequireMppe128 + mStatefulMppe + mRequireMppc + mCrtscts + mBaudRate + mMru + mMtu + mLcpEchoFailure + mLcpEchoInterval + + + diff --git a/tdenetworkmanager/src/settings/connection_setting_serial.ui b/tdenetworkmanager/src/settings/connection_setting_serial.ui new file mode 100644 index 0000000..2a3b9ad --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_setting_serial.ui @@ -0,0 +1,185 @@ + +ConnectionSettingSerialWidget + + + ConnectionSettingSerialWidget + + + + 0 + 0 + 170 + 187 + + + + Form2 + + + + unnamed + + + 0 + + + + layout23 + + + + unnamed + + + + mSendDelay + + + + + textLabel11 + + + &Send delay + + + mSendDelay + + + + + + None + + + + + Even + + + + + Odd + + + + mParity + + + + + + 0 + + + + + 1 + + + + mStopBits + + + 1 + + + + + + 7 + + + + + 8 + + + + + 9 + + + + mDataBits + + + 1 + + + + + mBaudRate + + + + + textLabel12_3 + + + &Stop bits: + + + mStopBits + + + + + textLabel7 + + + Baud rate + + + + + textLabel12_2 + + + &Parity: + + + mParity + + + + + textLabel12 + + + &Data bits: + + + mDataBits + + + + + + + spacer6 + + + Vertical + + + Expanding + + + + 20 + 141 + + + + + + + mBaudRate + mDataBits + mParity + mStopBits + mSendDelay + + + diff --git a/tdenetworkmanager/src/settings/connection_setting_vpn.ui b/tdenetworkmanager/src/settings/connection_setting_vpn.ui new file mode 100644 index 0000000..976fc25 --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_setting_vpn.ui @@ -0,0 +1,51 @@ + +ConnectionSettingVPNWidget + + + VPN + + + + 0 + 0 + 331 + 155 + + + + VPN + + + + unnamed + + + + cboServices + + + + + textLabel2 + + + Service + + + + + widgetStack + + + + WStackPage + + + 0 + + + + + + + diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless.ui b/tdenetworkmanager/src/settings/connection_setting_wireless.ui new file mode 100644 index 0000000..9415ce4 --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_setting_wireless.ui @@ -0,0 +1,140 @@ + +ConnectionSettingWirelessWidget + + + ConnectionSettingWirelessWidget + + + + 0 + 0 + 506 + 418 + + + + Form6 + + + + unnamed + + + + textLabel1 + + + Essid: + + + + + txtEssid + + + + + pbExpert + + + Expert options + + + + + spacer1 + + + Horizontal + + + Expanding + + + + 282 + 20 + + + + + + + Essid + + + true + + + true + + + + + Quality + + + true + + + true + + + + + Security + + + true + + + true + + + + lvEssids + + + StyledPanel + + + Sunken + + + true + + + true + + + + + framePlaceholder + + + NoFrame + + + Raised + + + + + chkAutoRefresh + + + Refresh automatically + + + true + + + + + + + klineedit.h + kpushbutton.h + klistview.h + + diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security.ui new file mode 100644 index 0000000..5fce58f --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_setting_wireless_security.ui @@ -0,0 +1,87 @@ + +ConnectionSettingWirelessSecurityWidget + + + Form1 + + + + 0 + 0 + 522 + 158 + + + + Form1 + + + + unnamed + + + + groupUseEncryption + + + Use Wireless Security + + + true + + + false + + + + unnamed + + + + cboSecurity + + + + + textLabel1 + + + Security: + + + + + buttonGroup5 + + + NoFrame + + + + + + + unnamed + + + 0 + + + + + + pbExtra + + + Expert settings + + + true + + + + + + + + diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security_auth.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security_auth.ui new file mode 100644 index 0000000..ce88e51 --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_setting_wireless_security_auth.ui @@ -0,0 +1,51 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 342 + 97 + + + + Form1 + + + + unnamed + + + + groupBox1 + + + Authentication + + + + unnamed + + + + textLabel1 + + + Method: + + + + + cboAuthAlg + + + + + + + + diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security_eap.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security_eap.ui new file mode 100644 index 0000000..a851a93 --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_setting_wireless_security_eap.ui @@ -0,0 +1,163 @@ + +ConnectionSettingWirelessSecurityEAP + + + ConnectionSettingWirelessSecurityEAP + + + + 0 + 0 + 583 + 174 + + + + Form2 + + + + unnamed + + + 0 + + + + groupBox2 + + + EAP + + + + unnamed + + + + textLabel8 + + + Method: + + + + + textLabel9 + + + Identity: + + + + + cboMethod + + + + + txtIdentity + + + + + txtAnonIdentity + + + + + textLabel10 + + + Anonymous Identity: + + + + + textLabel11 + + + Password: + + + + + txtPassword + + + + + textLabel16 + + + Private Secret Key: + + + + + txtPrivateSecretKey + + + + + textLabel12 + + + Client Certificate: + + + + + kURLClientCert + + + + + kURLPrivateKey + + + + + textLabel15 + + + Private Keyfile: + + + + + textLabel14 + + + CA Certificate: + + + + + kURLCACert + + + + + textLabel1 + + + Use System CA Certificates + + + + + chkCAStore + + + + + + + + + + + + + diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security_phase2.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security_phase2.ui new file mode 100644 index 0000000..b3237d4 --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_setting_wireless_security_phase2.ui @@ -0,0 +1,54 @@ + +ConnectionSettingWirelessSecurityPhase2 + + + ConnectionSettingWirelessSecurityPhase2 + + + + 0 + 0 + 225 + 135 + + + + Form4 + + + + unnamed + + + 0 + + + + groupBox4 + + + Phase 2 + + + + unnamed + + + + textLabel17 + + + Method: + + + + + cboPhase2Method + + + + + + + + diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security_wep.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security_wep.ui new file mode 100644 index 0000000..c07033e --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_setting_wireless_security_wep.ui @@ -0,0 +1,146 @@ + +ConnectionSettingWirelessSecurityWEP + + + ConnectionSettingWirelessSecurityWEP + + + + 0 + 0 + 333 + 238 + + + + Form1 + + + + unnamed + + + 0 + + + + WEP + + + WEP + + + + unnamed + + + + buttonGroup1 + + + NoFrame + + + + + + + unnamed + + + 0 + + + + txtWEPKey2 + + + + + rbKeyIdx1 + + + Key 2: + + + + + rbKeyIdx3 + + + Key 4: + + + + + textLabel1 + + + Type: + + + + + rbKeyIdx0 + + + Key 1: + + + + + txtWEPKey3 + + + + + rbKeyIdx2 + + + Key 3: + + + + + txtWEPKey1 + + + + + txtWEPKey0 + + + + + cbKeyType + + + + 7 + 0 + 0 + 0 + + + + + + textLabel1_2 + + + Authentication: + + + + + cboAuthentication + + + + + + + + + + diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security_wepencryption.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security_wepencryption.ui new file mode 100644 index 0000000..50c149d --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_setting_wireless_security_wepencryption.ui @@ -0,0 +1,46 @@ + +ConnectionSettingWirelessSecurityWEPEncryption + + + ConnectionSettingWirelessSecurityWEPEncryption + + + + 0 + 0 + 288 + 64 + + + + Form1 + + + + unnamed + + + 0 + + + + groupBox2 + + + Encryption + + + + unnamed + + + + cboEncryption + + + + + + + + diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpacipher.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpacipher.ui new file mode 100644 index 0000000..a402e66 --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpacipher.ui @@ -0,0 +1,128 @@ + +ConnectionSettingWirelessSecurityWPACipher + + + ConnectionSettingWirelessSecurityWPACipher + + + + 0 + 0 + 600 + 99 + + + + Form1 + + + + unnamed + + + 0 + + + + grpUseCipher + + + Use specific cipher + + + true + + + false + + + + unnamed + + + + textLabel18 + + + Group Cipher: + + + + + textLabel1 + + + Pairwise Cipher: + + + + + chkGroupCipherCCMP + + + CCMP + + + + + chkGroupCipherTKIP + + + TKIP + + + + + chkPairwiseCipherTKIP + + + TKIP + + + + + chkPairwiseCipherCCMP + + + CCMP + + + + + chkGroupCipherWEP40 + + + WEP 40 + + + + + spacer2 + + + Horizontal + + + Expanding + + + + 60 + 20 + + + + + + chkGroupCipherWEP104 + + + WEP 104 + + + + + + + + diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpapsk.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpapsk.ui new file mode 100644 index 0000000..4df8eea --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpapsk.ui @@ -0,0 +1,46 @@ + +ConnectionSettingWirelessSecurityWPAPSK + + + ConnectionSettingWirelessSecurityWPAPSK + + + + 0 + 0 + 600 + 480 + + + + Form2 + + + + unnamed + + + 0 + + + + groupBox3 + + + Shared Key + + + + unnamed + + + + txtPSK + + + + + + + + diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpaversion.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpaversion.ui new file mode 100644 index 0000000..11b1655 --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpaversion.ui @@ -0,0 +1,80 @@ + +ConnectionSettingWirelessSecurityWPAVersion + + + ConnectionSettingWirelessSecurityWPAVersion + + + + 0 + 0 + 308 + 64 + + + + Form3 + + + + unnamed + + + 0 + + + + grpUseWPAVersion + + + Use specific WPA Version + + + true + + + false + + + + unnamed + + + + cbRSN + + + WPA 2/RSN + + + + + cbWPA + + + WPA 1 + + + + + spacer7 + + + Horizontal + + + Expanding + + + + 50 + 20 + + + + + + + + + diff --git a/tdenetworkmanager/src/settings/connection_settings.ui b/tdenetworkmanager/src/settings/connection_settings.ui new file mode 100644 index 0000000..c7994de --- /dev/null +++ b/tdenetworkmanager/src/settings/connection_settings.ui @@ -0,0 +1,137 @@ + +ConnectionSettingsDialog + + + ConnectionSettingsDialog + + + + 0 + 0 + 644 + 318 + + + + Connections + + + + unnamed + + + + pbBack + + + Back + + + + + lblInfo + + + + 1 + + + + New Connection + + + + + wstackSettings + + + + 5 + 7 + 0 + 0 + + + + TabWidgetPanel + + + + WStackPage + + + 0 + + + + + + pbCancel + + + Cancel + + + + + spacer2 + + + Horizontal + + + Expanding + + + + 180 + 20 + + + + + + pbNext + + + Next + + + true + + + + + pbSave + + + Save + + + + + btnConnect + + + Connect && Save + + + + + + true + + + false + + + + + + + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + + diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.cpp new file mode 100644 index 0000000..50d7423 --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include + +/* kde headers */ +#include +#include + +/* TQT_DBus headers*/ +#include +#include + +/* 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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.h new file mode 100644 index 0000000..f189117 --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include +#include + +namespace ConnectionSettings +{ + +/* + Annotation: hopefully we can convert these to + TQMap when switching to TQt4 +*/ +typedef TQMap SettingsMap; + +class Connection; + +// the base class for all settings +class ConnectionSetting : public TQObject +{ + Q_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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.cpp new file mode 100644 index 0000000..4904f01 --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include + +/* kde headers */ +#include +#include + +/* TQT_DBus headers*/ +#include +#include + +/* 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 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 eap_methods = it.data().toTQValueList(); + if (!eap_methods.isEmpty()) + { + TQString eap = eap_methods.first().toString(); + TQBiDirectionalMap::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 eap = it.data().toString(); + if (!eap.isEmpty()) + { + TQBiDirectionalMap::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::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::getAllowedPhase2Methods() const +{ + TQValueList 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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.h new file mode 100644 index 0000000..a5c593e --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include +#include +#include +#include + +#include + +#include "knetworkmanager-connection_setting.h" +#include "qbidirectionalmap.h" +/* NM */ +#include +#include + + +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 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 _eapMap; +}; + +} +#endif /* KNETWORKMANAGER_CONNECTION_SETTING_8021X_H */ diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.cpp new file mode 100644 index 0000000..854590c --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include + +/* kde headers */ +#include +#include + +/* TQT_DBus headers*/ +#include +#include + +/* 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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.h new file mode 100644 index 0000000..c0825b3 --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include +#include +#include +#include + +#include + +#include "knetworkmanager-connection_setting.h" + +/* NM headers */ +#include + +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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.cpp new file mode 100644 index 0000000..cd38c3f --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include + +/* kde headers */ +#include +#include + +/* TQT_DBus headers*/ +#include +#include + +/* knetworkmanager headers */ +#include "knetworkmanager.h" +#include "knetworkmanager-connection.h" +#include "knetworkmanager-connection_setting_gsm.h" + +/* network-manager headers */ +#include + +#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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.h new file mode 100644 index 0000000..ac912ae --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include +#include +#include +#include + +#include + +#include "knetworkmanager-connection_setting.h" + +/* NM headers */ +#include + +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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.cpp new file mode 100644 index 0000000..225d002 --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include + +/* kde headers */ +#include +#include + +/* TQT_DBus headers*/ +#include +#include + +/* 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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.h new file mode 100644 index 0000000..705387b --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include +#include +#include +#include +#include + +#include +#include "knetworkmanager-connection_setting.h" + +/* NM headers */ +#include + +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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.cpp new file mode 100644 index 0000000..15f8978 --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include + +/* kde headers */ +#include +#include + +/* TQT_DBus headers*/ +#include +#include + +/* 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 IPv4::getAddresses() const +{ + return _addresses; +} + +void IPv4::setAddresses(const TQValueList & adr) +{ + _addresses = adr; + emitValidityChanged(); +} + +TQValueList IPv4::getDNS() const +{ + return _dns; +} + +void IPv4::setDNS(const TQValueList& 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::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::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 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 dns; + TQValueList::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 ips; + for (TQValueList::ConstIterator it = _addresses.begin(); it != _addresses.end(); ++it) + { + TQValueList 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 dns_search = it.data().toTQValueList(); + for (TQValueList::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 dns = it.data().toTQValueList(); + for (TQValueList::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 ips = it.data().toTQValueList(); + for (TQValueList::Iterator it2 = ips.begin(); it2 != ips.end(); ++it2) + { + TQValueList 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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.h new file mode 100644 index 0000000..7788769 --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include +#include +#include +#include + +#include + +#include "knetworkmanager-connection_setting.h" + +/* NM headers */ +#include + +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 getAddresses() const; + void setAddresses(const TQValueList&); + + TQValueList getDNS() const; + void setDNS(const TQValueList&); + + 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 _dns; + TQStringList _dns_search; + TQValueList _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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.cpp new file mode 100644 index 0000000..257a012 --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 + +/* qt headers */ +#include +#include + +/* kde headers */ +#include +#include + +/* TQT_DBus headers*/ +#include +#include + +/* 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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.h new file mode 100644 index 0000000..9f72e42 --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include +#include +#include +#include + +#include + +#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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.cpp new file mode 100644 index 0000000..4861e7b --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include + +/* kde headers */ +#include +#include + +/* TQT_DBus headers*/ +#include +#include + +/* 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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.h new file mode 100644 index 0000000..40099a7 --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include +#include +#include +#include + +#include + +#include "knetworkmanager-connection_setting.h" + +/* NM headers */ +#include +#include + +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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.cpp new file mode 100644 index 0000000..22e8b20 --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include + +/* kde headers */ +#include +#include + +/* TQT_DBus headers*/ +#include +#include + +/* 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 VPN::getRoutes() const +{ + return _routes; +} + +void VPN::setRoutes(const TQValueList& r) +{ + _routes = r; + emitValidityChanged(); +} + +void VPN::setData(TQMap data) +{ + _data = data; + emitValidityChanged(); +} + +TQMap VPN::getData() const +{ + return _data; +} + +void VPN::setSecrets(const TQMap& data) +{ + _secrets = data; + emitValidityChanged(); +} + +TQMap 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 list; + for (TQValueList::ConstIterator it = _routes.begin(); it != _routes.end(); ++it) + { + list.append(TQT_DBusData::fromString(*it)); + } + } + + // NM expects a String/String map -> convert + TQT_DBusDataMap data; + + for (TQMap::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 data; + _data.clear(); + + if ((it = map.find(NM_SETTING_VPN_DATA)) != map.end()) + { + data = it.data().toStringKeyMap(); + for (TQMap::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::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 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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.h new file mode 100644 index 0000000..6850fc2 --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include +#include +#include +#include +#include + +#include +#include "knetworkmanager-connection_setting.h" + +/* NM headers */ +#include + +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 getRoutes() const; + void setRoutes(const TQValueList&); + + TQMap getData() const; + void setData(TQMap data); + + // Ugh, that is ugly + TQMap getSecrets() const; + void setSecrets(const TQMap& secrets); + + bool isValid() const; + + private: + TQString _userName; + TQString _serviceType; + TQValueList _routes; + TQMap _data; + TQMap _secrets; +}; + +} +#endif /* KNETWORKMANAGER_CONNECTION_SETTING_VPN_H */ diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.cpp new file mode 100644 index 0000000..03aa61f --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include + +/* kde headers */ +#include +#include + +/* TQT_DBus headers*/ +#include +#include + +/* NM headers */ +#include + +/* 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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.h new file mode 100644 index 0000000..9da930e --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include +#include +#include +#include + +#include +#include "knetworkmanager-connection_setting.h" +#include + +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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.cpp new file mode 100644 index 0000000..2e1db8e --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include +#include + +/* kde headers */ +#include +#include + +/* TQT_DBus headers*/ +#include +#include + +/* 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 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 bssids; + for (TQValueList::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::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 dbus_essid = (*it).toTQValueList(); + TQByteArray essid(dbus_essid.size()); + + int index = 0; + for (TQValueList::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 bssids = (*it).toTQValueList(); + _seenBssids.clear(); + + for(TQValueList::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::Iterator it = _seenBssids.begin(); it != _seenBssids.end(); ++it) + { + if ((*it) == bssid) + return; + } + + // insert this bssid + _seenBssids.append(bssid); + emitValidityChanged(); +} diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.h new file mode 100644 index 0000000..acdec94 --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include +#include +#include +#include + +#include +#include "knetworkmanager-connection_setting.h" +#include "qbidirectionalmap.h" +/* NM headers */ +#include + + +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 _seenBssids; + TQString _security; + + TQBiDirectionalMap _modeMap; +}; + +} +#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_H */ diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.cpp new file mode 100644 index 0000000..a01f8f6 --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include + +/* kde headers */ +#include +#include + +/* TQT_DBus headers*/ +#include +#include + +/* 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(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 protos; + for (TQMap::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 ciphers; + for (TQMap::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 ciphers; + + for (TQMap::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::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::Iterator it2; + if (_authAlgMap.end() != (it2 = _authAlgMap.findData(it.data().toString()))) + setAuthAlg(it2.key()); + } + else if(it.key() == NM_SETTING_WIRELESS_SECURITY_PROTO) + { + TQValueList proto_list = it.data().toTQValueList(); + uint32_t protos = PROTO_NONE; + for (TQValueList::Iterator proto_it = proto_list.begin(); proto_it != proto_list.end(); ++proto_it) + { + TQBiDirectionalMap::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 cipher_list = it.data().toTQValueList(); + uint32_t ciphers = CIPHER_NONE; + for (TQValueList::Iterator cipher_it = cipher_list.begin(); cipher_it != cipher_list.end(); ++cipher_it) + { + TQBiDirectionalMap::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 cipher_list = it.data().toTQValueList(); + uint32_t ciphers = CIPHER_NONE; + for (TQValueList::Iterator cipher_it = cipher_list.begin(); cipher_it != cipher_list.end(); ++cipher_it) + { + TQBiDirectionalMap::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/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.h new file mode 100644 index 0000000..187fd37 --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 +#include +#include +#include +#include + +#include + +#include "knetworkmanager-connection_setting.h" +#include "qbidirectionalmap.h" +/* NM */ +#include +#include + + +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 _keyMgmtMap; + TQBiDirectionalMap _authAlgMap; + TQBiDirectionalMap _protoMap; + TQBiDirectionalMap _cipherMap; +}; + +} +#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_H */ diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp new file mode 100644 index 0000000..97f8350 --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * Author: Timothy Pearson + * + * 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 +#include +#include +#include +#include +#include +#include + +// kde headers +#include +#include +#include + +// TQt DBus headers +#include +#include + +// NM headers +#include + +// 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 +ConnectionSettingsDialogImpl::createWidgetsForWireless(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) +{ + TQValueList 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 +ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting, const TQByteArray& essid) +{ + TQValueList ret; + + // Set ESSID +// _wireless_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); +// _info_setting = dynamic_cast (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 +ConnectionSettingsDialogImpl::createWidgetsForWired(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) +{ + TQValueList ret; + + // widgetlist for wired connection + ret.append(new ConnectionSettings::IPv4WidgetImpl(conn)); + ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); + + return ret; +} + +TQValueList +ConnectionSettingsDialogImpl::createWidgetsForVPN(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) +{ + TQValueList ret; + + // widgetlist for wired connection + ret.append(new ConnectionSettings::VPNWidgetImpl(conn, new_conn)); + ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); + + return ret; +} + +TQValueList +ConnectionSettingsDialogImpl::createWidgetsForCDMA(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) +{ + TQValueList 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 +ConnectionSettingsDialogImpl::createWidgetsForGSM(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) +{ + TQValueList 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 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::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::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(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::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(wstackSettings->widget(*current)); + if (widget) + deactivateWidget(widget); + + // next widget + current++; + + // let the widget know about it being the active one + widget = dynamic_cast(wstackSettings->widget(*current)); + if (widget) + activateWidget(widget); + } + slotEnableButtons(); +} + +void +ConnectionSettingsDialogImpl::slotBack() +{ + TQValueList::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(wstackSettings->widget(*current)); + if (widget) + deactivateWidget(widget); + + // one back + current--; + + // let the widget know about it being the active one + widget = dynamic_cast(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::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/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.h new file mode 100644 index 0000000..9cedc69 --- /dev/null +++ b/tdenetworkmanager/src/settings/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 , + * + * 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 + +// 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 + + 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 createWidgetsForWired(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); + TQValueList createWidgetsForWireless(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); + TQValueList createWidgetsForWirelessKnownESSID(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting, const TQByteArray& essid); + TQValueList createWidgetsForVPN(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); + TQValueList createWidgetsForCDMA(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); + TQValueList createWidgetsForGSM(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); + + ConnectionSettings::Connection* _conn; + ConnectionSettings::ConnectionSetting* _setting; + TQValueList _widgetIds; + bool _new_conn; +}; + +#endif /* KNETWORKMANAGER_CONNECTION_SETTINGS_DIALOG_H*/ -- cgit v1.2.1 From 9265fa10ad0ff141e4090fb280176680dd35ebef Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 4 Sep 2012 13:51:32 -0500 Subject: Remove more unneeded files and start conversion to TDE network API --- tdenetworkmanager/src/CMakeLists.txt | 22 +- tdenetworkmanager/src/devicetraycomponent.cpp | 123 ++-- tdenetworkmanager/src/devicetraycomponent.h | 29 +- .../src/knetworkmanager-accesspoint.cpp | 222 ------- .../src/knetworkmanager-accesspoint.h | 75 --- .../src/knetworkmanager-cdma_device.cpp | 67 -- .../src/knetworkmanager-cdma_device.h | 51 -- .../src/knetworkmanager-cellular_device.cpp | 37 -- .../src/knetworkmanager-cellular_device.h | 40 -- .../src/knetworkmanager-cellular_device_tray.cpp | 4 +- .../src/knetworkmanager-cellular_device_tray.h | 2 +- .../src/knetworkmanager-connection.cpp | 296 --------- tdenetworkmanager/src/knetworkmanager-connection.h | 131 ---- .../src/knetworkmanager-connection_dbus.cpp | 200 ------ .../src/knetworkmanager-connection_dbus.h | 77 --- .../src/knetworkmanager-connection_editor.cpp | 21 +- .../src/knetworkmanager-connection_editor.h | 2 +- .../knetworkmanager-connection_secrets_dbus.cpp | 230 ------- .../src/knetworkmanager-connection_secrets_dbus.h | 76 --- .../src/knetworkmanager-connection_store.cpp | 191 ------ .../src/knetworkmanager-connection_store.h | 88 --- tdenetworkmanager/src/knetworkmanager-device.cpp | 166 ----- tdenetworkmanager/src/knetworkmanager-device.h | 72 --- .../src/knetworkmanager-devicestore.cpp | 220 ------- .../src/knetworkmanager-devicestore.h | 65 -- .../src/knetworkmanager-gsm_device.cpp | 67 -- tdenetworkmanager/src/knetworkmanager-gsm_device.h | 51 -- .../src/knetworkmanager-hal_device_proxy.cpp | 126 ---- .../src/knetworkmanager-hal_device_proxy.h | 65 -- tdenetworkmanager/src/knetworkmanager-nm_proxy.cpp | 329 ---------- tdenetworkmanager/src/knetworkmanager-nm_proxy.h | 62 -- tdenetworkmanager/src/knetworkmanager-storage.cpp | 634 ------------------ tdenetworkmanager/src/knetworkmanager-storage.h | 101 --- tdenetworkmanager/src/knetworkmanager-tray.cpp | 719 +++++---------------- tdenetworkmanager/src/knetworkmanager-tray.h | 35 +- .../src/knetworkmanager-vpn_device.cpp | 75 --- tdenetworkmanager/src/knetworkmanager-vpn_device.h | 53 -- .../src/knetworkmanager-wired_device.cpp | 86 --- .../src/knetworkmanager-wired_device.h | 55 -- .../src/knetworkmanager-wired_device_tray.cpp | 4 +- .../src/knetworkmanager-wired_device_tray.h | 2 +- .../src/knetworkmanager-wireless_device.cpp | 207 ------ .../src/knetworkmanager-wireless_device.h | 70 -- .../src/knetworkmanager-wireless_device_tray.cpp | 48 +- .../src/knetworkmanager-wireless_device_tray.h | 22 +- .../src/knetworkmanager-wireless_network.h | 6 - tdenetworkmanager/src/knetworkmanager.cpp | 58 +- tdenetworkmanager/src/main.cpp | 7 +- tdenetworkmanager/src/secret_storage_plugin.cpp | 54 -- tdenetworkmanager/src/secret_storage_plugin.h | 53 -- .../knetworkmanager-connection_settings_dialog.cpp | 23 +- .../knetworkmanager-connection_settings_dialog.h | 21 +- tdenetworkmanager/src/traycomponent.h | 2 - 53 files changed, 376 insertions(+), 5166 deletions(-) delete mode 100644 tdenetworkmanager/src/knetworkmanager-accesspoint.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-accesspoint.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-cdma_device.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-cdma_device.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-cellular_device.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-cellular_device.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_dbus.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_dbus.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_secrets_dbus.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_secrets_dbus.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_store.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_store.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-device.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-device.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-devicestore.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-devicestore.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-gsm_device.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-gsm_device.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-hal_device_proxy.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-hal_device_proxy.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-nm_proxy.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-nm_proxy.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-storage.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-storage.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-vpn_device.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-vpn_device.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-wired_device.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-wired_device.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-wireless_device.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-wireless_device.h delete mode 100644 tdenetworkmanager/src/secret_storage_plugin.cpp delete mode 100644 tdenetworkmanager/src/secret_storage_plugin.h diff --git a/tdenetworkmanager/src/CMakeLists.txt b/tdenetworkmanager/src/CMakeLists.txt index cef1cd7..293cfcb 100644 --- a/tdenetworkmanager/src/CMakeLists.txt +++ b/tdenetworkmanager/src/CMakeLists.txt @@ -11,8 +11,8 @@ add_definitions( -UQT_NO_ASCII_CAST ) -add_subdirectory( settings ) -add_subdirectory( configwidgets ) +#add_subdirectory( settings ) +#add_subdirectory( configwidgets ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} @@ -50,26 +50,22 @@ tde_add_tdeinit_executable( knetworkmanager AUTOMOC SOURCES 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-vpn_plugin.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_dbus.cpp knetworkmanager-connection_secrets_dbus.cpp - knetworkmanager-connection.cpp knetworkmanager-generic_connection.cpp + knetworkmanager-wireless_menuitem.cpp knetworkmanager-menuitem.cpp + knetworkmanager-menu_subhead.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-nmsettings.cpp - sha1.cpp md5.cpp xmlmarshaller.cpp knetworkmanager-storage.cpp + knetworkmanager-nmsettings.cpp + sha1.cpp md5.cpp xmlmarshaller.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 + vpn_tray_component.cpp EMBED tdenetwork-connection-configwidgets-static tdenetwork-connection-settings-static LINK tdecore-shared tdeui-shared kutils-shared ${DBUS_TQT_LIBRARIES} ) diff --git a/tdenetworkmanager/src/devicetraycomponent.cpp b/tdenetworkmanager/src/devicetraycomponent.cpp index d42db60..d0a3f97 100644 --- a/tdenetworkmanager/src/devicetraycomponent.cpp +++ b/tdenetworkmanager/src/devicetraycomponent.cpp @@ -27,40 +27,79 @@ along with this program. If not, see . #include "knetworkmanager-device.h" #include "knetworkmanager-nm_proxy.h" +TQString pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { + TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = 0x80000000; + while (flag > 0) { + if (state & flag) { + if (m_pixmaps.contains(flag)) { + return m_pixmaps[flag]; + } + } + flag = flag >> 1; + } + return TQString::null; +} + +TQString movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { + TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = 0x80000000; + while (flag > 0) { + if (state & flag) { + if (m_movies.contains(flag)) { + return m_movies[flag]; + } + } + flag = flag >> 1; + } + return TQString::null; +} + +TQString tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { + TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = 0x80000000; + while (flag > 0) { + if (state & flag) { + if (m_tooltips.contains(flag)) { + return m_tooltips[flag]; + } + } + flag = flag >> 1; + } + return TQString::null; +} + 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"); + connect( m_device, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), TQT_SLOT(deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus))); + + m_pixmaps[TDENetworkConnectionStatus::Invalid] = "nm_no_connection"; + m_pixmaps[TDENetworkConnectionStatus::UnManaged] = "nm_no_connection"; + m_pixmaps[TDENetworkConnectionStatus::LinkUnavailable] = "nm_no_connection"; + m_pixmaps[TDENetworkConnectionStatus::Disconnected] = "nm_no_connection"; + m_pixmaps[TDENetworkConnectionStatus::Connected] = "ok"; + m_pixmaps[TDENetworkConnectionStatus::Failed] = "nm_no_connection"; + + m_movies[TDENetworkConnectionStatus::EstablishingLink] = "nm_stage01_connecting"; + m_movies[TDENetworkConnectionStatus::ConfiguringProtocols] = "nm_stage02_connecting"; + m_movies[TDENetworkConnectionStatus::VerifyingProtocols] = "nm_stage03_connecting"; + m_movies[TDENetworkConnectionStatus::NeedAuthorization] = m_movies[TDENetworkConnectionStatus::ConfiguringProtocols]; + + m_tooltips[TDENetworkConnectionStatus::Invalid] = i18n("Unknown"); + m_tooltips[TDENetworkConnectionStatus::LinkUnavailable] = i18n("Down"); + m_tooltips[TDENetworkConnectionStatus::UnManaged] = i18n("Unmanaged"); + m_tooltips[TDENetworkConnectionStatus::Disconnected] = i18n("Disconnected"); + m_tooltips[TDENetworkConnectionStatus::EstablishingLink] = i18n("Preparing"); + m_tooltips[TDENetworkConnectionStatus::ConfiguringProtocols] = i18n("Configuration"); + m_tooltips[TDENetworkConnectionStatus::NeedAuthorization] = i18n("Awaiting authentication"); + m_tooltips[TDENetworkConnectionStatus::VerifyingProtocols] = i18n("IP configuration"); + m_tooltips[TDENetworkConnectionStatus::Connected] = i18n("Activated"); + m_tooltips[TDENetworkConnectionStatus::Failed] = i18n("Failed"); } DeviceTrayComponent::~DeviceTrayComponent() { } -Device* DeviceTrayComponent::device() const +TDENetworkDevice* DeviceTrayComponent::device() const { return m_device; } @@ -68,62 +107,62 @@ Device* DeviceTrayComponent::device() const TQStringList DeviceTrayComponent::getToolTipText() { TQStringList list; - NMDeviceState state = m_device->getState(); - if (m_tooltips.contains(state)) { + TDENetworkConnectionStatus::TDENetworkConnectionStatus state = m_device->getState(); + if (tooltipForConnState(state) != "") { list.append(i18n("Device: %1").arg(m_device->getInterface())); - list.append(i18n("State: %1").arg(m_tooltips[state])); + list.append(i18n("State: %1").arg(tooltipForConnState(state))); } return list; } -TQPixmap DeviceTrayComponent::pixmapForState(NMDeviceState state) +TQPixmap DeviceTrayComponent::pixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { - if (m_pixmaps.contains(state)) { - return KSystemTray::loadIcon(m_pixmaps[state]); + if (pixmapForConnState(state) != "") { + return KSystemTray::loadIcon(pixmapForConnState(state)); } else { return TQPixmap(); } } -TQMovie DeviceTrayComponent::movieForState(NMDeviceState state) +TQMovie DeviceTrayComponent::movieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { - if (m_movies.contains(state)) { - return TQMovie( KGlobal::iconLoader()->moviePath(m_movies[state], KIcon::Panel)); + if (movieForConnState(state) != "") { + return TQMovie( KGlobal::iconLoader()->moviePath(movieForConnState(state), KIcon::Panel)); } else { return TQMovie(); } } -void DeviceTrayComponent::setMovieForState(NMDeviceState state, TQString movie) +void DeviceTrayComponent::setMovieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state, TQString movie) { m_movies[state] = movie; } -void DeviceTrayComponent::setPixmapForState(NMDeviceState state, TQString pixmap) +void DeviceTrayComponent::setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state, TQString pixmap) { m_pixmaps[state] = pixmap; } -void DeviceTrayComponent::deviceStateChanged(NMDeviceState state) +void DeviceTrayComponent::deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus 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: + case TDENetworkConnectionStatus::EstablishingLink: emit needsCenterStage(this, true); break; - case NM_DEVICE_STATE_ACTIVATED: + case TDENetworkConnectionStatus::Connected: 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: + case TDENetworkConnectionStatus::LinkUnavailable: + case TDENetworkConnectionStatus::Disconnected: + case TDENetworkConnectionStatus::Failed: emit needsCenterStage(this, false); break; default: diff --git a/tdenetworkmanager/src/devicetraycomponent.h b/tdenetworkmanager/src/devicetraycomponent.h index 729076f..e162020 100644 --- a/tdenetworkmanager/src/devicetraycomponent.h +++ b/tdenetworkmanager/src/devicetraycomponent.h @@ -21,16 +21,17 @@ along with this program. If not, see . #ifndef DEVICE_TRAY_COMPONENT_H #define DEVICE_TRAY_COMPONENT_H -#include - #include #include #include #include +#include +#include + #include "traycomponent.h" -class Device; +class TDENetworkDevice; class KPopupMenu; class KSystemTray; @@ -39,25 +40,25 @@ class DeviceTrayComponent : public TrayComponent Q_OBJECT public: - DeviceTrayComponent(Device * device, KSystemTray * parent, const char * name ); + DeviceTrayComponent(TDENetworkDevice * device, KSystemTray * parent, const char * name ); virtual ~DeviceTrayComponent(); - TQPixmap pixmapForState(NMDeviceState state); - TQMovie movieForState(NMDeviceState state); + TQPixmap pixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); + TQMovie movieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); virtual TQStringList getToolTipText(); - Device* device() const; + TDENetworkDevice* device() const; signals: void needsCenterStage(TrayComponent *, bool); public slots: virtual void newConnection() = 0; protected slots: - void deviceStateChanged(NMDeviceState); + void deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus); protected: - void setMovieForState(NMDeviceState, TQString); - void setPixmapForState(NMDeviceState, TQString); + void setMovieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString); + void setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString); private: - Device * m_device; - TQMap m_movies; - TQMap m_pixmaps; - TQMap m_tooltips; + TDENetworkDevice * m_device; + TQMap m_movies; + TQMap m_pixmaps; + TQMap m_tooltips; }; #endif // DEVICE_TRAY_COMPONENT_H diff --git a/tdenetworkmanager/src/knetworkmanager-accesspoint.cpp b/tdenetworkmanager/src/knetworkmanager-accesspoint.cpp deleted file mode 100644 index 0bd5528..0000000 --- a/tdenetworkmanager/src/knetworkmanager-accesspoint.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-accesspoint.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -// TQT_DBus includes -#include -#include -#include - -// NM includes -#include - -// 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 nmAccessPoint; - // DBus object path - TQString objPath; - - // Properties - TQ_UINT32 flags; - TQ_UINT32 wpaFlags; - TQ_UINT32 rsnFlags; - TQValueList 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 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 ssid = d->ssid; - TQByteArray ret_ssid(ssid.count()); - TQByteArray::Iterator byteit = ret_ssid.begin(); - for (TQValueList::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& 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&)), this, TQT_SLOT(slotPropertiesChanged(const TQMap&))); - - 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&)), this, TQT_SLOT(slotPropertiesChanged(const TQMap&))); - - 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&)), this, TQT_SLOT(slotPropertiesChanged(const TQMap&))); - - updateProperties(); -} -#endif -AccessPoint::~AccessPoint() -{ - delete d->nmAccessPoint; - delete d; -} - - -#include "knetworkmanager-accesspoint.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-accesspoint.h b/tdenetworkmanager/src/knetworkmanager-accesspoint.h deleted file mode 100644 index d9e7a60..0000000 --- a/tdenetworkmanager/src/knetworkmanager-accesspoint.h +++ /dev/null @@ -1,75 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-device.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * - * 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 - -class AccessPointPrivate; -namespace DBus -{ - class AccessPointProxy; -}; - -class AccessPoint : public TQObject -{ - Q_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 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& properties); - void updateProperties(); - - private: - - AccessPointPrivate * d; -}; - -#endif /* KNETWORKMANAGER_DEVICE_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-cdma_device.cpp b/tdenetworkmanager/src/knetworkmanager-cdma_device.cpp deleted file mode 100644 index 0aecade..0000000 --- a/tdenetworkmanager/src/knetworkmanager-cdma_device.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-cdma_device.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -// TQt includes -#include - -// TQT_DBus includes -#include -#include - -// NM includes -#include - -// 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/tdenetworkmanager/src/knetworkmanager-cdma_device.h b/tdenetworkmanager/src/knetworkmanager-cdma_device.h deleted file mode 100644 index 2de56d7..0000000 --- a/tdenetworkmanager/src/knetworkmanager-cdma_device.h +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-cdma_device.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-cellular_device.h" - -class KNetworkManager; - -class CDMADevicePrivate; - -class CDMADevice : public CellularDevice -{ - Q_OBJECT - - public: - CDMADevice (const TQString & obj_path ); - ~CDMADevice (); - - private: - CDMADevicePrivate * d; -}; - -#endif /* KNETWORKMANAGER_CDMADEVICE_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-cellular_device.cpp b/tdenetworkmanager/src/knetworkmanager-cellular_device.cpp deleted file mode 100644 index e74c590..0000000 --- a/tdenetworkmanager/src/knetworkmanager-cellular_device.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-cellular_device.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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/tdenetworkmanager/src/knetworkmanager-cellular_device.h b/tdenetworkmanager/src/knetworkmanager-cellular_device.h deleted file mode 100644 index d680490..0000000 --- a/tdenetworkmanager/src/knetworkmanager-cellular_device.h +++ /dev/null @@ -1,40 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-cellular_device.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 - - public: - CellularDevice (const TQString & obj_path ); - ~CellularDevice (); -}; - -#endif /* KNETWORKMANAGER_CELLULARDEVICE_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp b/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp index ea88749..49a3ab2 100644 --- a/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp +++ b/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp @@ -62,7 +62,7 @@ class CellularDeviceTrayPrivate CellularDeviceTrayPrivate() {} ~CellularDeviceTrayPrivate() {} - CellularDevice* dev; + TDENetworkDevice* dev; }; void CellularDeviceTray::newConnection() @@ -166,7 +166,7 @@ void CellularDeviceTray::addMenuItems(KPopupMenu* menu) menu->insertSeparator(); } -CellularDeviceTray::CellularDeviceTray (CellularDevice* dev, KSystemTray * parent, const char * name) +CellularDeviceTray::CellularDeviceTray (TDENetworkDevice* dev, KSystemTray * parent, const char * name) : DeviceTrayComponent (dev, parent, name) { d = new CellularDeviceTrayPrivate(); diff --git a/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.h b/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.h index 282cc3e..323a559 100644 --- a/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.h +++ b/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.h @@ -40,7 +40,7 @@ class CellularDeviceTray : public DeviceTrayComponent Q_OBJECT public: - CellularDeviceTray (CellularDevice*, KSystemTray * parent = 0, const char * name = 0); + CellularDeviceTray (TDENetworkDevice*, KSystemTray * parent = 0, const char * name = 0); ~CellularDeviceTray (); void addMenuItems(KPopupMenu* menu); diff --git a/tdenetworkmanager/src/knetworkmanager-connection.cpp b/tdenetworkmanager/src/knetworkmanager-connection.cpp deleted file mode 100644 index 2c6ea8b..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection.cpp +++ /dev/null @@ -1,296 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -/* kde headers */ -#include -#include - -/* TQDbus headers */ -#include -#include -#include -#include -#include - -/* 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 - -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 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::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::ConstIterator it = d->settings.begin(); it != d->settings.end(); ++it) - { - if ((*it)->getType() == type) - return (*it); - } - return NULL; -} - -TQValueList -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::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 settings = conn->getSettings(); - // copy all settings over to the new connection - for (TQValueList::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/tdenetworkmanager/src/knetworkmanager-connection.h b/tdenetworkmanager/src/knetworkmanager-connection.h deleted file mode 100644 index 695408c..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection.h +++ /dev/null @@ -1,131 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -#include "knetworkmanager-connection_setting.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 ConnectionMap; - - // a connection wraps multiple settings - class Connection : public TQObject, DBus::ConnectionNode - { - Q_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 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/tdenetworkmanager/src/knetworkmanager-connection_dbus.cpp b/tdenetworkmanager/src/knetworkmanager-connection_dbus.cpp deleted file mode 100644 index ecca0f5..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_dbus.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -/* kde headers */ -#include -#include - -/* TQDbus headers */ -#include -#include -#include -#include -#include -#include - -/* NM headers */ -#include - -/* 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& settings, TQT_DBusError& /*error*/) -{ - kdDebug() << "Connection::GetSettings, obj: " << objectPath().ascii() << endl; - - TQValueList all_settings = d->parent->getSettings(); - - // FIXME: ugly conversions, ask Kevin on how to make it better - for (TQValueList::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 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 variant_map; - - for (TQMap::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 map2 = TQT_DBusDataMap(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& 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 settings; - TQT_DBusError error; - if (GetSettings(settings, error)) - emitUpdated(settings); -} - -#include "knetworkmanager-connection_dbus.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-connection_dbus.h b/tdenetworkmanager/src/knetworkmanager-connection_dbus.h deleted file mode 100644 index f7bdc00..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_dbus.h +++ /dev/null @@ -1,77 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include - -#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 - - 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& settings, TQT_DBusError& error); - bool Update(const TQT_DBusDataMap& 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/tdenetworkmanager/src/knetworkmanager-connection_editor.cpp b/tdenetworkmanager/src/knetworkmanager-connection_editor.cpp index e787a79..a80f014 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_editor.cpp +++ b/tdenetworkmanager/src/knetworkmanager-connection_editor.cpp @@ -50,7 +50,6 @@ #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" @@ -63,7 +62,7 @@ class ConnectionListViewItem : public KListViewItem { public: - ConnectionListViewItem(TQListView* parent, GenericConnection* connection) + ConnectionListViewItem(TQListView* parent, TDENetworkConnection* connection) : KListViewItem(parent) , _conn(connection) { @@ -84,7 +83,7 @@ class ConnectionListViewItem : public KListViewItem } } - GenericConnection* _conn; + TDENetworkConnection* _conn; }; /* @@ -161,10 +160,10 @@ void ConnectionEditorImpl::slotNewVPNConnection() /* * */ -void ConnectionEditorImpl::slotEditNewConnection(Connection* conn) +void ConnectionEditorImpl::slotEditNewConnection(TDENetworkConnection* conn) { // open a dialog for editing the connection - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, this, "connect_something", false, TQt::WDestructiveClose); + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, this, "connect_something", false, TQt::WDestructiveClose); connect(dlg, TQT_SIGNAL(connectionSaved()), this, TQT_SLOT(slotRefershConnectionList())); dlg->show(); } @@ -183,7 +182,7 @@ void ConnectionEditorImpl::slotEditCurrentConnection() if (!item) return; - Connection* conn = item->_conn; + TDENetworkConnection* conn = item->_conn; Storage* storage = Storage::getInstance(); bool hasSecretsStored = storage->hasSecretsStored(conn); @@ -191,7 +190,7 @@ void ConnectionEditorImpl::slotEditCurrentConnection() if (hasSecretsStored) storage->restoreAllSecrets(conn); - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, false, NULL, this, "connect_something", false, TQt::WDestructiveClose); + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, false, this, "connect_something", false, TQt::WDestructiveClose); dlg->show(); // save all connections (if not done already) @@ -209,7 +208,7 @@ void ConnectionEditorImpl::slotRemoveCurrentConnection() return; ConnectionStore* cstore = ConnectionStore::getInstance(); - Connection* conn = item->_conn; + TDENetworkConnection* conn = item->_conn; lvConnections->takeItem(item); delete item; @@ -223,14 +222,14 @@ void ConnectionEditorImpl::slotRemoveCurrentConnection() void ConnectionEditorImpl::fillConnectionList() { ConnectionStore* cstore = ConnectionStore::getInstance(); - TQValueList conns = cstore->getConnections(); - TQValueList::Iterator it = conns.begin(); + TQValueList conns = cstore->getConnections(); + TQValueList::Iterator it = conns.begin(); lvConnections->clear(); for (; it != conns.end(); ++it) { - GenericConnection* conn = dynamic_cast(*it); + TDENetworkConnection* conn = *it; if (conn) { Info* info = conn->getInfoSetting(); diff --git a/tdenetworkmanager/src/knetworkmanager-connection_editor.h b/tdenetworkmanager/src/knetworkmanager-connection_editor.h index a0a7567..e853787 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_editor.h +++ b/tdenetworkmanager/src/knetworkmanager-connection_editor.h @@ -56,7 +56,7 @@ class ConnectionEditorImpl : public ConnectionEditor void slotEditCurrentConnection(); void slotNewWirelessConnection(); void slotNewWiredConnection(); - void slotEditNewConnection(Connection* conn); + void slotEditNewConnection(TDENetworkConnection* conn); void slotRefershConnectionList(); void slotNewVPNConnection(); diff --git a/tdenetworkmanager/src/knetworkmanager-connection_secrets_dbus.cpp b/tdenetworkmanager/src/knetworkmanager-connection_secrets_dbus.cpp deleted file mode 100644 index aa64666..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_secrets_dbus.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include - -/* kde headers */ -#include -#include - -/* TQDbus headers */ -#include -#include -#include -#include -#include -#include -#include -#include - -/* NM headers */ -#include - -/* 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 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 secrets(map); - - TQMap secrets; - for (TQMap::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 settings; - TQValueList all_settings = d->parent->getSettings(); - - // FIXME: ugly conversions, ask Kevin on how to make it better - for (TQValueList::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 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 variant_map; - - for (TQMap::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 map2 = TQT_DBusDataMap(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/tdenetworkmanager/src/knetworkmanager-connection_secrets_dbus.h b/tdenetworkmanager/src/knetworkmanager-connection_secrets_dbus.h deleted file mode 100644 index 78a6303..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_secrets_dbus.h +++ /dev/null @@ -1,76 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include - -#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 - - 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/tdenetworkmanager/src/knetworkmanager-connection_store.cpp b/tdenetworkmanager/src/knetworkmanager-connection_store.cpp deleted file mode 100644 index aeb3b60..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_store.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_store.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include - -#include -#include -#include - -#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 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::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::Iterator it = _connectionList.begin(); - for (; it != _connectionList.end(); ++it) - if (TQString((*it)->getObjectPath()) == obj_path) - return (*it); - return NULL; -} - -TQValueList -ConnectionStore::getConnections(const TQString& type) -{ - // return a list of connection - if (type.isEmpty()) - return _connectionList; - else - { - TQValueList ret; - for (TQValueList::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::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/tdenetworkmanager/src/knetworkmanager-connection_store.h b/tdenetworkmanager/src/knetworkmanager-connection_store.h deleted file mode 100644 index a399270..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_store.h +++ /dev/null @@ -1,88 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_store.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -namespace ConnectionSettings -{ - class Connection; - class ConnectionSetting; -} - -using namespace ConnectionSettings; - -class ConnectionStore : public TQObject -{ - Q_OBJECT - - - public: - static ConnectionStore* getInstance(); - ~ConnectionStore(); - - // add a new connection to the store - void addConnection(ConnectionSettings::Connection*); - - // get all connections - TQValueList 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 _connectionList; - static ConnectionStore* _instance; -}; - -#endif /* KNETWORKMANAGER_CONNECTION_STORE_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-device.cpp b/tdenetworkmanager/src/knetworkmanager-device.cpp deleted file mode 100644 index 585ce8d..0000000 --- a/tdenetworkmanager/src/knetworkmanager-device.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-device.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * - * 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 - -#include "knetworkmanager.h" -#include "knetworkmanager-nm_proxy.h" -#include "knetworkmanager-device.h" -#include "dbus/deviceproxy.h" -#include "knetworkmanager-hal_device_proxy.h" - - -#include -#include - -#include -#include -#include - - -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/tdenetworkmanager/src/knetworkmanager-device.h b/tdenetworkmanager/src/knetworkmanager-device.h deleted file mode 100644 index bd6e863..0000000 --- a/tdenetworkmanager/src/knetworkmanager-device.h +++ /dev/null @@ -1,72 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-device.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * - * 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 "knetworkmanager.h" - -#include - -class KNetworkManager; -class Network; -class IP4Config; - -class DevicePrivate; - -class Device : public TQObject -{ - Q_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/tdenetworkmanager/src/knetworkmanager-devicestore.cpp b/tdenetworkmanager/src/knetworkmanager-devicestore.cpp deleted file mode 100644 index 6f217c1..0000000 --- a/tdenetworkmanager/src/knetworkmanager-devicestore.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -#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 -#include -#include - -#include - -#if !defined(NM_CHECK_VERSION) -#define NM_CHECK_VERSION(x,y,z) 0 -#endif - -class DeviceStorePrivate -{ - public: - DeviceStorePrivate() {} - ~DeviceStorePrivate() {} - - TQMap 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::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::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 obj_paths; - TQT_DBusError err; - - // get a list of NM devices - nm->GetDevices(obj_paths, err); - - // create a list of KNM devices - for (TQValueList::Iterator it = obj_paths.begin(); it != obj_paths.end(); ++it) - { - createDevice((*it)); - } -} - -TQValueList DeviceStore::getDevices(TQ_UINT32 type) -{ - updateDevices(); - - if (type == 0) - return d->devices.values(); - else - { - // only return devices of a special type - TQValueList devs; - for (TQMap::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/tdenetworkmanager/src/knetworkmanager-devicestore.h b/tdenetworkmanager/src/knetworkmanager-devicestore.h deleted file mode 100644 index caf8428..0000000 --- a/tdenetworkmanager/src/knetworkmanager-devicestore.h +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * - * 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 - - - public: - static DeviceStore* getInstance(); - TQValueList 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/tdenetworkmanager/src/knetworkmanager-gsm_device.cpp b/tdenetworkmanager/src/knetworkmanager-gsm_device.cpp deleted file mode 100644 index e978b49..0000000 --- a/tdenetworkmanager/src/knetworkmanager-gsm_device.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-gsm_device.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -// TQt includes -#include - -// TQT_DBus includes -#include -#include - -// NM includes -#include - -// 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/tdenetworkmanager/src/knetworkmanager-gsm_device.h b/tdenetworkmanager/src/knetworkmanager-gsm_device.h deleted file mode 100644 index 6149890..0000000 --- a/tdenetworkmanager/src/knetworkmanager-gsm_device.h +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-gsm_device.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-cellular_device.h" - -class KNetworkManager; - -class GSMDevicePrivate; - -class GSMDevice : public CellularDevice -{ - Q_OBJECT - - public: - GSMDevice (const TQString & obj_path ); - ~GSMDevice (); - - private: - GSMDevicePrivate * d; -}; - -#endif /* KNETWORKMANAGER_GSMDEVICE_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-hal_device_proxy.cpp b/tdenetworkmanager/src/knetworkmanager-hal_device_proxy.cpp deleted file mode 100644 index dda50aa..0000000 --- a/tdenetworkmanager/src/knetworkmanager-hal_device_proxy.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-device.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * - * 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 -#include - -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/tdenetworkmanager/src/knetworkmanager-hal_device_proxy.h b/tdenetworkmanager/src/knetworkmanager-hal_device_proxy.h deleted file mode 100644 index 663301e..0000000 --- a/tdenetworkmanager/src/knetworkmanager-hal_device_proxy.h +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-device.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * - * 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 - -// std includes -#include - -class KNetworkManager; - -enum bustype { - BUS_PCI = 0, - BUS_USB = 1, - BUS_PCMCIA = 2, - BUS_UNKNOWN = 15 -}; - -class HalDeviceProxyPrivate; - -class HalDeviceProxy : public TQObject -{ - Q_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/tdenetworkmanager/src/knetworkmanager-nm_proxy.cpp b/tdenetworkmanager/src/knetworkmanager-nm_proxy.cpp deleted file mode 100644 index 3cfe642..0000000 --- a/tdenetworkmanager/src/knetworkmanager-nm_proxy.cpp +++ /dev/null @@ -1,329 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-device.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * - * 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 - -// TQtDBus includes -#include -#include -#include -#include -#include -#include - -// NM includes -#include - -// 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 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 connections; - - // get a list of all active connections from NM - connections = NetworkManagerProxy::getActiveConnections(err); - - for (TQValueList::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 connections; - - // get a list of all active connections from NM - connections = NetworkManagerProxy::getActiveConnections(err); - - for (TQValueList::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 devs = act_conn->getDevices(err); - for (TQValueList::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 > NMProxy::getActiveConnectionsMap() -{ - TQT_DBusError err; - TQValueList connections; - TQValueList > 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::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 devs = act_conn->getDevices(err); - found = false; - for (TQValueList::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(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(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 connections; - - // get a list of all active connections from NM - connections = NetworkManagerProxy::getActiveConnections(err); - - for (TQValueList::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 devs = act_conn->getDevices(err); - for (TQValueList::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 connections; - - // get a list of all active connections from NM - connections = NetworkManagerProxy::getActiveConnections(err); - - for (TQValueList::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 devs = act_conn->getDevices(err); - for (TQValueList::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 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/tdenetworkmanager/src/knetworkmanager-nm_proxy.h b/tdenetworkmanager/src/knetworkmanager-nm_proxy.h deleted file mode 100644 index 05ade99..0000000 --- a/tdenetworkmanager/src/knetworkmanager-nm_proxy.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-nm_proxy.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - - 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 > getActiveConnectionsMap(); - bool isNMRunning(); - - protected: - NMProxy (); - ~NMProxy (); - - private: - NMProxyPrivate * d; -}; - -#endif /* KNETWORKMANAGER_NMPROXY_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-storage.cpp b/tdenetworkmanager/src/knetworkmanager-storage.cpp deleted file mode 100644 index b4ce93b..0000000 --- a/tdenetworkmanager/src/knetworkmanager-storage.cpp +++ /dev/null @@ -1,634 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-storage.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * Author: Timothy Pearson - * - * 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 - -#include -#include -#include -#include - -#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 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 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::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 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::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 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::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 connections = store->getConnections(); - - for (TQValueList::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").arg(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 settings = conn->getSettings(); - TQString setting_grp; - TQString secrets_grp; - - // save all settings - for (TQValueList::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").arg(id).arg(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").arg(it.key()) << " = " << XMLMarshaller::fromTQT_DBusData( it.data() )<< endl; - grp.writeEntry(TQString("Value_%1").arg(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").arg(id).arg(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").arg(it.key()) << " = " << XMLMarshaller::fromTQT_DBusData( it.data() )<< endl; - if (storage_requested == true) { - grp.writeEntry(TQString("Value_%1").arg(it.key()), XMLMarshaller::fromTQT_DBusData( it.data() )); - } - else { - grp.writeEntry(TQString("Value_%1").arg(it.key()), TQString("") ); - } - } - return true; -} - -bool -Storage::hasSecretsStored(Connection* connection) -{ - TQString id = connection->getID(); - - // ID is necessary - if (id.isEmpty()) - return false; - - TQValueList settings = connection->getSettings(); - for (TQValueList::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").arg(id).arg(type); - - TQMap 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 settings = connection->getSettings(); - for (TQValueList::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").arg(id).arg(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").arg(id).arg(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").arg(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/tdenetworkmanager/src/knetworkmanager-storage.h b/tdenetworkmanager/src/knetworkmanager-storage.h deleted file mode 100644 index 33682ea..0000000 --- a/tdenetworkmanager/src/knetworkmanager-storage.h +++ /dev/null @@ -1,101 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-storage.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -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 - - - 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/tdenetworkmanager/src/knetworkmanager-tray.cpp b/tdenetworkmanager/src/knetworkmanager-tray.cpp index 62851ff..7a818cc 100644 --- a/tdenetworkmanager/src/knetworkmanager-tray.cpp +++ b/tdenetworkmanager/src/knetworkmanager-tray.cpp @@ -27,8 +27,6 @@ * **************************************************************************/ -class WirelessDialog; - #include #include #include @@ -40,7 +38,6 @@ class WirelessDialog; #include #include #include -#include #include #include #include @@ -59,48 +56,22 @@ class WirelessDialog; #include #include -#include -#include - -#include - -#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-menu_subhead.h" + #include "knetworkmanager-wired_device_tray.h" #include "knetworkmanager-wireless_device_tray.h" -#include "knetworkmanager-wireless_device.h" +#include "knetworkmanager-cellular_device_tray.h" #include -#define KDED_NETWORK_NAME "NMNetwork" - -#if !defined(NM_CHECK_VERSION) -#define NM_CHECK_VERSION(x,y,z) 0 -#endif +TDENetworkConnectionStatus::TDENetworkConnectionStatus nm_device_state_global; -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) +NewSecretsDialog::NewSecretsDialog(TDENetworkConnection *connection, TQWidget * parent, const char * name, bool modal, TQt::WFlags f) : TQDialog(parent, name, modal, f) { _connection = connection; @@ -114,20 +85,19 @@ NewSecretsDialog::~NewSecretsDialog () void NewSecretsDialog::slotDialogEdit() { - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(_connection, false, NULL, Tray::getInstance(), "Edit connection"); + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(_connection, false, Tray::getInstance(), "Edit connection"); dlg->show(); close(); } void NewSecretsDialog::reject() { - _connection->slotSecretsError(); TQDialog::reject(); } void NewSecretsDialog::init() { - ConnectionSettings::GenericConnection* conn = dynamic_cast(_connection); + TDENetworkConnection* conn = _connection; // if we do not have a connection bail out if (!conn) @@ -139,7 +109,7 @@ void NewSecretsDialog::init() // 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 ").arg(conn->getInfoSetting()->getName()), this); + TQLabel* label = new TQLabel(tqtr(" The connection %1 could not be established ").arg(conn->friendlyName), this); TQPushButton* buttonEdit = new TQPushButton(tr("&Edit"), this); TQPushButton* buttonCancel = new TQPushButton(tr("&Cancel"), this); @@ -171,7 +141,7 @@ class TrayPrivate TQValueList trayComponents; DeviceTrayComponent * foregroundTrayComponent; TQSignalMapper signalMapper; - TQMap > act_conn_map; + TQMap act_conn_map; int current_idx; }; @@ -193,69 +163,44 @@ void Tray::slotEditConnections() void Tray::slotEnableWireless() { - NMProxy* nm = NMProxy::getInstance(); - TQT_DBusError err; + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); if (!nm) return; - - nm->setWirelessEnabled(true, err); + nm->enableWiFi(true); } void Tray::slotDisableWireless() { - NMProxy* nm = NMProxy::getInstance(); - TQT_DBusError err; + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); if (!nm) return; - - nm->setWirelessEnabled(false, err); + nm->enableWiFi(false); } void Tray::slotOfflineMode() { - NMProxy* nm = NMProxy::getInstance(); - TQT_DBusError err; + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); if (!nm) return; - - nm->Sleep(true, err); + nm->enableNetworking(false); } void Tray::slotOnlineMode() { - NMProxy* nm = NMProxy::getInstance(); - TQT_DBusError err; + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); 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(); + nm->enableNetworking(true); } void Tray::contextMenuAboutToShow (KPopupMenu* menu) { - TQT_DBusError err; - NMProxy* nm = NMProxy::getInstance(); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); // clear menu menu->clear(); - if (nm->isNMRunning()) - { - - // actions for each Device - for (TQValueList::Iterator it = d->trayComponents.begin(); - it != d->trayComponents.end(); - ++it) - { - (*it)->addMenuItems(menu); - } + if (!(nm->backendStatus() & TDENetworkGlobalManagerFlags::BackendUnavailable)) { + // actions for each Device + for (TQValueList::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)); @@ -269,16 +214,12 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu) KActionMenu* newConnActionMenu = static_cast(newConnAction); newConnActionMenu->popupMenu()->clear(); TQValueList::Iterator it; - for (it = d->trayComponents.begin(); - it != d->trayComponents.end(); - ++it) - { + for (it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) { DeviceTrayComponent* dev_comp = dynamic_cast (*it); KAction * deviceNewConnAction = 0; - if (dev_comp) - { - TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->getInterface()); - TQString menuCaption = TQString("%1").arg(dev_comp->device()->getInterface()); + if (dev_comp) { + TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->deviceNode()); + TQString menuCaption = TQString("%1").arg(dev_comp->device()->deviceNode()); if (menuCaption.contains("eth", FALSE) > 0) { menuCaption = menuCaption.insert(0, "Wired Connection ("); } @@ -299,14 +240,8 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu) newConnActionMenu->insert(deviceNewConnAction); } } - // New VPN connection option - ++it; - KAction * deviceNewConnAction = 0; - TQString menuCaption = "VPN Connection"; - TQString actionName = TQString("new_connection_%1").arg("vpn"); - deviceNewConnAction = new KAction (menuCaption, 0, TQT_TQOBJECT(this), TQT_SLOT(slotNewVPNConnection()), actionCollection(), actionName); - newConnActionMenu->insert(deviceNewConnAction); - } else if ( devices == 1 ) { + } + 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())); @@ -315,42 +250,42 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu) newConnAction->plug(menu); } - // turn things off - if (nm) - { + // turn things off + if (nm) { KActionMenu* disableStuffActionMenu = static_cast(actionCollection ()->action ("deactivate_menu") ); disableStuffActionMenu->popupMenu()->clear(); - TQValueList > map = nm->getActiveConnectionsMap(); + TDENetworkConnectionList* map = nm->connections(); d->act_conn_map.clear(); - for (TQValueList >::Iterator it = map.begin(); it != map.end(); ++it) - { - ConnectionSettings::GenericConnection* conn = dynamic_cast((*it).first); - Device* dev = (*it).second; + for (TDENetworkConnectionList::Iterator it = map->begin(); it != map->end(); ++it) { + TDENetworkConnection* conn = (*it); - if (!conn) + if (!conn) { continue; + } - TQString actionName = TQString("disable_connection_%1_%2").arg(conn->getID()).arg(dev ? dev->getInterface() : ""); + if ((nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Disconnected) + || (nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Invalid)) { + continue; + } + + TQString actionName = TQString("disable_connection_%1").arg(conn->UUID); KAction * deviceNewConnAction = actionCollection ()->action (actionName); - TQString actionText = conn->getInfoSetting()->getName(); - if (dev) - actionText += TQString(" (%1)").arg(dev->getInterface()); + TQString actionText = conn->friendlyName; 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 (conn, dev)); + d->act_conn_map.insert(d->current_idx, conn); d->current_idx++; disableStuffActionMenu->insert(deviceNewConnAction); } // disable wireless - if (nm->getWirelessHardwareEnabled(err)) - { + if (nm->wiFiHardwareEnabled()) { KAction* wireless = NULL; - if (nm->getWirelessEnabled(err)) { + if (nm->wiFiEnabled()) { wireless = actionCollection ()->action ("disable_wireless"); } else { wireless = actionCollection ()->action ("enable_wireless"); @@ -360,7 +295,7 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu) // offline vs. online mode KAction* switch_mode = NULL; - if (nm->getState(err) != NM_STATE_ASLEEP) { + if (nm->backendStatus() != TDENetworkGlobalManagerFlags::Sleeping) { switch_mode = actionCollection ()->action ("offline_mode"); } else { @@ -371,8 +306,7 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu) disableStuffActionMenu->plug(menu); } } - else - { + else { Subhead* subhead = new Subhead (menu, "subhead", i18n("NetworkManager is not running"), SmallIcon("stop", TQIconSet::Automatic)); menu->insertItem (subhead, -1, -1); } @@ -388,28 +322,28 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu) // quit menu->insertSeparator (); KAction* quitAction = actionCollection ()->action (KStdAction::name (KStdAction::Quit)); - if (quitAction) + if (quitAction) { quitAction->plug (menu); + } } - void -Tray::slotStateChanged(TQ_UINT32 state) +Tray::slotStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState) { - NMState nm_state = (NMState) state; + TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags nm_state = newState; // 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; + + if ((nm_state & TDENetworkGlobalManagerFlags::Unknown) + || (nm_state & TDENetworkGlobalManagerFlags::Sleeping) + || (nm_state & TDENetworkGlobalManagerFlags::EstablishingLink) + || (nm_state & TDENetworkGlobalManagerFlags::Disconnected) + || (nm_state & TDENetworkGlobalManagerFlags::BackendUnavailable)) { + setPixmap (loadIcon ("knetworkmanager_disabled")); } + else if (nm_state & TDENetworkGlobalManagerFlags::Connected) { + setPixmap (loadIcon ("knetworkmanager")); + } + printf("NM state: %d\n\r", nm_state); } @@ -435,186 +369,19 @@ Tray::enterEvent (TQEvent* /*e*/) } void -Tray::slotVPNSecretsNeeded(ConnectionSettings::Connection* connection, ConnectionSettings::ConnectionSetting* setting, const TQStringList& hints, bool request_new) +Tray::slotSecretsNeeded(TDENetworkConnection* connection, 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(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").arg(id).arg(type); - - // Restore the settings - printf("Restoring VPN secret: %s\n\r", setting_grp.ascii()); - - KConfigGroup secrets_grp(KGlobal::config(), setting_grp); - TQMap 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 map; - for(TQMap::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 stuff - xmldata.replace("", ""); - xmldata.replace("", ""); - //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(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(connection); - VPNAuthenticationDialog* auth = new VPNAuthenticationDialog(conn, this, "vpnauth"); - // Prefill the password dialog with cached credentials - TQString passdata; - for(TQMap::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(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(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(); - } + // For now assume secrets are already in NM... } -void Tray::slotAddDeviceTrayComponent(Device* dev) +void Tray::slotAddDeviceTrayComponent(TDENetworkDevice* dev) { - if (dev) + if (dev) { createDeviceTrayComponent(dev); + } } -void Tray::slotRemoveDeviceTrayComponent(Device* dev) +void Tray::slotRemoveDeviceTrayComponent(TDENetworkDevice* dev) { for (TQValueList::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) { @@ -629,7 +396,7 @@ void Tray::slotRemoveDeviceTrayComponent(Device* dev) } // remove the appropriate action - TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->getInterface()); + TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->deviceNode()); KAction * deviceNewConnAction = actionCollection ()->action (actionName); if (!deviceNewConnAction) @@ -650,7 +417,7 @@ void Tray::slotRemoveDeviceTrayComponent(Device* dev) } } -void Tray::createDeviceTrayComponent(Device* dev) +void Tray::createDeviceTrayComponent(TDENetworkDevice* dev) { bool trayExists = false; @@ -672,33 +439,21 @@ void Tray::createDeviceTrayComponent(Device* dev) if (!trayExists) { DeviceTrayComponent* devTray = 0; + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); // different tray icons for different device types! - switch (dev->getDeviceType()) + switch (deviceConnMan->deviceType()) { -#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(dev), this, "wired_device_tray"); + case TDENetworkDeviceType::WiredEthernet: + devTray = new WiredDeviceTray(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(dev), this, "wireless_device_tray"); + case TDENetworkDeviceType::WiFi: + devTray = new WirelessDeviceTray(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(dev), this, "cellular_device_tray"); + case TDENetworkDeviceType::Modem: + devTray = new CellularDeviceTray(dev, this, "cellular_device_tray"); break; default: - kdWarning() << k_funcinfo << "UDI: " << dev->getUdi() << " has unknown devicetype: " << dev->getDeviceType() << endl; + kdWarning() << k_funcinfo << "UDI: " << dev->uniqueID() << " has unknown devicetype: " << deviceConnMan->deviceType() << endl; } if(devTray) { @@ -711,51 +466,25 @@ void Tray::createDeviceTrayComponent(Device* dev) } } -void Tray::createVPNTrayComponent() -{ - bool trayExists = false; - - // check if we have already a trayicon for this device - for (TQValueList::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) - { - VPNTrayComponent* vpn_comp = dynamic_cast (*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 devices = store->getDevices(); + TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); + if (!hwdevices) return; + + // create one tray-icon for each device + TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network); // check for newly added devices - for (TQValueList::iterator it = devices.begin(); it != devices.end(); ++it) + for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) { - Device* dev = (*it); - if (dev) + TDENetworkDevice* dev = dynamic_cast(*it); + if (dev) { createDeviceTrayComponent(dev); - else + } + 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 ) @@ -776,13 +505,12 @@ void Tray::mousePressEvent( TQMouseEvent *e ) 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(); + TDENetworkConnection* conn = d->act_conn_map[index]; + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (!nm) return; if (conn) { - TQString actionText = conn->getObjectPath().data(); - nm->deactivateConnection(conn, dev); + nm->deactivateConnection(conn->UUID); } } @@ -790,8 +518,8 @@ void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt) { DeviceTrayComponent * dtc = dynamic_cast(component); if (dtc) { - kdDebug() << k_funcinfo << dtc->device()->getInterface() << " : " << needsIt << endl; - Device * device = dtc->device(); + kdDebug() << k_funcinfo << dtc->device()->deviceNode() << " : " << needsIt << endl; + TDENetworkDevice * device = dtc->device(); if (needsIt) { if (d->foregroundTrayComponent) { disconnect(d->foregroundTrayComponent->device(), TQT_SIGNAL(StateChanged(NMDeviceState)), this, 0 ); @@ -801,8 +529,11 @@ void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt) TQT_SLOT(slotUpdateDeviceState(NMDeviceState))); } else { disconnect(device, TQT_SIGNAL(StateChanged(NMDeviceState)), this, 0 ); - //use active default - NMProxy* nm = NMProxy::getInstance(); + // use active default +#if 0 + // FIXME + // The TDE network backend has no concept of a default device + // Should it? device = nm->getDefaultDevice(); if ( device ) { // identify the new foreground @@ -814,11 +545,12 @@ void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt) break; } } - kdDebug() << " Device " << dtc->device()->getInterface() << " background, new foreground device: " << device->getInterface() << endl; + kdDebug() << " Device " << dtc->device()->deviceNode() << " background, new foreground device: " << device->deviceNode() << endl; connect(device, TQT_SIGNAL(StateChanged(NMDeviceState)), TQT_SLOT(slotUpdateDeviceState(NMDeviceState))); slotUpdateDeviceState(device->getState()); } +#endif } } } @@ -828,7 +560,7 @@ void Tray::slotUpdateDeviceState() // FIXME } -void Tray::slotUpdateDeviceState(NMDeviceState state) +void Tray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { updateTrayIcon(state); updateActiveConnection(state); @@ -838,59 +570,31 @@ void Tray::trayUiChanged() { DeviceTrayComponent * dtc = d->foregroundTrayComponent; if (dtc) { - updateTrayIcon(dtc->device()->getState()); + TDENetworkConnectionManager* deviceConnMan = dtc->device()->connectionManager(); + updateTrayIcon(deviceConnMan->deviceInformation().statusFlags); } } -void Tray::updateTrayIcon(NMDeviceState state) +void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { // Get all active connections - char active_vpn=0; char found_any_active_connection=0; - ConnectionStore* connectionStore = ConnectionStore::getInstance(); - NMProxy* nm = NMProxy::getInstance(); - TQValueList > map = nm->getActiveConnectionsMap(); - - // get all available VPN Connections - TQValueList connections = connectionStore->getConnections(NM_SETTING_VPN_SETTING_NAME); - if (!connections.empty()) - { - for (TQValueList::iterator it = connections.begin(); it != connections.end(); ++it) - { - VPNConnection* vpnconn = dynamic_cast(*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 >::Iterator it = map.begin(); it != map.end(); ++it) - { - ConnectionSettings::GenericConnection* conn = dynamic_cast((*it).first); - - if (conn) { - if (strcmp(info->getName(), conn->getInfoSetting()->getName()) == 0) { - active_vpn = 1; - } - } - } - } - } - } - } + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); found_any_active_connection = 0; // Get all active connections - TQValueList > allconnmap = nm->getActiveConnectionsMap(); - for (TQValueList >::Iterator it = allconnmap.begin(); it != allconnmap.end(); ++it) - { - ConnectionSettings::GenericConnection* conn = dynamic_cast((*it).first); + TDENetworkConnectionList* allconmap = nm->connections(); + for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) { + TDENetworkConnection* conn = (*it); - if (!conn) + if (!conn) { continue; + } + + if ((nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Disconnected) + || (nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Invalid)) { + continue; + } // Found an active connection found_any_active_connection = 1; @@ -900,142 +604,82 @@ void Tray::updateTrayIcon(NMDeviceState state) // 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; - } + // stop the old movie to avoid unnecessary wakups + DeviceTrayComponent * dtc = d->foregroundTrayComponent; - 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")); + 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 { + else if (!dtc->pixmapForState(state).isNull()) + setPixmap(dtc->pixmapForState(state)); + 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(); - } - } + setPixmap(loadIcon("knetworkmanager")); } nm_device_state_global = state; //printf("Device state: %d\n\r", nm_device_state_global); } -void Tray::updateActiveConnection(NMDeviceState state) +void Tray::updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { - if (state != NM_DEVICE_STATE_ACTIVATED) + if (state != TDENetworkConnectionStatus::Connected) { return; - - NMProxy* nm = NMProxy::getInstance(); - if (d->foregroundTrayComponent) { - Connection* active_conn = nm->getActiveConnection(d->foregroundTrayComponent->device()); - if (active_conn) - { - Info* info = dynamic_cast(active_conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME)); - if (info) - info->setTimestamp(TQDateTime::currentDateTime()); - } } } -void Tray::slotDeviceAddedNotify(Device* dev) +void Tray::slotDeviceAddedNotify(TDENetworkDevice* dev) { kdDebug() << "Tray::slotDeviceAddedNotify" << endl; - KNotifyClient::event( winId(), "knm-nm-device-added", i18n("New network device %1 found").arg(dev->getInterface()) ); + KNotifyClient::event( winId(), "knm-nm-device-added", i18n("New network device %1 found").arg(dev->deviceNode()) ); } -void Tray::slotDeviceRemovedNotify(Device* dev) +void Tray::slotDeviceRemovedNotify(TDENetworkDevice* dev) { kdDebug() << "Tray::slotDeviceRemovedNotify" << endl; - KNotifyClient::event( winId(), "knm-nm-device-removed", i18n("Network device %1 removed").arg(dev->getInterface()) ); + KNotifyClient::event( winId(), "knm-nm-device-removed", i18n("Network device %1 removed").arg(dev->deviceNode()) ); } -void Tray::slotVPNBannerShow(const TQString& vpnbanner) +void Tray::slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState) { - printf("VPN banner: %s\n\r", vpnbanner.ascii()); - KNotifyClient::event(winId(), "knm-nm-vpn-banner", vpnbanner); -} + TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags nm_state = newState; -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; + if (nm_state & TDENetworkGlobalManagerFlags::EstablishingLink) { + KNotifyClient::event( winId(), "knm-nm-connecting", i18n("NetworkManager is connecting") ); + } + else if (nm_state & TDENetworkGlobalManagerFlags::Disconnected) { + KNotifyClient::event( winId(), "knm-nm-disconnected", i18n("NetworkManager is now disconnected") ); + } + else if (nm_state & TDENetworkGlobalManagerFlags::Connected) { + KNotifyClient::event( winId(), "knm-nm-connected", i18n("NetworkManager is now connected") ); + } + else if (nm_state & TDENetworkGlobalManagerFlags::Sleeping) { + KNotifyClient::event( winId(), "knm-nm-sleeping", i18n("KNetworkManager Offline") ); + } + else if (nm_state & TDENetworkGlobalManagerFlags::Unknown) { + // } } @@ -1092,30 +736,25 @@ Tray::Tray () : KSystemTray () 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))); + connect(KGlobal::networkManager(), TQT_SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, TQT_SLOT(slotStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags))); // 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*))); + // FIXME +// DeviceStore* store = DeviceStore::getInstance(); +// connect(store, TQT_SIGNAL(DeviceStoreChanged()), this, TQT_SLOT(updateDeviceTrays())); +// connect(store, TQT_SIGNAL(DeviceAdded(TDENetworkDevice*)), this, TQT_SLOT(slotAddDeviceTrayComponent(TDENetworkDevice*))); +// connect(store, TQT_SIGNAL(DeviceRemoved(TDENetworkDevice*)), this, TQT_SLOT(slotRemoveDeviceTrayComponent(TDENetworkDevice*))); // 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))); + connect(KGlobal::networkManager(), TQT_SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, TQT_SLOT(slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags))); +// connect(store, TQT_SIGNAL(DeviceAdded(TDENetworkDevice*)), this, TQT_SLOT(slotDeviceAddedNotify(TDENetworkDevice*))); +// connect(store, TQT_SIGNAL(DeviceRemoved(TDENetworkDevice*)), this, TQT_SLOT(slotDeviceRemovedNotify(TDENetworkDevice*))); // initial setup of the device-trays updateDeviceTrays(); - TQT_DBusError err; - slotStateChanged(nm->getState(err)); + slotStateChanged(KGlobal::networkManager()->backendStatus(), TDENetworkGlobalManagerFlags::Unknown); } Tray::~Tray () diff --git a/tdenetworkmanager/src/knetworkmanager-tray.h b/tdenetworkmanager/src/knetworkmanager-tray.h index cbce02b..6f39948 100644 --- a/tdenetworkmanager/src/knetworkmanager-tray.h +++ b/tdenetworkmanager/src/knetworkmanager-tray.h @@ -84,36 +84,31 @@ class Tray : public KSystemTray 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 slotStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState); + void slotSecretsNeeded(TDENetworkConnection* connection, const TQStringList& hints, bool request_new); - void slotDeviceAddedNotify(Device*); - void slotDeviceRemovedNotify(Device*); - void slotStateChangedNotify(TQ_UINT32 state); + void slotDeviceAddedNotify(TDENetworkDevice*); + void slotDeviceRemovedNotify(TDENetworkDevice*); + void slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState); void slotUpdateDeviceState(); - void slotUpdateDeviceState(NMDeviceState); - - void slotNewVPNConnection(); - void slotVPNBannerShow(const TQString& vpnbanner); + void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus); protected slots: void updateDeviceTrays(); - void slotAddDeviceTrayComponent(Device*); - void slotRemoveDeviceTrayComponent(Device*); + void slotAddDeviceTrayComponent(TDENetworkDevice*); + void slotRemoveDeviceTrayComponent(TDENetworkDevice*); 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*); + void updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + void updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + void mousePressEvent(TQMouseEvent *e); + void createDeviceTrayComponent(TDENetworkDevice*); + void enterEvent(TQEvent*); TrayPrivate* d; @@ -125,7 +120,7 @@ class NewSecretsDialog : public TQDialog public: - NewSecretsDialog(ConnectionSettings::Connection* connection, TQWidget * parent, const char * name, bool modal = false, TQt::WFlags f = 0); + NewSecretsDialog(TDENetworkConnection* connection, TQWidget * parent, const char * name, bool modal = false, TQt::WFlags f = 0); ~NewSecretsDialog(); void init(); @@ -134,7 +129,7 @@ class NewSecretsDialog : public TQDialog void reject(); private: - ConnectionSettings::Connection* _connection; + TDENetworkConnection* _connection; }; #endif /* KNETWORKMANAGER_TRAY_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-vpn_device.cpp b/tdenetworkmanager/src/knetworkmanager-vpn_device.cpp deleted file mode 100644 index 6093ecf..0000000 --- a/tdenetworkmanager/src/knetworkmanager-vpn_device.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-vpn_device.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -// TQt includes -#include - -// TQT_DBus includes -#include -#include - -// NM includes -#include -#include - -// 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/tdenetworkmanager/src/knetworkmanager-vpn_device.h b/tdenetworkmanager/src/knetworkmanager-vpn_device.h deleted file mode 100644 index f3c3db7..0000000 --- a/tdenetworkmanager/src/knetworkmanager-vpn_device.h +++ /dev/null @@ -1,53 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wired_device.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-device.h" - -class KNetworkManager; - -class VPNDevicePrivate; - -class VPNDevice : public Device -{ - Q_OBJECT - - public: - VPNDevice (const TQString & obj_path ); - ~VPNDevice (); - - TQ_UINT32 getState(); - - private: - VPNDevicePrivate * d; -}; - -#endif /* KNETWORKMANAGER_VPNDEVICE_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-wired_device.cpp b/tdenetworkmanager/src/knetworkmanager-wired_device.cpp deleted file mode 100644 index 2a59d3d..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wired_device.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wired_device.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -// TQt includes -#include - -// TQT_DBus includes -#include -#include - -// NM includes -#include - -// 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/tdenetworkmanager/src/knetworkmanager-wired_device.h b/tdenetworkmanager/src/knetworkmanager-wired_device.h deleted file mode 100644 index 0a52a44..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wired_device.h +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wired_device.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-device.h" - -class KNetworkManager; - -class WiredDevicePrivate; - -class WiredDevice : public Device -{ - Q_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/tdenetworkmanager/src/knetworkmanager-wired_device_tray.cpp b/tdenetworkmanager/src/knetworkmanager-wired_device_tray.cpp index 7e96886..9f2e9ed 100644 --- a/tdenetworkmanager/src/knetworkmanager-wired_device_tray.cpp +++ b/tdenetworkmanager/src/knetworkmanager-wired_device_tray.cpp @@ -66,7 +66,7 @@ class WiredDeviceTrayPrivate WiredDeviceTrayPrivate() {} ~WiredDeviceTrayPrivate() {} - WiredDevice* dev; + TDENetworkDevice* dev; }; void WiredDeviceTray::newConnection() @@ -144,7 +144,7 @@ void WiredDeviceTray::addMenuItems(KPopupMenu* menu) } } -WiredDeviceTray::WiredDeviceTray (WiredDevice* dev, KSystemTray * parent, const char * name ) +WiredDeviceTray::WiredDeviceTray (TDENetworkDevice* dev, KSystemTray * parent, const char * name ) : DeviceTrayComponent (dev, parent, name) { d = new WiredDeviceTrayPrivate(); diff --git a/tdenetworkmanager/src/knetworkmanager-wired_device_tray.h b/tdenetworkmanager/src/knetworkmanager-wired_device_tray.h index 7fcab3b..b2a2f7d 100644 --- a/tdenetworkmanager/src/knetworkmanager-wired_device_tray.h +++ b/tdenetworkmanager/src/knetworkmanager-wired_device_tray.h @@ -42,7 +42,7 @@ class WiredDeviceTray : public DeviceTrayComponent public: - WiredDeviceTray (WiredDevice*, KSystemTray * parent = 0, const char * name = 0); + WiredDeviceTray (TDENetworkDevice*, KSystemTray * parent = 0, const char * name = 0); ~WiredDeviceTray (); void addMenuItems(KPopupMenu* menu); diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_device.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_device.cpp deleted file mode 100644 index 554f797..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wireless_device.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-device.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * - * 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 - -// 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 - -// TQt includes -#include -#include -#include - -// TQt-Dbus includes -#include -#include -#include - -class WirelessDevicePrivate -{ -public: - WirelessDevicePrivate(TQString service, TQString obj_path) - : nmWireless(service, obj_path) - {} - - ~WirelessDevicePrivate() - { - // cleanup the AP-list - for (TQMap::Iterator it = aps.begin(); it != aps.end(); ++it) - { - AccessPoint* p = it.data(); - delete p; - } - } - - DBus::WirelessDeviceProxy nmWireless; - TQMap 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&)), this, TQT_SLOT(slotPropertiesChanged(const TQMap&))); - 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& 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 WirelessDevice::accessPoints() -{ - // update our AP list - if (d->aps.isEmpty()) { - updateAPList(); - } - - return d->aps.values(); -} - -void WirelessDevice::updateAPList() -{ - TQT_DBusError err; - TQValueList aps; - - // get the APs from NM - if (d->nmWireless.GetAccessPoints(aps, err)) - { - // for each AP - for (TQValueList::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 WirelessDevice::accessPointsForEssid( TQByteArray essid) -{ - TQValueList aps; - // the DBus proxy is shared - for (TQMap::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/tdenetworkmanager/src/knetworkmanager-wireless_device.h b/tdenetworkmanager/src/knetworkmanager-wireless_device.h deleted file mode 100644 index dd94ef7..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wireless_device.h +++ /dev/null @@ -1,70 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-device.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * - * 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 - -#include - -class KNetworkManager; -class AccessPoint; -class WirelessDevicePrivate; - -class WirelessDevice : public Device -{ - Q_OBJECT - - public: - WirelessDevice (const TQString & obj_path ); - ~WirelessDevice (); - - TQ_UINT32 getWirelessCapabilities() const; - TQValueList accessPointsForEssid(TQByteArray essid = TQByteArray()); - TQValueList accessPoints(); - AccessPoint * getActiveAccessPoint(); - TQ_UINT32 getBitrate() const; - - public slots: - void slotPropertiesChanged(const TQMap& 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/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp index 443fdec..b56cb00 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp +++ b/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp @@ -73,15 +73,15 @@ class WirelessDeviceTrayPrivate WirelessDeviceTrayPrivate() :dev(0), activeAccessPoint(0) { } ~WirelessDeviceTrayPrivate() {} - WirelessDevice* dev; - TQGuardedPtr activeAccessPoint; + TDENetworkDevice* dev; + TQGuardedPtr activeAccessPoint; }; TQStringList WirelessDeviceTray::getToolTipText() { TQStringList tooltip = DeviceTrayComponent::getToolTipText(); - AccessPoint * ap = d->dev->getActiveAccessPoint(); + TDENetworkWiFiAPInfo * ap = d->dev->getActiveAccessPoint(); if (ap) tooltip.append(i18n("Network: %1").arg(ap->getDisplaySsid())); @@ -91,7 +91,7 @@ TQStringList WirelessDeviceTray::getToolTipText() void WirelessDeviceTray::newConnection() { // create a new wireless connection - Connection* conn = new WirelessConnection(); + Connection* conn = new TDEWiFiConnection(); // open a dialog for editing the connection use_new_wireless_essid = 0; // deactivate autofill for now @@ -99,7 +99,7 @@ void WirelessDeviceTray::newConnection() dlg->show(); } -bool WirelessDeviceTray::findMatchingNetwork(const WirelessConnection* conn, const TQValueList& nets, WirelessNetwork& net) +bool WirelessDeviceTray::findMatchingNetwork(const TDEWiFiConnection* conn, const TQValueList& nets, WirelessNetwork& net) { Wireless* wireless = conn->getWirelessSetting(); WirelessSecurity* security = conn->getWirelessSecuritySetting(); @@ -118,10 +118,10 @@ bool WirelessDeviceTray::findMatchingNetwork(const WirelessConnection* conn, con return false; } -WirelessConnection* WirelessDeviceTray::findMatchingConnection(const WirelessNetwork& net, const TQValueList& connections) +TDEWiFiConnection* WirelessDeviceTray::findMatchingConnection(const WirelessNetwork& net, const TQValueList& connections) { // try to find a connection matching this network - for (TQValueList::ConstIterator it = connections.begin(); it != connections.end(); ++it) + for (TQValueList::ConstIterator it = connections.begin(); it != connections.end(); ++it) { Wireless* wireless = (*it)->getWirelessSetting(); WirelessSecurity* security = (*it)->getWirelessSecuritySetting(); @@ -147,7 +147,7 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) TQValueList nets = WirelessManager::getWirelessNetworks(d->dev); // get all wireless connections - TQValueList conns = WirelessManager::getWirelessConnections(); + TQValueList conns = WirelessManager::getWirelessConnections(); // get the currently active connection NMProxy* nm = NMProxy::getInstance(); @@ -157,7 +157,7 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) // add all wireless connections in range // (we may have more then one connection per network) - for (TQValueList::iterator it = conns.begin(); it != conns.end(); ++it) + for (TQValueList::iterator it = conns.begin(); it != conns.end(); ++it) { WirelessNetworkItem* wirelessNetworkItem; WirelessNetwork net; @@ -180,7 +180,7 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) TQPopupMenu* popup = new TQPopupMenu(menu); uint networkItemsAdded = 0; - for (TQValueList::iterator it = conns.begin(); it != conns.end(); ++it) + for (TQValueList::iterator it = conns.begin(); it != conns.end(); ++it) { WirelessNetworkItem* wirelessNetworkItem; WirelessNetwork net; @@ -213,7 +213,7 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) // // List available unsaved networks TQPopupMenu* newpopup = new TQPopupMenu(menu); - WirelessConnection* newconn; + TDEWiFiConnection* newconn; uint newnetworkItemsAdded = 0; TQValueList newnets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID); @@ -281,27 +281,27 @@ void WirelessDeviceTray::addMenuItems(KPopupMenu* menu) menu->insertSeparator(); } -void WirelessDeviceTray::slotUpdateDeviceState(NMDeviceState state) +void WirelessDeviceTray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { slotCheckActiveAccessPoint(); if (state == NM_DEVICE_STATE_ACTIVATED) { // trigger an update of the connections seen bssids property - AccessPoint * ap = d->dev->getActiveAccessPoint(); + TDENetworkWiFiAPInfo * ap = d->dev->getActiveAccessPoint(); if (ap) { int strength = ap->getStrength(); if (strength > 80) - setPixmapForState((NMDeviceState)state, "nm_signal_100"); + setPixmapForState((TDENetworkConnectionStatus::TDENetworkConnectionStatus)state, "nm_signal_100"); else if (strength > 55) - setPixmapForState((NMDeviceState)state, "nm_signal_75"); + setPixmapForState((TDENetworkConnectionStatus::TDENetworkConnectionStatus)state, "nm_signal_75"); else if (strength > 30) - setPixmapForState((NMDeviceState)state, "nm_signal_50"); + setPixmapForState((TDENetworkConnectionStatus::TDENetworkConnectionStatus)state, "nm_signal_50"); else if (strength > 5) - setPixmapForState((NMDeviceState)state, "nm_signal_25"); + setPixmapForState((TDENetworkConnectionStatus::TDENetworkConnectionStatus)state, "nm_signal_25"); else - setPixmapForState((NMDeviceState)state, "nm_signal_00"); + setPixmapForState((TDENetworkConnectionStatus::TDENetworkConnectionStatus)state, "nm_signal_00"); } } } @@ -314,7 +314,7 @@ void WirelessDeviceTray::slotCheckActiveAccessPoint() if (!nm) return; - WirelessConnection* active_conn = dynamic_cast(nm->getActiveConnection(d->dev)); + TDEWiFiConnection* active_conn = dynamic_cast(nm->getActiveConnection(d->dev)); if (active_conn && d->dev->getState() == NM_DEVICE_STATE_ACTIVATED) { if ( d->dev->getActiveAccessPoint() != d->activeAccessPoint) { @@ -334,7 +334,7 @@ void WirelessDeviceTray::slotCheckActiveAccessPoint() void WirelessDeviceTray::apStrengthChanged(TQ_UINT8 strength) { kdDebug() << k_funcinfo << (uint)strength << endl; - NMDeviceState state = device()->getState(); + TDENetworkConnectionStatus::TDENetworkConnectionStatus state = device()->getState(); if (strength > 80) setPixmapForState(state, "nm_signal_100"); else if (strength > 55) @@ -348,7 +348,7 @@ void WirelessDeviceTray::apStrengthChanged(TQ_UINT8 strength) emit uiUpdated(); } -void WirelessDeviceTray::slotAccessPointAdded(AccessPoint* ap) +void WirelessDeviceTray::slotAccessPointAdded(TDENetworkWiFiAPInfo* ap) { KNotifyClient::event( tray()->winId(), "knm-nm-network-found", i18n("KNetworkManager New Wireless Network Found") ); } @@ -358,7 +358,7 @@ 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) +WirelessDeviceTray::WirelessDeviceTray (TDENetworkDevice* dev, KSystemTray * parent, const char * name) : DeviceTrayComponent (dev, parent, name) { d = new WirelessDeviceTrayPrivate(); @@ -372,13 +372,13 @@ WirelessDeviceTray::WirelessDeviceTray (WirelessDevice* dev, KSystemTray * paren 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))); + connect(dev, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), this, TQT_SLOT(slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus))); // 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(accessPointAdded(TDENetworkWiFiAPInfo*)), this, TQT_SLOT(slotAccessPointAdded(TDENetworkWiFiAPInfo*))); connect(dev, TQT_SIGNAL(accessPointRemoved(const TQString&)), this, TQT_SLOT(slotAccessPointRemoved(const TQString&))); } diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h b/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h index 46b25f1..4a13548 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h +++ b/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h @@ -36,20 +36,14 @@ class WirelessDevice; class WirelessDeviceTrayPrivate; -namespace ConnectionSettings -{ - class Connection; - class WirelessConnection; -} - class WirelessDeviceTray : public DeviceTrayComponent { Q_OBJECT public: - WirelessDeviceTray (WirelessDevice*, KSystemTray * parent = 0, const char * name = 0); - ~WirelessDeviceTray (); + WirelessDeviceTray (TDENetworkDevice*, KSystemTray * parent = 0, const char * name = 0); + ~WirelessDeviceTray (); void addMenuItems(KPopupMenu* menu); @@ -60,20 +54,20 @@ class WirelessDeviceTray : public DeviceTrayComponent TQStringList getToolTipText(); public slots: - void slotUpdateDeviceState(NMDeviceState); + void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus); void slotCheckActiveAccessPoint(); void newConnection(); protected slots: void apStrengthChanged(TQ_UINT8 strength); - void slotAccessPointAdded(AccessPoint*); + void slotAccessPointAdded(TDENetworkWiFiAPInfo*); void slotAccessPointRemoved(const TQString&); private: - void addWirelessNetworks (KPopupMenu* menu); + void addWirelessNetworks(KPopupMenu* menu); TQValueList getWirelessNetworks(); - TQValueList getWirelessConnections(); - ConnectionSettings::WirelessConnection* findMatchingConnection(const WirelessNetwork& net, const TQValueList& connection); - bool findMatchingNetwork(const ConnectionSettings::WirelessConnection* conn, const TQValueList& nets, WirelessNetwork& net); + TQValueList getWirelessConnections(); + TDEWiFiConnection* findMatchingConnection(const WirelessNetwork& net, const TQValueList& connection); + bool findMatchingNetwork(const TDEWiFiConnection* conn, const TQValueList& nets, WirelessNetwork& net); WirelessDeviceTrayPrivate* d; diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_network.h b/tdenetworkmanager/src/knetworkmanager-wireless_network.h index addce7a..9fcf809 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_network.h +++ b/tdenetworkmanager/src/knetworkmanager-wireless_network.h @@ -26,7 +26,6 @@ #define KNETWORKMANAGER_WIRELESS_NETWORK_H #include "knetworkmanager.h" -#include "knetworkmanager-device.h" #include @@ -34,11 +33,6 @@ class KNetworkManager; class AccessPoint; class WirelessNetworkPrivate; -namespace ConnectionSettings -{ - class WirelessConnection; -} - /* A wireless network represents multiple accesspoints that share the same essid and security-caps diff --git a/tdenetworkmanager/src/knetworkmanager.cpp b/tdenetworkmanager/src/knetworkmanager.cpp index 81532e0..5a3d281 100644 --- a/tdenetworkmanager/src/knetworkmanager.cpp +++ b/tdenetworkmanager/src/knetworkmanager.cpp @@ -22,43 +22,15 @@ * **************************************************************************/ -// KDE includes +// TDE includes #include #include - -// NM includes -#include -#include - -// TQDBus includes -#include +#include +#include // 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 @@ -70,9 +42,7 @@ #include #include -char active_vpn_prev = 0; -extern NMDeviceState nm_device_state_global; -VPNDBUSPlugin* vpnproxy; +extern TDENetworkConnectionStatus::TDENetworkConnectionStatus nm_device_state_global; class KNetworkManagerPrivate { @@ -92,11 +62,7 @@ KNetworkManager* KNetworkManager::getInstance() void KNetworkManager::slotShutDown() { - // cleanup code - Storage* storage = Storage::getInstance(); - - // save all connections (if not done already) - storage->saveConnections(); + // } void KNetworkManager::timerEvent( TQTimerEvent *e ) @@ -113,28 +79,14 @@ KNetworkManager::KNetworkManager () : KUniqueApplication () // 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; } diff --git a/tdenetworkmanager/src/main.cpp b/tdenetworkmanager/src/main.cpp index 0355bad..fd11c11 100644 --- a/tdenetworkmanager/src/main.cpp +++ b/tdenetworkmanager/src/main.cpp @@ -37,16 +37,17 @@ static const char* knm_version = I18N_NOOP(KNETWORKMANAGER_VERSION_STRING); static const char* knm_descr = I18N_NOOP("A NetworkManager front-end for TDE"); -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"); +static const char* knm_copy = I18N_NOOP("Copyright (C) 2012 Trinity Destop Project"); +static const char* knm_webpage = I18N_NOOP("http://www.trinitydesktop.org"); extern "C" KDE_EXPORT int kdemain (int argc, char* argv[]) { - KAboutData aboutData ("knetworkmanager", I18N_NOOP("KNetworkManager"), + KAboutData aboutData ("tdenetworkmanager", I18N_NOOP("TDENetworkManager"), knm_version, knm_descr, KAboutData::License_GPL, knm_copy, 0, knm_webpage ); + aboutData.addAuthor ("Timothy Pearson", I18N_NOOP("TDE Rewrite"), "kb9vqf@pearsoncomputing.net"); aboutData.addAuthor ("Helmut Schaa", I18N_NOOP("Maintainer"), "hschaa@suse.de"); aboutData.addAuthor ("Timo Hoenig", I18N_NOOP("Maintainer"), "thoenig@suse.de"); aboutData.addAuthor ("Will Stephenson", I18N_NOOP("Additional code"), "wstephenson@suse.de"); diff --git a/tdenetworkmanager/src/secret_storage_plugin.cpp b/tdenetworkmanager/src/secret_storage_plugin.cpp deleted file mode 100644 index db051c4..0000000 --- a/tdenetworkmanager/src/secret_storage_plugin.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************** - * - * secret_storage_plugin.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -#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& secrets) -{ - return false; -} - -void SecretStoragePlugin::restoreSecretsAsync(TQString& key) -{ - // just emit an error - TQMap empty; - emit signalSecretsRestored(key, empty, false); -} - - - -#include "secret_storage_plugin.moc" diff --git a/tdenetworkmanager/src/secret_storage_plugin.h b/tdenetworkmanager/src/secret_storage_plugin.h deleted file mode 100644 index c2713e8..0000000 --- a/tdenetworkmanager/src/secret_storage_plugin.h +++ /dev/null @@ -1,53 +0,0 @@ -/*************************************************************************** - * - * secret_storage_plugin.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include "knetworkmanager-plugin.h" - -#define KNETWORKMANAGER_SECRET_STORAGE_PLUGIN "KNetworkManager/SecretStoragePlugin" - -class SecretStoragePlugin : public Plugin -{ - Q_OBJECT - - public: - SecretStoragePlugin(TQObject*, const char*, const TQStringList&); - virtual ~SecretStoragePlugin(); - - virtual bool saveSecret(TQString& key, TQMap& secrets); - virtual void restoreSecretsAsync(TQString& key); - - signals: - void signalSecretsRestored(TQString& key, TQMap, bool); -}; - - -#endif /* KNETWORKMANAGER_SECRET_STORAGE_PLUGIN_H */ - diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp index 97f8350..cc3b8f7 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp @@ -76,17 +76,12 @@ #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) +ConnectionSettingsDialogImpl::ConnectionSettingsDialogImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, bool modal, WFlags fl) : ConnectionSettingsDialog(parent, name, modal, fl) , _conn(conn) - , _setting(setting) , _new_conn(new_conn) { updateDialogForDeviceType(); @@ -115,7 +110,7 @@ ConnectionSettingsDialogImpl::~ConnectionSettingsDialogImpl() } TQValueList -ConnectionSettingsDialogImpl::createWidgetsForWireless(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) +ConnectionSettingsDialogImpl::createWidgetsForWireless(TDENetworkConnection* conn, bool new_conn) { TQValueList ret; @@ -135,7 +130,7 @@ ConnectionSettingsDialogImpl::createWidgetsForWireless(ConnectionSettings::Conne } TQValueList -ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting, const TQByteArray& essid) +ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(TDENetworkConnection* conn, bool new_conn, const TQByteArray& essid) { TQValueList ret; @@ -164,7 +159,7 @@ ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(ConnectionSetti } TQValueList -ConnectionSettingsDialogImpl::createWidgetsForWired(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) +ConnectionSettingsDialogImpl::createWidgetsForWired(TDENetworkConnection* conn, bool new_conn) { TQValueList ret; @@ -176,7 +171,7 @@ ConnectionSettingsDialogImpl::createWidgetsForWired(ConnectionSettings::Connecti } TQValueList -ConnectionSettingsDialogImpl::createWidgetsForVPN(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) +ConnectionSettingsDialogImpl::createWidgetsForVPN(TDENetworkConnection* conn, bool new_conn) { TQValueList ret; @@ -188,7 +183,7 @@ ConnectionSettingsDialogImpl::createWidgetsForVPN(ConnectionSettings::Connection } TQValueList -ConnectionSettingsDialogImpl::createWidgetsForCDMA(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) +ConnectionSettingsDialogImpl::createWidgetsForCDMA(TDENetworkConnection* conn, bool new_conn) { TQValueList ret; @@ -203,7 +198,7 @@ ConnectionSettingsDialogImpl::createWidgetsForCDMA(ConnectionSettings::Connectio } TQValueList -ConnectionSettingsDialogImpl::createWidgetsForGSM(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) +ConnectionSettingsDialogImpl::createWidgetsForGSM(TDENetworkConnection* conn, bool new_conn) { TQValueList ret; @@ -218,7 +213,7 @@ ConnectionSettingsDialogImpl::createWidgetsForGSM(ConnectionSettings::Connection } void -ConnectionSettingsDialogImpl::createWidgetsForConnection(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) +ConnectionSettingsDialogImpl::createWidgetsForConnection(TDENetworkConnection* conn, bool new_conn) { /* Currently two modes: @@ -283,7 +278,7 @@ ConnectionSettingsDialogImpl::updateDialogForDeviceType() if (_conn) { connect(_conn, TQT_SIGNAL(validityChanged()), this, TQT_SLOT(slotEnableButtons())); - createWidgetsForConnection(_conn, _new_conn, _setting); + createWidgetsForConnection(_conn, _new_conn); } else { diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.h index 9cedc69..251ad33 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.h @@ -48,7 +48,7 @@ class ConnectionSettingsDialogImpl : public ConnectionSettingsDialog Q_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(TDENetworkConnection* conn, bool new_conn, TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~ConnectionSettingsDialogImpl(); public slots: @@ -64,21 +64,20 @@ class ConnectionSettingsDialogImpl : public ConnectionSettingsDialog private: void updateDialogForDeviceType(); - void createWidgetsForConnection(ConnectionSettings::Connection*, bool new_conn, ConnectionSettings::ConnectionSetting* setting); + void createWidgetsForConnection(TDENetworkConnection*, bool new_conn); void activateWidget(ConnectionSettings::WidgetInterface* widget); void deactivateWidget(ConnectionSettings::WidgetInterface* widget); - int getDeviceTypeFromConnection(ConnectionSettings::Connection* conn); + int getDeviceTypeFromConnection(TDENetworkConnection* conn); // TODO: To be moved to a factory class - TQValueList createWidgetsForWired(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); - TQValueList createWidgetsForWireless(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); - TQValueList createWidgetsForWirelessKnownESSID(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting, const TQByteArray& essid); - TQValueList createWidgetsForVPN(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); - TQValueList createWidgetsForCDMA(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); - TQValueList createWidgetsForGSM(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); + TQValueList createWidgetsForWired(TDENetworkConnection* conn, bool new_conn); + TQValueList createWidgetsForWireless(TDENetworkConnection* conn, bool new_conn); + TQValueList createWidgetsForWirelessKnownESSID(TDENetworkConnection* conn, bool new_conn, const TQByteArray& essid); + TQValueList createWidgetsForVPN(TDENetworkConnection* conn, bool new_conn); + TQValueList createWidgetsForCDMA(TDENetworkConnection* conn, bool new_conn); + TQValueList createWidgetsForGSM(TDENetworkConnection* conn, bool new_conn); - ConnectionSettings::Connection* _conn; - ConnectionSettings::ConnectionSetting* _setting; + TDENetworkConnection* _conn; TQValueList _widgetIds; bool _new_conn; }; diff --git a/tdenetworkmanager/src/traycomponent.h b/tdenetworkmanager/src/traycomponent.h index 4128f11..2a4da49 100644 --- a/tdenetworkmanager/src/traycomponent.h +++ b/tdenetworkmanager/src/traycomponent.h @@ -21,8 +21,6 @@ along with this program. If not, see . #ifndef TRAY_COMPONENT_H #define TRAY_COMPONENT_H -#include - #include #include #include -- cgit v1.2.1 From 4c6980873386dff306b3083e4ed861fdee45e37b Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 4 Sep 2012 20:41:08 -0500 Subject: More conversion to new TDE API --- tdenetworkmanager/src/devicetraycomponent.cpp | 12 +- .../src/knetworkmanager-cellular_device_tray.cpp | 120 ++++---------- .../src/knetworkmanager-device_tray.cpp | 183 +++++++++++++-------- .../src/knetworkmanager-device_tray.h | 23 +-- tdenetworkmanager/src/knetworkmanager-menuitem.cpp | 18 +- tdenetworkmanager/src/knetworkmanager-menuitem.h | 2 +- .../src/knetworkmanager-wired_device_tray.cpp | 80 ++++----- .../src/knetworkmanager-wireless_device_tray.cpp | 12 -- .../src/knetworkmanager-wireless_manager.h | 2 - .../src/knetworkmanager-wireless_menuitem.cpp | 12 +- .../src/knetworkmanager-wireless_menuitem.h | 7 +- 11 files changed, 204 insertions(+), 267 deletions(-) diff --git a/tdenetworkmanager/src/devicetraycomponent.cpp b/tdenetworkmanager/src/devicetraycomponent.cpp index d0a3f97..d0b0929 100644 --- a/tdenetworkmanager/src/devicetraycomponent.cpp +++ b/tdenetworkmanager/src/devicetraycomponent.cpp @@ -28,40 +28,40 @@ along with this program. If not, see . #include "knetworkmanager-nm_proxy.h" TQString pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { - TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = 0x80000000; + TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; while (flag > 0) { if (state & flag) { if (m_pixmaps.contains(flag)) { return m_pixmaps[flag]; } } - flag = flag >> 1; + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); } return TQString::null; } TQString movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { - TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = 0x80000000; + TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; while (flag > 0) { if (state & flag) { if (m_movies.contains(flag)) { return m_movies[flag]; } } - flag = flag >> 1; + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); } return TQString::null; } TQString tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { - TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = 0x80000000; + TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; while (flag > 0) { if (state & flag) { if (m_tooltips.contains(flag)) { return m_tooltips[flag]; } } - flag = flag >> 1; + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); } return TQString::null; } diff --git a/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp b/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp index 49a3ab2..d3d23d5 100644 --- a/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp +++ b/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp @@ -30,29 +30,12 @@ #include #include -// TQt DBus -#include - - // 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 +#include "knetworkmanager-connection_settings_dialog.h" using namespace ConnectionSettings; @@ -68,94 +51,57 @@ class CellularDeviceTrayPrivate 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(); + TDENetworkConnection* conn = 0; + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + switch (deviceConnMan->deviceType()) { + case TDENetworkDeviceType::Modem: + conn = new TDEModemConnection(); 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); + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, 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)); + Subhead* subhead = new Subhead (menu, "subhead", d->dev->deviceNode(), 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; + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnection* active_conn = NULL; + if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected)) + && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) { + active_conn = nm->findConnectionByUUID(deviceConnMan->deviceInformation().activeConnectionUUID); + } // get all available Connections for cellular devices - // WILLTODO : repeat for GSM - TQValueList connections = connectionStore->getConnections(NM_SETTING_CDMA_SETTING_NAME); - for (TQValueList::iterator it = connections.begin(); it != connections.end(); ++it) - { - CDMAConnection* cellularconn = dynamic_cast(*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)").arg(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)); - } + + TDENetworkConnectionList* allconmap = nm->connections(); + for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) { + TDEModemConnection* conn = dynamic_cast(*it); + if (!conn) { + continue; } - } - connections = connectionStore->getConnections(NM_SETTING_GSM_SETTING_NAME); - for (TQValueList::iterator it = connections.begin(); it != connections.end(); ++it) - { - GSMConnection* cellularconn = dynamic_cast(*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)").arg(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)); - } + + // lets create a nice name for this connection + TQString title = conn->friendlyName; + if (conn->ipConfig.valid) { + title += TQString(" (%1)").arg((conn->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPIP) ? i18n("DHCP") : i18n("Manual IP config")); } + + NetworkMenuItem* item = new NetworkMenuItem(d->dev, conn, TQT_TQOBJECT(menu)); + + int id = menu->insertItem(title, item, TQT_SLOT(slotActivate())); + menu->setItemChecked(id, ((*it) == active_conn)); } // bring the device down @@ -172,7 +118,7 @@ CellularDeviceTray::CellularDeviceTray (TDENetworkDevice* dev, KSystemTray * par d = new CellularDeviceTrayPrivate(); d->dev = dev; - setPixmapForState(NM_DEVICE_STATE_ACTIVATED, "nm_device_wwan"); + setPixmapForState(TDENetworkConnectionStatus::Connected, "nm_device_wwan"); } CellularDeviceTray::~CellularDeviceTray () diff --git a/tdenetworkmanager/src/knetworkmanager-device_tray.cpp b/tdenetworkmanager/src/knetworkmanager-device_tray.cpp index e0c05a9..493582a 100644 --- a/tdenetworkmanager/src/knetworkmanager-device_tray.cpp +++ b/tdenetworkmanager/src/knetworkmanager-device_tray.cpp @@ -37,7 +37,7 @@ class WirelessDialog; #include #include -// KDE includes +// TDE includes #include #include #include @@ -52,15 +52,14 @@ class WirelessDialog; #include #include #include +#include +#include // 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; @@ -71,38 +70,84 @@ class DeviceTrayPrivate 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"); + tooltips[TDENetworkConnectionStatus::Invalid] = i18n("Unknown"); + tooltips[TDENetworkConnectionStatus::LinkUnavailable] = i18n("Down"); + tooltips[TDENetworkConnectionStatus::UnManaged] = i18n("Unmanaged"); + tooltips[TDENetworkConnectionStatus::Disconnected] = i18n("Disconnected"); + tooltips[TDENetworkConnectionStatus::EstablishingLink] = i18n("Preparing"); + tooltips[TDENetworkConnectionStatus::ConfiguringProtocols] = i18n("Configuration"); + tooltips[TDENetworkConnectionStatus::NeedAuthorization] = i18n("Awaiting authentication"); + tooltips[TDENetworkConnectionStatus::VerifyingProtocols] = i18n("IP configuration"); + tooltips[TDENetworkConnectionStatus::Connected] = i18n("Activated"); + tooltips[TDENetworkConnectionStatus::Failed] = i18n("Failed"); } ~DeviceTrayPrivate() {} - Device* dev; - TQMap movies; - TQMap pixmaps; - TQMap tooltips; + TDENetworkDevice* dev; + TQMap movies; + TQMap pixmaps; + TQMap tooltips; + + TQPixmap pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); + TQMovie movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); + TQString tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); }; -Device* DeviceTray::getDevice() const +TQPixmap DeviceTrayPrivate::pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { + TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; + while (flag > 0) { + if (state & flag) { + if (pixmaps.contains(flag)) { + return pixmaps[flag]; + } + } + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); + } + return TQPixmap(); +} + +TQMovie DeviceTrayPrivate::movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { + TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; + while (flag > 0) { + if (state & flag) { + if (movies.contains(flag)) { + return movies[flag]; + } + } + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); + } + return TQMovie(); +} + +TQString DeviceTrayPrivate::tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { + TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; + while (flag > 0) { + if (state & flag) { + if (tooltips.contains(flag)) { + return tooltips[flag]; + } + } + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); + } + return TQString::null; +} + +TDENetworkDevice* DeviceTray::getDevice() const { return d->dev; } TQString DeviceTray::getTooltipText() { - NMDeviceState state = d->dev->getState(); + + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnectionStatus::TDENetworkConnectionStatus state = deviceConnMan->deviceInformation().statusFlags; TQString tooltip = TQString(); - if (!d->tooltips[state].isEmpty()) - tooltip += i18n("State: %1").arg(d->tooltips[state]); + if (!d->tooltipForConnState(state).isEmpty()) { + tooltip += i18n("State: %1").arg(d->tooltipForConnState(state)); + } return tooltip; } @@ -113,8 +158,9 @@ void DeviceTray::enterEvent (TQEvent* /*e*/) TQToolTip::remove (this); TQString tooltip = getTooltipText(); - if (!tooltip.isEmpty()) + if (!tooltip.isEmpty()) { TQToolTip::add (this, tooltip); + } } @@ -183,8 +229,9 @@ void DeviceTray::contextMenuAboutToShow (KPopupMenu* menu) // quit menu->insertSeparator (); KAction* quitAction = actionCollection ()->action (KStdAction::name (KStdAction::Quit)); - if (quitAction) + if (quitAction) { quitAction->plug (menu); + } } void DeviceTray::resizeEvent ( TQResizeEvent * ) @@ -194,26 +241,26 @@ void DeviceTray::resizeEvent ( TQResizeEvent * ) updateTrayIcon(m_currentIconState); } -void DeviceTray::setPixmapForState(NMDeviceState state, TQMovie movie) +void DeviceTray::setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state, TQMovie movie) { d->movies[state] = movie; slotUpdateDeviceState(); } -void DeviceTray::setPixmapForState(NMDeviceState state, TQPixmap pixmap) +void DeviceTray::setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state, TQPixmap pixmap) { d->pixmaps[state] = pixmap; slotUpdateDeviceState(); } -void DeviceTray::updateTrayIcon(NMDeviceState state) +void DeviceTray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { // stop the old movie to avoid unnecessary wakups - if (movie()) + if (movie()) { movie()->pause(); + } - if (d->movies.find(state) != d->movies.end() && !d->movies[state].isNull()) - { + if (!d->movieForConnState(state).isNull()) { if (m_currentIconState != state) { // Clear the icon pixmap as the movie may be a different size TQPixmap nullPixmap; @@ -222,11 +269,12 @@ void DeviceTray::updateTrayIcon(NMDeviceState state) // animation desired int frame = -1; - if (movie()) + if (movie()) { frame = movie()->frameNumber(); + } // set the movie - setMovie(d->movies[state]); + setMovie(d->movieForConnState(state)); // start at the same frame as the movie before if (frame > 0) @@ -235,42 +283,36 @@ void DeviceTray::updateTrayIcon(NMDeviceState state) // start the animation movie()->unpause(); } - else if (d->pixmaps.find(state) != d->pixmaps.end() && !d->pixmaps[state].isNull()) - setPixmap(d->pixmaps[state]); - else + else if (!d->pixmapForConnState(state).isNull()) { + setPixmap(d->pixmapForConnState(state)); + } + else { setPixmap(loadSizedIcon("KNetworkManager", width())); + } m_currentIconState = state; } -void DeviceTray::updateActions(NMDeviceState state) +void DeviceTray::updateActions(TDENetworkConnectionStatus::TDENetworkConnectionStatus 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) ); + deactivate->setEnabled( (state & TDENetworkConnectionStatus::Connected || + state & TDENetworkConnectionStatus::VerifyingProtocols || + state & TDENetworkConnectionStatus::EstablishingLink || + state & TDENetworkConnectionStatus::ConfiguringProtocols || + state & TDENetworkConnectionStatus::NeedAuthorization) ); } -void DeviceTray::updateActiveConnection(NMDeviceState state) +void DeviceTray::updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { - if (state != NM_DEVICE_STATE_ACTIVATED) + if (!(state & TDENetworkConnectionStatus::Connected)) { return; - - NMProxy* nm = NMProxy::getInstance(); - Connection* active_conn = nm->getActiveConnection(d->dev); - if (active_conn) - { - Info* info = dynamic_cast(active_conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME)); - if (info) - info->setTimestamp(TQDateTime::currentDateTime()); } } -void DeviceTray::slotUpdateDeviceState(NMDeviceState state) +void DeviceTray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { updateTrayIcon(state); updateActions(state); @@ -279,42 +321,43 @@ void DeviceTray::slotUpdateDeviceState(NMDeviceState state) void DeviceTray::slotUpdateDeviceState() { - slotUpdateDeviceState(d->dev->getState()); + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + slotUpdateDeviceState(deviceConnMan->deviceInformation().statusFlags); } 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->pixmaps[TDENetworkConnectionStatus::Invalid] = loadSizedIcon("nm_no_connection", width()); + d->pixmaps[TDENetworkConnectionStatus::UnManaged] = loadSizedIcon("nm_no_connection", width()); + d->pixmaps[TDENetworkConnectionStatus::LinkUnavailable] = loadSizedIcon("nm_no_connection", width()); + d->pixmaps[TDENetworkConnectionStatus::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[TDENetworkConnectionStatus::EstablishingLink] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage01_connecting", KIcon::Panel)); + d->movies[TDENetworkConnectionStatus::EstablishingLink].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[TDENetworkConnectionStatus::ConfiguringProtocols] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage02_connecting", KIcon::Panel)); + d->movies[TDENetworkConnectionStatus::ConfiguringProtocols].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[TDENetworkConnectionStatus::VerifyingProtocols] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage03_connecting", KIcon::Panel)); + d->movies[TDENetworkConnectionStatus::VerifyingProtocols].pause(); - d->movies[NM_DEVICE_STATE_NEED_AUTH] = d->movies[NM_DEVICE_STATE_CONFIG]; - d->movies[NM_DEVICE_STATE_NEED_AUTH].pause(); + d->movies[TDENetworkConnectionStatus::NeedAuthorization] = d->movies[TDENetworkConnectionStatus::ConfiguringProtocols]; + d->movies[TDENetworkConnectionStatus::NeedAuthorization].pause(); - d->pixmaps[NM_DEVICE_STATE_ACTIVATED] = loadSizedIcon("ok", width()); + d->pixmaps[TDENetworkConnectionStatus::Connected] = loadSizedIcon("ok", width()); - d->pixmaps[NM_DEVICE_STATE_FAILED] = loadSizedIcon("nm_no_connection", width()); + d->pixmaps[TDENetworkConnectionStatus::Failed] = loadSizedIcon("nm_no_connection", width()); } -DeviceTray::DeviceTray (Device* dev) : KSystemTray () +DeviceTray::DeviceTray (TDENetworkDevice* dev) : KSystemTray () { d = new DeviceTrayPrivate(); d->dev = dev; - m_currentIconState = NM_DEVICE_STATE_UNKNOWN; + m_currentIconState = TDENetworkConnectionStatus::Invalid; loadIcons(); // get notified when the device state changes - connect(dev, TQT_SIGNAL(StateChanged(NMDeviceState)), this, TQT_SLOT(slotUpdateDeviceState(NMDeviceState))); + connect(dev, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), this, TQT_SLOT(slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus))); setMouseTracking (true); diff --git a/tdenetworkmanager/src/knetworkmanager-device_tray.h b/tdenetworkmanager/src/knetworkmanager-device_tray.h index 5b390ad..60f6888 100644 --- a/tdenetworkmanager/src/knetworkmanager-device_tray.h +++ b/tdenetworkmanager/src/knetworkmanager-device_tray.h @@ -42,13 +42,8 @@ #include #include -#include #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 @@ -57,34 +52,34 @@ class DeviceTray : public KSystemTray public: - DeviceTray (Device*); + DeviceTray (TDENetworkDevice*); ~DeviceTray (); void contextMenuAboutToShow (KPopupMenu* menu); virtual void addMenuItems(KPopupMenu* menu) = 0; - Device* getDevice() const; + TDENetworkDevice* getDevice() const; protected: - void setPixmapForState(NMDeviceState, TQMovie); - void setPixmapForState(NMDeviceState, TQPixmap); + void setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQMovie); + void setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQPixmap); void resizeEvent ( TQResizeEvent * ); virtual TQString getTooltipText(); public slots: void setPixmap(const TQPixmap &); - void slotUpdateDeviceState(NMDeviceState); + void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus); void slotUpdateDeviceState(); private: - void updateTrayIcon(NMDeviceState); - void updateActions(NMDeviceState); - void updateActiveConnection(NMDeviceState); + void updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + void updateActions(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + void updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus); void enterEvent (TQEvent*); void loadIcons(); DeviceTrayPrivate* d; - NMDeviceState m_currentIconState; + TDENetworkConnectionStatus::TDENetworkConnectionStatus m_currentIconState; }; #endif /* KNETWORKMANAGER_DEVICE_TRAY_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-menuitem.cpp b/tdenetworkmanager/src/knetworkmanager-menuitem.cpp index b13563e..f44ebfa 100644 --- a/tdenetworkmanager/src/knetworkmanager-menuitem.cpp +++ b/tdenetworkmanager/src/knetworkmanager-menuitem.cpp @@ -49,35 +49,24 @@ #include #include -#include -#include - #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) + NetworkMenuItemPrivate(TDENetworkDevice* device, TDENetworkConnection* connection) : dev(device), conn(connection) { } ~NetworkMenuItemPrivate() {} - TQGuardedPtr dev; - TQGuardedPtr conn; + TQGuardedPtr dev; + TQGuardedPtr conn; }; void NetworkMenuItem::slotActivate() @@ -113,7 +102,6 @@ void NetworkMenuItem::slotActivate() 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 diff --git a/tdenetworkmanager/src/knetworkmanager-menuitem.h b/tdenetworkmanager/src/knetworkmanager-menuitem.h index 5f9f6eb..e384d8c 100644 --- a/tdenetworkmanager/src/knetworkmanager-menuitem.h +++ b/tdenetworkmanager/src/knetworkmanager-menuitem.h @@ -41,7 +41,7 @@ class NetworkMenuItem : public TQObject Q_OBJECT public: - NetworkMenuItem (Device* dev, ConnectionSettings::Connection* conn, TQObject* parent = 0, const char* name = 0); + NetworkMenuItem (TDENetworkDevice* dev, TDENetworkConnection* conn, TQObject* parent = 0, const char* name = 0); ~NetworkMenuItem (); public slots: diff --git a/tdenetworkmanager/src/knetworkmanager-wired_device_tray.cpp b/tdenetworkmanager/src/knetworkmanager-wired_device_tray.cpp index 9f2e9ed..c399a7a 100644 --- a/tdenetworkmanager/src/knetworkmanager-wired_device_tray.cpp +++ b/tdenetworkmanager/src/knetworkmanager-wired_device_tray.cpp @@ -46,15 +46,9 @@ // 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" @@ -72,69 +66,64 @@ class WiredDeviceTrayPrivate void WiredDeviceTray::newConnection() { // create a new wired connection - Connection* conn = new WiredConnection(); + TDENetworkConnection* conn = new TDEWiredEthernetConnection(); // edit the new connection - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, tray(), "connect_something", false, TQt::WDestructiveClose); + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, 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)").arg(d->dev->getInterface()), SmallIcon("wired", TQIconSet::Automatic)); + Subhead* subhead = new Subhead (menu, "subhead", TQString("Wired Connection (%1)").arg(d->dev->deviceNode()), SmallIcon("wired", TQIconSet::Automatic)); menu->insertItem (subhead, -1, -1); - // bolding subhead instead + // bolding subhead instead //menu->insertSeparator(); - if (!d->dev->getCarrier()) - { + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + if (deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::LinkUnavailable) { // 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; + else { + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnection* active_conn = NULL; + if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected)) + && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) { + active_conn = nm->findConnectionByUUID(deviceConnMan->deviceInformation().activeConnectionUUID); + } // get all available Connections for wired devices - TQValueList connections = connectionStore->getConnections(NM_SETTING_WIRED_SETTING_NAME); + TDENetworkConnectionList* connections = nm->connections(); int connectionItems = 0; - for (TQValueList::iterator it = connections.begin(); it != connections.end(); ++it) - { - WiredConnection* wiredconn = dynamic_cast(*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)").arg(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)); - } + for (TDENetworkConnectionList::Iterator it = connections->begin(); it != connections->end(); ++it) { + TDEWiredEthernetConnection* conn = dynamic_cast(*it); + if (!conn) { + continue; + } + + // wired connection found :) + // lets create a nice name for this connection + TQString title = conn->friendlyName; + if (conn->ipConfig.valid) { + title += TQString(" (%1)").arg((conn->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPIP) ? i18n("DHCP") : i18n("Manual IP config")); } + + NetworkMenuItem* item = new NetworkMenuItem(d->dev, conn, 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())); + 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"); @@ -150,8 +139,7 @@ WiredDeviceTray::WiredDeviceTray (TDENetworkDevice* dev, KSystemTray * parent, c d = new WiredDeviceTrayPrivate(); d->dev = dev; - setPixmapForState(NM_DEVICE_STATE_ACTIVATED, "nm_device_wired"); - + setPixmapForState(TDENetworkConnectionStatus::Connected, "nm_device_wired"); } WiredDeviceTray::~WiredDeviceTray () diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp index b56cb00..a1a59ab 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp +++ b/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp @@ -42,23 +42,11 @@ #include #include -// QT DBus -#include -#include - // 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" diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_manager.h b/tdenetworkmanager/src/knetworkmanager-wireless_manager.h index f90fce7..ab32ee6 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_manager.h +++ b/tdenetworkmanager/src/knetworkmanager-wireless_manager.h @@ -32,8 +32,6 @@ // 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 diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.cpp index f8bedae..5956e85 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.cpp +++ b/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.cpp @@ -56,10 +56,6 @@ #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() @@ -73,11 +69,7 @@ void WirelessNetworkItem::slotActivate() 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; } @@ -148,7 +140,7 @@ WirelessNetworkItem::sizeHint () return TQSize (_width, _height); } -WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, Device* dev, WirelessNetwork& net, WirelessConnection* conn, bool adhoc) +WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, TDENetworkDevice* dev, WirelessNetwork& net, WirelessConnection* conn, bool adhoc) : NetworkMenuItem(dev, conn, 0, 0 ), TQCustomMenuItem () { parent = p; @@ -189,7 +181,7 @@ WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, Device* dev, WirelessNetw _width += _space; /* pbarStrength -> contextMenu */ } -WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, Device* dev, WirelessNetwork& net, bool adhoc) +WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, TDENetworkDevice* dev, WirelessNetwork& net, bool adhoc) : NetworkMenuItem(dev, NULL, 0, 0 ), TQCustomMenuItem () { parent = p; diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.h b/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.h index 98b6321..1021cc6 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.h +++ b/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.h @@ -45,15 +45,14 @@ #include #include "knetworkmanager-wireless_network.h" -#include "knetworkmanager-connection.h" class WirelessNetworkItem : public NetworkMenuItem, public TQCustomMenuItem { Q_OBJECT public: - WirelessNetworkItem (TQWidget*, Device* dev, WirelessNetwork& net, ConnectionSettings::WirelessConnection* conn, bool adhoc); - WirelessNetworkItem (TQWidget*, Device* dev, WirelessNetwork& net, bool adhoc); + WirelessNetworkItem (TQWidget*, TDENetworkDevice* dev, WirelessNetwork& net, ConnectionSettings::WirelessConnection* conn, bool adhoc); + WirelessNetworkItem (TQWidget*, TDENetworkDevice* dev, WirelessNetwork& net, bool adhoc); ~WirelessNetworkItem (); TQWidget* parent; @@ -70,7 +69,7 @@ class WirelessNetworkItem : public NetworkMenuItem, public TQCustomMenuItem bool _adhoc; WirelessNetwork _net; - Device* _dev; + TDENetworkDevice* _dev; ConnectionSettings::WirelessConnection* _conn; /* menu item */ -- cgit v1.2.1 From 26cdc6b2b5c6f838688bdfb5c1ef4f55520e9bf3 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 5 Sep 2012 16:43:22 -0500 Subject: Convert various wireless elements to the new TDE API --- tdenetworkmanager/src/knetworkmanager-menuitem.cpp | 51 +++-- tdenetworkmanager/src/knetworkmanager-menuitem.h | 3 + .../src/knetworkmanager-wireless_device_tray.cpp | 206 ++++++++++++--------- .../src/knetworkmanager-wireless_device_tray.h | 3 +- .../src/knetworkmanager-wireless_manager.cpp | 18 +- .../src/knetworkmanager-wireless_manager.h | 8 +- .../src/knetworkmanager-wireless_menuitem.cpp | 44 +++-- .../src/knetworkmanager-wireless_menuitem.h | 4 +- .../src/knetworkmanager-wireless_network.cpp | 14 +- .../src/knetworkmanager-wireless_network.h | 6 +- 10 files changed, 196 insertions(+), 161 deletions(-) diff --git a/tdenetworkmanager/src/knetworkmanager-menuitem.cpp b/tdenetworkmanager/src/knetworkmanager-menuitem.cpp index f44ebfa..927f1ae 100644 --- a/tdenetworkmanager/src/knetworkmanager-menuitem.cpp +++ b/tdenetworkmanager/src/knetworkmanager-menuitem.cpp @@ -49,10 +49,6 @@ #include #include -#include "knetworkmanager-connection.h" -#include "knetworkmanager-device.h" -#include "knetworkmanager-nm_proxy.h" - using namespace ConnectionSettings; class NetworkMenuItemPrivate @@ -71,48 +67,47 @@ class NetworkMenuItemPrivate void NetworkMenuItem::slotActivate() { - int id; - TQT_DBusError err; kdDebug() << "NetworkMenuItem::slotActivate()" << endl; - NMProxy* nm = NMProxy::getInstance(); + + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); if (d->dev && d->conn) { - NMProxy* nm = NMProxy::getInstance(); - if (nm) + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + if (deviceConnMan) { - 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 - { + kdDebug() << "Activate Connection " << d->conn->UUID.ascii() << " on Device " << d->dev->deviceNode().ascii() << endl; + printf("Activate Connection %s on Device %s\n\r", d->conn->UUID.ascii(), d->dev->deviceNode().ascii()); + TDENetworkConnectionStatus::TDENetworkConnectionStatus result = deviceConnMan->initiateConnection(d->conn->UUID); + if ((result == TDENetworkConnectionStatus::Disconnected) + || (result == TDENetworkConnectionStatus::Invalid)) { + // } - else + 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); -#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 + printf("Activate Connection %s on default device\n\r", d->conn->UUID.ascii()); + + TDENetworkConnectionStatus::TDENetworkConnectionStatus result = nm->initiateConnection(d->conn->UUID); + if ((result == TDENetworkConnectionStatus::Disconnected) + || (result == TDENetworkConnectionStatus::Invalid)) { + // + } + else { + kdDebug() << "ActivateConnection failed" << endl; + } } else kdDebug() << "Device or Connection invalid" << endl; } -NetworkMenuItem::NetworkMenuItem (Device* dev, Connection* conn, TQObject* parent, const char* name) +NetworkMenuItem::NetworkMenuItem (TDENetworkDevice* dev, TDENetworkConnection* conn, TQObject* parent, const char* name) : TQObject(parent, name) { d = new NetworkMenuItemPrivate(dev, conn); diff --git a/tdenetworkmanager/src/knetworkmanager-menuitem.h b/tdenetworkmanager/src/knetworkmanager-menuitem.h index e384d8c..86552dc 100644 --- a/tdenetworkmanager/src/knetworkmanager-menuitem.h +++ b/tdenetworkmanager/src/knetworkmanager-menuitem.h @@ -28,6 +28,9 @@ #include +#include +#include + class Device; class NetworkMenuItemPrivate; diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp index a1a59ab..996ea1e 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp +++ b/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp @@ -69,9 +69,11 @@ TQStringList WirelessDeviceTray::getToolTipText() { TQStringList tooltip = DeviceTrayComponent::getToolTipText(); - TDENetworkWiFiAPInfo * ap = d->dev->getActiveAccessPoint(); - if (ap) - tooltip.append(i18n("Network: %1").arg(ap->getDisplaySsid())); + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkWiFiAPInfo * ap = deviceConnMan->findAccessPointByBSSID(deviceConnMan->deviceInformation().wiFiInfo.activeAccessPointBSSID); + if (ap) { + tooltip.append(i18n("Network: %1").arg(ap->friendlySSID())); + } return tooltip; } @@ -79,29 +81,27 @@ TQStringList WirelessDeviceTray::getToolTipText() void WirelessDeviceTray::newConnection() { // create a new wireless connection - Connection* conn = new TDEWiFiConnection(); + TDENetworkConnection* conn = new TDEWiFiConnection(); // 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); + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, tray(), "connect_something", false, TQt::WDestructiveClose); dlg->show(); } bool WirelessDeviceTray::findMatchingNetwork(const TDEWiFiConnection* conn, const TQValueList& nets, WirelessNetwork& net) { - Wireless* wireless = conn->getWirelessSetting(); - WirelessSecurity* security = conn->getWirelessSecuritySetting(); + const TDEWiFiConnection* wireless = dynamic_cast(conn); - if (!wireless && !security) + if (!wireless) { return false; + } - for (TQValueList::ConstIterator it = nets.begin(); it != nets.end(); ++it) - { - if (wireless->getEssid() == (*it).getSsid()) - { + for (TQValueList::ConstIterator it = nets.begin(); it != nets.end(); ++it) { + if (wireless->SSID == (*it).getSsid()) { net = *it; return true; - } + } } return false; } @@ -109,16 +109,14 @@ bool WirelessDeviceTray::findMatchingNetwork(const TDEWiFiConnection* conn, cons TDEWiFiConnection* WirelessDeviceTray::findMatchingConnection(const WirelessNetwork& net, const TQValueList& connections) { // try to find a connection matching this network - for (TQValueList::ConstIterator it = connections.begin(); it != connections.end(); ++it) - { - Wireless* wireless = (*it)->getWirelessSetting(); - WirelessSecurity* security = (*it)->getWirelessSecuritySetting(); + for (TQValueList::ConstIterator it = connections.begin(); it != connections.end(); ++it) { + const TDEWiFiConnection* wireless = dynamic_cast(*it); - // should not happen but its ever better to check - if (!wireless || !security) + if (!wireless) { continue; + } - if (wireless->getEssid() == net.getSsid()) + if (wireless->SSID == net.getSsid()) { return *it; } @@ -138,10 +136,13 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) TQValueList 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; + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnection* active_conn = NULL; + if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected)) + && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) { + active_conn = nm->findConnectionByUUID(deviceConnMan->deviceInformation().activeConnectionUUID); + } // add all wireless connections in range // (we may have more then one connection per network) @@ -160,7 +161,7 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) *it, false); int id = menu->insertItem (wirelessNetworkItem, -1, -1); - menu->setItemChecked(id, ((Connection*)(*it) == active_conn)); + menu->setItemChecked(id, ((TDENetworkConnection*)(*it) == active_conn)); menu->connectItem(id, wirelessNetworkItem, TQT_SLOT(slotActivate())); } @@ -177,11 +178,11 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) if ( findMatchingNetwork(*it, nets, net) ) continue; - Info* info = (*it)->getInfoSetting(); - Wireless* wireless = (*it)->getWirelessSetting(); + TDEWiFiConnection* wireless = dynamic_cast(*it); - if (!info || !wireless) + if (!wireless) { continue; + } wirelessNetworkItem = new WirelessNetworkItem (menu, d->dev, @@ -201,7 +202,6 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) // // List available unsaved networks TQPopupMenu* newpopup = new TQPopupMenu(menu); - TDEWiFiConnection* newconn; uint newnetworkItemsAdded = 0; TQValueList newnets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID); @@ -234,23 +234,23 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) void WirelessDeviceTray::addMenuItems(KPopupMenu* menu) { - NMProxy* nm = NMProxy::getInstance(); - TQT_DBusError err; + // get the currently active connection + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); // device title - Subhead* subhead = new Subhead (menu, "subhead", TQString("Wireless Connection (%1)").arg(d->dev->getInterface()), SmallIcon("wireless", TQIconSet::Automatic)); + Subhead* subhead = new Subhead (menu, "subhead", TQString("Wireless Connection (%1)").arg(d->dev->deviceNode()), SmallIcon("wireless", TQIconSet::Automatic)); menu->insertItem (subhead, -1, -1); // bolding subhead instead //menu->insertSeparator(); - if (!nm->getWirelessEnabled(err)) + if (!nm->wiFiEnabled()) { // 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)) + else if (!nm->wiFiHardwareEnabled()) { // wireless disabled -> do not show any connections subhead = new Subhead(menu, "subhead2", i18n("Wireless disabled by Killswitch"), SmallIcon("no", TQIconSet::Automatic)); @@ -263,33 +263,49 @@ void WirelessDeviceTray::addMenuItems(KPopupMenu* menu) // bring the device down KAction* deactivate = tray()->actionCollection()->action("deactivate_device"); - if (deactivate) + if (deactivate) { deactivate->plug(menu); + } } menu->insertSeparator(); } +void WirelessDeviceTray::setPixmapForStates(TDENetworkConnectionStatus::TDENetworkConnectionStatus states, TQString pixmap) { + TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; + while (flag > 0) { + if (states & flag) { + setPixmapForState(flag, pixmap); + } + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); + } +} + void WirelessDeviceTray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { - slotCheckActiveAccessPoint(); - if (state == NM_DEVICE_STATE_ACTIVATED) - { - // trigger an update of the connections seen bssids property + slotCheckActiveAccessPoint(); - TDENetworkWiFiAPInfo * ap = d->dev->getActiveAccessPoint(); + if (state == TDENetworkConnectionStatus::Connected) { + // trigger an update of the connections seen bssids property + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkWiFiAPInfo * ap = deviceConnMan->findAccessPointByBSSID(deviceConnMan->deviceInformation().wiFiInfo.activeAccessPointBSSID); if (ap) { - int strength = ap->getStrength(); - - if (strength > 80) - setPixmapForState((TDENetworkConnectionStatus::TDENetworkConnectionStatus)state, "nm_signal_100"); - else if (strength > 55) - setPixmapForState((TDENetworkConnectionStatus::TDENetworkConnectionStatus)state, "nm_signal_75"); - else if (strength > 30) - setPixmapForState((TDENetworkConnectionStatus::TDENetworkConnectionStatus)state, "nm_signal_50"); - else if (strength > 5) - setPixmapForState((TDENetworkConnectionStatus::TDENetworkConnectionStatus)state, "nm_signal_25"); - else - setPixmapForState((TDENetworkConnectionStatus::TDENetworkConnectionStatus)state, "nm_signal_00"); + int strength = (ap->signalQuality*100.0); + + if (strength > 80) { + setPixmapForStates(state, "nm_signal_100"); + } + else if (strength > 55) { + setPixmapForStates(state, "nm_signal_75"); + } + else if (strength > 30) { + setPixmapForStates(state, "nm_signal_50"); + } + else if (strength > 5) { + setPixmapForStates(state, "nm_signal_25"); + } + else { + setPixmapForStates(state, "nm_signal_00"); + } } } } @@ -298,42 +314,64 @@ 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; - TDEWiFiConnection* active_conn = dynamic_cast(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))); + // get the currently active connection + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnection* active_conn = NULL; + if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected)) + && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) { + active_conn = nm->findConnectionByUUID(deviceConnMan->deviceInformation().activeConnectionUUID); + } + + if (active_conn && deviceConnMan->deviceInformation().statusFlags == TDENetworkConnectionStatus::Connected) { + TDENetworkWiFiAPInfo * activeap = deviceConnMan->findAccessPointByBSSID(deviceConnMan->deviceInformation().wiFiInfo.activeAccessPointBSSID); + if ( activeap != d->activeAccessPoint) { + if (!d->activeAccessPoint.isNull()) { + disconnect( deviceConnMan, TQT_SIGNAL(accessPointStatusChanged(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType)), this, TQT_SLOT(apPropertyChanged(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType))); + } - d->activeAccessPoint = d->dev->getActiveAccessPoint(); + d->activeAccessPoint = activeap; 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()); + connect( deviceConnMan, TQT_SIGNAL(accessPointStatusChanged(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType)), this, TQT_SLOT(apPropertyChanged(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType))); + TDEWiFiConnection* wireless = dynamic_cast(active_conn); + if (wireless) { + if (!(wireless->heardBSSIDs.contains(d->activeAccessPoint->BSSID))) { + wireless->heardBSSIDs.append(d->activeAccessPoint->BSSID); + } + } } } } } -void WirelessDeviceTray::apStrengthChanged(TQ_UINT8 strength) +void WirelessDeviceTray::apPropertyChanged(TDEMACAddress BSSID, TDENetworkAPEventType::TDENetworkAPEventType event) { - kdDebug() << k_funcinfo << (uint)strength << endl; - TDENetworkConnectionStatus::TDENetworkConnectionStatus 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(); + if (event == TDENetworkAPEventType::SignalStrengthChanged) { + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkWiFiAPInfo * ap = deviceConnMan->findAccessPointByBSSID(BSSID); + if (ap) { + TQ_UINT32 strength = (ap->signalQuality*100.0); + kdDebug() << k_funcinfo << strength << endl; + TDENetworkConnectionStatus::TDENetworkConnectionStatus state = deviceConnMan->deviceInformation().statusFlags; + if (strength > 80) { + setPixmapForStates(state, "nm_signal_100"); + } + else if (strength > 55) { + setPixmapForStates(state, "nm_signal_75"); + } + else if (strength > 30) { + setPixmapForStates(state, "nm_signal_50"); + } + else if (strength > 5) { + setPixmapForStates(state, "nm_signal_25"); + } + else { + setPixmapForStates(state, "nm_signal_00"); + } + emit uiUpdated(); + } + } } void WirelessDeviceTray::slotAccessPointAdded(TDENetworkWiFiAPInfo* ap) @@ -353,11 +391,11 @@ WirelessDeviceTray::WirelessDeviceTray (TDENetworkDevice* dev, KSystemTray * par 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"); + setPixmapForState(TDENetworkConnectionStatus::Invalid, "wireless_off"); + setPixmapForState(TDENetworkConnectionStatus::LinkUnavailable, "wireless_off"); + setPixmapForState(TDENetworkConnectionStatus::UnManaged, "wireless_off"); + setPixmapForState(TDENetworkConnectionStatus::Disconnected, "wireless"); + setPixmapForState(TDENetworkConnectionStatus::Connected, "nm_signal_50"); // get notified when the device state changes connect(dev, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), this, TQT_SLOT(slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus))); diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h b/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h index 4a13548..a987b77 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h +++ b/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h @@ -58,7 +58,7 @@ class WirelessDeviceTray : public DeviceTrayComponent void slotCheckActiveAccessPoint(); void newConnection(); protected slots: - void apStrengthChanged(TQ_UINT8 strength); + void apPropertyChanged(TDEMACAddress BSSID, TDENetworkAPEventType::TDENetworkAPEventType event); void slotAccessPointAdded(TDENetworkWiFiAPInfo*); void slotAccessPointRemoved(const TQString&); @@ -68,6 +68,7 @@ class WirelessDeviceTray : public DeviceTrayComponent TQValueList getWirelessConnections(); TDEWiFiConnection* findMatchingConnection(const WirelessNetwork& net, const TQValueList& connection); bool findMatchingNetwork(const TDEWiFiConnection* conn, const TQValueList& nets, WirelessNetwork& net); + void setPixmapForStates(TDENetworkConnectionStatus::TDENetworkConnectionStatus states, TQString pixmap); WirelessDeviceTrayPrivate* d; diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp index c77d2ad..3238c0a 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp +++ b/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp @@ -45,7 +45,7 @@ #define NM_CHECK_VERSION(x,y,z) 0 #endif -TQValueList WirelessManager::getWirelessNetworks(WirelessDevice* dev, TQ_UINT32 match) +TQValueList WirelessManager::getWirelessNetworks(TDENetworkDevice* dev, TQ_UINT32 match) { TQValueList nets; TQValueList aps; @@ -100,7 +100,7 @@ TQValueList WirelessManager::getWirelessNetworks(WirelessDevice return nets; } -TQValueList WirelessManager::getAccessPoints(WirelessDevice* dev) +TQValueList WirelessManager::getAccessPoints(TDENetworkDevice* dev) { // build up AP list depending on one device or on all devices if (dev) { @@ -118,7 +118,7 @@ TQValueList WirelessManager::getAccessPoints(WirelessDevice* dev) #endif for (TQValueList::Iterator it = devs.begin(); it != devs.end(); ++it) { - WirelessDevice* wdev = dynamic_cast(*it); + TDENetworkDevice* wdev = dynamic_cast(*it); if (!wdev) continue; // add all APs from this device @@ -129,17 +129,17 @@ TQValueList WirelessManager::getAccessPoints(WirelessDevice* dev) } } -TQValueList WirelessManager::getWirelessConnections() +TQValueList WirelessManager::getWirelessConnections() { - TQValueList conns; + TQValueList conns; ConnectionStore* store = ConnectionStore::getInstance(); // get all wireless connections TQValueList connections = store->getConnections(NM_SETTING_WIRELESS_SETTING_NAME); for (TQValueList::Iterator it = connections.begin(); it != connections.end(); ++it) { - // cast to WirelessConnection* - WirelessConnection* wireless_conn = dynamic_cast(*it); + // cast to TDEWiFiConnection* + TDEWiFiConnection* wireless_conn = dynamic_cast(*it); if (!wireless_conn) continue; conns.append(wireless_conn); @@ -147,7 +147,7 @@ TQValueList WirelessManager::getWirelessConnections() return conns; } -TQValueList WirelessManager::getAccessPointsForEssid(TQByteArray essid, WirelessDevice* dev) +TQValueList WirelessManager::getAccessPointsForEssid(TQByteArray essid, TDENetworkDevice* dev) { // build up AP list depending on one device or on all devices if (dev) @@ -165,7 +165,7 @@ TQValueList WirelessManager::getAccessPointsForEssid(TQByteArray e #endif for (TQValueList::Iterator it = devs.begin(); it != devs.end(); ++it) { - WirelessDevice* wdev = dynamic_cast(*it); + TDENetworkDevice* wdev = dynamic_cast(*it); if (!wdev) continue; // add all APs from this device diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_manager.h b/tdenetworkmanager/src/knetworkmanager-wireless_manager.h index ab32ee6..ac49a37 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_manager.h +++ b/tdenetworkmanager/src/knetworkmanager-wireless_manager.h @@ -44,16 +44,16 @@ 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 getWirelessNetworks(WirelessDevice* dev = 0, TQ_UINT32 match = WirelessNetwork::MATCH_SSID); + static TQValueList getWirelessNetworks(TDENetworkDevice* dev = 0, TQ_UINT32 match = WirelessNetwork::MATCH_SSID); // get all aps from either one device or from all available devices - static TQValueList getAccessPoints(WirelessDevice* dev = 0); + static TQValueList getAccessPoints(TDENetworkDevice* dev = 0); // get a list of all known wireless connections - static TQValueList getWirelessConnections(); + static TQValueList getWirelessConnections(); // get a list of all APs with a specific SSID - static TQValueList getAccessPointsForEssid(TQByteArray, WirelessDevice* dev = 0); + static TQValueList getAccessPointsForEssid(TQByteArray, TDENetworkDevice* dev = 0); }; diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.cpp index 5956e85..dd7fc81 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.cpp +++ b/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.cpp @@ -45,32 +45,29 @@ #include #include #include -#include - -#include -#include #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" using namespace ConnectionSettings; void WirelessNetworkItem::slotActivate() { - NMProxy* nm = NMProxy::getInstance(); - int id; - TQT_DBusError err; + + TDENetworkConnectionManager* deviceConnMan = _dev->connectionManager(); + printf("slotActivate\n\r"); - if (_dev && nm) + if (_dev && deviceConnMan) { if ( _conn ) { - kdDebug() << "Activate Connection " << _conn->getObjectPath().data() << " on Device " << _dev->getObjectPath().ascii() << endl; - if (!nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), TQT_DBusObjectPath(QCString(_dev->getObjectPath())), _conn->getObjectPath(), err)) + kdDebug() << "Activate Connection " << _conn->UUID.ascii() << " on Device " << _dev->deviceNode().ascii() << endl; + TDENetworkConnectionStatus::TDENetworkConnectionStatus result = deviceConnMan->initiateConnection(_conn->UUID); + if ((result == TDENetworkConnectionStatus::Disconnected) + || (result == TDENetworkConnectionStatus::Invalid)) { kdDebug() << "ActivateDevice failed" << endl; + } } else @@ -85,21 +82,22 @@ void WirelessNetworkItem::slotActivate() TQString WirelessNetworkItem::getDisplayText() { TQString security = ""; - if (_net.getWpaFlags() != NM_802_11_AP_SEC_NONE && _net.getRsnFlags() != NM_802_11_AP_SEC_NONE) + if (((_net.getWpaFlags() & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None) && ((_net.getRsnFlags() & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None)) { security = TQString("(%1/%2)").arg(i18n("WPA")).arg(i18n("RSN")); - else if (_net.getWpaFlags() != NM_802_11_AP_SEC_NONE) + } + else if ((_net.getWpaFlags() & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None) { security = TQString("(%1)").arg(i18n("WPA")); - else if (_net.getRsnFlags() != NM_802_11_AP_SEC_NONE) + } + else if ((_net.getRsnFlags() & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None) { security = TQString("(%2)").arg(i18n("RSN")); + } - Info* info = NULL; - if (_conn) - info = _conn->getInfoSetting(); - - if (info && info->getName() != _net.getDisplaySsid()) - return TQString("%2/%1 %3").arg(TQString::fromUtf8(_net.getDisplaySsid())).arg(info->getName()).arg(security); - else + if (_conn && (_conn->friendlyName != _net.getDisplaySsid())) { + return TQString("%2/%1 %3").arg(TQString::fromUtf8(_net.getDisplaySsid())).arg(_conn->friendlyName).arg(security); + } + else { return TQString("%1 %2").arg(TQString::fromUtf8(_net.getDisplaySsid())).arg(security); + } } void @@ -140,7 +138,7 @@ WirelessNetworkItem::sizeHint () return TQSize (_width, _height); } -WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, TDENetworkDevice* dev, WirelessNetwork& net, WirelessConnection* conn, bool adhoc) +WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, TDENetworkDevice* dev, WirelessNetwork& net, TDEWiFiConnection* conn, bool adhoc) : NetworkMenuItem(dev, conn, 0, 0 ), TQCustomMenuItem () { parent = p; diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.h b/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.h index 1021cc6..960258e 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.h +++ b/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.h @@ -51,7 +51,7 @@ class WirelessNetworkItem : public NetworkMenuItem, public TQCustomMenuItem Q_OBJECT public: - WirelessNetworkItem (TQWidget*, TDENetworkDevice* dev, WirelessNetwork& net, ConnectionSettings::WirelessConnection* conn, bool adhoc); + WirelessNetworkItem (TQWidget*, TDENetworkDevice* dev, WirelessNetwork& net, TDEWiFiConnection* conn, bool adhoc); WirelessNetworkItem (TQWidget*, TDENetworkDevice* dev, WirelessNetwork& net, bool adhoc); ~WirelessNetworkItem (); @@ -70,7 +70,7 @@ class WirelessNetworkItem : public NetworkMenuItem, public TQCustomMenuItem bool _adhoc; WirelessNetwork _net; TDENetworkDevice* _dev; - ConnectionSettings::WirelessConnection* _conn; + TDEWiFiConnection* _conn; /* menu item */ int _width; diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp index ba509dd..66eded2 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp +++ b/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp @@ -121,9 +121,9 @@ TQString WirelessNetwork::getDisplaySsid() const } } -TQ_UINT32 WirelessNetwork::getFlags() const +TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getFlags() const { - TQ_UINT32 flags = NM_802_11_AP_FLAGS_NONE; + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { flags |= (*it)->getFlags(); @@ -131,9 +131,9 @@ TQ_UINT32 WirelessNetwork::getFlags() const return flags; } -TQ_UINT32 WirelessNetwork::getWpaFlags() const +TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getWpaFlags() const { - TQ_UINT32 flags = NM_802_11_AP_SEC_NONE; + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { flags |= (*it)->getWpaFlags(); @@ -141,9 +141,9 @@ TQ_UINT32 WirelessNetwork::getWpaFlags() const return flags; } -TQ_UINT32 WirelessNetwork::getRsnFlags() const +TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getRsnFlags() const { - TQ_UINT32 flags = NM_802_11_AP_SEC_NONE; + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { flags |= (*it)->getRsnFlags(); @@ -153,7 +153,7 @@ TQ_UINT32 WirelessNetwork::getRsnFlags() const bool WirelessNetwork::isEncrypted() const { - return (getFlags() && NM_802_11_AP_FLAGS_PRIVACY); + return (getFlags() & TDENetworkWiFiAPFlags::PrivacySupport); } TQ_UINT8 WirelessNetwork::getStrength() const diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_network.h b/tdenetworkmanager/src/knetworkmanager-wireless_network.h index 9fcf809..ff3c09b 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_network.h +++ b/tdenetworkmanager/src/knetworkmanager-wireless_network.h @@ -61,13 +61,13 @@ class WirelessNetwork bool addAP(const AccessPoint * const); // combined flags of all APs - TQ_UINT32 getFlags() const; + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags getFlags() const; // combined wpa-flags of all APs - TQ_UINT32 getWpaFlags() const; + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags getWpaFlags() const; // combined rsn-flags of all APs - TQ_UINT32 getRsnFlags() const; + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags getRsnFlags() const; // ssid of all APs const TQByteArray getSsid() const; -- cgit v1.2.1 From 3f5288877b9e475abff17385dae4719513c131d5 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 5 Sep 2012 20:01:53 -0500 Subject: Remove unneeded connection files --- tdenetworkmanager/src/CMakeLists.txt | 4 - .../src/knetworkmanager-cdma_connection.cpp | 61 -------------- .../src/knetworkmanager-cdma_connection.h | 50 ------------ .../src/knetworkmanager-generic_connection.cpp | 91 --------------------- .../src/knetworkmanager-generic_connection.h | 58 ------------- .../src/knetworkmanager-gsm_connection.cpp | 60 -------------- .../src/knetworkmanager-gsm_connection.h | 50 ------------ .../src/knetworkmanager-ppp_connection.cpp | 54 ------------- .../src/knetworkmanager-ppp_connection.h | 51 ------------ .../src/knetworkmanager-vpn_connection.cpp | 85 ------------------- .../src/knetworkmanager-vpn_connection.h | 54 ------------- .../src/knetworkmanager-wired_connection.cpp | 84 ------------------- .../src/knetworkmanager-wired_connection.h | 55 ------------- .../src/knetworkmanager-wireless_connection.cpp | 94 ---------------------- .../src/knetworkmanager-wireless_connection.h | 59 -------------- 15 files changed, 910 deletions(-) delete mode 100644 tdenetworkmanager/src/knetworkmanager-cdma_connection.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-cdma_connection.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-generic_connection.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-generic_connection.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-gsm_connection.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-gsm_connection.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-ppp_connection.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-ppp_connection.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-vpn_connection.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-vpn_connection.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-wired_connection.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-wired_connection.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-wireless_connection.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-wireless_connection.h diff --git a/tdenetworkmanager/src/CMakeLists.txt b/tdenetworkmanager/src/CMakeLists.txt index 293cfcb..c3961da 100644 --- a/tdenetworkmanager/src/CMakeLists.txt +++ b/tdenetworkmanager/src/CMakeLists.txt @@ -55,10 +55,6 @@ tde_add_tdeinit_executable( knetworkmanager AUTOMOC knetworkmanager-wired_device_tray.cpp knetworkmanager-wireless_device_tray.cpp knetworkmanager-wireless_menuitem.cpp knetworkmanager-menuitem.cpp knetworkmanager-menu_subhead.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-nmsettings.cpp sha1.cpp md5.cpp xmlmarshaller.cpp knetworkmanager-wireless_network.cpp knetworkmanager-wireless_manager.cpp diff --git a/tdenetworkmanager/src/knetworkmanager-cdma_connection.cpp b/tdenetworkmanager/src/knetworkmanager-cdma_connection.cpp deleted file mode 100644 index 9118c49..0000000 --- a/tdenetworkmanager/src/knetworkmanager-cdma_connection.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-cdma_connection.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 -#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(getSetting(NM_SETTING_CDMA_SETTING_NAME)); -} - -ConnectionSettings::Serial* ConnectionSettings::CDMAConnection::getSerialSetting() const -{ - return dynamic_cast(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/tdenetworkmanager/src/knetworkmanager-cdma_connection.h b/tdenetworkmanager/src/knetworkmanager-cdma_connection.h deleted file mode 100644 index 0d52d22..0000000 --- a/tdenetworkmanager/src/knetworkmanager-cdma_connection.h +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-cdma_connection.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 - - public: - CDMAConnection(); - ~CDMAConnection(); - CDMA* getCDMASetting() const; - Serial* getSerialSetting() const; - Connection* duplicate(); - }; -} // namespace ConnectionSettings - -#endif - diff --git a/tdenetworkmanager/src/knetworkmanager-generic_connection.cpp b/tdenetworkmanager/src/knetworkmanager-generic_connection.cpp deleted file mode 100644 index 9f9b12d..0000000 --- a/tdenetworkmanager/src/knetworkmanager-generic_connection.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-generic_connection.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include - -/* kde headers */ -#include -#include - -/* TQDbus headers */ -#include -#include -#include -#include -#include - -/* NM headers */ -#include - -/* 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(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(getSetting("connection")); -} - -#include "knetworkmanager-generic_connection.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-generic_connection.h b/tdenetworkmanager/src/knetworkmanager-generic_connection.h deleted file mode 100644 index 6acbd32..0000000 --- a/tdenetworkmanager/src/knetworkmanager-generic_connection.h +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-generic_connection.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -#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 - - 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/tdenetworkmanager/src/knetworkmanager-gsm_connection.cpp b/tdenetworkmanager/src/knetworkmanager-gsm_connection.cpp deleted file mode 100644 index 307f40f..0000000 --- a/tdenetworkmanager/src/knetworkmanager-gsm_connection.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-gsm_connection.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 -#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(getSetting(NM_SETTING_GSM_SETTING_NAME)); -} - -ConnectionSettings::Serial* ConnectionSettings::GSMConnection::getSerialSetting() const -{ - return dynamic_cast(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/tdenetworkmanager/src/knetworkmanager-gsm_connection.h b/tdenetworkmanager/src/knetworkmanager-gsm_connection.h deleted file mode 100644 index 0e4dc0e..0000000 --- a/tdenetworkmanager/src/knetworkmanager-gsm_connection.h +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-gsm_connection.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 - - public: - GSMConnection(); - ~GSMConnection(); - GSM* getGSMSetting() const; - Serial* getSerialSetting() const; - Connection* duplicate(); - }; -}; // namespace ConnectionSettings - -#endif - diff --git a/tdenetworkmanager/src/knetworkmanager-ppp_connection.cpp b/tdenetworkmanager/src/knetworkmanager-ppp_connection.cpp deleted file mode 100644 index 9595c31..0000000 --- a/tdenetworkmanager/src/knetworkmanager-ppp_connection.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-ppp_connection.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 -#include - -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(getSetting(NM_SETTING_IP4_CONFIG_SETTING_NAME)); -} - -ConnectionSettings::PPP* ConnectionSettings::PPPConnection::getPPPSetting() const -{ - return dynamic_cast(getSetting(NM_SETTING_PPP_SETTING_NAME)); -} - -#include "knetworkmanager-ppp_connection.moc" - -// vim: sw=4 sts=4 noet tw=100 diff --git a/tdenetworkmanager/src/knetworkmanager-ppp_connection.h b/tdenetworkmanager/src/knetworkmanager-ppp_connection.h deleted file mode 100644 index e58e553..0000000 --- a/tdenetworkmanager/src/knetworkmanager-ppp_connection.h +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-ppp_connection.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 - - public: - PPPConnection(const TQString& infoName); - ~PPPConnection(); - PPP* getPPPSetting() const; - IPv4* getIPv4Setting() const; - }; -} // namespace ConnectionSettings - -#endif - diff --git a/tdenetworkmanager/src/knetworkmanager-vpn_connection.cpp b/tdenetworkmanager/src/knetworkmanager-vpn_connection.cpp deleted file mode 100644 index e15f2a9..0000000 --- a/tdenetworkmanager/src/knetworkmanager-vpn_connection.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-vpn_connection.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include - -/* kde headers */ -#include -#include - -/* TQDbus headers */ -#include -#include -#include -#include -#include - -/* NM headers */ -#include - -/* 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(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/tdenetworkmanager/src/knetworkmanager-vpn_connection.h b/tdenetworkmanager/src/knetworkmanager-vpn_connection.h deleted file mode 100644 index 6d504f5..0000000 --- a/tdenetworkmanager/src/knetworkmanager-vpn_connection.h +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-vpn_connection.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -#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 - - public: - VPNConnection(); - - VPN* getVPNSetting() const; - ConnectionSetting* getVPNSettingConnectionCore() const; - Connection* duplicate(); - }; -} -#endif /* KNETWORKMANAGER_VPN_CONNECTION_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-wired_connection.cpp b/tdenetworkmanager/src/knetworkmanager-wired_connection.cpp deleted file mode 100644 index 6eff4ee..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wired_connection.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wired_connection.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include - -/* kde headers */ -#include -#include - -/* TQDbus headers */ -#include -#include -#include -#include -#include - -/* NM headers */ -#include - -/* 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(getSetting(NM_SETTING_WIRED_SETTING_NAME)); -} - -IPv4* WiredConnection::getIPv4Setting() const -{ - return dynamic_cast(getSetting("ipv4")); -} - -Connection* WiredConnection::duplicate() -{ - WiredConnection* conn = new WiredConnection(); - conn->updateSettings(this); - return conn; -} - -#include "knetworkmanager-wired_connection.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-wired_connection.h b/tdenetworkmanager/src/knetworkmanager-wired_connection.h deleted file mode 100644 index e641bfa..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wired_connection.h +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wired_connection.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include - -#include "knetworkmanager-generic_connection.h" -#include "knetworkmanager-connection_setting.h" - -class TQDBusObjectPath; - -namespace ConnectionSettings -{ - - class Wired; - class IPv4; - - class WiredConnection : public GenericConnection - { - Q_OBJECT - - public: - WiredConnection(); - - Wired* getWiredSetting() const; - IPv4* getIPv4Setting() const; - Connection* duplicate(); - }; -} -#endif /* KNETWORKMANAGER_WIRED_CONNECTION_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_connection.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_connection.cpp deleted file mode 100644 index b11879f..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wireless_connection.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wireless_connection.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include - -/* kde headers */ -#include -#include - -/* TQDbus headers */ -#include -#include -#include -#include -#include - -/* NM headers */ -#include - -/* 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(getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); -} - -WirelessSecurity* WirelessConnection::getWirelessSecuritySetting() const -{ - return dynamic_cast(getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)); -} - -IPv4* WirelessConnection::getIPv4Setting() const -{ - return dynamic_cast(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/tdenetworkmanager/src/knetworkmanager-wireless_connection.h b/tdenetworkmanager/src/knetworkmanager-wireless_connection.h deleted file mode 100644 index b559ab1..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wireless_connection.h +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wireless_connection.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include - -#include "knetworkmanager-generic_connection.h" -#include "knetworkmanager-connection_setting.h" - -class TQDBusObjectPath; -namespace ConnectionSettings -{ - - class Info; - class Wireless; - class WirelessSecurity; - class IPv4; - - typedef TQMap ConnectionMap; - - class WirelessConnection : public GenericConnection - { - Q_OBJECT - - public: - WirelessConnection(); - - Wireless* getWirelessSetting() const; - WirelessSecurity* getWirelessSecuritySetting() const; - IPv4* getIPv4Setting() const; - Connection* duplicate(); - }; -} -#endif /* KNETWORKMANAGER_WIRELESS_CONNECTION_H */ -- cgit v1.2.1 From c5bbf78c1b8af92f3b319656704adaa8083eb260 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 5 Sep 2012 20:09:03 -0500 Subject: Remove additional obsolete files --- tdenetworkmanager/src/CMakeLists.txt | 3 +- .../src/knetworkmanager-nmsettings.cpp | 162 --- tdenetworkmanager/src/knetworkmanager-nmsettings.h | 77 -- .../src/knetworkmanager-wireless_manager.cpp | 26 +- .../src/knetworkmanager-wireless_manager.h | 4 +- .../src/knetworkmanager-wireless_network.cpp | 23 +- .../src/knetworkmanager-wireless_network.h | 8 +- tdenetworkmanager/src/xmlmarshaller.cpp | 1109 -------------------- tdenetworkmanager/src/xmlmarshaller.h | 42 - 9 files changed, 23 insertions(+), 1431 deletions(-) delete mode 100644 tdenetworkmanager/src/knetworkmanager-nmsettings.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-nmsettings.h delete mode 100644 tdenetworkmanager/src/xmlmarshaller.cpp delete mode 100644 tdenetworkmanager/src/xmlmarshaller.h diff --git a/tdenetworkmanager/src/CMakeLists.txt b/tdenetworkmanager/src/CMakeLists.txt index c3961da..9c89dfc 100644 --- a/tdenetworkmanager/src/CMakeLists.txt +++ b/tdenetworkmanager/src/CMakeLists.txt @@ -55,8 +55,7 @@ tde_add_tdeinit_executable( knetworkmanager AUTOMOC knetworkmanager-wired_device_tray.cpp knetworkmanager-wireless_device_tray.cpp knetworkmanager-wireless_menuitem.cpp knetworkmanager-menuitem.cpp knetworkmanager-menu_subhead.cpp - knetworkmanager-nmsettings.cpp - sha1.cpp md5.cpp xmlmarshaller.cpp + sha1.cpp md5.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 diff --git a/tdenetworkmanager/src/knetworkmanager-nmsettings.cpp b/tdenetworkmanager/src/knetworkmanager-nmsettings.cpp deleted file mode 100644 index e0227c7..0000000 --- a/tdenetworkmanager/src/knetworkmanager-nmsettings.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-nminfo_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Valentine Sinitsyn - * - * 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 -#include - -#include - -#include -#include - -#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& connections, TQT_DBusError& /*error*/) -{ - // return connections - ConnectionStore* cstore = ConnectionStore::getInstance(); - TQValueList conns = cstore->getConnections(); - - for (TQValueList::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/tdenetworkmanager/src/knetworkmanager-nmsettings.h b/tdenetworkmanager/src/knetworkmanager-nmsettings.h deleted file mode 100644 index c9769c1..0000000 --- a/tdenetworkmanager/src/knetworkmanager-nmsettings.h +++ /dev/null @@ -1,77 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-nminfo_dbus.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -#include "knetworkmanager-connection_setting.h" -#include "dbus/networkmanagersettings.h" - -class Network; -class TQT_DBusObjectPath; -class NMSettingsPrivate; - -class NMSettings : public TQObject, DBus::SettingsInterface -{ - Q_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& 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/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp index 3238c0a..2137939 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp +++ b/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp @@ -41,24 +41,20 @@ #include "knetworkmanager-nm_proxy.h" #include "knetworkmanager-devicestore.h" -#if !defined(NM_CHECK_VERSION) -#define NM_CHECK_VERSION(x,y,z) 0 -#endif - TQValueList WirelessManager::getWirelessNetworks(TDENetworkDevice* dev, TQ_UINT32 match) { TQValueList nets; - TQValueList aps; + TQValueList aps; // fetch all APs aps = WirelessManager::getAccessPoints(dev); // now group the APs together according to their security settings - for (TQValueList::Iterator apit = aps.begin(); apit != aps.end(); ++apit) + for (TQValueList::Iterator apit = aps.begin(); apit != aps.end(); ++apit) { bool found = false; // no hidden APs - AccessPoint * ap = *apit; + TDENetworkWiFiAPInfo * ap = *apit; if ( ap ) { if (!ap->isValid()) continue; @@ -100,22 +96,18 @@ TQValueList WirelessManager::getWirelessNetworks(TDENetworkDevi return nets; } -TQValueList WirelessManager::getAccessPoints(TDENetworkDevice* dev) +TQValueList WirelessManager::getAccessPoints(TDENetworkDevice* dev) { // build up AP list depending on one device or on all devices if (dev) { return dev->accessPoints(); } else { - TQValueList aps; + TQValueList aps; DeviceStore* store = DeviceStore::getInstance(); if (store) { -#if NM_CHECK_VERSION(0,8,992) TQValueList devs = store->getDevices(NM_DEVICE_TYPE_WIFI); -#else - TQValueList devs = store->getDevices(DEVICE_TYPE_802_11_WIRELESS); -#endif for (TQValueList::Iterator it = devs.begin(); it != devs.end(); ++it) { TDENetworkDevice* wdev = dynamic_cast(*it); @@ -147,22 +139,18 @@ TQValueList WirelessManager::getWirelessConnections() return conns; } -TQValueList WirelessManager::getAccessPointsForEssid(TQByteArray essid, TDENetworkDevice* dev) +TQValueList WirelessManager::getAccessPointsForEssid(TQByteArray essid, TDENetworkDevice* dev) { // build up AP list depending on one device or on all devices if (dev) return dev->accessPointsForEssid(essid); else { - TQValueList aps; + TQValueList aps; DeviceStore* store = DeviceStore::getInstance(); if (store) { -#if NM_CHECK_VERSION(0,8,992) TQValueList devs = store->getDevices(NM_DEVICE_TYPE_WIFI); -#else - TQValueList devs = store->getDevices(DEVICE_TYPE_802_11_WIRELESS); -#endif for (TQValueList::Iterator it = devs.begin(); it != devs.end(); ++it) { TDENetworkDevice* wdev = dynamic_cast(*it); diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_manager.h b/tdenetworkmanager/src/knetworkmanager-wireless_manager.h index ac49a37..75d9f4a 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_manager.h +++ b/tdenetworkmanager/src/knetworkmanager-wireless_manager.h @@ -47,13 +47,13 @@ class WirelessManager static TQValueList getWirelessNetworks(TDENetworkDevice* dev = 0, TQ_UINT32 match = WirelessNetwork::MATCH_SSID); // get all aps from either one device or from all available devices - static TQValueList getAccessPoints(TDENetworkDevice* dev = 0); + static TQValueList getAccessPoints(TDENetworkDevice* dev = 0); // get a list of all known wireless connections static TQValueList getWirelessConnections(); // get a list of all APs with a specific SSID - static TQValueList getAccessPointsForEssid(TQByteArray, TDENetworkDevice* dev = 0); + static TQValueList getAccessPointsForEssid(TQByteArray, TDENetworkDevice* dev = 0); }; diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp index 66eded2..3b96bb2 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp +++ b/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp @@ -22,24 +22,17 @@ * **************************************************************************/ -// NM includes -#include - // KNM includes #include "knetworkmanager.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-accesspoint.h" #include "knetworkmanager-wireless_network.h" -// KDE includes +// TDE includes #include // TQt includes #include #include -using namespace ConnectionSettings; - class WirelessNetworkPrivate { public: @@ -55,7 +48,7 @@ class WirelessNetworkPrivate bool active; TQ_UINT32 match; - TQValueList aps; + TQValueList aps; }; WirelessNetwork::WirelessNetwork(const WirelessNetwork& other) @@ -84,7 +77,7 @@ WirelessNetwork& WirelessNetwork::operator= (const WirelessNetwork& other) return *this; } -bool WirelessNetwork::contains (const AccessPoint * const ap) +bool WirelessNetwork::contains (const TDENetworkWiFiAPInfo * const ap) { if ( (d->match & MATCH_SSID) && getSsid() != ap->getSsidByteArray()) return false; @@ -93,7 +86,7 @@ bool WirelessNetwork::contains (const AccessPoint * const ap) return true; } -bool WirelessNetwork::addAP(const AccessPoint * const ap) +bool WirelessNetwork::addAP(const TDENetworkWiFiAPInfo * const ap) { if ( this->contains( ap ) || d->aps.isEmpty()) { @@ -124,7 +117,7 @@ TQString WirelessNetwork::getDisplaySsid() const TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getFlags() const { TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; - for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) + for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { flags |= (*it)->getFlags(); } @@ -134,7 +127,7 @@ TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getFlags() const TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getWpaFlags() const { TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; - for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) + for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { flags |= (*it)->getWpaFlags(); } @@ -144,7 +137,7 @@ TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getWpaFlags() cons TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getRsnFlags() const { TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; - for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) + for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { flags |= (*it)->getRsnFlags(); } @@ -159,7 +152,7 @@ bool WirelessNetwork::isEncrypted() const TQ_UINT8 WirelessNetwork::getStrength() const { TQ_UINT8 strength = 0; - for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) + for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { if ((*it)->getStrength() > strength) strength = (*it)->getStrength(); diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_network.h b/tdenetworkmanager/src/knetworkmanager-wireless_network.h index ff3c09b..979eddc 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_network.h +++ b/tdenetworkmanager/src/knetworkmanager-wireless_network.h @@ -29,8 +29,10 @@ #include +#include +#include + class KNetworkManager; -class AccessPoint; class WirelessNetworkPrivate; /* @@ -55,10 +57,10 @@ class WirelessNetwork WirelessNetwork& operator= (const WirelessNetwork&); // check if the AccessPoint represents the same net - bool contains(const AccessPoint * const); + bool contains(const TDENetworkWiFiAPInfo * const); // add an AP to the Network - bool addAP(const AccessPoint * const); + bool addAP(const TDENetworkWiFiAPInfo * const); // combined flags of all APs TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags getFlags() const; diff --git a/tdenetworkmanager/src/xmlmarshaller.cpp b/tdenetworkmanager/src/xmlmarshaller.cpp deleted file mode 100644 index a826e39..0000000 --- a/tdenetworkmanager/src/xmlmarshaller.cpp +++ /dev/null @@ -1,1109 +0,0 @@ -/*************************************************************************** - * - * Copyright (C) 2008 by Kevin Krammer - * - * 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 -#include -#include -#include -#include - -#include -#include - -#include - -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& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap::const_iterator it = map.begin(); - TQT_DBusDataMap::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& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap::const_iterator it = map.begin(); - TQT_DBusDataMap::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& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap::const_iterator it = map.begin(); - TQT_DBusDataMap::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& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap::const_iterator it = map.begin(); - TQT_DBusDataMap::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& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap::const_iterator it = map.begin(); - TQT_DBusDataMap::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& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap::const_iterator it = map.begin(); - TQT_DBusDataMap::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& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap::const_iterator it = map.begin(); - TQT_DBusDataMap::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& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap::const_iterator it = map.begin(); - TQT_DBusDataMap::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& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap::const_iterator it = map.begin(); - TQT_DBusDataMap::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 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 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 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 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 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 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 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 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 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 items = list.toTQValueList(); - TQValueList::const_iterator it = items.begin(); - TQValueList::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 members = data.toStruct(); - TQValueList::const_iterator it = members.begin(); - TQValueList::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 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 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/tdenetworkmanager/src/xmlmarshaller.h b/tdenetworkmanager/src/xmlmarshaller.h deleted file mode 100644 index f86ef92..0000000 --- a/tdenetworkmanager/src/xmlmarshaller.h +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************************** - * - * Copyright (C) 2008 by Kevin Krammer - * - * 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 - -- cgit v1.2.1 From fed6fccc41db9ffac1b1e88411faa7e2debc8b71 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 6 Sep 2012 10:37:18 -0500 Subject: More API porting --- tdenetworkmanager/src/CMakeLists.txt | 10 +- tdenetworkmanager/src/devicetraycomponent.cpp | 84 +++++++------ tdenetworkmanager/src/devicetraycomponent.h | 56 +++++---- .../src/knetworkmanager-connection_editor.cpp | 98 +++++++-------- .../src/knetworkmanager-connection_editor.h | 10 +- .../src/knetworkmanager-device_tray.h | 3 + .../src/knetworkmanager-wireless_manager.cpp | 136 ++++++++++++--------- .../src/knetworkmanager-wireless_network.cpp | 34 +++--- .../knetworkmanager-connection_settings_dialog.cpp | 28 ----- 9 files changed, 229 insertions(+), 230 deletions(-) diff --git a/tdenetworkmanager/src/CMakeLists.txt b/tdenetworkmanager/src/CMakeLists.txt index 9c89dfc..a379be9 100644 --- a/tdenetworkmanager/src/CMakeLists.txt +++ b/tdenetworkmanager/src/CMakeLists.txt @@ -57,10 +57,12 @@ tde_add_tdeinit_executable( knetworkmanager AUTOMOC knetworkmanager-menu_subhead.cpp sha1.cpp md5.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 + knetworkmanager-connection_editor.cpp + devicetraycomponent.cpp traycomponent.cpp + #knetworkmanager-plugin.cpp knetworkmanager-vpnplugin.cpp + #knetworkmanager-pluginmanager.cpp knetworkmanager-vpnservice.cpp knetworkmanager-vpnmanager.cpp + #knetworkmanager-vpnauthenticationdialog.cpp + #vpn_tray_component.cpp EMBED tdenetwork-connection-configwidgets-static tdenetwork-connection-settings-static LINK tdecore-shared tdeui-shared kutils-shared ${DBUS_TQT_LIBRARIES} ) diff --git a/tdenetworkmanager/src/devicetraycomponent.cpp b/tdenetworkmanager/src/devicetraycomponent.cpp index d0b0929..648ffa8 100644 --- a/tdenetworkmanager/src/devicetraycomponent.cpp +++ b/tdenetworkmanager/src/devicetraycomponent.cpp @@ -24,10 +24,7 @@ along with this program. If not, see . #include #include -#include "knetworkmanager-device.h" -#include "knetworkmanager-nm_proxy.h" - -TQString pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { +TQString DeviceTrayComponent::pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; while (flag > 0) { if (state & flag) { @@ -40,7 +37,7 @@ TQString pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStat return TQString::null; } -TQString movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { +TQString DeviceTrayComponent::movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; while (flag > 0) { if (state & flag) { @@ -53,7 +50,7 @@ TQString movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatu return TQString::null; } -TQString tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { +TQString DeviceTrayComponent::tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; while (flag > 0) { if (state & flag) { @@ -66,7 +63,7 @@ TQString tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionSta return TQString::null; } -DeviceTrayComponent::DeviceTrayComponent(Device * device, KSystemTray * parent, const char * name ) +DeviceTrayComponent::DeviceTrayComponent(TDENetworkDevice * device, KSystemTray * parent, const char * name ) : TrayComponent(parent, name), m_device(device) { connect( m_device, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), TQT_SLOT(deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus))); @@ -107,9 +104,10 @@ TDENetworkDevice* DeviceTrayComponent::device() const TQStringList DeviceTrayComponent::getToolTipText() { TQStringList list; - TDENetworkConnectionStatus::TDENetworkConnectionStatus state = m_device->getState(); + TDENetworkConnectionManager* deviceConnMan = m_device->connectionManager(); + TDENetworkConnectionStatus::TDENetworkConnectionStatus state = deviceConnMan->deviceInformation().statusFlags; if (tooltipForConnState(state) != "") { - list.append(i18n("Device: %1").arg(m_device->getInterface())); + list.append(i18n("Device: %1").arg(m_device->deviceNode())); list.append(i18n("State: %1").arg(tooltipForConnState(state))); } return list; @@ -118,55 +116,55 @@ TQStringList DeviceTrayComponent::getToolTipText() TQPixmap DeviceTrayComponent::pixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { - if (pixmapForConnState(state) != "") { - return KSystemTray::loadIcon(pixmapForConnState(state)); - } else { - return TQPixmap(); - } + if (pixmapForConnState(state) != "") { + return KSystemTray::loadIcon(pixmapForConnState(state)); + } + else { + return TQPixmap(); + } } TQMovie DeviceTrayComponent::movieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { - if (movieForConnState(state) != "") { - return TQMovie( KGlobal::iconLoader()->moviePath(movieForConnState(state), KIcon::Panel)); - } else { - return TQMovie(); - } + if (movieForConnState(state) != "") { + return TQMovie( KGlobal::iconLoader()->moviePath(movieForConnState(state), KIcon::Panel)); + } + else { + return TQMovie(); + } } void DeviceTrayComponent::setMovieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state, TQString movie) { - m_movies[state] = movie; + m_movies[state] = movie; } void DeviceTrayComponent::setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state, TQString pixmap) { - m_pixmaps[state] = pixmap; + m_pixmaps[state] = pixmap; } void DeviceTrayComponent::deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus 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 TDENetworkConnectionStatus::EstablishingLink: - emit needsCenterStage(this, true); - break; - case TDENetworkConnectionStatus::Connected: - nm = NMProxy::getInstance(); - if ( m_device == nm->getDefaultDevice() ) { - emit needsCenterStage(this, true); - } - break; - case TDENetworkConnectionStatus::LinkUnavailable: - case TDENetworkConnectionStatus::Disconnected: - case TDENetworkConnectionStatus::Failed: - emit needsCenterStage(this, false); - break; - default: - break; - } + //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? + switch (state) { + case TDENetworkConnectionStatus::EstablishingLink: + emit needsCenterStage(this, true); + break; + case TDENetworkConnectionStatus::Connected: +// if ( m_device == nm->getDefaultDevice() ) { + emit needsCenterStage(this, true); +// } + break; + case TDENetworkConnectionStatus::LinkUnavailable: + case TDENetworkConnectionStatus::Disconnected: + case TDENetworkConnectionStatus::Failed: + emit needsCenterStage(this, false); + break; + default: + break; + } } #include "devicetraycomponent.moc" diff --git a/tdenetworkmanager/src/devicetraycomponent.h b/tdenetworkmanager/src/devicetraycomponent.h index e162020..52a9bea 100644 --- a/tdenetworkmanager/src/devicetraycomponent.h +++ b/tdenetworkmanager/src/devicetraycomponent.h @@ -37,28 +37,38 @@ class KSystemTray; class DeviceTrayComponent : public TrayComponent { -Q_OBJECT - -public: - DeviceTrayComponent(TDENetworkDevice * device, KSystemTray * parent, const char * name ); - virtual ~DeviceTrayComponent(); - TQPixmap pixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); - TQMovie movieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); - virtual TQStringList getToolTipText(); - TDENetworkDevice* device() const; -signals: - void needsCenterStage(TrayComponent *, bool); -public slots: - virtual void newConnection() = 0; -protected slots: - void deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus); -protected: - void setMovieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString); - void setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString); -private: - TDENetworkDevice * m_device; - TQMap m_movies; - TQMap m_pixmaps; - TQMap m_tooltips; + Q_OBJECT + + public: + DeviceTrayComponent(TDENetworkDevice * device, KSystemTray * parent, const char * name ); + virtual ~DeviceTrayComponent(); + TQPixmap pixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); + TQMovie movieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); + virtual TQStringList getToolTipText(); + TDENetworkDevice* device() const; + + signals: + void needsCenterStage(TrayComponent *, bool); + + public slots: + virtual void newConnection() = 0; + + protected slots: + void deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + + protected: + void setMovieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString); + void setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString); + + private: + TQString pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); + TQString movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); + TQString tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); + + private: + TDENetworkDevice * m_device; + TQMap m_movies; + TQMap m_pixmaps; + TQMap m_tooltips; }; #endif // DEVICE_TRAY_COMPONENT_H diff --git a/tdenetworkmanager/src/knetworkmanager-connection_editor.cpp b/tdenetworkmanager/src/knetworkmanager-connection_editor.cpp index a80f014..6d2368f 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_editor.cpp +++ b/tdenetworkmanager/src/knetworkmanager-connection_editor.cpp @@ -43,15 +43,8 @@ // 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-vpnservice.h" -#include "knetworkmanager-vpnmanager.h" using namespace ConnectionSettings; @@ -66,20 +59,22 @@ class ConnectionListViewItem : public KListViewItem : KListViewItem(parent) , _conn(connection) { - Info* info = _conn->getInfoSetting(); - if (info) - { - setText(0, info->getName()); - setText(1, info->getDevType()); + if (_conn) { + setText(0, _conn->friendlyName); + setText(1, TDENetworkConnectionManager::friendlyConnectionTypeName(_conn->type())); // TODO: Move to a Factory - if (info->getDevType() == NM_SETTING_WIRED_SETTING_NAME) + if (_conn->type() == TDENetworkConnectionType::WiredEthernet) { setPixmap(0, KGlobal::iconLoader()->loadIcon("wired", KIcon::Small)); - else if (info->getDevType() == NM_SETTING_WIRELESS_SETTING_NAME) + } + else if (_conn->type() == TDENetworkConnectionType::WiFi) { 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 + } +// else if (_conn->type() == TDENetworkConnectionType::VPN) { +// setPixmap(0, KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small)); +// } + else { setPixmap(0, KGlobal::iconLoader()->loadIcon("help", KIcon::Small)); + } } } @@ -109,8 +104,9 @@ ConnectionEditorImpl::ConnectionEditorImpl(TQWidget* parent, const char* name, b 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())); +// if (!VPNManager::getVPNServices().isEmpty()) { +// popup->insertItem(KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small), i18n("VPN"), this, TQT_SLOT(slotNewVPNConnection())); +// } pbNew->setPopup(popup); @@ -128,8 +124,9 @@ ConnectionEditorImpl::ConnectionEditorImpl(TQWidget* parent, const char* name, b ConnectionEditorImpl::~ConnectionEditorImpl() { // remove the popupmenu - if (pbNew->popup()) + if (pbNew->popup()) { delete pbNew->popup(); + } } /* @@ -138,7 +135,7 @@ ConnectionEditorImpl::~ConnectionEditorImpl() void ConnectionEditorImpl::slotNewWirelessConnection() { // create a new wireless connection - slotEditNewConnection(new WirelessConnection()); + slotEditNewConnection(new TDEWiFiConnection()); } /* @@ -146,7 +143,7 @@ void ConnectionEditorImpl::slotNewWirelessConnection() */ void ConnectionEditorImpl::slotNewWiredConnection() { - slotEditNewConnection(new WiredConnection()); + slotEditNewConnection(new TDEWiredEthernetConnection()); } /* @@ -154,7 +151,7 @@ void ConnectionEditorImpl::slotNewWiredConnection() */ void ConnectionEditorImpl::slotNewVPNConnection() { - slotEditNewConnection(new VPNConnection()); +// slotEditNewConnection(new TDEVPNConnection()); } /* @@ -164,11 +161,11 @@ void ConnectionEditorImpl::slotEditNewConnection(TDENetworkConnection* conn) { // open a dialog for editing the connection ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, this, "connect_something", false, TQt::WDestructiveClose); - connect(dlg, TQT_SIGNAL(connectionSaved()), this, TQT_SLOT(slotRefershConnectionList())); + connect(dlg, TQT_SIGNAL(connectionSaved()), this, TQT_SLOT(slotRefreshConnectionList())); dlg->show(); } -void ConnectionEditorImpl::slotRefershConnectionList() +void ConnectionEditorImpl::slotRefreshConnectionList() { fillConnectionList(); } @@ -179,22 +176,25 @@ void ConnectionEditorImpl::slotRefershConnectionList() void ConnectionEditorImpl::slotEditCurrentConnection() { ConnectionListViewItem* item = dynamic_cast(lvConnections->currentItem()); - if (!item) + if (!item) { return; + } + + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (!nm) { + return; + } TDENetworkConnection* conn = item->_conn; - Storage* storage = Storage::getInstance(); - bool hasSecretsStored = storage->hasSecretsStored(conn); // we need the secrets for editing - if (hasSecretsStored) - storage->restoreAllSecrets(conn); + nm->loadConnectionSecrets(conn->UUID); ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, false, this, "connect_something", false, TQt::WDestructiveClose); dlg->show(); // save all connections (if not done already) - storage->saveConnections(); + nm->saveConnection(conn); } @@ -204,16 +204,21 @@ void ConnectionEditorImpl::slotEditCurrentConnection() void ConnectionEditorImpl::slotRemoveCurrentConnection() { ConnectionListViewItem* item = dynamic_cast(lvConnections->currentItem()); - if (!item) + if (!item) { return; + } + + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (!nm) { + return; + } - ConnectionStore* cstore = ConnectionStore::getInstance(); TDENetworkConnection* conn = item->_conn; lvConnections->takeItem(item); delete item; - cstore->removeConnection(conn); + nm->deleteConnection(conn->UUID); } /* @@ -221,28 +226,17 @@ void ConnectionEditorImpl::slotRemoveCurrentConnection() */ void ConnectionEditorImpl::fillConnectionList() { - ConnectionStore* cstore = ConnectionStore::getInstance(); - TQValueList conns = cstore->getConnections(); - TQValueList::Iterator it = conns.begin(); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (!nm) { + return; + } lvConnections->clear(); - for (; it != conns.end(); ++it) - { + TDENetworkConnectionList* allconmap = nm->connections(); + for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) { TDENetworkConnection* conn = *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; - + new ConnectionListViewItem(lvConnections, conn); } } diff --git a/tdenetworkmanager/src/knetworkmanager-connection_editor.h b/tdenetworkmanager/src/knetworkmanager-connection_editor.h index e853787..83ec029 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_editor.h +++ b/tdenetworkmanager/src/knetworkmanager-connection_editor.h @@ -25,12 +25,16 @@ #ifndef KNETWORKMANAGER_CONNECTION_EDITOR_H #define KNETWORKMANAGER_CONNECTION_EDITOR_H -// qt headers +// tqt headers #include -// qt autogenerated headers +// tqt autogenerated headers #include "connection_editor.h" +// TDE headers +#include +#include + // knm headers #include "knetworkmanager-connection_setting.h" @@ -57,7 +61,7 @@ class ConnectionEditorImpl : public ConnectionEditor void slotNewWirelessConnection(); void slotNewWiredConnection(); void slotEditNewConnection(TDENetworkConnection* conn); - void slotRefershConnectionList(); + void slotRefreshConnectionList(); void slotNewVPNConnection(); private: diff --git a/tdenetworkmanager/src/knetworkmanager-device_tray.h b/tdenetworkmanager/src/knetworkmanager-device_tray.h index 60f6888..2ee1c87 100644 --- a/tdenetworkmanager/src/knetworkmanager-device_tray.h +++ b/tdenetworkmanager/src/knetworkmanager-device_tray.h @@ -42,6 +42,9 @@ #include #include +#include +#include + #include "knetworkmanager.h" class DeviceTrayPrivate; diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp index 2137939..baec85f 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp +++ b/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp @@ -25,21 +25,8 @@ // other includes #include -// QT DBus -#include - // 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" TQValueList WirelessManager::getWirelessNetworks(TDENetworkDevice* dev, TQ_UINT32 match) { @@ -56,17 +43,13 @@ TQValueList WirelessManager::getWirelessNetworks(TDENetworkDevi // no hidden APs TDENetworkWiFiAPInfo * ap = *apit; if ( ap ) { - if (!ap->isValid()) - continue; - - if (ap->getSsid().count() == 0) + if (ap->SSID.count() == 0) { continue; + } // check if we have a network matching this AP - for (TQValueList::Iterator netIt = nets.begin(); netIt != nets.end(); ++netIt) - { - if ((*netIt).contains(ap) ) - { + for (TQValueList::Iterator netIt = nets.begin(); netIt != nets.end(); ++netIt) { + if ((*netIt).contains(ap) ) { // we alread have a network where this AP belongs to found = true; @@ -84,8 +67,7 @@ TQValueList WirelessManager::getWirelessNetworks(TDENetworkDevi } } - if (!found) - { + if (!found) { // create a new network-descriptor according to this ap WirelessNetwork net(match); net.addAP(ap); @@ -96,25 +78,39 @@ TQValueList WirelessManager::getWirelessNetworks(TDENetworkDevi return nets; } +TQValueList internalGetAccessPoints(TDENetworkDevice* dev) { + TQValueList list; + if (dev) { + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + TDENetworkHWNeighbor* neighbor; + TDENetworkHWNeighborList* neighbors = deviceConnMan->siteSurvey(); + for (neighbor = neighbors->first(); neighbor; neighbor = neighbors->next()) { + TDENetworkWiFiAPInfo* apInfo = dynamic_cast(neighbor); + if (!apInfo) { + continue; + } + list.append(apInfo); + } + } + return list; +} + TQValueList WirelessManager::getAccessPoints(TDENetworkDevice* dev) { // build up AP list depending on one device or on all devices if (dev) { - return dev->accessPoints(); + return internalGetAccessPoints(dev); } else { TQValueList aps; - DeviceStore* store = DeviceStore::getInstance(); - if (store) - { - TQValueList devs = store->getDevices(NM_DEVICE_TYPE_WIFI); - for (TQValueList::Iterator it = devs.begin(); it != devs.end(); ++it) - { + TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); + if (hwdevices) { + TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network); + for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) { TDENetworkDevice* wdev = dynamic_cast(*it); - if (!wdev) - continue; - // add all APs from this device - aps +=wdev->accessPoints(); + if (wdev) { + aps += internalGetAccessPoints(wdev); + } } } return aps; @@ -124,43 +120,61 @@ TQValueList WirelessManager::getAccessPoints(TDENetworkDe TQValueList WirelessManager::getWirelessConnections() { TQValueList conns; - ConnectionStore* store = ConnectionStore::getInstance(); - // get all wireless connections - TQValueList connections = store->getConnections(NM_SETTING_WIRELESS_SETTING_NAME); - for (TQValueList::Iterator it = connections.begin(); it != connections.end(); ++it) - { - // cast to TDEWiFiConnection* - TDEWiFiConnection* wireless_conn = dynamic_cast(*it); - if (!wireless_conn) - continue; - conns.append(wireless_conn); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (nm) { + // get all wireless connections + TDENetworkConnectionList* allconmap = nm->connections(); + for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) { + TDEWiFiConnection* wireless_conn = dynamic_cast(*it); + if (!wireless_conn) { + continue; + } + conns.append(wireless_conn); + } } - return conns; + + return conns; +} + +TQValueList internalGetAccessPointsWithESSID(TQByteArray essid, TDENetworkDevice* dev) { + TQValueList list; + if (dev) { + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + TDENetworkHWNeighbor* neighbor; + TDENetworkHWNeighborList* neighbors = deviceConnMan->siteSurvey(); + for (neighbor = neighbors->first(); neighbor; neighbor = neighbors->next()) { + TDENetworkWiFiAPInfo* apInfo = dynamic_cast(neighbor); + if (!apInfo) { + continue; + } + if (apInfo->SSID == essid) { + list.append(apInfo); + } + } + } + return list; } TQValueList WirelessManager::getAccessPointsForEssid(TQByteArray essid, TDENetworkDevice* dev) { // build up AP list depending on one device or on all devices - if (dev) - return dev->accessPointsForEssid(essid); - else - { - TQValueList aps; - DeviceStore* store = DeviceStore::getInstance(); - if (store) - { - TQValueList devs = store->getDevices(NM_DEVICE_TYPE_WIFI); - for (TQValueList::Iterator it = devs.begin(); it != devs.end(); ++it) - { + if (dev) { + return internalGetAccessPointsWithESSID(essid, dev); + } + else { + TQValueList aps; + TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); + if (hwdevices) { + TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network); + for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) { TDENetworkDevice* wdev = dynamic_cast(*it); - if (!wdev) - continue; - // add all APs from this device - aps += wdev->accessPointsForEssid(essid); + if (wdev) { + aps += internalGetAccessPointsWithESSID(essid, wdev); + } } } - return aps; + return aps; } } diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp index 3b96bb2..b8328ee 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp +++ b/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp @@ -79,8 +79,9 @@ WirelessNetwork& WirelessNetwork::operator= (const WirelessNetwork& other) bool WirelessNetwork::contains (const TDENetworkWiFiAPInfo * const ap) { - if ( (d->match & MATCH_SSID) && getSsid() != ap->getSsidByteArray()) + if ( (d->match & MATCH_SSID) && getSsid() != ap->SSID) { return false; + } // AP matches return true; @@ -88,8 +89,7 @@ bool WirelessNetwork::contains (const TDENetworkWiFiAPInfo * const ap) bool WirelessNetwork::addAP(const TDENetworkWiFiAPInfo * const ap) { - if ( this->contains( ap ) || d->aps.isEmpty()) - { + if ( this->contains( ap ) || d->aps.isEmpty()) { d->aps.append(ap); return true; } @@ -99,8 +99,9 @@ bool WirelessNetwork::addAP(const TDENetworkWiFiAPInfo * const ap) const TQByteArray WirelessNetwork::getSsid() const { if ( !d->aps.isEmpty() ) { - return (*(d->aps.begin()))->getSsidByteArray(); - } else { + return (*(d->aps.begin()))->SSID; + } + else { return TQByteArray(); } } @@ -108,8 +109,9 @@ const TQByteArray WirelessNetwork::getSsid() const TQString WirelessNetwork::getDisplaySsid() const { if (!d->aps.isEmpty()) { - return (*(d->aps.begin()))->getDisplaySsid(); - } else { + return (*(d->aps.begin()))->friendlySSID(); + } + else { return TQString(); } } @@ -117,9 +119,9 @@ TQString WirelessNetwork::getDisplaySsid() const TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getFlags() const { TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; - for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) - { - flags |= (*it)->getFlags(); + for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { + flags |= ((*it)->wpaFlags & TDENetworkWiFiAPFlags::GeneralFlagsMask); + flags |= ((*it)->rsnFlags & TDENetworkWiFiAPFlags::GeneralFlagsMask); } return flags; } @@ -129,7 +131,7 @@ TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getWpaFlags() cons TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { - flags |= (*it)->getWpaFlags(); + flags |= ((*it)->wpaFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask); } return flags; } @@ -139,7 +141,7 @@ TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getRsnFlags() cons TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { - flags |= (*it)->getRsnFlags(); + flags |= ((*it)->rsnFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask); } return flags; } @@ -152,10 +154,10 @@ bool WirelessNetwork::isEncrypted() const TQ_UINT8 WirelessNetwork::getStrength() const { TQ_UINT8 strength = 0; - for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) - { - if ((*it)->getStrength() > strength) - strength = (*it)->getStrength(); + for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { + if (((*it)->signalQuality*100.0) > strength) { + strength = ((*it)->signalQuality*100.0); + } } return strength; } diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp index cc3b8f7..88a3d11 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp @@ -294,35 +294,15 @@ 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 @@ -353,20 +333,12 @@ ConnectionSettingsDialogImpl::slotConnect() { 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 } } } -- cgit v1.2.1 From 4e6c7c0e4e0383ffb067942f79aea0ebd07d98cf Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 6 Sep 2012 13:01:10 -0500 Subject: Rearrange files again --- tdenetworkmanager/src/CMakeLists.txt | 4 +- .../src/configwidgets/connection_setting_cdma.ui | 131 +++++++++ .../src/configwidgets/connection_setting_gsm.ui | 294 +++++++++++++++++++ .../src/configwidgets/connection_setting_info.ui | 71 +++++ .../src/configwidgets/connection_setting_ipv4.ui | 116 ++++++++ .../src/configwidgets/connection_setting_ppp.ui | 320 +++++++++++++++++++++ .../src/configwidgets/connection_setting_serial.ui | 185 ++++++++++++ .../src/configwidgets/connection_setting_vpn.ui | 51 ++++ .../configwidgets/connection_setting_wireless.ui | 140 +++++++++ .../connection_setting_wireless_security.ui | 87 ++++++ .../connection_setting_wireless_security_auth.ui | 51 ++++ .../connection_setting_wireless_security_eap.ui | 163 +++++++++++ .../connection_setting_wireless_security_phase2.ui | 54 ++++ .../connection_setting_wireless_security_wep.ui | 146 ++++++++++ ...tion_setting_wireless_security_wepencryption.ui | 46 +++ ...nnection_setting_wireless_security_wpacipher.ui | 128 +++++++++ .../connection_setting_wireless_security_wpapsk.ui | 46 +++ ...nection_setting_wireless_security_wpaversion.ui | 80 ++++++ .../src/configwidgets/connection_settings.ui | 137 +++++++++ ...tworkmanager-connection_setting_cdma_widget.cpp | 8 +- ...networkmanager-connection_setting_cdma_widget.h | 14 +- .../src/settings/connection_setting_cdma.ui | 131 --------- .../src/settings/connection_setting_gsm.ui | 294 ------------------- .../src/settings/connection_setting_info.ui | 71 ----- .../src/settings/connection_setting_ipv4.ui | 116 -------- .../src/settings/connection_setting_ppp.ui | 320 --------------------- .../src/settings/connection_setting_serial.ui | 185 ------------ .../src/settings/connection_setting_vpn.ui | 51 ---- .../src/settings/connection_setting_wireless.ui | 140 --------- .../connection_setting_wireless_security.ui | 87 ------ .../connection_setting_wireless_security_auth.ui | 51 ---- .../connection_setting_wireless_security_eap.ui | 163 ----------- .../connection_setting_wireless_security_phase2.ui | 54 ---- .../connection_setting_wireless_security_wep.ui | 146 ---------- ...tion_setting_wireless_security_wepencryption.ui | 46 --- ...nnection_setting_wireless_security_wpacipher.ui | 128 --------- .../connection_setting_wireless_security_wpapsk.ui | 46 --- ...nection_setting_wireless_security_wpaversion.ui | 80 ------ .../src/settings/connection_settings.ui | 137 --------- 39 files changed, 2258 insertions(+), 2260 deletions(-) create mode 100644 tdenetworkmanager/src/configwidgets/connection_setting_cdma.ui create mode 100644 tdenetworkmanager/src/configwidgets/connection_setting_gsm.ui create mode 100644 tdenetworkmanager/src/configwidgets/connection_setting_info.ui create mode 100644 tdenetworkmanager/src/configwidgets/connection_setting_ipv4.ui create mode 100644 tdenetworkmanager/src/configwidgets/connection_setting_ppp.ui create mode 100644 tdenetworkmanager/src/configwidgets/connection_setting_serial.ui create mode 100644 tdenetworkmanager/src/configwidgets/connection_setting_vpn.ui create mode 100644 tdenetworkmanager/src/configwidgets/connection_setting_wireless.ui create mode 100644 tdenetworkmanager/src/configwidgets/connection_setting_wireless_security.ui create mode 100644 tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_auth.ui create mode 100644 tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_eap.ui create mode 100644 tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_phase2.ui create mode 100644 tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wep.ui create mode 100644 tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wepencryption.ui create mode 100644 tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpacipher.ui create mode 100644 tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpapsk.ui create mode 100644 tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpaversion.ui create mode 100644 tdenetworkmanager/src/configwidgets/connection_settings.ui delete mode 100644 tdenetworkmanager/src/settings/connection_setting_cdma.ui delete mode 100644 tdenetworkmanager/src/settings/connection_setting_gsm.ui delete mode 100644 tdenetworkmanager/src/settings/connection_setting_info.ui delete mode 100644 tdenetworkmanager/src/settings/connection_setting_ipv4.ui delete mode 100644 tdenetworkmanager/src/settings/connection_setting_ppp.ui delete mode 100644 tdenetworkmanager/src/settings/connection_setting_serial.ui delete mode 100644 tdenetworkmanager/src/settings/connection_setting_vpn.ui delete mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless.ui delete mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security.ui delete mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security_auth.ui delete mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security_eap.ui delete mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security_phase2.ui delete mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security_wep.ui delete mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security_wepencryption.ui delete mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security_wpacipher.ui delete mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security_wpapsk.ui delete mode 100644 tdenetworkmanager/src/settings/connection_setting_wireless_security_wpaversion.ui delete mode 100644 tdenetworkmanager/src/settings/connection_settings.ui diff --git a/tdenetworkmanager/src/CMakeLists.txt b/tdenetworkmanager/src/CMakeLists.txt index a379be9..aa06061 100644 --- a/tdenetworkmanager/src/CMakeLists.txt +++ b/tdenetworkmanager/src/CMakeLists.txt @@ -12,7 +12,7 @@ add_definitions( -UQT_NO_ASCII_CAST ) #add_subdirectory( settings ) -#add_subdirectory( configwidgets ) +add_subdirectory( configwidgets ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} @@ -63,6 +63,6 @@ tde_add_tdeinit_executable( knetworkmanager AUTOMOC #knetworkmanager-pluginmanager.cpp knetworkmanager-vpnservice.cpp knetworkmanager-vpnmanager.cpp #knetworkmanager-vpnauthenticationdialog.cpp #vpn_tray_component.cpp - EMBED tdenetwork-connection-configwidgets-static tdenetwork-connection-settings-static + EMBED tdenetwork-connection-configwidgets-static #tdenetwork-connection-settings-static LINK tdecore-shared tdeui-shared kutils-shared ${DBUS_TQT_LIBRARIES} ) diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_cdma.ui b/tdenetworkmanager/src/configwidgets/connection_setting_cdma.ui new file mode 100644 index 0000000..5674468 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_setting_cdma.ui @@ -0,0 +1,131 @@ + +ConnectionSettingCdmaWidget + + + ConnectionSettingCdmaWidget + + + + 0 + 0 + 381 + 102 + + + + Form1 + + + + unnamed + + + 0 + + + + layout10 + + + + unnamed + + + + mPassword + + + Password needed to access the service + + + + + textLabel1 + + + &Number: + + + mNumber + + + + + mUsername + + + Username needed to access the service + + + + + textLabel2 + + + &Username: + + + mUsername + + + + + textLabel2_2 + + + &Password: + + + mUsername + + + + + mNumber + + + + + spacer2 + + + Horizontal + + + Expanding + + + + 146 + 20 + + + + + + + + spacer1 + + + Vertical + + + Expanding + + + + 20 + 16 + + + + + + + mNumber + mUsername + mPassword + + + diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_gsm.ui b/tdenetworkmanager/src/configwidgets/connection_setting_gsm.ui new file mode 100644 index 0000000..c89a749 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_setting_gsm.ui @@ -0,0 +1,294 @@ + +ConnectionSettingGsmWidget + + + ConnectionSettingGsmWidget + + + + 0 + 0 + 381 + 245 + + + + Form1 + + + + unnamed + + + 0 + + + + layout9 + + + + unnamed + + + + textLabel4 + + + Network &ID: + + + mNetworkId + + + + + textLabel2_2_2 + + + PU&K: + + + mUsername + + + + + textLabel1 + + + &Number: + + + mNumber + + + + + mPassword + + + Password needed to access the service + + + + + + Any + + + + + GPRS + + + + + GSM + + + + + Prefer GPRS + + + + + Prefer GSM + + + + mNetworkType + + + Select the type of cellular data network the connection should use + + + 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 + + + + + textLabel6 + + + Network &Type: + + + mNetworkType + + + + + textLabel2 + + + &Username: + + + mUsername + + + + + mApn + + + Access Point Name + + + The hostname of the machine providing network access + + + + + textLabel5 + + + &Band: + + + mBand + + + + + mPuk + + + Personal Unblocking Code + + + A code used to unblock a blocked SIM card + + + + + mBand + + + 5 + + + -1 + + + -1 + + + + + spacer4 + + + Horizontal + + + Expanding + + + + 171 + 20 + + + + + + mPin + + + Personal Identification Number + + + A code used for all GSM-based phones to establish authorisation for access to certain functions or information + + + + + mUsername + + + Username needed to access the service + + + + + mNumber + + + + + mNetworkId + + + The GSM network to connect to + + + + + textLabel2_3 + + + &PIN: + + + mUsername + + + + + textLabel2_2 + + + Pass&word: + + + mUsername + + + + + textLabel3 + + + &APN: + + + mApn + + + + + + + spacer5 + + + Vertical + + + Expanding + + + + 20 + 51 + + + + + + + mUsername + mPassword + mPin + mPuk + mNumber + mApn + mNetworkId + mNetworkType + mBand + + + diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_info.ui b/tdenetworkmanager/src/configwidgets/connection_setting_info.ui new file mode 100644 index 0000000..72a6e87 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_setting_info.ui @@ -0,0 +1,71 @@ + +ConnectionSettingInfoWidget + + + ConnectionSettingInfoWidget + + + + 0 + 0 + 591 + 151 + + + + Form1 + + + + unnamed + + + + textLabel1 + + + Connection Name: + + + + + txtConnectionName + + + + + spacer1 + + + Vertical + + + Expanding + + + + 20 + 30 + + + + + + textLabel1_2 + + + Autoconnect: + + + + + chkAutoConnect + + + + + + + + + diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_ipv4.ui b/tdenetworkmanager/src/configwidgets/connection_setting_ipv4.ui new file mode 100644 index 0000000..0f08a00 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_setting_ipv4.ui @@ -0,0 +1,116 @@ + +ConnectionSettingIPv4Widget + + + ConnectionSettingIPv4Widget + + + + 0 + 0 + 534 + 330 + + + + Form3 + + + + unnamed + + + + groupIPConfig + + + Use manual IP configuration + + + true + + + false + + + + unnamed + + + + textLabel1 + + + DNS Addresses: + + + + + textLabel2_2 + + + DNS Search: + + + + + textLabel2 + + + IP Address: + + + + + txtIP + + + + + txtDNSAddresses + + + + + txtDNSSearch + + + + + textLabel2_3 + + + Netmask: + + + + + txtNetmask + + + + + textLabel1_2 + + + Gateway: + + + + + txtGateway + + + + + + + + txtIP + txtNetmask + txtGateway + txtDNSAddresses + txtDNSSearch + + + diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_ppp.ui b/tdenetworkmanager/src/configwidgets/connection_setting_ppp.ui new file mode 100644 index 0000000..7db6e5e --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_setting_ppp.ui @@ -0,0 +1,320 @@ + +ConnectionSettingPppWidget + + + ConnectionSettingPppWidget + + + + 0 + 0 + 472 + 284 + + + + Form2 + + + + unnamed + + + 0 + + + + layout9 + + + + unnamed + + + + mRequireMppe128 + + + Require MPPE128 + + + + + spacer6 + + + Vertical + + + Expanding + + + + 20 + 50 + + + + + + layout11 + + + + unnamed + + + + mLcpEchoInterval + + + + + textLabel11 + + + LCP Echo Interval + + + + + + + layout12 + + + + unnamed + + + + mLcpEchoFailure + + + + + textLabel10 + + + LCP Echo Failure + + + + + + + layout15 + + + + unnamed + + + + mBaudRate + + + + + textLabel7 + + + Baud rate + + + + + + + layout13 + + + + unnamed + + + + mMtu + + + + + textLabel9 + + + MTU + + + + + + + mRefusePap + + + Refuse PAP + + + + + mNoAuth + + + No Authorization + + + + + mNoVjComp + + + No VJ Compression + + + + + mRefuseMschap + + + Refuse MSCHAP + + + + + layout14 + + + + unnamed + + + + mMru + + + + + textLabel8 + + + MRU + + + + + + + mRequireMppe + + + Require MPPE + + + + + mRequireMppc + + + Require MPPC + + + + + mRefuseMschapV2 + + + Refuse MSCHAPv2 + + + + + mNoBsd + + + No BSD + + + + + mStatefulMppe + + + Stateful MPPE + + + + + mCrtscts + + + CRTSCTS + + + + + mNoDeflate + + + No Deflate + + + + + mRefuseChap + + + Refuse CHAP + + + + + mRefuseEap + + + Refuse EAP + + + + + + + spacer2 + + + Vertical + + + Expanding + + + + 20 + 41 + + + + + + + mNoAuth + mRefuseEap + mRefusePap + mRefuseChap + mRefuseMschap + mRefuseMschapV2 + mNoBsd + mNoDeflate + mNoVjComp + mRequireMppe + mRequireMppe128 + mStatefulMppe + mRequireMppc + mCrtscts + mBaudRate + mMru + mMtu + mLcpEchoFailure + mLcpEchoInterval + + + diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_serial.ui b/tdenetworkmanager/src/configwidgets/connection_setting_serial.ui new file mode 100644 index 0000000..2a3b9ad --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_setting_serial.ui @@ -0,0 +1,185 @@ + +ConnectionSettingSerialWidget + + + ConnectionSettingSerialWidget + + + + 0 + 0 + 170 + 187 + + + + Form2 + + + + unnamed + + + 0 + + + + layout23 + + + + unnamed + + + + mSendDelay + + + + + textLabel11 + + + &Send delay + + + mSendDelay + + + + + + None + + + + + Even + + + + + Odd + + + + mParity + + + + + + 0 + + + + + 1 + + + + mStopBits + + + 1 + + + + + + 7 + + + + + 8 + + + + + 9 + + + + mDataBits + + + 1 + + + + + mBaudRate + + + + + textLabel12_3 + + + &Stop bits: + + + mStopBits + + + + + textLabel7 + + + Baud rate + + + + + textLabel12_2 + + + &Parity: + + + mParity + + + + + textLabel12 + + + &Data bits: + + + mDataBits + + + + + + + spacer6 + + + Vertical + + + Expanding + + + + 20 + 141 + + + + + + + mBaudRate + mDataBits + mParity + mStopBits + mSendDelay + + + diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_vpn.ui b/tdenetworkmanager/src/configwidgets/connection_setting_vpn.ui new file mode 100644 index 0000000..976fc25 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_setting_vpn.ui @@ -0,0 +1,51 @@ + +ConnectionSettingVPNWidget + + + VPN + + + + 0 + 0 + 331 + 155 + + + + VPN + + + + unnamed + + + + cboServices + + + + + textLabel2 + + + Service + + + + + widgetStack + + + + WStackPage + + + 0 + + + + + + + diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_wireless.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless.ui new file mode 100644 index 0000000..9415ce4 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless.ui @@ -0,0 +1,140 @@ + +ConnectionSettingWirelessWidget + + + ConnectionSettingWirelessWidget + + + + 0 + 0 + 506 + 418 + + + + Form6 + + + + unnamed + + + + textLabel1 + + + Essid: + + + + + txtEssid + + + + + pbExpert + + + Expert options + + + + + spacer1 + + + Horizontal + + + Expanding + + + + 282 + 20 + + + + + + + Essid + + + true + + + true + + + + + Quality + + + true + + + true + + + + + Security + + + true + + + true + + + + lvEssids + + + StyledPanel + + + Sunken + + + true + + + true + + + + + framePlaceholder + + + NoFrame + + + Raised + + + + + chkAutoRefresh + + + Refresh automatically + + + true + + + + + + + klineedit.h + kpushbutton.h + klistview.h + + diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security.ui new file mode 100644 index 0000000..5fce58f --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security.ui @@ -0,0 +1,87 @@ + +ConnectionSettingWirelessSecurityWidget + + + Form1 + + + + 0 + 0 + 522 + 158 + + + + Form1 + + + + unnamed + + + + groupUseEncryption + + + Use Wireless Security + + + true + + + false + + + + unnamed + + + + cboSecurity + + + + + textLabel1 + + + Security: + + + + + buttonGroup5 + + + NoFrame + + + + + + + unnamed + + + 0 + + + + + + pbExtra + + + Expert settings + + + true + + + + + + + + diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_auth.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_auth.ui new file mode 100644 index 0000000..ce88e51 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_auth.ui @@ -0,0 +1,51 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 342 + 97 + + + + Form1 + + + + unnamed + + + + groupBox1 + + + Authentication + + + + unnamed + + + + textLabel1 + + + Method: + + + + + cboAuthAlg + + + + + + + + diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_eap.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_eap.ui new file mode 100644 index 0000000..a851a93 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_eap.ui @@ -0,0 +1,163 @@ + +ConnectionSettingWirelessSecurityEAP + + + ConnectionSettingWirelessSecurityEAP + + + + 0 + 0 + 583 + 174 + + + + Form2 + + + + unnamed + + + 0 + + + + groupBox2 + + + EAP + + + + unnamed + + + + textLabel8 + + + Method: + + + + + textLabel9 + + + Identity: + + + + + cboMethod + + + + + txtIdentity + + + + + txtAnonIdentity + + + + + textLabel10 + + + Anonymous Identity: + + + + + textLabel11 + + + Password: + + + + + txtPassword + + + + + textLabel16 + + + Private Secret Key: + + + + + txtPrivateSecretKey + + + + + textLabel12 + + + Client Certificate: + + + + + kURLClientCert + + + + + kURLPrivateKey + + + + + textLabel15 + + + Private Keyfile: + + + + + textLabel14 + + + CA Certificate: + + + + + kURLCACert + + + + + textLabel1 + + + Use System CA Certificates + + + + + chkCAStore + + + + + + + + + + + + + diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_phase2.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_phase2.ui new file mode 100644 index 0000000..b3237d4 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_phase2.ui @@ -0,0 +1,54 @@ + +ConnectionSettingWirelessSecurityPhase2 + + + ConnectionSettingWirelessSecurityPhase2 + + + + 0 + 0 + 225 + 135 + + + + Form4 + + + + unnamed + + + 0 + + + + groupBox4 + + + Phase 2 + + + + unnamed + + + + textLabel17 + + + Method: + + + + + cboPhase2Method + + + + + + + + diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wep.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wep.ui new file mode 100644 index 0000000..c07033e --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wep.ui @@ -0,0 +1,146 @@ + +ConnectionSettingWirelessSecurityWEP + + + ConnectionSettingWirelessSecurityWEP + + + + 0 + 0 + 333 + 238 + + + + Form1 + + + + unnamed + + + 0 + + + + WEP + + + WEP + + + + unnamed + + + + buttonGroup1 + + + NoFrame + + + + + + + unnamed + + + 0 + + + + txtWEPKey2 + + + + + rbKeyIdx1 + + + Key 2: + + + + + rbKeyIdx3 + + + Key 4: + + + + + textLabel1 + + + Type: + + + + + rbKeyIdx0 + + + Key 1: + + + + + txtWEPKey3 + + + + + rbKeyIdx2 + + + Key 3: + + + + + txtWEPKey1 + + + + + txtWEPKey0 + + + + + cbKeyType + + + + 7 + 0 + 0 + 0 + + + + + + textLabel1_2 + + + Authentication: + + + + + cboAuthentication + + + + + + + + + + diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wepencryption.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wepencryption.ui new file mode 100644 index 0000000..50c149d --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wepencryption.ui @@ -0,0 +1,46 @@ + +ConnectionSettingWirelessSecurityWEPEncryption + + + ConnectionSettingWirelessSecurityWEPEncryption + + + + 0 + 0 + 288 + 64 + + + + Form1 + + + + unnamed + + + 0 + + + + groupBox2 + + + Encryption + + + + unnamed + + + + cboEncryption + + + + + + + + diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpacipher.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpacipher.ui new file mode 100644 index 0000000..a402e66 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpacipher.ui @@ -0,0 +1,128 @@ + +ConnectionSettingWirelessSecurityWPACipher + + + ConnectionSettingWirelessSecurityWPACipher + + + + 0 + 0 + 600 + 99 + + + + Form1 + + + + unnamed + + + 0 + + + + grpUseCipher + + + Use specific cipher + + + true + + + false + + + + unnamed + + + + textLabel18 + + + Group Cipher: + + + + + textLabel1 + + + Pairwise Cipher: + + + + + chkGroupCipherCCMP + + + CCMP + + + + + chkGroupCipherTKIP + + + TKIP + + + + + chkPairwiseCipherTKIP + + + TKIP + + + + + chkPairwiseCipherCCMP + + + CCMP + + + + + chkGroupCipherWEP40 + + + WEP 40 + + + + + spacer2 + + + Horizontal + + + Expanding + + + + 60 + 20 + + + + + + chkGroupCipherWEP104 + + + WEP 104 + + + + + + + + diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpapsk.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpapsk.ui new file mode 100644 index 0000000..4df8eea --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpapsk.ui @@ -0,0 +1,46 @@ + +ConnectionSettingWirelessSecurityWPAPSK + + + ConnectionSettingWirelessSecurityWPAPSK + + + + 0 + 0 + 600 + 480 + + + + Form2 + + + + unnamed + + + 0 + + + + groupBox3 + + + Shared Key + + + + unnamed + + + + txtPSK + + + + + + + + diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpaversion.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpaversion.ui new file mode 100644 index 0000000..11b1655 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpaversion.ui @@ -0,0 +1,80 @@ + +ConnectionSettingWirelessSecurityWPAVersion + + + ConnectionSettingWirelessSecurityWPAVersion + + + + 0 + 0 + 308 + 64 + + + + Form3 + + + + unnamed + + + 0 + + + + grpUseWPAVersion + + + Use specific WPA Version + + + true + + + false + + + + unnamed + + + + cbRSN + + + WPA 2/RSN + + + + + cbWPA + + + WPA 1 + + + + + spacer7 + + + Horizontal + + + Expanding + + + + 50 + 20 + + + + + + + + + diff --git a/tdenetworkmanager/src/configwidgets/connection_settings.ui b/tdenetworkmanager/src/configwidgets/connection_settings.ui new file mode 100644 index 0000000..c7994de --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/connection_settings.ui @@ -0,0 +1,137 @@ + +ConnectionSettingsDialog + + + ConnectionSettingsDialog + + + + 0 + 0 + 644 + 318 + + + + Connections + + + + unnamed + + + + pbBack + + + Back + + + + + lblInfo + + + + 1 + + + + New Connection + + + + + wstackSettings + + + + 5 + 7 + 0 + 0 + + + + TabWidgetPanel + + + + WStackPage + + + 0 + + + + + + pbCancel + + + Cancel + + + + + spacer2 + + + Horizontal + + + Expanding + + + + 180 + 20 + + + + + + pbNext + + + Next + + + true + + + + + pbSave + + + Save + + + + + btnConnect + + + Connect && Save + + + + + + true + + + false + + + + + + + kpushbutton.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + + diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp index b09fea9..c803b4a 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp @@ -34,19 +34,17 @@ #include // knm headers -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting_cdma.h" #include "knetworkmanager-connection_setting_cdma_widget.h" -#include "knetworkmanager-device.h" +// ui headers #include "connection_setting_cdma.h" using namespace ConnectionSettings; -CDMAWidgetImpl::CDMAWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl) +CDMAWidgetImpl::CDMAWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { - _cdmasetting = dynamic_cast (conn->getSetting(NM_SETTING_CDMA_SETTING_NAME)); + _cdmasetting = dynamic_cast (conn); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingCdmaWidget(this); diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.h index 6ee8a37..0cbbfee 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.h +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.h @@ -26,14 +26,16 @@ #define KNETWORKMANAGER_CONNECTION_SETTING_CDMA_WIDGET_H -// qt headers +// tqt headers #include #include +// tde headers +#include +#include + // knm headers -#include "knetworkmanager-connection_setting_cdma.h" #include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-device.h" //class VPNService; class ConnectionSettingCdmaWidget; @@ -41,14 +43,12 @@ class ConnectionSettingCdmaWidget; namespace ConnectionSettings { -class Connection; - class CDMAWidgetImpl : public WidgetInterface { Q_OBJECT public: - CDMAWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); + CDMAWidgetImpl(TDENetworkConnection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); void Activate(); void Deactivate(); public slots: @@ -59,7 +59,7 @@ class CDMAWidgetImpl : public WidgetInterface //VPNConfigWidget* getVPNConfigWidget(VPNService* service); - CDMA* _cdmasetting; + TDEModemConnection* _cdmasetting; ConnectionSettingCdmaWidget* _mainWid; }; diff --git a/tdenetworkmanager/src/settings/connection_setting_cdma.ui b/tdenetworkmanager/src/settings/connection_setting_cdma.ui deleted file mode 100644 index 5674468..0000000 --- a/tdenetworkmanager/src/settings/connection_setting_cdma.ui +++ /dev/null @@ -1,131 +0,0 @@ - -ConnectionSettingCdmaWidget - - - ConnectionSettingCdmaWidget - - - - 0 - 0 - 381 - 102 - - - - Form1 - - - - unnamed - - - 0 - - - - layout10 - - - - unnamed - - - - mPassword - - - Password needed to access the service - - - - - textLabel1 - - - &Number: - - - mNumber - - - - - mUsername - - - Username needed to access the service - - - - - textLabel2 - - - &Username: - - - mUsername - - - - - textLabel2_2 - - - &Password: - - - mUsername - - - - - mNumber - - - - - spacer2 - - - Horizontal - - - Expanding - - - - 146 - 20 - - - - - - - - spacer1 - - - Vertical - - - Expanding - - - - 20 - 16 - - - - - - - mNumber - mUsername - mPassword - - - diff --git a/tdenetworkmanager/src/settings/connection_setting_gsm.ui b/tdenetworkmanager/src/settings/connection_setting_gsm.ui deleted file mode 100644 index c89a749..0000000 --- a/tdenetworkmanager/src/settings/connection_setting_gsm.ui +++ /dev/null @@ -1,294 +0,0 @@ - -ConnectionSettingGsmWidget - - - ConnectionSettingGsmWidget - - - - 0 - 0 - 381 - 245 - - - - Form1 - - - - unnamed - - - 0 - - - - layout9 - - - - unnamed - - - - textLabel4 - - - Network &ID: - - - mNetworkId - - - - - textLabel2_2_2 - - - PU&K: - - - mUsername - - - - - textLabel1 - - - &Number: - - - mNumber - - - - - mPassword - - - Password needed to access the service - - - - - - Any - - - - - GPRS - - - - - GSM - - - - - Prefer GPRS - - - - - Prefer GSM - - - - mNetworkType - - - Select the type of cellular data network the connection should use - - - 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 - - - - - textLabel6 - - - Network &Type: - - - mNetworkType - - - - - textLabel2 - - - &Username: - - - mUsername - - - - - mApn - - - Access Point Name - - - The hostname of the machine providing network access - - - - - textLabel5 - - - &Band: - - - mBand - - - - - mPuk - - - Personal Unblocking Code - - - A code used to unblock a blocked SIM card - - - - - mBand - - - 5 - - - -1 - - - -1 - - - - - spacer4 - - - Horizontal - - - Expanding - - - - 171 - 20 - - - - - - mPin - - - Personal Identification Number - - - A code used for all GSM-based phones to establish authorisation for access to certain functions or information - - - - - mUsername - - - Username needed to access the service - - - - - mNumber - - - - - mNetworkId - - - The GSM network to connect to - - - - - textLabel2_3 - - - &PIN: - - - mUsername - - - - - textLabel2_2 - - - Pass&word: - - - mUsername - - - - - textLabel3 - - - &APN: - - - mApn - - - - - - - spacer5 - - - Vertical - - - Expanding - - - - 20 - 51 - - - - - - - mUsername - mPassword - mPin - mPuk - mNumber - mApn - mNetworkId - mNetworkType - mBand - - - diff --git a/tdenetworkmanager/src/settings/connection_setting_info.ui b/tdenetworkmanager/src/settings/connection_setting_info.ui deleted file mode 100644 index 72a6e87..0000000 --- a/tdenetworkmanager/src/settings/connection_setting_info.ui +++ /dev/null @@ -1,71 +0,0 @@ - -ConnectionSettingInfoWidget - - - ConnectionSettingInfoWidget - - - - 0 - 0 - 591 - 151 - - - - Form1 - - - - unnamed - - - - textLabel1 - - - Connection Name: - - - - - txtConnectionName - - - - - spacer1 - - - Vertical - - - Expanding - - - - 20 - 30 - - - - - - textLabel1_2 - - - Autoconnect: - - - - - chkAutoConnect - - - - - - - - - diff --git a/tdenetworkmanager/src/settings/connection_setting_ipv4.ui b/tdenetworkmanager/src/settings/connection_setting_ipv4.ui deleted file mode 100644 index 0f08a00..0000000 --- a/tdenetworkmanager/src/settings/connection_setting_ipv4.ui +++ /dev/null @@ -1,116 +0,0 @@ - -ConnectionSettingIPv4Widget - - - ConnectionSettingIPv4Widget - - - - 0 - 0 - 534 - 330 - - - - Form3 - - - - unnamed - - - - groupIPConfig - - - Use manual IP configuration - - - true - - - false - - - - unnamed - - - - textLabel1 - - - DNS Addresses: - - - - - textLabel2_2 - - - DNS Search: - - - - - textLabel2 - - - IP Address: - - - - - txtIP - - - - - txtDNSAddresses - - - - - txtDNSSearch - - - - - textLabel2_3 - - - Netmask: - - - - - txtNetmask - - - - - textLabel1_2 - - - Gateway: - - - - - txtGateway - - - - - - - - txtIP - txtNetmask - txtGateway - txtDNSAddresses - txtDNSSearch - - - diff --git a/tdenetworkmanager/src/settings/connection_setting_ppp.ui b/tdenetworkmanager/src/settings/connection_setting_ppp.ui deleted file mode 100644 index 7db6e5e..0000000 --- a/tdenetworkmanager/src/settings/connection_setting_ppp.ui +++ /dev/null @@ -1,320 +0,0 @@ - -ConnectionSettingPppWidget - - - ConnectionSettingPppWidget - - - - 0 - 0 - 472 - 284 - - - - Form2 - - - - unnamed - - - 0 - - - - layout9 - - - - unnamed - - - - mRequireMppe128 - - - Require MPPE128 - - - - - spacer6 - - - Vertical - - - Expanding - - - - 20 - 50 - - - - - - layout11 - - - - unnamed - - - - mLcpEchoInterval - - - - - textLabel11 - - - LCP Echo Interval - - - - - - - layout12 - - - - unnamed - - - - mLcpEchoFailure - - - - - textLabel10 - - - LCP Echo Failure - - - - - - - layout15 - - - - unnamed - - - - mBaudRate - - - - - textLabel7 - - - Baud rate - - - - - - - layout13 - - - - unnamed - - - - mMtu - - - - - textLabel9 - - - MTU - - - - - - - mRefusePap - - - Refuse PAP - - - - - mNoAuth - - - No Authorization - - - - - mNoVjComp - - - No VJ Compression - - - - - mRefuseMschap - - - Refuse MSCHAP - - - - - layout14 - - - - unnamed - - - - mMru - - - - - textLabel8 - - - MRU - - - - - - - mRequireMppe - - - Require MPPE - - - - - mRequireMppc - - - Require MPPC - - - - - mRefuseMschapV2 - - - Refuse MSCHAPv2 - - - - - mNoBsd - - - No BSD - - - - - mStatefulMppe - - - Stateful MPPE - - - - - mCrtscts - - - CRTSCTS - - - - - mNoDeflate - - - No Deflate - - - - - mRefuseChap - - - Refuse CHAP - - - - - mRefuseEap - - - Refuse EAP - - - - - - - spacer2 - - - Vertical - - - Expanding - - - - 20 - 41 - - - - - - - mNoAuth - mRefuseEap - mRefusePap - mRefuseChap - mRefuseMschap - mRefuseMschapV2 - mNoBsd - mNoDeflate - mNoVjComp - mRequireMppe - mRequireMppe128 - mStatefulMppe - mRequireMppc - mCrtscts - mBaudRate - mMru - mMtu - mLcpEchoFailure - mLcpEchoInterval - - - diff --git a/tdenetworkmanager/src/settings/connection_setting_serial.ui b/tdenetworkmanager/src/settings/connection_setting_serial.ui deleted file mode 100644 index 2a3b9ad..0000000 --- a/tdenetworkmanager/src/settings/connection_setting_serial.ui +++ /dev/null @@ -1,185 +0,0 @@ - -ConnectionSettingSerialWidget - - - ConnectionSettingSerialWidget - - - - 0 - 0 - 170 - 187 - - - - Form2 - - - - unnamed - - - 0 - - - - layout23 - - - - unnamed - - - - mSendDelay - - - - - textLabel11 - - - &Send delay - - - mSendDelay - - - - - - None - - - - - Even - - - - - Odd - - - - mParity - - - - - - 0 - - - - - 1 - - - - mStopBits - - - 1 - - - - - - 7 - - - - - 8 - - - - - 9 - - - - mDataBits - - - 1 - - - - - mBaudRate - - - - - textLabel12_3 - - - &Stop bits: - - - mStopBits - - - - - textLabel7 - - - Baud rate - - - - - textLabel12_2 - - - &Parity: - - - mParity - - - - - textLabel12 - - - &Data bits: - - - mDataBits - - - - - - - spacer6 - - - Vertical - - - Expanding - - - - 20 - 141 - - - - - - - mBaudRate - mDataBits - mParity - mStopBits - mSendDelay - - - diff --git a/tdenetworkmanager/src/settings/connection_setting_vpn.ui b/tdenetworkmanager/src/settings/connection_setting_vpn.ui deleted file mode 100644 index 976fc25..0000000 --- a/tdenetworkmanager/src/settings/connection_setting_vpn.ui +++ /dev/null @@ -1,51 +0,0 @@ - -ConnectionSettingVPNWidget - - - VPN - - - - 0 - 0 - 331 - 155 - - - - VPN - - - - unnamed - - - - cboServices - - - - - textLabel2 - - - Service - - - - - widgetStack - - - - WStackPage - - - 0 - - - - - - - diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless.ui b/tdenetworkmanager/src/settings/connection_setting_wireless.ui deleted file mode 100644 index 9415ce4..0000000 --- a/tdenetworkmanager/src/settings/connection_setting_wireless.ui +++ /dev/null @@ -1,140 +0,0 @@ - -ConnectionSettingWirelessWidget - - - ConnectionSettingWirelessWidget - - - - 0 - 0 - 506 - 418 - - - - Form6 - - - - unnamed - - - - textLabel1 - - - Essid: - - - - - txtEssid - - - - - pbExpert - - - Expert options - - - - - spacer1 - - - Horizontal - - - Expanding - - - - 282 - 20 - - - - - - - Essid - - - true - - - true - - - - - Quality - - - true - - - true - - - - - Security - - - true - - - true - - - - lvEssids - - - StyledPanel - - - Sunken - - - true - - - true - - - - - framePlaceholder - - - NoFrame - - - Raised - - - - - chkAutoRefresh - - - Refresh automatically - - - true - - - - - - - klineedit.h - kpushbutton.h - klistview.h - - diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security.ui deleted file mode 100644 index 5fce58f..0000000 --- a/tdenetworkmanager/src/settings/connection_setting_wireless_security.ui +++ /dev/null @@ -1,87 +0,0 @@ - -ConnectionSettingWirelessSecurityWidget - - - Form1 - - - - 0 - 0 - 522 - 158 - - - - Form1 - - - - unnamed - - - - groupUseEncryption - - - Use Wireless Security - - - true - - - false - - - - unnamed - - - - cboSecurity - - - - - textLabel1 - - - Security: - - - - - buttonGroup5 - - - NoFrame - - - - - - - unnamed - - - 0 - - - - - - pbExtra - - - Expert settings - - - true - - - - - - - - diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security_auth.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security_auth.ui deleted file mode 100644 index ce88e51..0000000 --- a/tdenetworkmanager/src/settings/connection_setting_wireless_security_auth.ui +++ /dev/null @@ -1,51 +0,0 @@ - -Form1 - - - Form1 - - - - 0 - 0 - 342 - 97 - - - - Form1 - - - - unnamed - - - - groupBox1 - - - Authentication - - - - unnamed - - - - textLabel1 - - - Method: - - - - - cboAuthAlg - - - - - - - - diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security_eap.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security_eap.ui deleted file mode 100644 index a851a93..0000000 --- a/tdenetworkmanager/src/settings/connection_setting_wireless_security_eap.ui +++ /dev/null @@ -1,163 +0,0 @@ - -ConnectionSettingWirelessSecurityEAP - - - ConnectionSettingWirelessSecurityEAP - - - - 0 - 0 - 583 - 174 - - - - Form2 - - - - unnamed - - - 0 - - - - groupBox2 - - - EAP - - - - unnamed - - - - textLabel8 - - - Method: - - - - - textLabel9 - - - Identity: - - - - - cboMethod - - - - - txtIdentity - - - - - txtAnonIdentity - - - - - textLabel10 - - - Anonymous Identity: - - - - - textLabel11 - - - Password: - - - - - txtPassword - - - - - textLabel16 - - - Private Secret Key: - - - - - txtPrivateSecretKey - - - - - textLabel12 - - - Client Certificate: - - - - - kURLClientCert - - - - - kURLPrivateKey - - - - - textLabel15 - - - Private Keyfile: - - - - - textLabel14 - - - CA Certificate: - - - - - kURLCACert - - - - - textLabel1 - - - Use System CA Certificates - - - - - chkCAStore - - - - - - - - - - - - - diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security_phase2.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security_phase2.ui deleted file mode 100644 index b3237d4..0000000 --- a/tdenetworkmanager/src/settings/connection_setting_wireless_security_phase2.ui +++ /dev/null @@ -1,54 +0,0 @@ - -ConnectionSettingWirelessSecurityPhase2 - - - ConnectionSettingWirelessSecurityPhase2 - - - - 0 - 0 - 225 - 135 - - - - Form4 - - - - unnamed - - - 0 - - - - groupBox4 - - - Phase 2 - - - - unnamed - - - - textLabel17 - - - Method: - - - - - cboPhase2Method - - - - - - - - diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security_wep.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security_wep.ui deleted file mode 100644 index c07033e..0000000 --- a/tdenetworkmanager/src/settings/connection_setting_wireless_security_wep.ui +++ /dev/null @@ -1,146 +0,0 @@ - -ConnectionSettingWirelessSecurityWEP - - - ConnectionSettingWirelessSecurityWEP - - - - 0 - 0 - 333 - 238 - - - - Form1 - - - - unnamed - - - 0 - - - - WEP - - - WEP - - - - unnamed - - - - buttonGroup1 - - - NoFrame - - - - - - - unnamed - - - 0 - - - - txtWEPKey2 - - - - - rbKeyIdx1 - - - Key 2: - - - - - rbKeyIdx3 - - - Key 4: - - - - - textLabel1 - - - Type: - - - - - rbKeyIdx0 - - - Key 1: - - - - - txtWEPKey3 - - - - - rbKeyIdx2 - - - Key 3: - - - - - txtWEPKey1 - - - - - txtWEPKey0 - - - - - cbKeyType - - - - 7 - 0 - 0 - 0 - - - - - - textLabel1_2 - - - Authentication: - - - - - cboAuthentication - - - - - - - - - - diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security_wepencryption.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security_wepencryption.ui deleted file mode 100644 index 50c149d..0000000 --- a/tdenetworkmanager/src/settings/connection_setting_wireless_security_wepencryption.ui +++ /dev/null @@ -1,46 +0,0 @@ - -ConnectionSettingWirelessSecurityWEPEncryption - - - ConnectionSettingWirelessSecurityWEPEncryption - - - - 0 - 0 - 288 - 64 - - - - Form1 - - - - unnamed - - - 0 - - - - groupBox2 - - - Encryption - - - - unnamed - - - - cboEncryption - - - - - - - - diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpacipher.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpacipher.ui deleted file mode 100644 index a402e66..0000000 --- a/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpacipher.ui +++ /dev/null @@ -1,128 +0,0 @@ - -ConnectionSettingWirelessSecurityWPACipher - - - ConnectionSettingWirelessSecurityWPACipher - - - - 0 - 0 - 600 - 99 - - - - Form1 - - - - unnamed - - - 0 - - - - grpUseCipher - - - Use specific cipher - - - true - - - false - - - - unnamed - - - - textLabel18 - - - Group Cipher: - - - - - textLabel1 - - - Pairwise Cipher: - - - - - chkGroupCipherCCMP - - - CCMP - - - - - chkGroupCipherTKIP - - - TKIP - - - - - chkPairwiseCipherTKIP - - - TKIP - - - - - chkPairwiseCipherCCMP - - - CCMP - - - - - chkGroupCipherWEP40 - - - WEP 40 - - - - - spacer2 - - - Horizontal - - - Expanding - - - - 60 - 20 - - - - - - chkGroupCipherWEP104 - - - WEP 104 - - - - - - - - diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpapsk.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpapsk.ui deleted file mode 100644 index 4df8eea..0000000 --- a/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpapsk.ui +++ /dev/null @@ -1,46 +0,0 @@ - -ConnectionSettingWirelessSecurityWPAPSK - - - ConnectionSettingWirelessSecurityWPAPSK - - - - 0 - 0 - 600 - 480 - - - - Form2 - - - - unnamed - - - 0 - - - - groupBox3 - - - Shared Key - - - - unnamed - - - - txtPSK - - - - - - - - diff --git a/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpaversion.ui b/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpaversion.ui deleted file mode 100644 index 11b1655..0000000 --- a/tdenetworkmanager/src/settings/connection_setting_wireless_security_wpaversion.ui +++ /dev/null @@ -1,80 +0,0 @@ - -ConnectionSettingWirelessSecurityWPAVersion - - - ConnectionSettingWirelessSecurityWPAVersion - - - - 0 - 0 - 308 - 64 - - - - Form3 - - - - unnamed - - - 0 - - - - grpUseWPAVersion - - - Use specific WPA Version - - - true - - - false - - - - unnamed - - - - cbRSN - - - WPA 2/RSN - - - - - cbWPA - - - WPA 1 - - - - - spacer7 - - - Horizontal - - - Expanding - - - - 50 - 20 - - - - - - - - - diff --git a/tdenetworkmanager/src/settings/connection_settings.ui b/tdenetworkmanager/src/settings/connection_settings.ui deleted file mode 100644 index c7994de..0000000 --- a/tdenetworkmanager/src/settings/connection_settings.ui +++ /dev/null @@ -1,137 +0,0 @@ - -ConnectionSettingsDialog - - - ConnectionSettingsDialog - - - - 0 - 0 - 644 - 318 - - - - Connections - - - - unnamed - - - - pbBack - - - Back - - - - - lblInfo - - - - 1 - - - - New Connection - - - - - wstackSettings - - - - 5 - 7 - 0 - 0 - - - - TabWidgetPanel - - - - WStackPage - - - 0 - - - - - - pbCancel - - - Cancel - - - - - spacer2 - - - Horizontal - - - Expanding - - - - 180 - 20 - - - - - - pbNext - - - Next - - - true - - - - - pbSave - - - Save - - - - - btnConnect - - - Connect && Save - - - - - - true - - - false - - - - - - - kpushbutton.h - kpushbutton.h - kpushbutton.h - kpushbutton.h - - -- cgit v1.2.1 From 9dce208848183d880895ed0da1cfd3e744d831ab Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 6 Sep 2012 20:00:58 -0500 Subject: Convert config widgets to new API --- .../src/configwidgets/connection_setting_gsm.ui | 31 +- .../src/configwidgets/connection_setting_ppp.ui | 9 - ...tworkmanager-connection_setting_cdma_widget.cpp | 26 +- ...etworkmanager-connection_setting_gsm_widget.cpp | 113 ++++-- ...knetworkmanager-connection_setting_gsm_widget.h | 13 +- ...tworkmanager-connection_setting_info_widget.cpp | 14 +- ...networkmanager-connection_setting_info_widget.h | 11 +- ...tworkmanager-connection_setting_ipv4_widget.cpp | 92 +++-- ...networkmanager-connection_setting_ipv4_widget.h | 11 +- ...etworkmanager-connection_setting_ppp_widget.cpp | 119 +++--- ...knetworkmanager-connection_setting_ppp_widget.h | 11 +- ...orkmanager-connection_setting_serial_widget.cpp | 79 +++- ...tworkmanager-connection_setting_serial_widget.h | 14 +- ...connection_setting_wireless_security_widget.cpp | 422 +++++++++++---------- ...r-connection_setting_wireless_security_widget.h | 56 +-- ...kmanager-connection_setting_wireless_widget.cpp | 24 +- ...orkmanager-connection_setting_wireless_widget.h | 13 +- 17 files changed, 610 insertions(+), 448 deletions(-) diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_gsm.ui b/tdenetworkmanager/src/configwidgets/connection_setting_gsm.ui index c89a749..0830da7 100644 --- a/tdenetworkmanager/src/configwidgets/connection_setting_gsm.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_gsm.ui @@ -41,17 +41,6 @@ mNetworkId - - - textLabel2_2_2 - - - PU&K: - - - mUsername - - textLabel1 @@ -79,22 +68,22 @@ - GPRS + Only 3G - GSM + Only GPRS/EDGE - Prefer GPRS + Prefer 3G - Prefer GSM + Prefer 2G @@ -151,17 +140,6 @@ mBand - - - mPuk - - - Personal Unblocking Code - - - A code used to unblock a blocked SIM card - - mBand @@ -283,7 +261,6 @@ mUsername mPassword mPin - mPuk mNumber mApn mNetworkId diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_ppp.ui b/tdenetworkmanager/src/configwidgets/connection_setting_ppp.ui index 7db6e5e..734fe78 100644 --- a/tdenetworkmanager/src/configwidgets/connection_setting_ppp.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_ppp.ui @@ -210,14 +210,6 @@ Require MPPE - - - mRequireMppc - - - Require MPPC - - mRefuseMschapV2 @@ -308,7 +300,6 @@ mRequireMppe mRequireMppe128 mStatefulMppe - mRequireMppc mCrtscts mBaudRate mMru diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp index c803b4a..09b9ed3 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp @@ -44,7 +44,7 @@ using namespace ConnectionSettings; CDMAWidgetImpl::CDMAWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { - _cdmasetting = dynamic_cast (conn); + _cdmasetting = dynamic_cast(conn); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingCdmaWidget(this); @@ -56,12 +56,16 @@ CDMAWidgetImpl::CDMAWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, con 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())); + if (_cdmasetting->cdmaConfig.valid) { + _mainWid->mUsername->setText( _cdmasetting->cdmaConfig.username ); + _mainWid->mNumber->setText( _cdmasetting->cdmaConfig.providerDataNumber ); + if (_cdmasetting->cdmaConfig.secretsValid) { + _mainWid->mPassword->setText( _cdmasetting->cdmaConfig.password ); + } + } + 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 @@ -78,9 +82,11 @@ CDMAWidgetImpl::Activate() void CDMAWidgetImpl::dirty() { - _cdmasetting->setUsername( _mainWid->mUsername->text() ); - _cdmasetting->setPassword( _mainWid->mPassword->text() ); - _cdmasetting->setNumber( _mainWid->mNumber->text() ); + _cdmasetting->cdmaConfig.username = _mainWid->mUsername->text(); + _cdmasetting->cdmaConfig.password = _mainWid->mPassword->text(); + _cdmasetting->cdmaConfig.providerDataNumber = _mainWid->mNumber->text(); + _cdmasetting->cdmaConfig.valid = true; + _cdmasetting->cdmaConfig.secretsValid = true; } diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.cpp index 88af9bb..36a9a57 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.cpp @@ -35,19 +35,17 @@ #include // 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) +GSMWidgetImpl::GSMWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { - _gsmsetting = dynamic_cast (conn->getSetting(NM_SETTING_GSM_SETTING_NAME)); + _gsmsetting = dynamic_cast(conn); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingGsmWidget(this); @@ -59,25 +57,27 @@ GSMWidgetImpl::GSMWidgetImpl(Connection* conn, TQWidget* parent, const char* nam 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())); + if (_gsmsetting->gsmConfig.valid) { + _mainWid->mUsername->setText( _gsmsetting->gsmConfig.username ); + _mainWid->mNumber->setText( _gsmsetting->gsmConfig.providerDataNumber ); + _mainWid->mApn->setText( _gsmsetting->gsmConfig.accessPointName ); + _mainWid->mNetworkId->setText( _gsmsetting->gsmConfig.networkID ); + setNetworkType( _gsmsetting->gsmConfig.networkType ); + _mainWid->mBand->setValue( _gsmsetting->gsmConfig.allowedFrequencyBands ); + if (_gsmsetting->gsmConfig.secretsValid) { + _mainWid->mPassword->setText( _gsmsetting->gsmConfig.password ); + _mainWid->mPin->setText( _gsmsetting->gsmConfig.pin ); + } + } + + 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->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 @@ -94,15 +94,64 @@ 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() ); + _gsmsetting->gsmConfig.username = _mainWid->mUsername->text(); + _gsmsetting->gsmConfig.password = _mainWid->mPassword->text(); + _gsmsetting->gsmConfig.pin = _mainWid->mPin->text(); + _gsmsetting->gsmConfig.providerDataNumber = _mainWid->mNumber->text(); + _gsmsetting->gsmConfig.accessPointName = _mainWid->mApn->text(); + _gsmsetting->gsmConfig.networkID = _mainWid->mNetworkId->text(); + _gsmsetting->gsmConfig.networkType = getNetworkType(); + _gsmsetting->gsmConfig.allowedFrequencyBands = _mainWid->mBand->value(); + + _gsmsetting->gsmConfig.valid = true; + _gsmsetting->gsmConfig.secretsValid = true; +} + +void +GSMWidgetImpl::setNetworkType(TDEGSMNetworkType::TDEGSMNetworkType type) +{ + if (type == TDEGSMNetworkType::Any) { + _mainWid->mBand->setValue(0); + } + else if (type == TDEGSMNetworkType::Only3G) { + _mainWid->mBand->setValue(1); + } + else if (type == TDEGSMNetworkType::GPRSEdge) { + _mainWid->mBand->setValue(2); + } + else if (type == TDEGSMNetworkType::Prefer3G) { + _mainWid->mBand->setValue(3); + } + else if (type == TDEGSMNetworkType::Prefer2G) { + _mainWid->mBand->setValue(4); + } + else { + _mainWid->mBand->setValue(0); + } +} + +TDEGSMNetworkType::TDEGSMNetworkType +GSMWidgetImpl::getNetworkType() +{ + int itemNo = _mainWid->mNetworkType->currentItem(); + if (itemNo == 0) { + return TDEGSMNetworkType::Any; + } + else if (itemNo == 1) { + return TDEGSMNetworkType::Only3G; + } + else if (itemNo == 2) { + return TDEGSMNetworkType::GPRSEdge; + } + else if (itemNo == 3) { + return TDEGSMNetworkType::Prefer3G; + } + else if (itemNo == 4) { + return TDEGSMNetworkType::Prefer2G; + } + else { + return TDEGSMNetworkType::Any; + } } #include "knetworkmanager-connection_setting_gsm_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.h index df77606..f4fd439 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.h +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.h @@ -26,14 +26,17 @@ #define KNETWORKMANAGER_CONNECTION_SETTING_GSM_WIDGET_H -// qt headers +// tqt headers #include #include +// tde headers +#include +#include + // knm headers #include "knetworkmanager-connection_setting_gsm.h" #include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-device.h" //class VPNService; class ConnectionSettingGsmWidget; @@ -48,7 +51,7 @@ class GSMWidgetImpl : public WidgetInterface Q_OBJECT public: - GSMWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); + GSMWidgetImpl(TDENetworkConnection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); void Activate(); void Deactivate(); public slots: @@ -58,8 +61,10 @@ class GSMWidgetImpl : public WidgetInterface void Init(); //VPNConfigWidget* getVPNConfigWidget(VPNService* service); + void setNetworkType(TDEGSMNetworkType::TDEGSMNetworkType); + TDEGSMNetworkType::TDEGSMNetworkType getNetworkType(); - GSM* _gsmsetting; + TDEModemConnection* _gsmsetting; ConnectionSettingGsmWidget* _mainWid; }; diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.cpp index e0982e8..f0c1972 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.cpp @@ -30,17 +30,15 @@ #include // 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) +InfoWidgetImpl::InfoWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { - _infosetting = dynamic_cast (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME)); + _infosetting = conn; TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); @@ -60,20 +58,20 @@ InfoWidgetImpl::Init() void InfoWidgetImpl::Activate() { - _mainWid->txtConnectionName->setText(_infosetting->getName()); - _mainWid->chkAutoConnect->setChecked(_infosetting->getAutoconnect()); + _mainWid->txtConnectionName->setText(_infosetting->friendlyName); + _mainWid->chkAutoConnect->setChecked(_infosetting->autoConnect); } void InfoWidgetImpl::slotNameChanged(const TQString& name) { - _infosetting->setName(name); + _infosetting->friendlyName = name; } void InfoWidgetImpl::slotAutoconnectChanged(bool autoconnect) { - _infosetting->setAutoconnect(autoconnect); + _infosetting->autoConnect = autoconnect; } #include "knetworkmanager-connection_setting_info_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.h index 16a7ace..c5900ce 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.h +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.h @@ -27,14 +27,17 @@ #define KNETWORKMANAGER_CONNECTION_SETTING_INFO_WIDGET_H -// qt headers +// tqt headers #include #include +// tde headers +#include +#include + // knm headers #include "connection_setting_info.h" #include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-device.h" namespace ConnectionSettings { @@ -47,7 +50,7 @@ class InfoWidgetImpl : public WidgetInterface Q_OBJECT public: - InfoWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); + InfoWidgetImpl(TDENetworkConnection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); void Activate(); public slots: @@ -57,7 +60,7 @@ class InfoWidgetImpl : public WidgetInterface private: void Init(); - Info* _infosetting; + TDENetworkConnection* _infosetting; ConnectionSettingInfoWidget* _mainWid; }; diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.cpp index ca00a49..7b48dfe 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.cpp @@ -36,10 +36,10 @@ using namespace ConnectionSettings; #define IP_INPUT_MASK "900.900.900.900" -IPv4WidgetImpl::IPv4WidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl) +IPv4WidgetImpl::IPv4WidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { - _ipv4_setting = dynamic_cast (conn->getSetting(NM_SETTING_IP4_CONFIG_SETTING_NAME)); + _ipv4_setting = conn; TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingIPv4Widget(this); @@ -51,7 +51,7 @@ IPv4WidgetImpl::IPv4WidgetImpl(Connection* conn, TQWidget* parent, const char* n void IPv4WidgetImpl::Init() { - _mainWid->groupIPConfig->setChecked(_ipv4_setting->getMethod() == IPv4::METHOD_MANUAL); + _mainWid->groupIPConfig->setChecked(!(_ipv4_setting->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPIP)); connect(_mainWid->groupIPConfig, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotIPConfigEnabled(bool))); @@ -59,26 +59,34 @@ IPv4WidgetImpl::Init() _mainWid->txtNetmask->setInputMask(IP_INPUT_MASK); _mainWid->txtGateway->setInputMask(IP_INPUT_MASK); - if (!_ipv4_setting->getAddresses().isEmpty()) + if (!_ipv4_setting->ipConfig.ipConfigurations.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()); + _mainWid->txtIP->setText(_ipv4_setting->ipConfig.ipConfigurations[0].ipAddress.toString()); + _mainWid->txtNetmask->setText(_ipv4_setting->ipConfig.ipConfigurations[0].networkMask.toString()); + _mainWid->txtGateway->setText(_ipv4_setting->ipConfig.ipConfigurations[0].gateway.toString()); } - if (!_ipv4_setting->getDNS().isEmpty()) + if (!_ipv4_setting->ipConfig.resolvers.isEmpty()) { - TQValueList hosts = _ipv4_setting->getDNS(); + TDENetworkAddressList hosts = _ipv4_setting->ipConfig.resolvers; TQStringList list; - for (TQValueList::Iterator it = hosts.begin(); it != hosts.end(); ++it) + for (TDENetworkAddressList::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(" ")); + if (!_ipv4_setting->ipConfig.searchDomains.isEmpty()) + { + TDENetworkSearchDomainList domains = _ipv4_setting->ipConfig.searchDomains; + TQStringList list; + for (TDENetworkSearchDomainList::Iterator it = domains.begin(); it != domains.end(); ++it) + { + list.append((*it).searchDomain()); + } + _mainWid->txtDNSSearch->setText(list.join(" ")); + } // connect the signals after setting up the values connect(_mainWid->txtIP, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotIPAddressChanged(const TQString&))); @@ -99,14 +107,16 @@ IPv4WidgetImpl::slotDNSAddressesChanged(const TQString& adr) { // TODO: use , and ; for splitting too TQStringList list = TQStringList::split(" ", adr); - TQValueList hosts; + TDENetworkAddressList hosts; for (TQStringList::Iterator it = list.begin(); it != list.end(); ++it) { TQHostAddress host(*it); if (!host.isNull()) + { hosts.append(host); + } } - _ipv4_setting->setDNS(hosts); + _ipv4_setting->ipConfig.resolvers = hosts; } @@ -114,13 +124,30 @@ void IPv4WidgetImpl::slotDNSSearchChanged(const TQString& search) { // TODO: use , and ; for splitting too - _ipv4_setting->setDNSSearch(TQStringList::split(" ", search)); + + TQStringList list = TQStringList::split(" ", search); + TDENetworkSearchDomainList domains; + for (TQStringList::Iterator it = list.begin(); it != list.end(); ++it) + { + if ((*it) != "") { + TDENetworkSearchDomain domain(*it); + domains.append(domain); + } + } + _ipv4_setting->ipConfig.searchDomains = domains; } void IPv4WidgetImpl::slotIPConfigEnabled(bool enabled) { - _ipv4_setting->setMethod(enabled ? IPv4::METHOD_MANUAL : IPv4::METHOD_DHCP ); + if (enabled) + { + _ipv4_setting->ipConfig.connectionFlags &= (~TDENetworkIPConfigurationFlags::IPV4DHCPIP); + } + else + { + _ipv4_setting->ipConfig.connectionFlags |= TDENetworkIPConfigurationFlags::IPV4DHCPIP; + } } void @@ -129,28 +156,33 @@ IPv4WidgetImpl::slotIPAddressChanged(const TQString& ip) TQHostAddress ipadr(ip); if (!ipadr.isNull()) { - TQValueList addrs = _ipv4_setting->getAddresses(); + TDENetworkSingleIPConfigurationList addrs = _ipv4_setting->ipConfig.ipConfigurations; if (addrs.size() > 0) - addrs[0].address = ipadr; + { + addrs[0].ipAddress = ipadr; + } else { - IPv4Address adr; - adr.address = ipadr; + TDENetworkSingleIPConfiguration adr; + adr.ipAddress = ipadr; addrs.append(adr); } - _ipv4_setting->setAddresses(addrs); + _ipv4_setting->ipConfig.ipConfigurations = 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) + if ( (ipadr.toIPv4Address() & 0xFF000000) >= 0xC0000000) { _mainWid->txtNetmask->setText("255.255.255.0"); // class C - else if ( (ipadr.toIPv4Address() & 0xFF000000) >= 0x80000000) + } + else if ( (ipadr.toIPv4Address() & 0xFF000000) >= 0x80000000) { _mainWid->txtNetmask->setText("255.255.0.0"); // class B - else + } + else { _mainWid->txtNetmask->setText("255.0.0.0"); // class A + } } } } @@ -159,17 +191,19 @@ IPv4WidgetImpl::slotIPAddressChanged(const TQString& ip) void IPv4WidgetImpl::slotNetmaskChanged(const TQString& ip) { - TQValueList addrs = _ipv4_setting->getAddresses(); - addrs[0].netmask = TQHostAddress(ip); - _ipv4_setting->setAddresses(addrs); + TDENetworkSingleIPConfigurationList addrs = _ipv4_setting->ipConfig.ipConfigurations; + TDENetMask mask; + mask.fromString(ip); + addrs[0].networkMask = mask; + _ipv4_setting->ipConfig.ipConfigurations = addrs; } void IPv4WidgetImpl::slotGatewayChanged(const TQString& ip) { - TQValueList addrs = _ipv4_setting->getAddresses(); + TDENetworkSingleIPConfigurationList addrs = _ipv4_setting->ipConfig.ipConfigurations; addrs[0].gateway = TQHostAddress(ip); - _ipv4_setting->setAddresses(addrs); + _ipv4_setting->ipConfig.ipConfigurations = addrs; } #include "knetworkmanager-connection_setting_ipv4_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.h index 4fabdce..cfee028 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.h +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.h @@ -25,11 +25,14 @@ #ifndef KNETWORKMANAGER_CONNECTION_SETTING_IPV4_WIDGET_H #define KNETWORKMANAGER_CONNECTION_SETTING_IPV4_WIDGET_H -// qt autogenerated headers +// tde headers +#include +#include + +// ui 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" @@ -43,7 +46,7 @@ namespace ConnectionSettings public: - IPv4WidgetImpl(Connection* conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + IPv4WidgetImpl(TDENetworkConnection* conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); void Activate(); public slots: @@ -57,7 +60,7 @@ namespace ConnectionSettings private: void Init(); - IPv4* _ipv4_setting; + TDENetworkConnection* _ipv4_setting; ConnectionSettingIPv4Widget* _mainWid; }; diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.cpp index e735969..3bc4783 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.cpp @@ -37,19 +37,17 @@ #include // 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) +PPPWidgetImpl::PPPWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { - _pppsetting = dynamic_cast (conn->getSetting(NM_SETTING_PPP_SETTING_NAME)); + _pppsetting = conn; TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingPppWidget(this); @@ -61,39 +59,40 @@ PPPWidgetImpl::PPPWidgetImpl(Connection* conn, TQWidget* parent, const char* nam 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())); + if (_pppsetting->pppConfig.valid) { + _mainWid->mNoAuth->setChecked( !(_pppsetting->pppConfig.requireServerAuthentication) ); + _mainWid->mRefuseEap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableEAP ); + _mainWid->mRefusePap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisablePAP ); + _mainWid->mRefuseChap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableCHAP ); + _mainWid->mRefuseMschap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableMSCHAP ); + _mainWid->mRefuseMschapV2->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableMSCHAPv2 ); + _mainWid->mNoBsd->setChecked( !(_pppsetting->pppConfig.flags & TDENetworkPPPFlags::AllowBSDCompression) ); + _mainWid->mNoDeflate->setChecked( !(_pppsetting->pppConfig.flags & TDENetworkPPPFlags::AllowDeflateCompression) ); + _mainWid->mNoVjComp->setChecked( !(_pppsetting->pppConfig.flags & TDENetworkPPPFlags::AllowVJCompression) ); + _mainWid->mRequireMppe->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::RequireMPPE ); + _mainWid->mRequireMppe128->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::RequireMPPE128 ); + _mainWid->mStatefulMppe->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::StatefulMPPE ); + _mainWid->mCrtscts->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::UseHardwareFlowControl ); + + _mainWid->mBaudRate->setValue(_pppsetting->pppConfig.baudRate); + _mainWid->mMru->setValue(_pppsetting->pppConfig.mru); + _mainWid->mMtu->setValue(_pppsetting->pppConfig.mtu); + _mainWid->mLcpEchoFailure->setValue(_pppsetting->pppConfig.lcpEchoFailureThreshold); + _mainWid->mLcpEchoInterval->setValue(_pppsetting->pppConfig.lcpEchoPingInterval); + } + + 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->mCrtscts, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); } void @@ -107,24 +106,40 @@ PPPWidgetImpl::Activate() } +#define SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(x,y,z) { \ + if (z) { \ + x |= y; \ + } \ + else { \ + x &= (~y); \ + } \ + } + 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()); + _pppsetting->pppConfig.requireServerAuthentication = ( !(_mainWid->mNoAuth->isChecked()) ); + + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableEAP, _mainWid->mRefuseEap->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisablePAP, _mainWid->mRefusePap->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableCHAP, _mainWid->mRefuseChap->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableMSCHAP, _mainWid->mRefuseMschap->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableMSCHAPv2, _mainWid->mRefuseMschapV2->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::AllowBSDCompression, !(_mainWid->mNoBsd->isChecked()) ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::AllowDeflateCompression, !(_mainWid->mNoDeflate->isChecked()) ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::AllowVJCompression, !(_mainWid->mNoVjComp->isChecked()) ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::RequireMPPE, _mainWid->mRequireMppe->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::RequireMPPE128, _mainWid->mRequireMppe128->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::StatefulMPPE, _mainWid->mStatefulMppe->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::UseHardwareFlowControl, _mainWid->mCrtscts->isChecked() ); + + _pppsetting->pppConfig.baudRate = _mainWid->mBaudRate->value(); + _pppsetting->pppConfig.mru = _mainWid->mMru->value(); + _pppsetting->pppConfig.mtu = _mainWid->mMtu->value(); + _pppsetting->pppConfig.lcpEchoFailureThreshold = _mainWid->mLcpEchoFailure->value(); + _pppsetting->pppConfig.lcpEchoPingInterval = _mainWid->mLcpEchoInterval->value(); + + _pppsetting->pppConfig.valid = true; } #include "knetworkmanager-connection_setting_ppp_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.h index acdc2a2..7cd4121 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.h +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.h @@ -26,14 +26,17 @@ #define KNETWORKMANAGER_CONNECTION_SETTING_PPP_WIDGET_H -// qt headers +// tqt headers #include #include +// tde headers +#include +#include + // knm headers #include "knetworkmanager-connection_setting_ppp.h" #include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-device.h" //class VPNService; class ConnectionSettingPppWidget; @@ -48,7 +51,7 @@ class PPPWidgetImpl : public WidgetInterface Q_OBJECT public: - PPPWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); + PPPWidgetImpl(TDENetworkConnection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); void Activate(); void Deactivate(); public slots: @@ -57,7 +60,7 @@ class PPPWidgetImpl : public WidgetInterface private: void Init(); - PPP* _pppsetting; + TDENetworkConnection* _pppsetting; ConnectionSettingPppWidget* _mainWid; }; diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.cpp index 87b92db..574cdb7 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.cpp @@ -36,41 +36,41 @@ #include // 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) +SerialWidgetImpl::SerialWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { - _serialsetting = dynamic_cast (conn->getSetting(NM_SETTING_SERIAL_SETTING_NAME)); + _serialsetting = conn; TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingSerialWidget(this); layout->addWidget(_mainWid); - _mainWid->mBaudRate->setMaxValue(INT_MAX); + _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())); + if (_serialsetting->serialConfig.valid) { + _mainWid->mBaudRate->setValue(_serialsetting->serialConfig.baudRate); + _mainWid->mDataBits->setCurrentItem(_serialsetting->serialConfig.byteWidth - 7); + setParityType(_serialsetting->serialConfig.parity); + _mainWid->mStopBits->setCurrentItem(_serialsetting->serialConfig.stopBits); + _mainWid->mSendDelay->setValue(_serialsetting->serialConfig.txDelay); + } + + 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 @@ -87,11 +87,48 @@ 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() ); + _serialsetting->serialConfig.baudRate = _mainWid->mBaudRate->value(); + _serialsetting->serialConfig.byteWidth = _mainWid->mDataBits->currentItem() + 7; + _serialsetting->serialConfig.parity = getParityType(); + _serialsetting->serialConfig.stopBits = _mainWid->mStopBits->currentItem(); + _serialsetting->serialConfig.txDelay = _mainWid->mSendDelay->value(); + + _serialsetting->serialConfig.valid = true; +} + +void +SerialWidgetImpl::setParityType(TDENetworkParity::TDENetworkParity type) +{ + if (type == TDENetworkParity::None) { + _mainWid->mParity->setCurrentItem(0); + } + else if (type == TDENetworkParity::Even) { + _mainWid->mParity->setCurrentItem(1); + } + else if (type == TDENetworkParity::Odd) { + _mainWid->mParity->setCurrentItem(2); + } + else { + _mainWid->mParity->setCurrentItem(0); + } +} + +TDENetworkParity::TDENetworkParity +SerialWidgetImpl::getParityType() +{ + int itemNo = _mainWid->mParity->currentItem(); + if (itemNo == 0) { + return TDENetworkParity::None; + } + else if (itemNo == 1) { + return TDENetworkParity::Even; + } + else if (itemNo == 2) { + return TDENetworkParity::Odd; + } + else { + return TDENetworkParity::None; + } } #include "knetworkmanager-connection_setting_serial_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.h index 5b3bf28..d12db89 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.h +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.h @@ -26,14 +26,17 @@ #define KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_WIDGET_H -// qt headers +// tqt headers #include #include +// tde headers +#include +#include + // knm headers #include "knetworkmanager-connection_setting_serial.h" #include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-device.h" //class VPNService; class ConnectionSettingSerialWidget; @@ -48,7 +51,7 @@ class SerialWidgetImpl : public WidgetInterface Q_OBJECT public: - SerialWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); + SerialWidgetImpl(TDENetworkConnection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); void Activate(); void Deactivate(); public slots: @@ -57,7 +60,10 @@ class SerialWidgetImpl : public WidgetInterface private: void Init(); - Serial* _serialsetting; + void setParityType(TDENetworkParity::TDENetworkParity type); + TDENetworkParity::TDENetworkParity getParityType(); + + TDENetworkConnection* _serialsetting; ConnectionSettingSerialWidget* _mainWid; }; diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.cpp index 1adea03..4b6d70a 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.cpp @@ -41,48 +41,52 @@ #include /* 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 +#define SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(x,y,z) { \ + if (z) { \ + x |= y; \ + } \ + else { \ + x &= (~y); \ + } \ + } + using namespace ConnectionSettings; /* class WirelessSecurityWEPImpl */ -WirelessSecurityWEPImpl::WirelessSecurityWEPImpl(WirelessSecurity* sec, TQWidget* parent, const char* name, WFlags fl) +WirelessSecurityWEPImpl::WirelessSecurityWEPImpl(TDEWiFiConnection* 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) + if (_security_setting->securitySettings.authType == TDENetworkWiFiAuthType::Open) { cboAuthentication->setCurrentItem(0); - else if (_security_setting->getAuthAlg() == WirelessSecurity::AUTH_ALG_SHARED) + } + else if (_security_setting->securitySettings.authType == TDENetworkWiFiAuthType::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)); + txtWEPKey0->setText(_security_setting->securitySettings.wepKey0); + txtWEPKey1->setText(_security_setting->securitySettings.wepKey1); + txtWEPKey2->setText(_security_setting->securitySettings.wepKey2); + txtWEPKey3->setText(_security_setting->securitySettings.wepKey3); - switch(_security_setting->getWepTxidx()) + switch(_security_setting->securitySettings.wepKeyIndex) { case 0: rbKeyIdx0->setChecked(true); @@ -116,10 +120,12 @@ WirelessSecurityWEPImpl::WirelessSecurityWEPImpl(WirelessSecurity* sec, TQWidget 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); + if (index == 0) { + _security_setting->securitySettings.authType =TDENetworkWiFiAuthType::Open; + } + else if (index == 1) { + _security_setting->securitySettings.authType = TDENetworkWiFiAuthType::Shared; + } } void WirelessSecurityWEPImpl::slotKeyTypeChanged(int index) @@ -132,49 +138,53 @@ void WirelessSecurityWEPImpl::slotKeyTypeChanged(int index) void WirelessSecurityWEPImpl::slotWepKey0Changed(const TQString &key) { TQCString hashed = getHashedWEPKey(key, _wepKeyType); - _security_setting->setWepKey(0, hashed); + _security_setting->securitySettings.wepKey0 = hashed; } void WirelessSecurityWEPImpl::slotWepKey1Changed(const TQString &key) { TQCString hashed = getHashedWEPKey(key, _wepKeyType); - _security_setting->setWepKey(1, hashed); + _security_setting->securitySettings.wepKey1 = hashed; } void WirelessSecurityWEPImpl::slotWepKey2Changed(const TQString &key) { TQCString hashed = getHashedWEPKey(key, _wepKeyType); - _security_setting->setWepKey(2, hashed); + _security_setting->securitySettings.wepKey2 = hashed; } void WirelessSecurityWEPImpl::slotWepKey3Changed(const TQString& key) { TQCString hashed = getHashedWEPKey(key, _wepKeyType); - _security_setting->setWepKey(3, hashed); + _security_setting->securitySettings.wepKey3 = hashed; } void WirelessSecurityWEPImpl::slotWepIdx0Checked(bool check) { - if (check) - _security_setting->setWepTxidx(0); + if (check) { + _security_setting->securitySettings.wepKeyIndex = 0; + } } void WirelessSecurityWEPImpl::slotWepIdx1Checked(bool check) { - if (check) - _security_setting->setWepTxidx(1); + if (check) { + _security_setting->securitySettings.wepKeyIndex = 1; + } } void WirelessSecurityWEPImpl::slotWepIdx2Checked(bool check) { - if (check) - _security_setting->setWepTxidx(2); + if (check) { + _security_setting->securitySettings.wepKeyIndex = 2; + } } void WirelessSecurityWEPImpl::slotWepIdx3Checked(bool check) { - if (check) - _security_setting->setWepTxidx(3); + if (check) { + _security_setting->securitySettings.wepKeyIndex = 3; + } } TQCString @@ -243,7 +253,7 @@ WirelessSecurityWEPImpl::String2Hex(TQByteArray bytes, int final_len) const /* class WirelessSecurityWEPEncryptionImpl */ -WirelessSecurityWEPEncryptionImpl::WirelessSecurityWEPEncryptionImpl(WirelessSecurity* security_setting, TQWidget* parent, const char* name, WFlags fl) +WirelessSecurityWEPEncryptionImpl::WirelessSecurityWEPEncryptionImpl(TDEWiFiConnection* security_setting, TQWidget* parent, const char* name, WFlags fl) : ConnectionSettingWirelessSecurityWEPEncryption(parent, name, fl) , _security_setting(security_setting) { @@ -255,12 +265,12 @@ WirelessSecurityWEPEncryptionImpl::WirelessSecurityWEPEncryptionImpl(WirelessSec /* class WirelessSecurityWPAVersionImpl */ -WirelessSecurityWPAVersionImpl::WirelessSecurityWPAVersionImpl(WirelessSecurity* security_setting, TQWidget* parent, const char* name, WFlags fl) +WirelessSecurityWPAVersionImpl::WirelessSecurityWPAVersionImpl(TDEWiFiConnection* 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); + cbWPA->setChecked(_security_setting->securitySettings.wpaVersion & TDENetworkWiFiWPAVersionFlags::WPA); + cbRSN->setChecked(_security_setting->securitySettings.wpaVersion & TDENetworkWiFiWPAVersionFlags::RSN); connect(cbWPA, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWPA1(bool))); connect(cbRSN, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWPA2(bool))); @@ -271,45 +281,39 @@ WirelessSecurityWPAVersionImpl::WirelessSecurityWPAVersionImpl(WirelessSecurity* void WirelessSecurityWPAVersionImpl::slotAuto(bool on) { - if (!on) - { + if (!on) { // auto-select proto - _security_setting->setProto(WirelessSecurity::PROTO_AUTO); + _security_setting->securitySettings.wpaVersion = TDENetworkWiFiWPAVersionFlags::Any; } - else - { + 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); + TDENetworkWiFiWPAVersionFlags::TDENetworkWiFiWPAVersionFlags proto = TDENetworkWiFiWPAVersionFlags::None; + if (cbWPA->isChecked()) { + proto |= TDENetworkWiFiWPAVersionFlags::WPA; + } + if (cbRSN->isChecked()) { + proto |= TDENetworkWiFiWPAVersionFlags::RSN; + } + _security_setting->securitySettings.wpaVersion = proto; } } void WirelessSecurityWPAVersionImpl::slotWPA1(bool on) { - if (on) - _security_setting->addProto(WirelessSecurity::PROTO_WPA); - else - _security_setting->delProto(WirelessSecurity::PROTO_WPA); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(_security_setting->securitySettings.wpaVersion, TDENetworkWiFiWPAVersionFlags::WPA, on); } void WirelessSecurityWPAVersionImpl::slotWPA2(bool on) { - if (on) - _security_setting->addProto(WirelessSecurity::PROTO_RSN); - else - _security_setting->delProto(WirelessSecurity::PROTO_RSN); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(_security_setting->securitySettings.wpaVersion, TDENetworkWiFiWPAVersionFlags::RSN, on); } /* class WirelessSecurityWPACipherImpl */ -WirelessSecurityWPACipherImpl::WirelessSecurityWPACipherImpl(WirelessSecurity* security_setting, TQWidget* parent, const char* name, WFlags fl) +WirelessSecurityWPACipherImpl::WirelessSecurityWPACipherImpl(TDEWiFiConnection* security_setting, TQWidget* parent, const char* name, WFlags fl) : ConnectionSettingWirelessSecurityWPACipher(parent, name, fl) , _security_setting(security_setting) { @@ -323,13 +327,13 @@ WirelessSecurityWPACipherImpl::WirelessSecurityWPACipherImpl(WirelessSecurity* s 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); + chkPairwiseCipherCCMP->setChecked(_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)); + chkPairwiseCipherTKIP->setChecked(_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)); - 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); + chkGroupCipherCCMP->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)); + chkGroupCipherTKIP->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)); + chkGroupCipherWEP40->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40)); + chkGroupCipherWEP104->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104)); } @@ -339,32 +343,40 @@ WirelessSecurityWPACipherImpl::slotCipherChangedAuto(bool checked) if (!checked) { // select auto for both ciphers - _security_setting->setGroupCiphers(WirelessSecurity::CIPHER_AUTO); - _security_setting->setPairwiseCiphers(WirelessSecurity::CIPHER_AUTO); + _security_setting->securitySettings.allowedGroupWiseCiphers.clear(); + _security_setting->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::Any); + _security_setting->securitySettings.allowedPairWiseCiphers.clear(); + _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::Any); } 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); + TDENetworkWiFiConnectionCipherList cipher; + if (chkGroupCipherTKIP->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherTKIP); + } + if (chkGroupCipherCCMP->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherCCMP); + } + if (chkGroupCipherWEP40->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherWEP40); + } + if (chkGroupCipherWEP104->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherWEP104); + } + _security_setting->securitySettings.allowedGroupWiseCiphers = 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); + cipher.clear(); + if (chkPairwiseCipherTKIP->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherTKIP); + } + if (chkPairwiseCipherCCMP->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherCCMP); + } + _security_setting->securitySettings.allowedPairWiseCiphers = cipher; } } @@ -372,66 +384,80 @@ WirelessSecurityWPACipherImpl::slotCipherChangedAuto(bool checked) 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)); + if (checked) { + if (!_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)) _security_setting->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherTKIP); + } + else { + _security_setting->securitySettings.allowedGroupWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherTKIP); + } } 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)); + if (checked) { + if (!_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)) _security_setting->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherCCMP); + } + else { + _security_setting->securitySettings.allowedGroupWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherCCMP); + } } 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)); + if (checked) { + if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP40); + } + else { + _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherWEP40); + } } 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)); + if (checked) { + if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP104); + } + else { + _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherWEP104); + } } 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)); + if (checked) { + if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherTKIP); + } + else { + _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherTKIP); + } } 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)); + if (checked) { + if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherCCMP); + } + else { + _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherCCMP); + } } /* class WirelessSecurityWPAPSK */ -WirelessSecurityWPAPSKImpl::WirelessSecurityWPAPSKImpl(WirelessSecurity* security_setting, Wireless* wireless_setting, TQWidget* parent, const char* name, WFlags fl) +WirelessSecurityWPAPSKImpl::WirelessSecurityWPAPSKImpl(TDEWiFiConnection* security_setting, TDEWiFiConnection* 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()); + if (_security_setting->securitySettings.secretsValid) { + txtPSK->setText(_security_setting->securitySettings.psk); + } connect(txtPSK, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotPSKChanged(const TQString&))); } @@ -440,7 +466,8 @@ WirelessSecurityWPAPSKImpl::slotPSKChanged(const TQString& psk) { if (_wireless_setting) { - _security_setting->setPSK(psk); + _security_setting->securitySettings.psk = psk; + _security_setting->securitySettings.secretsValid = true; } } @@ -464,7 +491,7 @@ WirelessSecurityWPAPSKImpl::String2Hex(TQByteArray bytes, int final_len) const /* class WirelessSecurityEAPImpl */ -WirelessSecurityEAPImpl::WirelessSecurityEAPImpl(IEEE8021x* security_setting, WirelessSecurityPhase2Impl* phase2_widget, TQWidget* parent, const char* name, WFlags fl) +WirelessSecurityEAPImpl::WirelessSecurityEAPImpl(TDEWiFiConnection* security_setting, WirelessSecurityPhase2Impl* phase2_widget, TQWidget* parent, const char* name, WFlags fl) : ConnectionSettingWirelessSecurityEAP(parent, name, fl) , _security_setting(security_setting) , _phase2_widget(phase2_widget) @@ -472,42 +499,44 @@ WirelessSecurityEAPImpl::WirelessSecurityEAPImpl(IEEE8021x* security_setting, Wi // insert all EAP-Methods int index = 0; cboMethod->insertItem(i18n("None"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_NONE; + _eapIndexMap[index] = TDENetworkIEEE8021xType::None; cboMethod->insertItem(i18n("TTLS"), ++index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_TTLS; + _eapIndexMap[index] = TDENetworkIEEE8021xType::TTLS; cboMethod->insertItem(i18n("PEAP"), ++index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_PEAP; + _eapIndexMap[index] = TDENetworkIEEE8021xType::PEAP; cboMethod->insertItem(i18n("TLS"), ++index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_TLS; + _eapIndexMap[index] = TDENetworkIEEE8021xType::TLS; cboMethod->insertItem(i18n("Leap"), ++index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_LEAP; + _eapIndexMap[index] = TDENetworkIEEE8021xType::LEAP; cboMethod->insertItem(i18n("MD5"), ++index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_MD5; + _eapIndexMap[index] = TDENetworkIEEE8021xType::MD5; cboMethod->insertItem(i18n("FAST"), ++index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_FAST; + _eapIndexMap[index] = TDENetworkIEEE8021xType::Fast; cboMethod->insertItem(i18n("SIM"), ++index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_SIM; + _eapIndexMap[index] = TDENetworkIEEE8021xType::SIM; // preselect the correct method - TQBiDirectionalMap::Iterator it = _eapIndexMap.findData(_security_setting->getEAP()); + TQBiDirectionalMap::Iterator it = _eapIndexMap.findData(_security_setting->eapConfig.type); cboMethod->setCurrentItem(it.key()); // update phase2 combobox - _phase2_widget->setAllowedPhase2Methods(_security_setting->getAllowedPhase2Methods()); + _phase2_widget->setAllowedPhase2Methods(_security_setting->eapConfig.allowedPhase2EAPMethods); - txtIdentity->setText(_security_setting->getIdentity()); - txtAnonIdentity->setText(_security_setting->getAnonIdentity()); - txtPassword->setText(_security_setting->getPassword()); + txtIdentity->setText(_security_setting->eapConfig.userName); + txtAnonIdentity->setText(_security_setting->eapConfig.anonymousUserName); + if (_security_setting->eapConfig.secretsValid) { + txtPassword->setText(_security_setting->eapConfig.password); + } - chkCAStore->setChecked(_security_setting->getUseSystemCaCert()); - kURLCACert->setEnabled(!_security_setting->getUseSystemCaCert()); + chkCAStore->setChecked(_security_setting->eapConfig.forceSystemCaCertificates); + kURLCACert->setEnabled(!_security_setting->eapConfig.forceSystemCaCertificates); // get notified if the method changes connect(cboMethod, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotMethodChanged(int))); @@ -519,42 +548,43 @@ WirelessSecurityEAPImpl::WirelessSecurityEAPImpl(IEEE8021x* security_setting, Wi void WirelessSecurityEAPImpl::slotUseSystemCaCertChanged(bool on) { - _security_setting->setUseSystemCaCert(on); + _security_setting->eapConfig.forceSystemCaCertificates = on; kURLCACert->setEnabled(!on); } void WirelessSecurityEAPImpl::slotMethodChanged(int index) { // new method choosen - IEEE8021x::EAP_PHASE1 eap = _eapIndexMap[index]; - _security_setting->setEAP(eap); + TDENetworkIEEE8021xType::TDENetworkIEEE8021xType eap = _eapIndexMap[index]; + _security_setting->eapConfig.type = eap; - _phase2_widget->setAllowedPhase2Methods(_security_setting->getAllowedPhase2Methods()); + _phase2_widget->setAllowedPhase2Methods(_security_setting->eapConfig.allowedPhase2EAPMethods); } void WirelessSecurityEAPImpl::slotIdentityChanged(const TQString& identity) { - _security_setting->setIdentity(identity); + _security_setting->eapConfig.userName = identity; } void WirelessSecurityEAPImpl::slotAnonIdentityChanged(const TQString& identity) { - _security_setting->setAnonIdentity(identity); + _security_setting->eapConfig.anonymousUserName = identity; } void WirelessSecurityEAPImpl::slotPasswordChanged(const TQString& pwd) { - _security_setting->setPassword(TQString(txtPassword->password())); + _security_setting->eapConfig.password = TQString(txtPassword->password()); + _security_setting->eapConfig.secretsValid = true; } /* class WirelessSecurityPhase2Impl */ -WirelessSecurityPhase2Impl::WirelessSecurityPhase2Impl(IEEE8021x* security_setting, TQWidget* parent, const char* name, WFlags fl) +WirelessSecurityPhase2Impl::WirelessSecurityPhase2Impl(TDEWiFiConnection* 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); + _allowed_methods.append(TDENetworkIEEE8021xType::None); updateMethodComboBox(); connect(cboPhase2Method, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotPhase2MethodChanged(int))); @@ -567,79 +597,79 @@ void WirelessSecurityPhase2Impl::updateMethodComboBox() cboPhase2Method->clear(); _eapIndexMap.clear(); - for (TQValueList::Iterator it = _allowed_methods.begin(); it != _allowed_methods.end(); ++it) + for (TQValueList::Iterator it = _allowed_methods.begin(); it != _allowed_methods.end(); ++it) { - if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_NONE) + if ((*it) == TDENetworkIEEE8021xType::None) { cboPhase2Method->insertItem(i18n("None"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_NONE; + _eapIndexMap[index] = TDENetworkIEEE8021xType::None; index++; } - else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_MSCHAPV2) + else if ((*it) == TDENetworkIEEE8021xType::MSCHAPV2) { cboPhase2Method->insertItem(i18n("MSCHAPv2"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_MSCHAPV2; + _eapIndexMap[index] = TDENetworkIEEE8021xType::MSCHAPV2; index++; } - else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_PAP) + else if ((*it) == TDENetworkIEEE8021xType::PAP) { cboPhase2Method->insertItem(i18n("PAP"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_PAP; + _eapIndexMap[index] = TDENetworkIEEE8021xType::PAP; index++; } - else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_CHAP) + else if ((*it) == TDENetworkIEEE8021xType::CHAP) { cboPhase2Method->insertItem(i18n("CHAP"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_CHAP; + _eapIndexMap[index] = TDENetworkIEEE8021xType::CHAP; index++; } - else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_MSCHAP) + else if ((*it) == TDENetworkIEEE8021xType::MSCHAP) { cboPhase2Method->insertItem(i18n("MSCHAP"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_MSCHAP; + _eapIndexMap[index] = TDENetworkIEEE8021xType::MSCHAP; index++; } - else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_GTC) + else if ((*it) == TDENetworkIEEE8021xType::GTC) { cboPhase2Method->insertItem(i18n("GTC"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_GTC; + _eapIndexMap[index] = TDENetworkIEEE8021xType::GTC; index++; } - else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_OTP) + else if ((*it) == TDENetworkIEEE8021xType::OTP) { cboPhase2Method->insertItem(i18n("OTP"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_OTP; + _eapIndexMap[index] = TDENetworkIEEE8021xType::OTP; index++; } - else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_MD5) + else if ((*it) == TDENetworkIEEE8021xType::MD5) { cboPhase2Method->insertItem(i18n("MD5"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_MD5; + _eapIndexMap[index] = TDENetworkIEEE8021xType::MD5; index++; } - else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_TLS) + else if ((*it) == TDENetworkIEEE8021xType::TLS) { cboPhase2Method->insertItem(i18n("TLS"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_TLS; + _eapIndexMap[index] = TDENetworkIEEE8021xType::TLS; index++; } } // preselect the correct method - TQBiDirectionalMap::Iterator it = _eapIndexMap.findData(_security_setting->getPhase2EAP()); + TQBiDirectionalMap::Iterator it = _eapIndexMap.findData(_security_setting->eapConfig.phase2EAPAuthMethod); if (it != _eapIndexMap.end()) { cboPhase2Method->setCurrentItem(it.key()); - _security_setting->setPhase2EAP(it.data()); + _security_setting->eapConfig.phase2EAPAuthMethod = it.data(); } else { cboPhase2Method->setCurrentItem(0); - _security_setting->setPhase2EAP(_eapIndexMap[0]); + _security_setting->eapConfig.phase2EAPAuthMethod = _eapIndexMap[0]; } } -void WirelessSecurityPhase2Impl::setAllowedPhase2Methods(const TQValueList& list) +void WirelessSecurityPhase2Impl::setAllowedPhase2Methods(const TQValueList& list) { _allowed_methods = list; updateMethodComboBox(); @@ -648,20 +678,20 @@ void WirelessSecurityPhase2Impl::setAllowedPhase2Methods(const TQValueListsetPhase2EAP(eap); + TDENetworkIEEE8021xType::TDENetworkIEEE8021xType eap = _eapIndexMap[index]; + _security_setting->eapConfig.phase2EAPAuthMethod = eap; } /* class WirelessSecurityWidgetImpl */ -WirelessSecurityWidgetImpl::WirelessSecurityWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl) +WirelessSecurityWidgetImpl::WirelessSecurityWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { - _security_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)); - _wireless_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); - _ieee8021x_setting = dynamic_cast (conn->getSetting(NM_SETTING_802_1X_SETTING_NAME)); + _security_setting = dynamic_cast (conn); + _wireless_setting = dynamic_cast (conn); + _ieee8021x_setting = dynamic_cast (conn); _new_conn = new_conn; TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); @@ -737,41 +767,41 @@ WirelessSecurityWidgetImpl::comboSecurityInit() // TODO: Preselect the right security method // We should have an Essid already, fetch all possible APs - TQValueList aps; - if (_new_conn && !_wireless_setting->getEssid().isEmpty()) - { - aps = WirelessManager::getAccessPointsForEssid(_wireless_setting->getEssid()); + TQValueList aps; + if (_new_conn && !_wireless_setting->SSID.isEmpty()) { + aps = WirelessManager::getAccessPointsForEssid(_wireless_setting->SSID); #if 0 kdDebug() << "Hugo " << TQString(TQCString(_wireless_setting->getEssid())).ascii() << endl; #endif } - if (!aps.isEmpty()) - { + if (!aps.isEmpty()) { // if at least one AP has this security setting show the entry in the combobox - for (TQValueList::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) - { + for (TQValueList::Iterator it = aps.begin(); it != aps.end(); ++it) { + if (((*it)->wpaFlags & TDENetworkWiFiAPFlags::PrivacySupport) || ((*it)->rsnFlags & TDENetworkWiFiAPFlags::PrivacySupport)) { + kdDebug() << "AP " << (*it)->friendlySSID().ascii() << " is encrypted" << endl; + if ((((*it)->rsnFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None) || (((*it)->wpaFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::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)) + if ((*it)->rsnFlags & TDENetworkWiFiAPFlags::KeyManagementPSK || (*it)->wpaFlags & TDENetworkWiFiAPFlags::KeyManagementPSK) { + 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)) + if ((*it)->rsnFlags & TDENetworkWiFiAPFlags::KeyManagement80211 || (*it)->wpaFlags & TDENetworkWiFiAPFlags::KeyManagement80211) { + 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)) + if (!allowed_methods.contains(SECURITY_WEP)) { allowed_methods.append(SECURITY_WEP); - if (!allowed_methods.contains(SECURITY_IEEE8021X)) - allowed_methods.append(SECURITY_IEEE8021X); + } + if (!allowed_methods.contains(SECURITY_IEEE8021X)) { + allowed_methods.append(SECURITY_IEEE8021X); + } } } @@ -815,14 +845,14 @@ WirelessSecurityWidgetImpl::comboSecurityInit() if (!_new_conn) { - switch(_security_setting->getKeyMgmt()) + switch(_security_setting->securitySettings.keyType) { - 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() ) + case TDENetworkWiFiKeyType::WEP: + if (_security_setting->securitySettings.authType == TDENetworkWiFiAuthType::Shared || + !_security_setting->securitySettings.wepKey0.isEmpty() || + !_security_setting->securitySettings.wepKey1.isEmpty() || + !_security_setting->securitySettings.wepKey2.isEmpty() || + !_security_setting->securitySettings.wepKey3.isEmpty() ) { _mainWid->groupUseEncryption->setChecked(true); _mainWid->cboSecurity->setCurrentItem(SECURITY_WEP); @@ -831,17 +861,17 @@ WirelessSecurityWidgetImpl::comboSecurityInit() else _mainWid->groupUseEncryption->setChecked(false); break; - case WirelessSecurity::KEY_MGMT_WPA_PSK: + case TDENetworkWiFiKeyType::WPAInfrastructure: _mainWid->groupUseEncryption->setChecked(true); _mainWid->cboSecurity->setCurrentItem(SECURITY_WPA_PSK); slotComboSecurityActivated(_securityComboMap[SECURITY_WPA_PSK]); break; - case WirelessSecurity::KEY_MGMT_WPA_EAP: + case TDENetworkWiFiKeyType::WPAEnterprise: _mainWid->groupUseEncryption->setChecked(true); _mainWid->cboSecurity->setCurrentItem(SECURITY_WPA_EAP); slotComboSecurityActivated(_securityComboMap[SECURITY_WPA_EAP]); break; - case WirelessSecurity::KEY_MGMT_IEEE8021X: + case TDENetworkWiFiKeyType::DynamicWEP: _mainWid->groupUseEncryption->setChecked(true); _mainWid->cboSecurity->setCurrentItem(SECURITY_IEEE8021X); slotComboSecurityActivated(_securityComboMap[SECURITY_IEEE8021X]); @@ -872,7 +902,7 @@ WirelessSecurityWidgetImpl::comboSecurityInit() void WirelessSecurityWidgetImpl::slotUseEncryptionToggled(bool on) { - _wireless_setting->setSecurity(on ? _security_setting->getType() : NULL); + _wireless_setting->securityRequired = on; } void @@ -968,28 +998,28 @@ WirelessSecurityWidgetImpl::slotExtraSettingsToggled(bool on) void WirelessSecurityWidgetImpl::configureForWEP() { - _security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_NONE); + _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::WEP; configureWidgets(SECURITY_WEP); } void WirelessSecurityWidgetImpl::configureForWPAPSK() { - _security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_WPA_PSK); + _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::WPAInfrastructure; configureWidgets(SECURITY_WPA_PSK); } void WirelessSecurityWidgetImpl::configureForWPAEAP() { - _security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_WPA_EAP); + _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::WPAEnterprise; configureWidgets(SECURITY_WPA_EAP); } void WirelessSecurityWidgetImpl::configureForIEEE8021X() { - _security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_IEEE8021X); + _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::DynamicWEP; configureWidgets(SECURITY_IEEE8021X); } diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.h index 7e90694..b6e4a5e 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.h +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.h @@ -25,7 +25,7 @@ #ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H #define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H -/* qt autogenerated headers */ +/* ui autogenerated headers */ #include "connection_setting_wireless_security.h" #include "connection_setting_wireless_security_eap.h" #include "connection_setting_wireless_security_phase2.h" @@ -35,9 +35,12 @@ #include "connection_setting_wireless_security_wpapsk.h" #include "connection_setting_wireless_security_wepencryption.h" +// tde headers +#include +#include + /* knetworkmanager headers */ -#include "knetworkmanager-connection_setting.h" -#include "knetworkmanager-connection_setting_8021x.h" +#include "qbidirectionalmap.h" #include "knetworkmanager-connection_setting_widget_interface.h" namespace ConnectionSettings @@ -45,7 +48,6 @@ namespace ConnectionSettings /* class declarations */ class WirelessSecurity; class Wireless; - class IEEE8021x; class WirelessSecurityPhase2Impl; class WirelessSecurityWEPImpl : public ConnectionSettingWirelessSecurityWEP @@ -60,7 +62,7 @@ namespace ConnectionSettings , WEPKEY_TYPE_PASSPHRASE }; - WirelessSecurityWEPImpl(WirelessSecurity* security, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + WirelessSecurityWEPImpl(TDEWiFiConnection* 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; @@ -77,7 +79,7 @@ namespace ConnectionSettings void slotWepIdx2Checked(bool); void slotWepIdx3Checked(bool); private: - WirelessSecurity* _security_setting; + TDEWiFiConnection* _security_setting; WEPKEY_TYPE _wepKeyType; }; @@ -86,9 +88,9 @@ namespace ConnectionSettings Q_OBJECT public: - WirelessSecurityWEPEncryptionImpl(WirelessSecurity* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + WirelessSecurityWEPEncryptionImpl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); private: - WirelessSecurity* _security_setting; + TDEWiFiConnection* _security_setting; }; class WirelessSecurityWPAVersionImpl : public ConnectionSettingWirelessSecurityWPAVersion @@ -96,7 +98,7 @@ namespace ConnectionSettings Q_OBJECT public: - WirelessSecurityWPAVersionImpl(WirelessSecurity* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + WirelessSecurityWPAVersionImpl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); public slots: void slotAuto(bool); @@ -104,7 +106,7 @@ namespace ConnectionSettings void slotWPA2(bool); private: - WirelessSecurity* _security_setting; + TDEWiFiConnection* _security_setting; }; @@ -121,7 +123,7 @@ namespace ConnectionSettings , WPA_CIPHER_LAST }; public: - WirelessSecurityWPACipherImpl(WirelessSecurity* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + WirelessSecurityWPACipherImpl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); public slots: void slotCipherChangedAuto(bool); @@ -133,7 +135,7 @@ namespace ConnectionSettings void slotPairwiseCipherChangedCCMP(bool); private: - WirelessSecurity* _security_setting; + TDEWiFiConnection* _security_setting; }; class WirelessSecurityWPAPSKImpl : public ConnectionSettingWirelessSecurityWPAPSK @@ -141,15 +143,15 @@ namespace ConnectionSettings Q_OBJECT public: - WirelessSecurityWPAPSKImpl(WirelessSecurity* security_setting, Wireless* wireless_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + WirelessSecurityWPAPSKImpl(TDEWiFiConnection* security_setting, TDEWiFiConnection* 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; + TDEWiFiConnection* _security_setting; + TDEWiFiConnection* _wireless_setting; }; class WirelessSecurityEAPImpl : public ConnectionSettingWirelessSecurityEAP @@ -157,7 +159,7 @@ namespace ConnectionSettings Q_OBJECT public: - WirelessSecurityEAPImpl(IEEE8021x* security_setting, WirelessSecurityPhase2Impl* phase2_widget, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + WirelessSecurityEAPImpl(TDEWiFiConnection* security_setting, WirelessSecurityPhase2Impl* phase2_widget, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); public slots: void slotMethodChanged(int index); @@ -167,8 +169,8 @@ namespace ConnectionSettings void slotUseSystemCaCertChanged(bool on); private: - IEEE8021x* _security_setting; - TQBiDirectionalMap _eapIndexMap; + TDEWiFiConnection* _security_setting; + TQBiDirectionalMap _eapIndexMap; WirelessSecurityPhase2Impl* _phase2_widget; }; @@ -177,16 +179,16 @@ namespace ConnectionSettings Q_OBJECT public: - WirelessSecurityPhase2Impl(IEEE8021x* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + WirelessSecurityPhase2Impl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); public slots: - void setAllowedPhase2Methods(const TQValueList&); + void setAllowedPhase2Methods(const TQValueList&); void slotPhase2MethodChanged(int index); private: void updateMethodComboBox(); - IEEE8021x* _security_setting; - TQBiDirectionalMap _eapIndexMap; - TQValueList _allowed_methods; + TDEWiFiConnection* _security_setting; + TQBiDirectionalMap _eapIndexMap; + TQValueList _allowed_methods; }; class WirelessSecurityWidgetImpl : public WidgetInterface @@ -204,7 +206,7 @@ namespace ConnectionSettings }; public: - WirelessSecurityWidgetImpl(Connection*, bool new_conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + WirelessSecurityWidgetImpl(TDENetworkConnection*, bool new_conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); void Activate(); public slots: @@ -226,9 +228,9 @@ namespace ConnectionSettings SecurityMethods _currentMethod; TQValueList _widgets[SECURITY_COUNT]; TQValueList _extra_widgets[SECURITY_COUNT]; - WirelessSecurity* _security_setting; - Wireless* _wireless_setting; - IEEE8021x* _ieee8021x_setting; + TDEWiFiConnection* _security_setting; + TDEWiFiConnection* _wireless_setting; + TDEWiFiConnection* _ieee8021x_setting; ConnectionSettingWirelessSecurityWidget* _mainWid; bool _new_conn; TQMap _securityComboMap; diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.cpp index e6bd9c2..5d34190 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.cpp @@ -34,14 +34,11 @@ #include #include #include +#include -#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; @@ -73,13 +70,13 @@ class NetworkListViewItem : public KListViewItem WirelessNetwork _net; }; -WirelessWidgetImpl::WirelessWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl) +WirelessWidgetImpl::WirelessWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { - _wireless_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); - _info_setting = dynamic_cast (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME)); - _security_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)); - _hasName = !_info_setting->getName().isEmpty(); + _wireless_setting = dynamic_cast(conn); + _info_setting = dynamic_cast(conn); + _security_setting = dynamic_cast(conn); + _hasName = !_info_setting->friendlyName.isEmpty(); _new_conn = new_conn; TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); @@ -128,7 +125,7 @@ WirelessWidgetImpl::Activate() } // FIXME, if essid contains unprintable characters show the essid in hex - _mainWid->txtEssid->setText(_wireless_setting->getEssid()); + _mainWid->txtEssid->setText(_wireless_setting->SSID); } void WirelessWidgetImpl::slotEssidChanged(TQListViewItem* item) @@ -176,12 +173,15 @@ WirelessWidgetImpl::slotEssidChanged(const TQString& new_essid) void WirelessWidgetImpl::updateEssid(const TQByteArray& essid) { - _wireless_setting->setEssid(essid); + _wireless_setting->SSID = essid; if (!_hasName) { // the connection has no name yet -> just take the essid for it - _info_setting->setName(essid); + _info_setting->friendlyName = TQString(essid); + if (_info_setting->friendlyName == "") { + _info_setting->friendlyName = "<" + i18n("hidden") + ">"; + } } } diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.h index 0baba65..37a3de7 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.h +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.h @@ -26,9 +26,12 @@ #ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H #define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H +// tde headers +#include +#include + #include "knetworkmanager-connection_setting_widget_interface.h" #include "connection_setting_wireless.h" -#include "knetworkmanager-connection_setting.h" class KListViewSearchLineWidget; @@ -44,7 +47,7 @@ namespace ConnectionSettings Q_OBJECT public: - WirelessWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + WirelessWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); void Activate(); @@ -60,9 +63,9 @@ namespace ConnectionSettings TQString hexStringFromByteArray(const TQByteArray& ); bool _hasName; - Wireless* _wireless_setting; - Info* _info_setting; - WirelessSecurity* _security_setting; + TDEWiFiConnection* _wireless_setting; + TDEWiFiConnection* _info_setting; + TDEWiFiConnection* _security_setting; ConnectionSettingWirelessWidget* _mainWid; KListViewSearchLineWidget* _searchLine; bool _new_conn; -- cgit v1.2.1 From d45099229d40b4850c68eb4a64f67ff3ad0dcbc5 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 6 Sep 2012 20:34:13 -0500 Subject: Now compiles with new API --- .../knetworkmanager-connection_settings_dialog.cpp | 461 +++++++++++++++++++ .../knetworkmanager-connection_settings_dialog.h | 90 ++++ .../knetworkmanager-connection_settings_dialog.cpp | 497 --------------------- .../knetworkmanager-connection_settings_dialog.h | 85 ---- 4 files changed, 551 insertions(+), 582 deletions(-) create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_settings_dialog.cpp create mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_settings_dialog.h delete mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp delete mode 100644 tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.h diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_settings_dialog.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_settings_dialog.cpp new file mode 100644 index 0000000..41d2776 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_settings_dialog.cpp @@ -0,0 +1,461 @@ +/*************************************************************************** + * + * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * Author: Timothy Pearson + * + * 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 +#include +#include +#include +#include +#include +#include + +// kde headers +#include +#include +#include + +// TQt DBus headers +#include +#include + +// knm headers +#include "knetworkmanager-connection_setting_widget_interface.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-wireless_network.h" +#include "knetworkmanager-wireless_manager.h" + +char use_new_wireless_essid = 0; +TQByteArray new_wireless_essid; + +using namespace ConnectionSettings; + +ConnectionSettingsDialogImpl::ConnectionSettingsDialogImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, bool modal, WFlags fl) + : ConnectionSettingsDialog(parent, name, modal, fl) + , _conn(conn) + , _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 +ConnectionSettingsDialogImpl::createWidgetsForWireless(TDENetworkConnection* conn, bool new_conn) +{ + TQValueList 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 +ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(TDENetworkConnection* conn, bool new_conn, const TQByteArray& essid) +{ + TQValueList ret; + + // Set ESSID +// _wireless_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); +// _info_setting = dynamic_cast (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 +ConnectionSettingsDialogImpl::createWidgetsForWired(TDENetworkConnection* conn, bool new_conn) +{ + TQValueList ret; + + // widgetlist for wired connection + ret.append(new ConnectionSettings::IPv4WidgetImpl(conn)); + ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); + + return ret; +} + +TQValueList +ConnectionSettingsDialogImpl::createWidgetsForVPN(TDENetworkConnection* conn, bool new_conn) +{ + TQValueList ret; + + // widgetlist for wired connection +// ret.append(new ConnectionSettings::VPNWidgetImpl(conn, new_conn)); + ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); + + return ret; +} + +TQValueList +ConnectionSettingsDialogImpl::createWidgetsForCDMA(TDENetworkConnection* conn, bool new_conn) +{ + TQValueList 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 +ConnectionSettingsDialogImpl::createWidgetsForGSM(TDENetworkConnection* conn, bool new_conn) +{ + TQValueList 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(TDENetworkConnection* conn, bool new_conn) +{ + /* + 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 widgets; + // TODO: move to a factory class + if (conn->type() == TDENetworkConnectionType::WiFi) { + if (use_new_wireless_essid == 0) { + widgets = createWidgetsForWireless(conn, new_conn); + } + else { + createWidgetsForWirelessKnownESSID(conn, new_conn, new_wireless_essid); + new_wireless_essid = TQByteArray(); + } + } + else if (conn->type() == TDENetworkConnectionType::WiredEthernet) { + widgets = createWidgetsForWired(conn, new_conn); + } + else if (conn->type() == TDENetworkConnectionType::Modem) { + TDEModemConnection* modemconn = dynamic_cast(conn); + if (modemconn) { + if (modemconn->type == TDEModemConnectionType::CDMA) { + widgets = createWidgetsForCDMA(conn, new_conn); + } + else if (modemconn->type == TDEModemConnectionType::GSM) { + widgets = createWidgetsForGSM(conn, new_conn); + } + else { + kdWarning() << k_funcinfo << "Specific modem type not handled yet" << endl; + } + } + } +// else if (conn->getType() == NM_SETTING_VPN_SETTING_NAME) { +// widgets = createWidgetsForVPN(conn, new_conn); +// } + else { + kdWarning() << k_funcinfo << "Not handled yet" << endl; + } + + int id; + for (TQValueList::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) { + createWidgetsForConnection(_conn, _new_conn); + } + else { + // this should never happen + TQLabel* lbl = new TQLabel(wstackSettings, "Unknown Device Type"); + wstackSettings->addWidget(lbl); + + wstackSettings->raiseWidget(lbl); + } +} + +int +ConnectionSettingsDialogImpl::getDeviceTypeFromConnection(TDENetworkConnection* conn) +{ + if (conn->type() == TDENetworkConnectionType::WiFi) { + return TDENetworkDeviceType::WiFi; + } + else if (conn->type() == TDENetworkConnectionType::WiredEthernet) { + return TDENetworkDeviceType::WiredEthernet; + } + else if (conn->type() == TDENetworkConnectionType::Modem) { + return TDENetworkDeviceType::Modem; + } + + return TDENetworkDeviceType::Other; +} + +void +ConnectionSettingsDialogImpl::slotConnect() +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + // add/save the connection + nm->saveConnection(_conn); + + // activate device + if (_conn && nm) { +// // 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); +// nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), device, act_conn, err); +// } +// else { + // we need to call ActivateDevice async + nm->initiateConnection(_conn->UUID); +// } + } + + emit connectionSaved(); + this->close(true); +} + +void +ConnectionSettingsDialogImpl::slotSave() +{ + // Make sure settings are committed + TQValueList::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(wstackSettings->widget(*current)); + if (widget) { + deactivateWidget(widget); + } + } + + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + // save the connection + nm->saveConnection(_conn); + + emit connectionSaved(); + this->close(true); +} + +void +ConnectionSettingsDialogImpl::slotCancel() +{ + close(); +} + +void +ConnectionSettingsDialogImpl::slotNext() +{ + TQValueList::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(wstackSettings->widget(*current)); + if (widget) + deactivateWidget(widget); + + // next widget + current++; + + // let the widget know about it being the active one + widget = dynamic_cast(wstackSettings->widget(*current)); + if (widget) + activateWidget(widget); + } + slotEnableButtons(); +} + +void +ConnectionSettingsDialogImpl::slotBack() +{ + TQValueList::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(wstackSettings->widget(*current)); + if (widget) + deactivateWidget(widget); + + // one back + current--; + + // let the widget know about it being the active one + widget = dynamic_cast(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::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) { + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + btnConnect->setEnabled(nm->verifyConnectionSettings(_conn)); + pbSave->setEnabled(nm->verifyConnectionSettings(_conn)); + } +} + +#include "knetworkmanager-connection_settings_dialog.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_settings_dialog.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_settings_dialog.h new file mode 100644 index 0000000..f65de7a --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_settings_dialog.h @@ -0,0 +1,90 @@ +/*************************************************************************** + * + * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 + +// tqt headers +#include +#include + +// tde headers +#include +#include + +// ui 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 + + public: + ConnectionSettingsDialogImpl(TDENetworkConnection* conn, bool new_conn, 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(TDENetworkConnection*, bool new_conn); + void activateWidget(ConnectionSettings::WidgetInterface* widget); + void deactivateWidget(ConnectionSettings::WidgetInterface* widget); + int getDeviceTypeFromConnection(TDENetworkConnection* conn); + + // TODO: To be moved to a factory class + TQValueList createWidgetsForWired(TDENetworkConnection* conn, bool new_conn); + TQValueList createWidgetsForWireless(TDENetworkConnection* conn, bool new_conn); + TQValueList createWidgetsForWirelessKnownESSID(TDENetworkConnection* conn, bool new_conn, const TQByteArray& essid); + TQValueList createWidgetsForVPN(TDENetworkConnection* conn, bool new_conn); + TQValueList createWidgetsForCDMA(TDENetworkConnection* conn, bool new_conn); + TQValueList createWidgetsForGSM(TDENetworkConnection* conn, bool new_conn); + + TDENetworkConnection* _conn; + TQValueList _widgetIds; + bool _new_conn; +}; + +#endif /* KNETWORKMANAGER_CONNECTION_SETTINGS_DIALOG_H*/ diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp deleted file mode 100644 index 88a3d11..0000000 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp +++ /dev/null @@ -1,497 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * Author: Timothy Pearson - * - * 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 -#include -#include -#include -#include -#include -#include - -// kde headers -#include -#include -#include - -// TQt DBus headers -#include -#include - -// NM headers -#include - -// 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" - -char use_new_wireless_essid = 0; -TQByteArray new_wireless_essid; - -ConnectionSettingsDialogImpl::ConnectionSettingsDialogImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, bool modal, WFlags fl) - : ConnectionSettingsDialog(parent, name, modal, fl) - , _conn(conn) - , _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 -ConnectionSettingsDialogImpl::createWidgetsForWireless(TDENetworkConnection* conn, bool new_conn) -{ - TQValueList 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 -ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(TDENetworkConnection* conn, bool new_conn, const TQByteArray& essid) -{ - TQValueList ret; - - // Set ESSID -// _wireless_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); -// _info_setting = dynamic_cast (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 -ConnectionSettingsDialogImpl::createWidgetsForWired(TDENetworkConnection* conn, bool new_conn) -{ - TQValueList ret; - - // widgetlist for wired connection - ret.append(new ConnectionSettings::IPv4WidgetImpl(conn)); - ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); - - return ret; -} - -TQValueList -ConnectionSettingsDialogImpl::createWidgetsForVPN(TDENetworkConnection* conn, bool new_conn) -{ - TQValueList ret; - - // widgetlist for wired connection - ret.append(new ConnectionSettings::VPNWidgetImpl(conn, new_conn)); - ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); - - return ret; -} - -TQValueList -ConnectionSettingsDialogImpl::createWidgetsForCDMA(TDENetworkConnection* conn, bool new_conn) -{ - TQValueList 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 -ConnectionSettingsDialogImpl::createWidgetsForGSM(TDENetworkConnection* conn, bool new_conn) -{ - TQValueList 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(TDENetworkConnection* conn, bool new_conn) -{ - /* - 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 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::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); - } - 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) - return NM_DEVICE_TYPE_WIFI; - else if (conn->getType() == NM_SETTING_WIRED_SETTING_NAME) - return NM_DEVICE_TYPE_ETHERNET; - else if (conn->getType() == NM_SETTING_GSM_SETTING_NAME) - return NM_DEVICE_TYPE_MODEM; - else if (conn->getType() == NM_SETTING_CDMA_SETTING_NAME) - return NM_DEVICE_TYPE_MODEM; - - return NM_DEVICE_TYPE_UNKNOWN; -} - -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); - nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), device, act_conn, err); - } - else - { - // we need to call ActivateDevice async - nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), TQT_DBusObjectPath(QCString(dev->getObjectPath())), _conn->getObjectPath(), err); - } - } - } - - emit connectionSaved(); - this->close(true); -} - -void -ConnectionSettingsDialogImpl::slotSave() -{ - // Make sure settings are committed - TQValueList::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(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::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(wstackSettings->widget(*current)); - if (widget) - deactivateWidget(widget); - - // next widget - current++; - - // let the widget know about it being the active one - widget = dynamic_cast(wstackSettings->widget(*current)); - if (widget) - activateWidget(widget); - } - slotEnableButtons(); -} - -void -ConnectionSettingsDialogImpl::slotBack() -{ - TQValueList::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(wstackSettings->widget(*current)); - if (widget) - deactivateWidget(widget); - - // one back - current--; - - // let the widget know about it being the active one - widget = dynamic_cast(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::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/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.h deleted file mode 100644 index 251ad33..0000000 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.h +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -// 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 - - public: - ConnectionSettingsDialogImpl(TDENetworkConnection* conn, bool new_conn, 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(TDENetworkConnection*, bool new_conn); - void activateWidget(ConnectionSettings::WidgetInterface* widget); - void deactivateWidget(ConnectionSettings::WidgetInterface* widget); - int getDeviceTypeFromConnection(TDENetworkConnection* conn); - - // TODO: To be moved to a factory class - TQValueList createWidgetsForWired(TDENetworkConnection* conn, bool new_conn); - TQValueList createWidgetsForWireless(TDENetworkConnection* conn, bool new_conn); - TQValueList createWidgetsForWirelessKnownESSID(TDENetworkConnection* conn, bool new_conn, const TQByteArray& essid); - TQValueList createWidgetsForVPN(TDENetworkConnection* conn, bool new_conn); - TQValueList createWidgetsForCDMA(TDENetworkConnection* conn, bool new_conn); - TQValueList createWidgetsForGSM(TDENetworkConnection* conn, bool new_conn); - - TDENetworkConnection* _conn; - TQValueList _widgetIds; - bool _new_conn; -}; - -#endif /* KNETWORKMANAGER_CONNECTION_SETTINGS_DIALOG_H*/ -- cgit v1.2.1 From 82102f3f7168b27e115f9f959bad75c99c1ae76a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 6 Sep 2012 21:16:31 -0500 Subject: Rename files to something more sensible --- tdenetworkmanager/CMakeLists.txt | 2 +- tdenetworkmanager/knetworkmanager.conf | 63 -- tdenetworkmanager/pics/CMakeLists.txt | 4 +- .../pics/hi16-app-knetworkmanager.png | Bin 954 -> 0 bytes .../pics/hi16-app-knetworkmanager_disabled.png | Bin 650 -> 0 bytes tdenetworkmanager/pics/hi16-app-tdenetman.png | Bin 0 -> 954 bytes .../pics/hi16-app-tdenetman_disabled.png | Bin 0 -> 650 bytes .../pics/hi32-app-knetworkmanager.png | Bin 2636 -> 0 bytes .../pics/hi32-app-knetworkmanager_disabled.png | Bin 2202 -> 0 bytes tdenetworkmanager/pics/hi32-app-tdenetman.png | Bin 0 -> 2636 bytes .../pics/hi32-app-tdenetman_disabled.png | Bin 0 -> 2202 bytes .../pics/hi48-app-knetworkmanager.png | Bin 7282 -> 0 bytes .../pics/hi48-app-knetworkmanager_disabled.png | Bin 8390 -> 0 bytes tdenetworkmanager/pics/hi48-app-tdenetman.png | Bin 0 -> 7282 bytes .../pics/hi48-app-tdenetman_disabled.png | Bin 0 -> 8390 bytes tdenetworkmanager/src/CMakeLists.txt | 34 +- ...tworkmanager-connection_setting_cdma_widget.cpp | 93 -- ...networkmanager-connection_setting_cdma_widget.h | 67 -- ...etworkmanager-connection_setting_gsm_widget.cpp | 157 --- ...knetworkmanager-connection_setting_gsm_widget.h | 72 -- ...tworkmanager-connection_setting_info_widget.cpp | 77 -- ...networkmanager-connection_setting_info_widget.h | 68 -- ...tworkmanager-connection_setting_ipv4_widget.cpp | 209 ---- ...networkmanager-connection_setting_ipv4_widget.h | 68 -- ...etworkmanager-connection_setting_ppp_widget.cpp | 145 --- ...knetworkmanager-connection_setting_ppp_widget.h | 68 -- ...orkmanager-connection_setting_serial_widget.cpp | 134 --- ...tworkmanager-connection_setting_serial_widget.h | 71 -- ...etworkmanager-connection_setting_vpn_widget.cpp | 206 ---- ...knetworkmanager-connection_setting_vpn_widget.h | 69 -- ...manager-connection_setting_widget_interface.cpp | 37 - ...rkmanager-connection_setting_widget_interface.h | 47 - ...connection_setting_wireless_security_widget.cpp | 1029 -------------------- ...r-connection_setting_wireless_security_widget.h | 240 ----- ...kmanager-connection_setting_wireless_widget.cpp | 231 ----- ...orkmanager-connection_setting_wireless_widget.h | 74 -- .../knetworkmanager-connection_settings_dialog.cpp | 461 --------- .../knetworkmanager-connection_settings_dialog.h | 90 -- .../tdenetman-connection_setting_cdma_widget.cpp | 93 ++ .../tdenetman-connection_setting_cdma_widget.h | 67 ++ .../tdenetman-connection_setting_gsm_widget.cpp | 156 +++ .../tdenetman-connection_setting_gsm_widget.h | 71 ++ .../tdenetman-connection_setting_info_widget.cpp | 76 ++ .../tdenetman-connection_setting_info_widget.h | 68 ++ .../tdenetman-connection_setting_ipv4_widget.cpp | 208 ++++ .../tdenetman-connection_setting_ipv4_widget.h | 67 ++ .../tdenetman-connection_setting_ppp_widget.cpp | 143 +++ .../tdenetman-connection_setting_ppp_widget.h | 67 ++ .../tdenetman-connection_setting_serial_widget.cpp | 133 +++ .../tdenetman-connection_setting_serial_widget.h | 70 ++ .../tdenetman-connection_setting_vpn_widget.cpp | 206 ++++ .../tdenetman-connection_setting_vpn_widget.h | 69 ++ ...enetman-connection_setting_widget_interface.cpp | 37 + ...tdenetman-connection_setting_widget_interface.h | 47 + ...connection_setting_wireless_security_widget.cpp | 1029 ++++++++++++++++++++ ...n-connection_setting_wireless_security_widget.h | 240 +++++ ...denetman-connection_setting_wireless_widget.cpp | 230 +++++ .../tdenetman-connection_setting_wireless_widget.h | 74 ++ .../tdenetman-connection_settings_dialog.cpp | 461 +++++++++ .../tdenetman-connection_settings_dialog.h | 87 ++ .../src/knetworkmanager-cellular_device_tray.cpp | 130 --- .../src/knetworkmanager-cellular_device_tray.h | 55 -- .../src/knetworkmanager-connection_editor.cpp | 243 ----- .../src/knetworkmanager-connection_editor.h | 71 -- .../src/knetworkmanager-device_tray.cpp | 380 -------- .../src/knetworkmanager-device_tray.h | 88 -- .../src/knetworkmanager-menu_subhead.cpp | 76 -- .../src/knetworkmanager-menu_subhead.h | 56 -- tdenetworkmanager/src/knetworkmanager-menuitem.cpp | 123 --- tdenetworkmanager/src/knetworkmanager-menuitem.h | 57 -- .../src/knetworkmanager-nm_vpn_proxy.cpp | 81 -- .../src/knetworkmanager-nm_vpn_proxy.h | 52 - tdenetworkmanager/src/knetworkmanager-plugin.cpp | 38 - tdenetworkmanager/src/knetworkmanager-plugin.h | 39 - .../src/knetworkmanager-pluginmanager.cpp | 184 ---- .../src/knetworkmanager-pluginmanager.h | 67 -- tdenetworkmanager/src/knetworkmanager-tray.cpp | 766 --------------- tdenetworkmanager/src/knetworkmanager-tray.h | 135 --- .../src/knetworkmanager-vpn_plugin.cpp | 132 --- tdenetworkmanager/src/knetworkmanager-vpn_plugin.h | 62 -- .../knetworkmanager-vpnauthenticationdialog.cpp | 179 ---- .../src/knetworkmanager-vpnauthenticationdialog.h | 69 -- .../src/knetworkmanager-vpnmanager.cpp | 107 -- tdenetworkmanager/src/knetworkmanager-vpnmanager.h | 53 - .../src/knetworkmanager-vpnplugin.cpp | 128 --- tdenetworkmanager/src/knetworkmanager-vpnplugin.h | 79 -- .../src/knetworkmanager-vpnservice.cpp | 123 --- tdenetworkmanager/src/knetworkmanager-vpnservice.h | 63 -- .../src/knetworkmanager-wired_device_tray.cpp | 150 --- .../src/knetworkmanager-wired_device_tray.h | 57 -- .../src/knetworkmanager-wireless_device_tray.cpp | 417 -------- .../src/knetworkmanager-wireless_device_tray.h | 77 -- .../src/knetworkmanager-wireless_manager.cpp | 181 ---- .../src/knetworkmanager-wireless_manager.h | 60 -- .../src/knetworkmanager-wireless_menuitem.cpp | 228 ----- .../src/knetworkmanager-wireless_menuitem.h | 87 -- .../src/knetworkmanager-wireless_network.cpp | 174 ---- .../src/knetworkmanager-wireless_network.h | 92 -- tdenetworkmanager/src/knetworkmanager.cpp | 94 -- tdenetworkmanager/src/knetworkmanager.desktop | 47 - tdenetworkmanager/src/knetworkmanager.h | 57 -- tdenetworkmanager/src/knetworkmanager.la.cpp | 2 - tdenetworkmanager/src/knetworkmanager_dummy.cpp | 3 - .../src/knetworkmanager_plugin.desktop | 31 - .../src/knetworkmanager_vpnplugin.desktop | 33 - tdenetworkmanager/src/main.cpp | 2 +- tdenetworkmanager/src/settings.kcfgc | 2 +- .../knetworkmanager-connection_setting.cpp | 12 +- .../settings/knetworkmanager-connection_setting.h | 2 +- .../knetworkmanager-connection_setting_8021x.cpp | 14 +- .../knetworkmanager-connection_setting_8021x.h | 4 +- .../knetworkmanager-connection_setting_cdma.cpp | 10 +- .../knetworkmanager-connection_setting_cdma.h | 4 +- .../knetworkmanager-connection_setting_gsm.cpp | 10 +- .../knetworkmanager-connection_setting_gsm.h | 4 +- .../knetworkmanager-connection_setting_info.cpp | 10 +- .../knetworkmanager-connection_setting_info.h | 4 +- .../knetworkmanager-connection_setting_ipv4.cpp | 8 +- .../knetworkmanager-connection_setting_ipv4.h | 4 +- .../knetworkmanager-connection_setting_ppp.cpp | 10 +- .../knetworkmanager-connection_setting_ppp.h | 4 +- .../knetworkmanager-connection_setting_serial.cpp | 10 +- .../knetworkmanager-connection_setting_serial.h | 4 +- .../knetworkmanager-connection_setting_vpn.cpp | 8 +- .../knetworkmanager-connection_setting_vpn.h | 4 +- .../knetworkmanager-connection_setting_wired.cpp | 10 +- .../knetworkmanager-connection_setting_wired.h | 4 +- ...knetworkmanager-connection_setting_wireless.cpp | 12 +- .../knetworkmanager-connection_setting_wireless.h | 4 +- ...anager-connection_setting_wireless_security.cpp | 14 +- ...kmanager-connection_setting_wireless_security.h | 4 +- .../src/tdenetman-cellular_device_tray.cpp | 130 +++ .../src/tdenetman-cellular_device_tray.h | 55 ++ .../src/tdenetman-connection_editor.cpp | 242 +++++ .../src/tdenetman-connection_editor.h | 68 ++ tdenetworkmanager/src/tdenetman-device_tray.cpp | 379 +++++++ tdenetworkmanager/src/tdenetman-device_tray.h | 88 ++ tdenetworkmanager/src/tdenetman-menu_subhead.cpp | 76 ++ tdenetworkmanager/src/tdenetman-menu_subhead.h | 56 ++ tdenetworkmanager/src/tdenetman-menuitem.cpp | 123 +++ tdenetworkmanager/src/tdenetman-menuitem.h | 57 ++ tdenetworkmanager/src/tdenetman-nm_vpn_proxy.cpp | 81 ++ tdenetworkmanager/src/tdenetman-nm_vpn_proxy.h | 52 + tdenetworkmanager/src/tdenetman-plugin.cpp | 38 + tdenetworkmanager/src/tdenetman-plugin.h | 39 + tdenetworkmanager/src/tdenetman-pluginmanager.cpp | 184 ++++ tdenetworkmanager/src/tdenetman-pluginmanager.h | 67 ++ tdenetworkmanager/src/tdenetman-tray.cpp | 766 +++++++++++++++ tdenetworkmanager/src/tdenetman-tray.h | 135 +++ tdenetworkmanager/src/tdenetman-vpn_plugin.cpp | 132 +++ tdenetworkmanager/src/tdenetman-vpn_plugin.h | 62 ++ .../src/tdenetman-vpnauthenticationdialog.cpp | 179 ++++ .../src/tdenetman-vpnauthenticationdialog.h | 69 ++ tdenetworkmanager/src/tdenetman-vpnmanager.cpp | 107 ++ tdenetworkmanager/src/tdenetman-vpnmanager.h | 53 + tdenetworkmanager/src/tdenetman-vpnplugin.cpp | 128 +++ tdenetworkmanager/src/tdenetman-vpnplugin.h | 79 ++ tdenetworkmanager/src/tdenetman-vpnservice.cpp | 123 +++ tdenetworkmanager/src/tdenetman-vpnservice.h | 63 ++ .../src/tdenetman-wired_device_tray.cpp | 149 +++ .../src/tdenetman-wired_device_tray.h | 57 ++ .../src/tdenetman-wireless_device_tray.cpp | 417 ++++++++ .../src/tdenetman-wireless_device_tray.h | 77 ++ .../src/tdenetman-wireless_manager.cpp | 181 ++++ tdenetworkmanager/src/tdenetman-wireless_manager.h | 60 ++ .../src/tdenetman-wireless_menuitem.cpp | 227 +++++ .../src/tdenetman-wireless_menuitem.h | 87 ++ .../src/tdenetman-wireless_network.cpp | 174 ++++ tdenetworkmanager/src/tdenetman-wireless_network.h | 92 ++ tdenetworkmanager/src/tdenetman.cpp | 94 ++ tdenetworkmanager/src/tdenetman.h | 57 ++ tdenetworkmanager/src/tdenetman.la.cpp | 2 + tdenetworkmanager/src/tdenetman_dummy.cpp | 3 + tdenetworkmanager/src/tdenetworkmanager.desktop | 47 + .../src/tdenetworkmanager_plugin.desktop | 31 + .../src/tdenetworkmanager_vpnplugin.desktop | 33 + tdenetworkmanager/src/vpn_tray_component.cpp | 18 +- tdenetworkmanager/src/vpn_tray_component.h | 4 +- tdenetworkmanager/tdenetworkmanager.conf | 63 ++ 179 files changed, 9301 insertions(+), 9322 deletions(-) delete mode 100644 tdenetworkmanager/knetworkmanager.conf delete mode 100644 tdenetworkmanager/pics/hi16-app-knetworkmanager.png delete mode 100644 tdenetworkmanager/pics/hi16-app-knetworkmanager_disabled.png create mode 100644 tdenetworkmanager/pics/hi16-app-tdenetman.png create mode 100644 tdenetworkmanager/pics/hi16-app-tdenetman_disabled.png delete mode 100644 tdenetworkmanager/pics/hi32-app-knetworkmanager.png delete mode 100644 tdenetworkmanager/pics/hi32-app-knetworkmanager_disabled.png create mode 100644 tdenetworkmanager/pics/hi32-app-tdenetman.png create mode 100644 tdenetworkmanager/pics/hi32-app-tdenetman_disabled.png delete mode 100644 tdenetworkmanager/pics/hi48-app-knetworkmanager.png delete mode 100644 tdenetworkmanager/pics/hi48-app-knetworkmanager_disabled.png create mode 100644 tdenetworkmanager/pics/hi48-app-tdenetman.png create mode 100644 tdenetworkmanager/pics/hi48-app-tdenetman_disabled.png delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.h delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.cpp delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.h delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.cpp delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.h delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.cpp delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.h delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.cpp delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.h delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.cpp delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.h delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_vpn_widget.cpp delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_vpn_widget.h delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_widget_interface.cpp delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_widget_interface.h delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.cpp delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.h delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.cpp delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.h delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_settings_dialog.cpp delete mode 100644 tdenetworkmanager/src/configwidgets/knetworkmanager-connection_settings_dialog.h create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.h create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.h create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.h create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.h create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.h create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.h create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.cpp create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.h create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp create mode 100644 tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-cellular_device_tray.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_editor.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-connection_editor.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-device_tray.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-device_tray.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-menu_subhead.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-menu_subhead.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-menuitem.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-menuitem.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-nm_vpn_proxy.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-nm_vpn_proxy.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-plugin.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-plugin.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-pluginmanager.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-pluginmanager.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-tray.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-tray.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-vpn_plugin.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-vpn_plugin.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-vpnauthenticationdialog.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-vpnauthenticationdialog.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-vpnmanager.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-vpnmanager.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-vpnplugin.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-vpnplugin.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-vpnservice.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-vpnservice.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-wired_device_tray.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-wired_device_tray.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-wireless_manager.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-wireless_menuitem.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-wireless_menuitem.h delete mode 100644 tdenetworkmanager/src/knetworkmanager-wireless_network.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager-wireless_network.h delete mode 100644 tdenetworkmanager/src/knetworkmanager.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager.desktop delete mode 100644 tdenetworkmanager/src/knetworkmanager.h delete mode 100644 tdenetworkmanager/src/knetworkmanager.la.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager_dummy.cpp delete mode 100644 tdenetworkmanager/src/knetworkmanager_plugin.desktop delete mode 100644 tdenetworkmanager/src/knetworkmanager_vpnplugin.desktop create mode 100644 tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp create mode 100644 tdenetworkmanager/src/tdenetman-cellular_device_tray.h create mode 100644 tdenetworkmanager/src/tdenetman-connection_editor.cpp create mode 100644 tdenetworkmanager/src/tdenetman-connection_editor.h create mode 100644 tdenetworkmanager/src/tdenetman-device_tray.cpp create mode 100644 tdenetworkmanager/src/tdenetman-device_tray.h create mode 100644 tdenetworkmanager/src/tdenetman-menu_subhead.cpp create mode 100644 tdenetworkmanager/src/tdenetman-menu_subhead.h create mode 100644 tdenetworkmanager/src/tdenetman-menuitem.cpp create mode 100644 tdenetworkmanager/src/tdenetman-menuitem.h create mode 100644 tdenetworkmanager/src/tdenetman-nm_vpn_proxy.cpp create mode 100644 tdenetworkmanager/src/tdenetman-nm_vpn_proxy.h create mode 100644 tdenetworkmanager/src/tdenetman-plugin.cpp create mode 100644 tdenetworkmanager/src/tdenetman-plugin.h create mode 100644 tdenetworkmanager/src/tdenetman-pluginmanager.cpp create mode 100644 tdenetworkmanager/src/tdenetman-pluginmanager.h create mode 100644 tdenetworkmanager/src/tdenetman-tray.cpp create mode 100644 tdenetworkmanager/src/tdenetman-tray.h create mode 100644 tdenetworkmanager/src/tdenetman-vpn_plugin.cpp create mode 100644 tdenetworkmanager/src/tdenetman-vpn_plugin.h create mode 100644 tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp create mode 100644 tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h create mode 100644 tdenetworkmanager/src/tdenetman-vpnmanager.cpp create mode 100644 tdenetworkmanager/src/tdenetman-vpnmanager.h create mode 100644 tdenetworkmanager/src/tdenetman-vpnplugin.cpp create mode 100644 tdenetworkmanager/src/tdenetman-vpnplugin.h create mode 100644 tdenetworkmanager/src/tdenetman-vpnservice.cpp create mode 100644 tdenetworkmanager/src/tdenetman-vpnservice.h create mode 100644 tdenetworkmanager/src/tdenetman-wired_device_tray.cpp create mode 100644 tdenetworkmanager/src/tdenetman-wired_device_tray.h create mode 100644 tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp create mode 100644 tdenetworkmanager/src/tdenetman-wireless_device_tray.h create mode 100644 tdenetworkmanager/src/tdenetman-wireless_manager.cpp create mode 100644 tdenetworkmanager/src/tdenetman-wireless_manager.h create mode 100644 tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp create mode 100644 tdenetworkmanager/src/tdenetman-wireless_menuitem.h create mode 100644 tdenetworkmanager/src/tdenetman-wireless_network.cpp create mode 100644 tdenetworkmanager/src/tdenetman-wireless_network.h create mode 100644 tdenetworkmanager/src/tdenetman.cpp create mode 100644 tdenetworkmanager/src/tdenetman.h create mode 100644 tdenetworkmanager/src/tdenetman.la.cpp create mode 100644 tdenetworkmanager/src/tdenetman_dummy.cpp create mode 100644 tdenetworkmanager/src/tdenetworkmanager.desktop create mode 100644 tdenetworkmanager/src/tdenetworkmanager_plugin.desktop create mode 100644 tdenetworkmanager/src/tdenetworkmanager_vpnplugin.desktop create mode 100644 tdenetworkmanager/tdenetworkmanager.conf diff --git a/tdenetworkmanager/CMakeLists.txt b/tdenetworkmanager/CMakeLists.txt index 119a77e..1938a55 100644 --- a/tdenetworkmanager/CMakeLists.txt +++ b/tdenetworkmanager/CMakeLists.txt @@ -14,4 +14,4 @@ add_subdirectory( src ) # add_subdirectory( vpn-plugins ) # add_subdirectory( po ) -install( FILES knetworkmanager.conf DESTINATION ${DBUS_SYS_DIR} ) +install( FILES tdenetworkmanager.conf DESTINATION ${DBUS_SYS_DIR} ) diff --git a/tdenetworkmanager/knetworkmanager.conf b/tdenetworkmanager/knetworkmanager.conf deleted file mode 100644 index 82a596f..0000000 --- a/tdenetworkmanager/knetworkmanager.conf +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tdenetworkmanager/pics/CMakeLists.txt b/tdenetworkmanager/pics/CMakeLists.txt index 44de539..edb9979 100644 --- a/tdenetworkmanager/pics/CMakeLists.txt +++ b/tdenetworkmanager/pics/CMakeLists.txt @@ -9,5 +9,5 @@ # ################################################# -tde_install_icons( DESTINATION ${DATA_INSTALL_DIR}/knetworkmanager/icons ) -tde_install_icons( knetworkmanager knetworkmanager_disabled ) +tde_install_icons( DESTINATION ${DATA_INSTALL_DIR}/tdenetworkmanager/icons ) +tde_install_icons( tdenetworkmanager tdenetworkmanager_disabled ) diff --git a/tdenetworkmanager/pics/hi16-app-knetworkmanager.png b/tdenetworkmanager/pics/hi16-app-knetworkmanager.png deleted file mode 100644 index db29bb8..0000000 Binary files a/tdenetworkmanager/pics/hi16-app-knetworkmanager.png and /dev/null differ diff --git a/tdenetworkmanager/pics/hi16-app-knetworkmanager_disabled.png b/tdenetworkmanager/pics/hi16-app-knetworkmanager_disabled.png deleted file mode 100644 index 971f7e3..0000000 Binary files a/tdenetworkmanager/pics/hi16-app-knetworkmanager_disabled.png and /dev/null differ diff --git a/tdenetworkmanager/pics/hi16-app-tdenetman.png b/tdenetworkmanager/pics/hi16-app-tdenetman.png new file mode 100644 index 0000000..db29bb8 Binary files /dev/null and b/tdenetworkmanager/pics/hi16-app-tdenetman.png differ diff --git a/tdenetworkmanager/pics/hi16-app-tdenetman_disabled.png b/tdenetworkmanager/pics/hi16-app-tdenetman_disabled.png new file mode 100644 index 0000000..971f7e3 Binary files /dev/null and b/tdenetworkmanager/pics/hi16-app-tdenetman_disabled.png differ diff --git a/tdenetworkmanager/pics/hi32-app-knetworkmanager.png b/tdenetworkmanager/pics/hi32-app-knetworkmanager.png deleted file mode 100644 index 5e98e9c..0000000 Binary files a/tdenetworkmanager/pics/hi32-app-knetworkmanager.png and /dev/null differ diff --git a/tdenetworkmanager/pics/hi32-app-knetworkmanager_disabled.png b/tdenetworkmanager/pics/hi32-app-knetworkmanager_disabled.png deleted file mode 100644 index a9ed5f9..0000000 Binary files a/tdenetworkmanager/pics/hi32-app-knetworkmanager_disabled.png and /dev/null differ diff --git a/tdenetworkmanager/pics/hi32-app-tdenetman.png b/tdenetworkmanager/pics/hi32-app-tdenetman.png new file mode 100644 index 0000000..5e98e9c Binary files /dev/null and b/tdenetworkmanager/pics/hi32-app-tdenetman.png differ diff --git a/tdenetworkmanager/pics/hi32-app-tdenetman_disabled.png b/tdenetworkmanager/pics/hi32-app-tdenetman_disabled.png new file mode 100644 index 0000000..a9ed5f9 Binary files /dev/null and b/tdenetworkmanager/pics/hi32-app-tdenetman_disabled.png differ diff --git a/tdenetworkmanager/pics/hi48-app-knetworkmanager.png b/tdenetworkmanager/pics/hi48-app-knetworkmanager.png deleted file mode 100644 index 8306829..0000000 Binary files a/tdenetworkmanager/pics/hi48-app-knetworkmanager.png and /dev/null differ diff --git a/tdenetworkmanager/pics/hi48-app-knetworkmanager_disabled.png b/tdenetworkmanager/pics/hi48-app-knetworkmanager_disabled.png deleted file mode 100644 index 53eafb4..0000000 Binary files a/tdenetworkmanager/pics/hi48-app-knetworkmanager_disabled.png and /dev/null differ diff --git a/tdenetworkmanager/pics/hi48-app-tdenetman.png b/tdenetworkmanager/pics/hi48-app-tdenetman.png new file mode 100644 index 0000000..8306829 Binary files /dev/null and b/tdenetworkmanager/pics/hi48-app-tdenetman.png differ diff --git a/tdenetworkmanager/pics/hi48-app-tdenetman_disabled.png b/tdenetworkmanager/pics/hi48-app-tdenetman_disabled.png new file mode 100644 index 0000000..53eafb4 Binary files /dev/null and b/tdenetworkmanager/pics/hi48-app-tdenetman_disabled.png differ diff --git a/tdenetworkmanager/src/CMakeLists.txt b/tdenetworkmanager/src/CMakeLists.txt index aa06061..28fa0f8 100644 --- a/tdenetworkmanager/src/CMakeLists.txt +++ b/tdenetworkmanager/src/CMakeLists.txt @@ -33,35 +33,35 @@ link_directories( ##### headers ################################### install( FILES - knetworkmanager-plugin.h knetworkmanager-vpnplugin.h + tdenetman-plugin.h tdenetman-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} ) +install( FILES tdenetworkmanager.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) +install( FILES eventsrc DESTINATION ${DATA_INSTALL_DIR}/tdenetworkmanager ) +install( FILES tdenetworkmanager_plugin.desktop tdenetworkmanager_vpnplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} ) -##### knetworkmanager (tdeinit) ################# +##### tdenetman (tdeinit) ################# -tde_add_tdeinit_executable( knetworkmanager AUTOMOC +tde_add_tdeinit_executable( tdenetman AUTOMOC SOURCES connection_editor.ui - vpnauthentication.ui main.cpp knetworkmanager.cpp knetworkmanager-tray.cpp - #knetworkmanager-vpn_plugin.cpp - knetworkmanager-cellular_device_tray.cpp knetworkmanager-device_tray.cpp - knetworkmanager-wired_device_tray.cpp knetworkmanager-wireless_device_tray.cpp - knetworkmanager-wireless_menuitem.cpp knetworkmanager-menuitem.cpp - knetworkmanager-menu_subhead.cpp + vpnauthentication.ui main.cpp tdenetman.cpp tdenetman-tray.cpp + #tdenetman-vpn_plugin.cpp + tdenetman-cellular_device_tray.cpp tdenetman-device_tray.cpp + tdenetman-wired_device_tray.cpp tdenetman-wireless_device_tray.cpp + tdenetman-wireless_menuitem.cpp tdenetman-menuitem.cpp + tdenetman-menu_subhead.cpp sha1.cpp md5.cpp - knetworkmanager-wireless_network.cpp knetworkmanager-wireless_manager.cpp - knetworkmanager-connection_editor.cpp + tdenetman-wireless_network.cpp tdenetman-wireless_manager.cpp + tdenetman-connection_editor.cpp devicetraycomponent.cpp traycomponent.cpp - #knetworkmanager-plugin.cpp knetworkmanager-vpnplugin.cpp - #knetworkmanager-pluginmanager.cpp knetworkmanager-vpnservice.cpp knetworkmanager-vpnmanager.cpp - #knetworkmanager-vpnauthenticationdialog.cpp + #tdenetman-plugin.cpp tdenetman-vpnplugin.cpp + #tdenetman-pluginmanager.cpp tdenetman-vpnservice.cpp tdenetman-vpnmanager.cpp + #tdenetman-vpnauthenticationdialog.cpp #vpn_tray_component.cpp EMBED tdenetwork-connection-configwidgets-static #tdenetwork-connection-settings-static LINK tdecore-shared tdeui-shared kutils-shared ${DBUS_TQT_LIBRARIES} diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp deleted file mode 100644 index 09b9ed3..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_cdma_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include - -// knm headers -#include "knetworkmanager-connection_setting_cdma_widget.h" - -// ui headers -#include "connection_setting_cdma.h" - -using namespace ConnectionSettings; - -CDMAWidgetImpl::CDMAWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) - : WidgetInterface(parent, name, fl) -{ - _cdmasetting = dynamic_cast(conn); - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingCdmaWidget(this); - layout->addWidget(_mainWid); - - Init(); -} - -void -CDMAWidgetImpl::Init() -{ - if (_cdmasetting->cdmaConfig.valid) { - _mainWid->mUsername->setText( _cdmasetting->cdmaConfig.username ); - _mainWid->mNumber->setText( _cdmasetting->cdmaConfig.providerDataNumber ); - if (_cdmasetting->cdmaConfig.secretsValid) { - _mainWid->mPassword->setText( _cdmasetting->cdmaConfig.password ); - } - } - 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->cdmaConfig.username = _mainWid->mUsername->text(); - _cdmasetting->cdmaConfig.password = _mainWid->mPassword->text(); - _cdmasetting->cdmaConfig.providerDataNumber = _mainWid->mNumber->text(); - _cdmasetting->cdmaConfig.valid = true; - _cdmasetting->cdmaConfig.secretsValid = true; -} - - -#include "knetworkmanager-connection_setting_cdma_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.h deleted file mode 100644 index 0cbbfee..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.h +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_cdma_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 - - -// tqt headers -#include -#include - -// tde headers -#include -#include - -// knm headers -#include "knetworkmanager-connection_setting_widget_interface.h" - -//class VPNService; -class ConnectionSettingCdmaWidget; - -namespace ConnectionSettings -{ - -class CDMAWidgetImpl : public WidgetInterface -{ - Q_OBJECT - - public: - CDMAWidgetImpl(TDENetworkConnection* 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); - - - TDEModemConnection* _cdmasetting; - ConnectionSettingCdmaWidget* _mainWid; -}; - -} -#endif /* KNETWORKMANAGER_CONNECTION_SETTING_CDMA_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.cpp deleted file mode 100644 index 36a9a57..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_gsm_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// knm headers -#include "knetworkmanager-connection_setting_gsm.h" -#include "knetworkmanager-connection_setting_gsm_widget.h" - -#include "connection_setting_gsm.h" - -using namespace ConnectionSettings; - -GSMWidgetImpl::GSMWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) - : WidgetInterface(parent, name, fl) -{ - _gsmsetting = dynamic_cast(conn); - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingGsmWidget(this); - layout->addWidget(_mainWid); - - Init(); -} - -void -GSMWidgetImpl::Init() -{ - if (_gsmsetting->gsmConfig.valid) { - _mainWid->mUsername->setText( _gsmsetting->gsmConfig.username ); - _mainWid->mNumber->setText( _gsmsetting->gsmConfig.providerDataNumber ); - _mainWid->mApn->setText( _gsmsetting->gsmConfig.accessPointName ); - _mainWid->mNetworkId->setText( _gsmsetting->gsmConfig.networkID ); - setNetworkType( _gsmsetting->gsmConfig.networkType ); - _mainWid->mBand->setValue( _gsmsetting->gsmConfig.allowedFrequencyBands ); - if (_gsmsetting->gsmConfig.secretsValid) { - _mainWid->mPassword->setText( _gsmsetting->gsmConfig.password ); - _mainWid->mPin->setText( _gsmsetting->gsmConfig.pin ); - } - } - - 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->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->gsmConfig.username = _mainWid->mUsername->text(); - _gsmsetting->gsmConfig.password = _mainWid->mPassword->text(); - _gsmsetting->gsmConfig.pin = _mainWid->mPin->text(); - _gsmsetting->gsmConfig.providerDataNumber = _mainWid->mNumber->text(); - _gsmsetting->gsmConfig.accessPointName = _mainWid->mApn->text(); - _gsmsetting->gsmConfig.networkID = _mainWid->mNetworkId->text(); - _gsmsetting->gsmConfig.networkType = getNetworkType(); - _gsmsetting->gsmConfig.allowedFrequencyBands = _mainWid->mBand->value(); - - _gsmsetting->gsmConfig.valid = true; - _gsmsetting->gsmConfig.secretsValid = true; -} - -void -GSMWidgetImpl::setNetworkType(TDEGSMNetworkType::TDEGSMNetworkType type) -{ - if (type == TDEGSMNetworkType::Any) { - _mainWid->mBand->setValue(0); - } - else if (type == TDEGSMNetworkType::Only3G) { - _mainWid->mBand->setValue(1); - } - else if (type == TDEGSMNetworkType::GPRSEdge) { - _mainWid->mBand->setValue(2); - } - else if (type == TDEGSMNetworkType::Prefer3G) { - _mainWid->mBand->setValue(3); - } - else if (type == TDEGSMNetworkType::Prefer2G) { - _mainWid->mBand->setValue(4); - } - else { - _mainWid->mBand->setValue(0); - } -} - -TDEGSMNetworkType::TDEGSMNetworkType -GSMWidgetImpl::getNetworkType() -{ - int itemNo = _mainWid->mNetworkType->currentItem(); - if (itemNo == 0) { - return TDEGSMNetworkType::Any; - } - else if (itemNo == 1) { - return TDEGSMNetworkType::Only3G; - } - else if (itemNo == 2) { - return TDEGSMNetworkType::GPRSEdge; - } - else if (itemNo == 3) { - return TDEGSMNetworkType::Prefer3G; - } - else if (itemNo == 4) { - return TDEGSMNetworkType::Prefer2G; - } - else { - return TDEGSMNetworkType::Any; - } -} - -#include "knetworkmanager-connection_setting_gsm_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.h deleted file mode 100644 index f4fd439..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.h +++ /dev/null @@ -1,72 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_gsm_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 - - -// tqt headers -#include -#include - -// tde headers -#include -#include - -// knm headers -#include "knetworkmanager-connection_setting_gsm.h" -#include "knetworkmanager-connection_setting_widget_interface.h" - -//class VPNService; -class ConnectionSettingGsmWidget; - -namespace ConnectionSettings -{ - -class Connection; - -class GSMWidgetImpl : public WidgetInterface -{ - Q_OBJECT - - public: - GSMWidgetImpl(TDENetworkConnection* 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); - - void setNetworkType(TDEGSMNetworkType::TDEGSMNetworkType); - TDEGSMNetworkType::TDEGSMNetworkType getNetworkType(); - - TDEModemConnection* _gsmsetting; - ConnectionSettingGsmWidget* _mainWid; -}; - -} -#endif /* KNETWORKMANAGER_CONNECTION_SETTING_GSM_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.cpp deleted file mode 100644 index f0c1972..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Valentine Sinitsyn - * - * 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 -#include -#include -#include - -// knm headers -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-connection_setting_info_widget.h" - -using namespace ConnectionSettings; - -InfoWidgetImpl::InfoWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) - : WidgetInterface(parent, name, fl) -{ - _infosetting = conn; - - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingInfoWidget(this); - layout->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->friendlyName); - _mainWid->chkAutoConnect->setChecked(_infosetting->autoConnect); -} - -void -InfoWidgetImpl::slotNameChanged(const TQString& name) -{ - _infosetting->friendlyName = name; -} - -void -InfoWidgetImpl::slotAutoconnectChanged(bool autoconnect) -{ - _infosetting->autoConnect = autoconnect; -} - -#include "knetworkmanager-connection_setting_info_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.h deleted file mode 100644 index c5900ce..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.h +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Valentine Sinitsyn - * - * 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 - - -// tqt headers -#include -#include - -// tde headers -#include -#include - -// knm headers -#include "connection_setting_info.h" -#include "knetworkmanager-connection_setting_widget_interface.h" - -namespace ConnectionSettings -{ - -class Info; -class Connection; - -class InfoWidgetImpl : public WidgetInterface -{ - Q_OBJECT - - public: - InfoWidgetImpl(TDENetworkConnection* 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(); - - TDENetworkConnection* _infosetting; - ConnectionSettingInfoWidget* _mainWid; -}; - -} -#endif /* KNETWORKMANAGER_CONNECTION_SETTING_INFO_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.cpp deleted file mode 100644 index 7b48dfe..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Valentine Sinitsyn - * - * 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 -#include -#include -#include -#include - -#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(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) - : WidgetInterface(parent, name, fl) -{ - _ipv4_setting = conn; - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingIPv4Widget(this); - layout->addWidget(_mainWid); - - Init(); -} - -void -IPv4WidgetImpl::Init() -{ - _mainWid->groupIPConfig->setChecked(!(_ipv4_setting->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPIP)); - - 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->ipConfig.ipConfigurations.isEmpty()) - { - _mainWid->txtIP->setText(_ipv4_setting->ipConfig.ipConfigurations[0].ipAddress.toString()); - _mainWid->txtNetmask->setText(_ipv4_setting->ipConfig.ipConfigurations[0].networkMask.toString()); - _mainWid->txtGateway->setText(_ipv4_setting->ipConfig.ipConfigurations[0].gateway.toString()); - } - - if (!_ipv4_setting->ipConfig.resolvers.isEmpty()) - { - TDENetworkAddressList hosts = _ipv4_setting->ipConfig.resolvers; - TQStringList list; - for (TDENetworkAddressList::Iterator it = hosts.begin(); it != hosts.end(); ++it) - { - list.append((*it).toString()); - } - _mainWid->txtDNSAddresses->setText(list.join(" ")); - } - - if (!_ipv4_setting->ipConfig.searchDomains.isEmpty()) - { - TDENetworkSearchDomainList domains = _ipv4_setting->ipConfig.searchDomains; - TQStringList list; - for (TDENetworkSearchDomainList::Iterator it = domains.begin(); it != domains.end(); ++it) - { - list.append((*it).searchDomain()); - } - _mainWid->txtDNSSearch->setText(list.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); - TDENetworkAddressList hosts; - for (TQStringList::Iterator it = list.begin(); it != list.end(); ++it) - { - TQHostAddress host(*it); - if (!host.isNull()) - { - hosts.append(host); - } - } - _ipv4_setting->ipConfig.resolvers = hosts; -} - - -void -IPv4WidgetImpl::slotDNSSearchChanged(const TQString& search) -{ - // TODO: use , and ; for splitting too - - TQStringList list = TQStringList::split(" ", search); - TDENetworkSearchDomainList domains; - for (TQStringList::Iterator it = list.begin(); it != list.end(); ++it) - { - if ((*it) != "") { - TDENetworkSearchDomain domain(*it); - domains.append(domain); - } - } - _ipv4_setting->ipConfig.searchDomains = domains; -} - -void -IPv4WidgetImpl::slotIPConfigEnabled(bool enabled) -{ - if (enabled) - { - _ipv4_setting->ipConfig.connectionFlags &= (~TDENetworkIPConfigurationFlags::IPV4DHCPIP); - } - else - { - _ipv4_setting->ipConfig.connectionFlags |= TDENetworkIPConfigurationFlags::IPV4DHCPIP; - } -} - -void -IPv4WidgetImpl::slotIPAddressChanged(const TQString& ip) -{ - TQHostAddress ipadr(ip); - if (!ipadr.isNull()) - { - TDENetworkSingleIPConfigurationList addrs = _ipv4_setting->ipConfig.ipConfigurations; - if (addrs.size() > 0) - { - addrs[0].ipAddress = ipadr; - } - else - { - TDENetworkSingleIPConfiguration adr; - adr.ipAddress = ipadr; - addrs.append(adr); - } - _ipv4_setting->ipConfig.ipConfigurations = 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) -{ - TDENetworkSingleIPConfigurationList addrs = _ipv4_setting->ipConfig.ipConfigurations; - TDENetMask mask; - mask.fromString(ip); - addrs[0].networkMask = mask; - _ipv4_setting->ipConfig.ipConfigurations = addrs; -} - -void -IPv4WidgetImpl::slotGatewayChanged(const TQString& ip) -{ - TDENetworkSingleIPConfigurationList addrs = _ipv4_setting->ipConfig.ipConfigurations; - addrs[0].gateway = TQHostAddress(ip); - _ipv4_setting->ipConfig.ipConfigurations = addrs; -} - -#include "knetworkmanager-connection_setting_ipv4_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.h deleted file mode 100644 index cfee028..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.h +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * - * 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 - -// tde headers -#include -#include - -// ui headers -#include "connection_setting_ipv4.h" - -// knetworkmanager headers -#include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-connection_setting_ipv4.h" - -namespace ConnectionSettings -{ - class IPv4; - - class IPv4WidgetImpl : public WidgetInterface - { - Q_OBJECT - - - public: - IPv4WidgetImpl(TDENetworkConnection* 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(); - - TDENetworkConnection* _ipv4_setting; - ConnectionSettingIPv4Widget* _mainWid; - }; - -} -#endif /* KNETWORKMANAGER_CONNECTION_SETTING_IPv4_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.cpp deleted file mode 100644 index 3bc4783..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_ppp_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 - -// qt headers -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// knm headers -#include "knetworkmanager-connection_setting_ppp.h" -#include "knetworkmanager-connection_setting_ppp_widget.h" - -#include "connection_setting_ppp.h" - -using namespace ConnectionSettings; - -PPPWidgetImpl::PPPWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) - : WidgetInterface(parent, name, fl) -{ - _pppsetting = conn; - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingPppWidget(this); - layout->addWidget(_mainWid); - - Init(); -} - -void -PPPWidgetImpl::Init() -{ - if (_pppsetting->pppConfig.valid) { - _mainWid->mNoAuth->setChecked( !(_pppsetting->pppConfig.requireServerAuthentication) ); - _mainWid->mRefuseEap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableEAP ); - _mainWid->mRefusePap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisablePAP ); - _mainWid->mRefuseChap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableCHAP ); - _mainWid->mRefuseMschap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableMSCHAP ); - _mainWid->mRefuseMschapV2->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableMSCHAPv2 ); - _mainWid->mNoBsd->setChecked( !(_pppsetting->pppConfig.flags & TDENetworkPPPFlags::AllowBSDCompression) ); - _mainWid->mNoDeflate->setChecked( !(_pppsetting->pppConfig.flags & TDENetworkPPPFlags::AllowDeflateCompression) ); - _mainWid->mNoVjComp->setChecked( !(_pppsetting->pppConfig.flags & TDENetworkPPPFlags::AllowVJCompression) ); - _mainWid->mRequireMppe->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::RequireMPPE ); - _mainWid->mRequireMppe128->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::RequireMPPE128 ); - _mainWid->mStatefulMppe->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::StatefulMPPE ); - _mainWid->mCrtscts->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::UseHardwareFlowControl ); - - _mainWid->mBaudRate->setValue(_pppsetting->pppConfig.baudRate); - _mainWid->mMru->setValue(_pppsetting->pppConfig.mru); - _mainWid->mMtu->setValue(_pppsetting->pppConfig.mtu); - _mainWid->mLcpEchoFailure->setValue(_pppsetting->pppConfig.lcpEchoFailureThreshold); - _mainWid->mLcpEchoInterval->setValue(_pppsetting->pppConfig.lcpEchoPingInterval); - } - - 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->mCrtscts, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); -} - -void -PPPWidgetImpl::Deactivate() -{ -} - -void -PPPWidgetImpl::Activate() -{ - -} - -#define SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(x,y,z) { \ - if (z) { \ - x |= y; \ - } \ - else { \ - x &= (~y); \ - } \ - } - -void -PPPWidgetImpl::dirty() -{ - _pppsetting->pppConfig.requireServerAuthentication = ( !(_mainWid->mNoAuth->isChecked()) ); - - SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableEAP, _mainWid->mRefuseEap->isChecked() ); - SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisablePAP, _mainWid->mRefusePap->isChecked() ); - SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableCHAP, _mainWid->mRefuseChap->isChecked() ); - SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableMSCHAP, _mainWid->mRefuseMschap->isChecked() ); - SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableMSCHAPv2, _mainWid->mRefuseMschapV2->isChecked() ); - SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::AllowBSDCompression, !(_mainWid->mNoBsd->isChecked()) ); - SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::AllowDeflateCompression, !(_mainWid->mNoDeflate->isChecked()) ); - SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::AllowVJCompression, !(_mainWid->mNoVjComp->isChecked()) ); - SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::RequireMPPE, _mainWid->mRequireMppe->isChecked() ); - SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::RequireMPPE128, _mainWid->mRequireMppe128->isChecked() ); - SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::StatefulMPPE, _mainWid->mStatefulMppe->isChecked() ); - SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::UseHardwareFlowControl, _mainWid->mCrtscts->isChecked() ); - - _pppsetting->pppConfig.baudRate = _mainWid->mBaudRate->value(); - _pppsetting->pppConfig.mru = _mainWid->mMru->value(); - _pppsetting->pppConfig.mtu = _mainWid->mMtu->value(); - _pppsetting->pppConfig.lcpEchoFailureThreshold = _mainWid->mLcpEchoFailure->value(); - _pppsetting->pppConfig.lcpEchoPingInterval = _mainWid->mLcpEchoInterval->value(); - - _pppsetting->pppConfig.valid = true; -} - -#include "knetworkmanager-connection_setting_ppp_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.h deleted file mode 100644 index 7cd4121..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.h +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_ppp_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 - - -// tqt headers -#include -#include - -// tde headers -#include -#include - -// knm headers -#include "knetworkmanager-connection_setting_ppp.h" -#include "knetworkmanager-connection_setting_widget_interface.h" - -//class VPNService; -class ConnectionSettingPppWidget; - -namespace ConnectionSettings -{ - -class Connection; - -class PPPWidgetImpl : public WidgetInterface -{ - Q_OBJECT - - public: - PPPWidgetImpl(TDENetworkConnection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); - void Activate(); - void Deactivate(); - public slots: - void dirty(); - - private: - void Init(); - - TDENetworkConnection* _pppsetting; - ConnectionSettingPppWidget* _mainWid; -}; - -} -#endif /* KNETWORKMANAGER_CONNECTION_SETTING_PPP_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.cpp deleted file mode 100644 index 574cdb7..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_serial_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 -// qt headers -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// knm headers -#include "knetworkmanager-connection_setting_serial.h" -#include "knetworkmanager-connection_setting_serial_widget.h" - -#include "connection_setting_serial.h" - -using namespace ConnectionSettings; - -SerialWidgetImpl::SerialWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) - : WidgetInterface(parent, name, fl) -{ - _serialsetting = conn; - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingSerialWidget(this); - layout->addWidget(_mainWid); - _mainWid->mBaudRate->setMaxValue(INT_MAX); - Init(); -} - -void -SerialWidgetImpl::Init() -{ - if (_serialsetting->serialConfig.valid) { - _mainWid->mBaudRate->setValue(_serialsetting->serialConfig.baudRate); - _mainWid->mDataBits->setCurrentItem(_serialsetting->serialConfig.byteWidth - 7); - setParityType(_serialsetting->serialConfig.parity); - _mainWid->mStopBits->setCurrentItem(_serialsetting->serialConfig.stopBits); - _mainWid->mSendDelay->setValue(_serialsetting->serialConfig.txDelay); - } - - 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->serialConfig.baudRate = _mainWid->mBaudRate->value(); - _serialsetting->serialConfig.byteWidth = _mainWid->mDataBits->currentItem() + 7; - _serialsetting->serialConfig.parity = getParityType(); - _serialsetting->serialConfig.stopBits = _mainWid->mStopBits->currentItem(); - _serialsetting->serialConfig.txDelay = _mainWid->mSendDelay->value(); - - _serialsetting->serialConfig.valid = true; -} - -void -SerialWidgetImpl::setParityType(TDENetworkParity::TDENetworkParity type) -{ - if (type == TDENetworkParity::None) { - _mainWid->mParity->setCurrentItem(0); - } - else if (type == TDENetworkParity::Even) { - _mainWid->mParity->setCurrentItem(1); - } - else if (type == TDENetworkParity::Odd) { - _mainWid->mParity->setCurrentItem(2); - } - else { - _mainWid->mParity->setCurrentItem(0); - } -} - -TDENetworkParity::TDENetworkParity -SerialWidgetImpl::getParityType() -{ - int itemNo = _mainWid->mParity->currentItem(); - if (itemNo == 0) { - return TDENetworkParity::None; - } - else if (itemNo == 1) { - return TDENetworkParity::Even; - } - else if (itemNo == 2) { - return TDENetworkParity::Odd; - } - else { - return TDENetworkParity::None; - } -} - -#include "knetworkmanager-connection_setting_serial_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.h deleted file mode 100644 index d12db89..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.h +++ /dev/null @@ -1,71 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_serial_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2008 Novell, Inc. - * - * Author: Will Stephenson - * - * 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 - - -// tqt headers -#include -#include - -// tde headers -#include -#include - -// knm headers -#include "knetworkmanager-connection_setting_serial.h" -#include "knetworkmanager-connection_setting_widget_interface.h" - -//class VPNService; -class ConnectionSettingSerialWidget; - -namespace ConnectionSettings -{ - -class Connection; - -class SerialWidgetImpl : public WidgetInterface -{ - Q_OBJECT - - public: - SerialWidgetImpl(TDENetworkConnection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); - void Activate(); - void Deactivate(); - public slots: - void dirty(); - - private: - void Init(); - - void setParityType(TDENetworkParity::TDENetworkParity type); - TDENetworkParity::TDENetworkParity getParityType(); - - TDENetworkConnection* _serialsetting; - ConnectionSettingSerialWidget* _mainWid; -}; - -} -#endif /* KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_vpn_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_vpn_widget.cpp deleted file mode 100644 index 0e9ac95..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_vpn_widget.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_vpn_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * Author: Timothy Pearson - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include - -// 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 (conn->getSetting(NM_SETTING_VPN_SETTING_NAME)); - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingVPNWidget(this); - layout->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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_vpn_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_vpn_widget.h deleted file mode 100644 index f7c16cd..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_vpn_widget.h +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_vpn_widget.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -// 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 - - 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 _mapServiceCombo; - TQMap _mapServiceWidget; -}; - -} -#endif /* KNETWORKMANAGER_CONNECTION_SETTING_VPN_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_widget_interface.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_widget_interface.cpp deleted file mode 100644 index 2c00288..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_widget_interface.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_widget_interface.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_widget_interface.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_widget_interface.h deleted file mode 100644 index 13ea65e..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_widget_interface.h +++ /dev/null @@ -1,47 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_widget_interface.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -namespace ConnectionSettings -{ - - class WidgetInterface : public TQWidget - { - Q_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/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.cpp deleted file mode 100644 index 4b6d70a..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.cpp +++ /dev/null @@ -1,1029 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_setting_wireless_security_widget.cpp - * - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include - -/* kde headers */ -#include -#include -#include -#include - -/* knetworkmanager headers */ -#include "knetworkmanager-connection_setting_wireless_security_widget.h" -#include "sha1.h" -#include "md5.h" -#include "knetworkmanager-wireless_manager.h" - -#define WPA_PMK_LEN 32 - -#define SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(x,y,z) { \ - if (z) { \ - x |= y; \ - } \ - else { \ - x &= (~y); \ - } \ - } - -using namespace ConnectionSettings; - -/* - class WirelessSecurityWEPImpl -*/ -WirelessSecurityWEPImpl::WirelessSecurityWEPImpl(TDEWiFiConnection* 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->securitySettings.authType == TDENetworkWiFiAuthType::Open) { - cboAuthentication->setCurrentItem(0); - } - else if (_security_setting->securitySettings.authType == TDENetworkWiFiAuthType::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->securitySettings.wepKey0); - txtWEPKey1->setText(_security_setting->securitySettings.wepKey1); - txtWEPKey2->setText(_security_setting->securitySettings.wepKey2); - txtWEPKey3->setText(_security_setting->securitySettings.wepKey3); - - switch(_security_setting->securitySettings.wepKeyIndex) - { - 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->securitySettings.authType =TDENetworkWiFiAuthType::Open; - } - else if (index == 1) { - _security_setting->securitySettings.authType = TDENetworkWiFiAuthType::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->securitySettings.wepKey0 = hashed; -} - -void WirelessSecurityWEPImpl::slotWepKey1Changed(const TQString &key) -{ - TQCString hashed = getHashedWEPKey(key, _wepKeyType); - _security_setting->securitySettings.wepKey1 = hashed; -} - -void WirelessSecurityWEPImpl::slotWepKey2Changed(const TQString &key) -{ - TQCString hashed = getHashedWEPKey(key, _wepKeyType); - _security_setting->securitySettings.wepKey2 = hashed; -} - -void WirelessSecurityWEPImpl::slotWepKey3Changed(const TQString& key) -{ - TQCString hashed = getHashedWEPKey(key, _wepKeyType); - _security_setting->securitySettings.wepKey3 = hashed; -} - -void WirelessSecurityWEPImpl::slotWepIdx0Checked(bool check) -{ - if (check) { - _security_setting->securitySettings.wepKeyIndex = 0; - } -} - -void WirelessSecurityWEPImpl::slotWepIdx1Checked(bool check) -{ - if (check) { - _security_setting->securitySettings.wepKeyIndex = 1; - } -} - -void WirelessSecurityWEPImpl::slotWepIdx2Checked(bool check) -{ - if (check) { - _security_setting->securitySettings.wepKeyIndex = 2; - } -} - -void WirelessSecurityWEPImpl::slotWepIdx3Checked(bool check) -{ - if (check) { - _security_setting->securitySettings.wepKeyIndex = 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(TDEWiFiConnection* 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(TDEWiFiConnection* security_setting, TQWidget* parent, const char* name, WFlags fl) - : ConnectionSettingWirelessSecurityWPAVersion(parent, name, fl) - , _security_setting(security_setting) -{ - cbWPA->setChecked(_security_setting->securitySettings.wpaVersion & TDENetworkWiFiWPAVersionFlags::WPA); - cbRSN->setChecked(_security_setting->securitySettings.wpaVersion & TDENetworkWiFiWPAVersionFlags::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->securitySettings.wpaVersion = TDENetworkWiFiWPAVersionFlags::Any; - } - else { - // use selected wpa-version - TDENetworkWiFiWPAVersionFlags::TDENetworkWiFiWPAVersionFlags proto = TDENetworkWiFiWPAVersionFlags::None; - if (cbWPA->isChecked()) { - proto |= TDENetworkWiFiWPAVersionFlags::WPA; - } - if (cbRSN->isChecked()) { - proto |= TDENetworkWiFiWPAVersionFlags::RSN; - } - _security_setting->securitySettings.wpaVersion = proto; - } -} - -void -WirelessSecurityWPAVersionImpl::slotWPA1(bool on) -{ - SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(_security_setting->securitySettings.wpaVersion, TDENetworkWiFiWPAVersionFlags::WPA, on); -} - -void -WirelessSecurityWPAVersionImpl::slotWPA2(bool on) -{ - SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(_security_setting->securitySettings.wpaVersion, TDENetworkWiFiWPAVersionFlags::RSN, on); -} - -/* - class WirelessSecurityWPACipherImpl -*/ -WirelessSecurityWPACipherImpl::WirelessSecurityWPACipherImpl(TDEWiFiConnection* 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->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)); - chkPairwiseCipherTKIP->setChecked(_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)); - - chkGroupCipherCCMP->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)); - chkGroupCipherTKIP->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)); - chkGroupCipherWEP40->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40)); - chkGroupCipherWEP104->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104)); - -} - -void -WirelessSecurityWPACipherImpl::slotCipherChangedAuto(bool checked) -{ - if (!checked) - { - // select auto for both ciphers - _security_setting->securitySettings.allowedGroupWiseCiphers.clear(); - _security_setting->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::Any); - _security_setting->securitySettings.allowedPairWiseCiphers.clear(); - _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::Any); - } - else - { - // use the already selected ciphers - - // group cipher - TDENetworkWiFiConnectionCipherList cipher; - if (chkGroupCipherTKIP->isChecked()) { - cipher.append(TDENetworkWiFiConnectionCipher::CipherTKIP); - } - if (chkGroupCipherCCMP->isChecked()) { - cipher.append(TDENetworkWiFiConnectionCipher::CipherCCMP); - } - if (chkGroupCipherWEP40->isChecked()) { - cipher.append(TDENetworkWiFiConnectionCipher::CipherWEP40); - } - if (chkGroupCipherWEP104->isChecked()) { - cipher.append(TDENetworkWiFiConnectionCipher::CipherWEP104); - } - _security_setting->securitySettings.allowedGroupWiseCiphers = cipher; - - // pairwise cipher - cipher.clear(); - if (chkPairwiseCipherTKIP->isChecked()) { - cipher.append(TDENetworkWiFiConnectionCipher::CipherTKIP); - } - if (chkPairwiseCipherCCMP->isChecked()) { - cipher.append(TDENetworkWiFiConnectionCipher::CipherCCMP); - } - _security_setting->securitySettings.allowedPairWiseCiphers = cipher; - - } -} - -void -WirelessSecurityWPACipherImpl::slotGroupCipherChangedTKIP(bool checked) -{ - if (checked) { - if (!_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)) _security_setting->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherTKIP); - } - else { - _security_setting->securitySettings.allowedGroupWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherTKIP); - } -} - -void -WirelessSecurityWPACipherImpl::slotGroupCipherChangedCCMP(bool checked) -{ - if (checked) { - if (!_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)) _security_setting->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherCCMP); - } - else { - _security_setting->securitySettings.allowedGroupWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherCCMP); - } -} - -void -WirelessSecurityWPACipherImpl::slotGroupCipherChangedWEP40(bool checked) -{ - if (checked) { - if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP40); - } - else { - _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherWEP40); - } -} - -void -WirelessSecurityWPACipherImpl::slotGroupCipherChangedWEP104(bool checked) -{ - if (checked) { - if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP104); - } - else { - _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherWEP104); - } -} - -void -WirelessSecurityWPACipherImpl::slotPairwiseCipherChangedTKIP(bool checked) -{ - if (checked) { - if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherTKIP); - } - else { - _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherTKIP); - } -} - -void -WirelessSecurityWPACipherImpl::slotPairwiseCipherChangedCCMP(bool checked) -{ - if (checked) { - if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherCCMP); - } - else { - _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherCCMP); - } -} - -/* - class WirelessSecurityWPAPSK -*/ -WirelessSecurityWPAPSKImpl::WirelessSecurityWPAPSKImpl(TDEWiFiConnection* security_setting, TDEWiFiConnection* wireless_setting, TQWidget* parent, const char* name, WFlags fl) - : ConnectionSettingWirelessSecurityWPAPSK(parent, name, fl) - , _security_setting(security_setting) - , _wireless_setting(wireless_setting) -{ - if (_security_setting->securitySettings.secretsValid) { - txtPSK->setText(_security_setting->securitySettings.psk); - } - connect(txtPSK, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotPSKChanged(const TQString&))); -} - -void -WirelessSecurityWPAPSKImpl::slotPSKChanged(const TQString& psk) -{ - if (_wireless_setting) - { - _security_setting->securitySettings.psk = psk; - _security_setting->securitySettings.secretsValid = true; - } -} - -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(TDEWiFiConnection* 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] = TDENetworkIEEE8021xType::None; - - cboMethod->insertItem(i18n("TTLS"), ++index); - _eapIndexMap[index] = TDENetworkIEEE8021xType::TTLS; - - cboMethod->insertItem(i18n("PEAP"), ++index); - _eapIndexMap[index] = TDENetworkIEEE8021xType::PEAP; - - cboMethod->insertItem(i18n("TLS"), ++index); - _eapIndexMap[index] = TDENetworkIEEE8021xType::TLS; - - cboMethod->insertItem(i18n("Leap"), ++index); - _eapIndexMap[index] = TDENetworkIEEE8021xType::LEAP; - - cboMethod->insertItem(i18n("MD5"), ++index); - _eapIndexMap[index] = TDENetworkIEEE8021xType::MD5; - - cboMethod->insertItem(i18n("FAST"), ++index); - _eapIndexMap[index] = TDENetworkIEEE8021xType::Fast; - - cboMethod->insertItem(i18n("SIM"), ++index); - _eapIndexMap[index] = TDENetworkIEEE8021xType::SIM; - - // preselect the correct method - TQBiDirectionalMap::Iterator it = _eapIndexMap.findData(_security_setting->eapConfig.type); - cboMethod->setCurrentItem(it.key()); - - // update phase2 combobox - _phase2_widget->setAllowedPhase2Methods(_security_setting->eapConfig.allowedPhase2EAPMethods); - - txtIdentity->setText(_security_setting->eapConfig.userName); - txtAnonIdentity->setText(_security_setting->eapConfig.anonymousUserName); - if (_security_setting->eapConfig.secretsValid) { - txtPassword->setText(_security_setting->eapConfig.password); - } - - chkCAStore->setChecked(_security_setting->eapConfig.forceSystemCaCertificates); - kURLCACert->setEnabled(!_security_setting->eapConfig.forceSystemCaCertificates); - - // 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->eapConfig.forceSystemCaCertificates = on; - kURLCACert->setEnabled(!on); -} - -void WirelessSecurityEAPImpl::slotMethodChanged(int index) -{ - // new method choosen - TDENetworkIEEE8021xType::TDENetworkIEEE8021xType eap = _eapIndexMap[index]; - _security_setting->eapConfig.type = eap; - - _phase2_widget->setAllowedPhase2Methods(_security_setting->eapConfig.allowedPhase2EAPMethods); -} - -void WirelessSecurityEAPImpl::slotIdentityChanged(const TQString& identity) -{ - _security_setting->eapConfig.userName = identity; -} - -void WirelessSecurityEAPImpl::slotAnonIdentityChanged(const TQString& identity) -{ - _security_setting->eapConfig.anonymousUserName = identity; -} - -void WirelessSecurityEAPImpl::slotPasswordChanged(const TQString& pwd) -{ - _security_setting->eapConfig.password = TQString(txtPassword->password()); - _security_setting->eapConfig.secretsValid = true; -} - -/* - class WirelessSecurityPhase2Impl -*/ -WirelessSecurityPhase2Impl::WirelessSecurityPhase2Impl(TDEWiFiConnection* security_setting, TQWidget* parent, const char* name, WFlags fl) - : ConnectionSettingWirelessSecurityPhase2(parent, name, fl) - , _security_setting(security_setting) -{ - _allowed_methods.append(TDENetworkIEEE8021xType::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::Iterator it = _allowed_methods.begin(); it != _allowed_methods.end(); ++it) - { - if ((*it) == TDENetworkIEEE8021xType::None) - { - cboPhase2Method->insertItem(i18n("None"), index); - _eapIndexMap[index] = TDENetworkIEEE8021xType::None; - index++; - } - else if ((*it) == TDENetworkIEEE8021xType::MSCHAPV2) - { - cboPhase2Method->insertItem(i18n("MSCHAPv2"), index); - _eapIndexMap[index] = TDENetworkIEEE8021xType::MSCHAPV2; - index++; - } - else if ((*it) == TDENetworkIEEE8021xType::PAP) - { - cboPhase2Method->insertItem(i18n("PAP"), index); - _eapIndexMap[index] = TDENetworkIEEE8021xType::PAP; - index++; - } - else if ((*it) == TDENetworkIEEE8021xType::CHAP) - { - cboPhase2Method->insertItem(i18n("CHAP"), index); - _eapIndexMap[index] = TDENetworkIEEE8021xType::CHAP; - index++; - } - else if ((*it) == TDENetworkIEEE8021xType::MSCHAP) - { - cboPhase2Method->insertItem(i18n("MSCHAP"), index); - _eapIndexMap[index] = TDENetworkIEEE8021xType::MSCHAP; - index++; - } - else if ((*it) == TDENetworkIEEE8021xType::GTC) - { - cboPhase2Method->insertItem(i18n("GTC"), index); - _eapIndexMap[index] = TDENetworkIEEE8021xType::GTC; - index++; - } - else if ((*it) == TDENetworkIEEE8021xType::OTP) - { - cboPhase2Method->insertItem(i18n("OTP"), index); - _eapIndexMap[index] = TDENetworkIEEE8021xType::OTP; - index++; - } - else if ((*it) == TDENetworkIEEE8021xType::MD5) - { - cboPhase2Method->insertItem(i18n("MD5"), index); - _eapIndexMap[index] = TDENetworkIEEE8021xType::MD5; - index++; - } - else if ((*it) == TDENetworkIEEE8021xType::TLS) - { - cboPhase2Method->insertItem(i18n("TLS"), index); - _eapIndexMap[index] = TDENetworkIEEE8021xType::TLS; - index++; - } - } - - // preselect the correct method - TQBiDirectionalMap::Iterator it = _eapIndexMap.findData(_security_setting->eapConfig.phase2EAPAuthMethod); - if (it != _eapIndexMap.end()) - { - cboPhase2Method->setCurrentItem(it.key()); - _security_setting->eapConfig.phase2EAPAuthMethod = it.data(); - } - else - { - cboPhase2Method->setCurrentItem(0); - _security_setting->eapConfig.phase2EAPAuthMethod = _eapIndexMap[0]; - } -} - -void WirelessSecurityPhase2Impl::setAllowedPhase2Methods(const TQValueList& list) -{ - _allowed_methods = list; - updateMethodComboBox(); -} - -void WirelessSecurityPhase2Impl::slotPhase2MethodChanged(int index) -{ - // new method choosen - TDENetworkIEEE8021xType::TDENetworkIEEE8021xType eap = _eapIndexMap[index]; - _security_setting->eapConfig.phase2EAPAuthMethod = eap; -} - -/* - class WirelessSecurityWidgetImpl -*/ - -WirelessSecurityWidgetImpl::WirelessSecurityWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl) - : WidgetInterface(parent, name, fl) -{ - _security_setting = dynamic_cast (conn); - _wireless_setting = dynamic_cast (conn); - _ieee8021x_setting = dynamic_cast (conn); - _new_conn = new_conn; - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingWirelessSecurityWidget(this); - layout->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 allowed_methods; - _mainWid->cboSecurity->clear(); - - // TODO: Preselect the right security method - // We should have an Essid already, fetch all possible APs - TQValueList aps; - if (_new_conn && !_wireless_setting->SSID.isEmpty()) { - aps = WirelessManager::getAccessPointsForEssid(_wireless_setting->SSID); -#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::Iterator it = aps.begin(); it != aps.end(); ++it) { - if (((*it)->wpaFlags & TDENetworkWiFiAPFlags::PrivacySupport) || ((*it)->rsnFlags & TDENetworkWiFiAPFlags::PrivacySupport)) { - kdDebug() << "AP " << (*it)->friendlySSID().ascii() << " is encrypted" << endl; - if ((((*it)->rsnFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None) || (((*it)->wpaFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None)) { - // WPA or RSN - if ((*it)->rsnFlags & TDENetworkWiFiAPFlags::KeyManagementPSK || (*it)->wpaFlags & TDENetworkWiFiAPFlags::KeyManagementPSK) { - if (!allowed_methods.contains(SECURITY_WPA_PSK)) { - allowed_methods.append(SECURITY_WPA_PSK); - } - } - - if ((*it)->rsnFlags & TDENetworkWiFiAPFlags::KeyManagement80211 || (*it)->wpaFlags & TDENetworkWiFiAPFlags::KeyManagement80211) { - 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->securitySettings.keyType) - { - case TDENetworkWiFiKeyType::WEP: - if (_security_setting->securitySettings.authType == TDENetworkWiFiAuthType::Shared || - !_security_setting->securitySettings.wepKey0.isEmpty() || - !_security_setting->securitySettings.wepKey1.isEmpty() || - !_security_setting->securitySettings.wepKey2.isEmpty() || - !_security_setting->securitySettings.wepKey3.isEmpty() ) - { - _mainWid->groupUseEncryption->setChecked(true); - _mainWid->cboSecurity->setCurrentItem(SECURITY_WEP); - slotComboSecurityActivated(_securityComboMap[SECURITY_WEP]); - } - else - _mainWid->groupUseEncryption->setChecked(false); - break; - case TDENetworkWiFiKeyType::WPAInfrastructure: - _mainWid->groupUseEncryption->setChecked(true); - _mainWid->cboSecurity->setCurrentItem(SECURITY_WPA_PSK); - slotComboSecurityActivated(_securityComboMap[SECURITY_WPA_PSK]); - break; - case TDENetworkWiFiKeyType::WPAEnterprise: - _mainWid->groupUseEncryption->setChecked(true); - _mainWid->cboSecurity->setCurrentItem(SECURITY_WPA_EAP); - slotComboSecurityActivated(_securityComboMap[SECURITY_WPA_EAP]); - break; - case TDENetworkWiFiKeyType::DynamicWEP: - _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->securityRequired = on; -} - -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::iterator it = _widgets[i].begin(); it != _widgets[i].end(); ++it) - { - _mainWid->groupUseEncryption->layout()->remove(*it); - (*it)->hide(); - } - // remove extra widgets too - for (TQValueList::iterator it = _extra_widgets[i].begin(); it != _extra_widgets[i].end(); ++it) - { - _mainWid->groupUseEncryption->layout()->remove(*it); - (*it)->hide(); - } - } - } - - // show all widgets widgets for the selected security method - for (TQValueList::iterator it = _widgets[method].begin(); it != _widgets[method].end(); ++it) - { - _mainWid->groupUseEncryption->layout()->add(*it); - (*it)->show(); - } - - if (_mainWid->pbExtra->isOn()) - for (TQValueList::iterator it = _extra_widgets[method].begin(); it != _extra_widgets[method].end(); ++it) - { - _mainWid->groupUseEncryption->layout()->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::iterator it = _extra_widgets[_currentMethod].begin(); it != _extra_widgets[_currentMethod].end(); ++it) - { - _mainWid->groupUseEncryption->layout()->add(*it); - (*it)->show(); - } - else - for (TQValueList::iterator it = _extra_widgets[_currentMethod].begin(); it != _extra_widgets[_currentMethod].end(); ++it) - { - _mainWid->groupUseEncryption->layout()->remove(*it); - (*it)->hide(); - } -} - -void -WirelessSecurityWidgetImpl::configureForWEP() -{ - _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::WEP; - configureWidgets(SECURITY_WEP); -} - -void -WirelessSecurityWidgetImpl::configureForWPAPSK() -{ - _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::WPAInfrastructure; - configureWidgets(SECURITY_WPA_PSK); -} - -void -WirelessSecurityWidgetImpl::configureForWPAEAP() -{ - _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::WPAEnterprise; - configureWidgets(SECURITY_WPA_EAP); -} - -void -WirelessSecurityWidgetImpl::configureForIEEE8021X() -{ - _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::DynamicWEP; - configureWidgets(SECURITY_IEEE8021X); -} - - - - -#include "knetworkmanager-connection_setting_wireless_security_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.h deleted file mode 100644 index b6e4a5e..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.h +++ /dev/null @@ -1,240 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -/* ui 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" - -// tde headers -#include -#include - -/* knetworkmanager headers */ -#include "qbidirectionalmap.h" -#include "knetworkmanager-connection_setting_widget_interface.h" - -namespace ConnectionSettings -{ - /* class declarations */ - class WirelessSecurity; - class Wireless; - class WirelessSecurityPhase2Impl; - - class WirelessSecurityWEPImpl : public ConnectionSettingWirelessSecurityWEP - { - Q_OBJECT - - public: - enum WEPKEY_TYPE - { - WEPKEY_TYPE_ASCII = 0 - , WEPKEY_TYPE_HEX - , WEPKEY_TYPE_PASSPHRASE - }; - - WirelessSecurityWEPImpl(TDEWiFiConnection* 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: - TDEWiFiConnection* _security_setting; - WEPKEY_TYPE _wepKeyType; - }; - - class WirelessSecurityWEPEncryptionImpl : public ConnectionSettingWirelessSecurityWEPEncryption - { - Q_OBJECT - - public: - WirelessSecurityWEPEncryptionImpl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); - private: - TDEWiFiConnection* _security_setting; - }; - - class WirelessSecurityWPAVersionImpl : public ConnectionSettingWirelessSecurityWPAVersion - { - Q_OBJECT - - public: - WirelessSecurityWPAVersionImpl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); - - public slots: - void slotAuto(bool); - void slotWPA1(bool); - void slotWPA2(bool); - - private: - TDEWiFiConnection* _security_setting; - - }; - - class WirelessSecurityWPACipherImpl : public ConnectionSettingWirelessSecurityWPACipher - { - Q_OBJECT - - private: - enum WPA_CIPHERS - { - WPA_CIPHER_AUTO = 0 - , WPA_CIPHER_TKIP - , WPA_CIPHER_CCMP - , WPA_CIPHER_LAST - }; - public: - WirelessSecurityWPACipherImpl(TDEWiFiConnection* 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: - TDEWiFiConnection* _security_setting; - }; - - class WirelessSecurityWPAPSKImpl : public ConnectionSettingWirelessSecurityWPAPSK - { - Q_OBJECT - - public: - WirelessSecurityWPAPSKImpl(TDEWiFiConnection* security_setting, TDEWiFiConnection* 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: - TDEWiFiConnection* _security_setting; - TDEWiFiConnection* _wireless_setting; - }; - - class WirelessSecurityEAPImpl : public ConnectionSettingWirelessSecurityEAP - { - Q_OBJECT - - public: - WirelessSecurityEAPImpl(TDEWiFiConnection* 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: - TDEWiFiConnection* _security_setting; - TQBiDirectionalMap _eapIndexMap; - WirelessSecurityPhase2Impl* _phase2_widget; - }; - - class WirelessSecurityPhase2Impl : public ConnectionSettingWirelessSecurityPhase2 - { - Q_OBJECT - - public: - WirelessSecurityPhase2Impl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); - public slots: - void setAllowedPhase2Methods(const TQValueList&); - void slotPhase2MethodChanged(int index); - private: - void updateMethodComboBox(); - - TDEWiFiConnection* _security_setting; - TQBiDirectionalMap _eapIndexMap; - TQValueList _allowed_methods; - }; - - class WirelessSecurityWidgetImpl : public WidgetInterface - { - Q_OBJECT - - private: - enum SecurityMethods - { - SECURITY_WEP = 0 - , SECURITY_WPA_PSK - , SECURITY_WPA_EAP - , SECURITY_IEEE8021X - , SECURITY_COUNT - }; - - public: - WirelessSecurityWidgetImpl(TDENetworkConnection*, 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 _widgets[SECURITY_COUNT]; - TQValueList _extra_widgets[SECURITY_COUNT]; - TDEWiFiConnection* _security_setting; - TDEWiFiConnection* _wireless_setting; - TDEWiFiConnection* _ieee8021x_setting; - ConnectionSettingWirelessSecurityWidget* _mainWid; - bool _new_conn; - TQMap _securityComboMap; - }; -} - -#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.cpp deleted file mode 100644 index 5d34190..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Valentine Sinitsyn - * - * 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 -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-connection_setting_wireless_widget.h" -#include "knetworkmanager-connection_setting_info.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\%").arg(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(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl) - : WidgetInterface(parent, name, fl) -{ - _wireless_setting = dynamic_cast(conn); - _info_setting = dynamic_cast(conn); - _security_setting = dynamic_cast(conn); - _hasName = !_info_setting->friendlyName.isEmpty(); - _new_conn = new_conn; - - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _mainWid = new ConnectionSettingWirelessWidget(this); - layout->addWidget(_mainWid); - - // FIXME hide this button until it is implemented - _mainWid->pbExpert->hide(); - - Init(); -} - -void -WirelessWidgetImpl::Init() -{ - TQVBoxLayout* layout = new TQVBoxLayout(_mainWid->framePlaceholder, 1, 1); - _searchLine = new KListViewSearchLineWidget(_mainWid->lvEssids, _mainWid->framePlaceholder); - layout->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 nets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID); - - _mainWid->lvEssids->clear(); - - for (TQValueList::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->SSID); -} - -void WirelessWidgetImpl::slotEssidChanged(TQListViewItem* item) -{ - NetworkListViewItem* net_item = dynamic_cast(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(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->SSID = essid; - - if (!_hasName) - { - // the connection has no name yet -> just take the essid for it - _info_setting->friendlyName = TQString(essid); - if (_info_setting->friendlyName == "") { - _info_setting->friendlyName = "<" + i18n("hidden") + ">"; - } - } -} - -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(bytes[i]); - } - return tmp; -} - -#include "knetworkmanager-connection_setting_wireless_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.h deleted file mode 100644 index 37a3de7..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.h +++ /dev/null @@ -1,74 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Valentine Sinitsyn - * - * 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 - -// tde headers -#include -#include - -#include "knetworkmanager-connection_setting_widget_interface.h" -#include "connection_setting_wireless.h" - -class KListViewSearchLineWidget; - -namespace ConnectionSettings -{ - class Wireless; - class WirelessSecurity; - class Info; - - - class WirelessWidgetImpl : public WidgetInterface - { - Q_OBJECT - - public: - WirelessWidgetImpl(TDENetworkConnection* 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; - TDEWiFiConnection* _wireless_setting; - TDEWiFiConnection* _info_setting; - TDEWiFiConnection* _security_setting; - ConnectionSettingWirelessWidget* _mainWid; - KListViewSearchLineWidget* _searchLine; - bool _new_conn; - }; -} -#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_settings_dialog.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_settings_dialog.cpp deleted file mode 100644 index 41d2776..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_settings_dialog.cpp +++ /dev/null @@ -1,461 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * Author: Timothy Pearson - * - * 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 -#include -#include -#include -#include -#include -#include - -// kde headers -#include -#include -#include - -// TQt DBus headers -#include -#include - -// knm headers -#include "knetworkmanager-connection_setting_widget_interface.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-wireless_network.h" -#include "knetworkmanager-wireless_manager.h" - -char use_new_wireless_essid = 0; -TQByteArray new_wireless_essid; - -using namespace ConnectionSettings; - -ConnectionSettingsDialogImpl::ConnectionSettingsDialogImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, bool modal, WFlags fl) - : ConnectionSettingsDialog(parent, name, modal, fl) - , _conn(conn) - , _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 -ConnectionSettingsDialogImpl::createWidgetsForWireless(TDENetworkConnection* conn, bool new_conn) -{ - TQValueList 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 -ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(TDENetworkConnection* conn, bool new_conn, const TQByteArray& essid) -{ - TQValueList ret; - - // Set ESSID -// _wireless_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); -// _info_setting = dynamic_cast (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 -ConnectionSettingsDialogImpl::createWidgetsForWired(TDENetworkConnection* conn, bool new_conn) -{ - TQValueList ret; - - // widgetlist for wired connection - ret.append(new ConnectionSettings::IPv4WidgetImpl(conn)); - ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); - - return ret; -} - -TQValueList -ConnectionSettingsDialogImpl::createWidgetsForVPN(TDENetworkConnection* conn, bool new_conn) -{ - TQValueList ret; - - // widgetlist for wired connection -// ret.append(new ConnectionSettings::VPNWidgetImpl(conn, new_conn)); - ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); - - return ret; -} - -TQValueList -ConnectionSettingsDialogImpl::createWidgetsForCDMA(TDENetworkConnection* conn, bool new_conn) -{ - TQValueList 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 -ConnectionSettingsDialogImpl::createWidgetsForGSM(TDENetworkConnection* conn, bool new_conn) -{ - TQValueList 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(TDENetworkConnection* conn, bool new_conn) -{ - /* - 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 widgets; - // TODO: move to a factory class - if (conn->type() == TDENetworkConnectionType::WiFi) { - if (use_new_wireless_essid == 0) { - widgets = createWidgetsForWireless(conn, new_conn); - } - else { - createWidgetsForWirelessKnownESSID(conn, new_conn, new_wireless_essid); - new_wireless_essid = TQByteArray(); - } - } - else if (conn->type() == TDENetworkConnectionType::WiredEthernet) { - widgets = createWidgetsForWired(conn, new_conn); - } - else if (conn->type() == TDENetworkConnectionType::Modem) { - TDEModemConnection* modemconn = dynamic_cast(conn); - if (modemconn) { - if (modemconn->type == TDEModemConnectionType::CDMA) { - widgets = createWidgetsForCDMA(conn, new_conn); - } - else if (modemconn->type == TDEModemConnectionType::GSM) { - widgets = createWidgetsForGSM(conn, new_conn); - } - else { - kdWarning() << k_funcinfo << "Specific modem type not handled yet" << endl; - } - } - } -// else if (conn->getType() == NM_SETTING_VPN_SETTING_NAME) { -// widgets = createWidgetsForVPN(conn, new_conn); -// } - else { - kdWarning() << k_funcinfo << "Not handled yet" << endl; - } - - int id; - for (TQValueList::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) { - createWidgetsForConnection(_conn, _new_conn); - } - else { - // this should never happen - TQLabel* lbl = new TQLabel(wstackSettings, "Unknown Device Type"); - wstackSettings->addWidget(lbl); - - wstackSettings->raiseWidget(lbl); - } -} - -int -ConnectionSettingsDialogImpl::getDeviceTypeFromConnection(TDENetworkConnection* conn) -{ - if (conn->type() == TDENetworkConnectionType::WiFi) { - return TDENetworkDeviceType::WiFi; - } - else if (conn->type() == TDENetworkConnectionType::WiredEthernet) { - return TDENetworkDeviceType::WiredEthernet; - } - else if (conn->type() == TDENetworkConnectionType::Modem) { - return TDENetworkDeviceType::Modem; - } - - return TDENetworkDeviceType::Other; -} - -void -ConnectionSettingsDialogImpl::slotConnect() -{ - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - - // add/save the connection - nm->saveConnection(_conn); - - // activate device - if (_conn && nm) { -// // 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); -// nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), device, act_conn, err); -// } -// else { - // we need to call ActivateDevice async - nm->initiateConnection(_conn->UUID); -// } - } - - emit connectionSaved(); - this->close(true); -} - -void -ConnectionSettingsDialogImpl::slotSave() -{ - // Make sure settings are committed - TQValueList::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(wstackSettings->widget(*current)); - if (widget) { - deactivateWidget(widget); - } - } - - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - - // save the connection - nm->saveConnection(_conn); - - emit connectionSaved(); - this->close(true); -} - -void -ConnectionSettingsDialogImpl::slotCancel() -{ - close(); -} - -void -ConnectionSettingsDialogImpl::slotNext() -{ - TQValueList::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(wstackSettings->widget(*current)); - if (widget) - deactivateWidget(widget); - - // next widget - current++; - - // let the widget know about it being the active one - widget = dynamic_cast(wstackSettings->widget(*current)); - if (widget) - activateWidget(widget); - } - slotEnableButtons(); -} - -void -ConnectionSettingsDialogImpl::slotBack() -{ - TQValueList::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(wstackSettings->widget(*current)); - if (widget) - deactivateWidget(widget); - - // one back - current--; - - // let the widget know about it being the active one - widget = dynamic_cast(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::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) { - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - btnConnect->setEnabled(nm->verifyConnectionSettings(_conn)); - pbSave->setEnabled(nm->verifyConnectionSettings(_conn)); - } -} - -#include "knetworkmanager-connection_settings_dialog.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_settings_dialog.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_settings_dialog.h deleted file mode 100644 index f65de7a..0000000 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_settings_dialog.h +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -// tqt headers -#include -#include - -// tde headers -#include -#include - -// ui 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 - - public: - ConnectionSettingsDialogImpl(TDENetworkConnection* conn, bool new_conn, 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(TDENetworkConnection*, bool new_conn); - void activateWidget(ConnectionSettings::WidgetInterface* widget); - void deactivateWidget(ConnectionSettings::WidgetInterface* widget); - int getDeviceTypeFromConnection(TDENetworkConnection* conn); - - // TODO: To be moved to a factory class - TQValueList createWidgetsForWired(TDENetworkConnection* conn, bool new_conn); - TQValueList createWidgetsForWireless(TDENetworkConnection* conn, bool new_conn); - TQValueList createWidgetsForWirelessKnownESSID(TDENetworkConnection* conn, bool new_conn, const TQByteArray& essid); - TQValueList createWidgetsForVPN(TDENetworkConnection* conn, bool new_conn); - TQValueList createWidgetsForCDMA(TDENetworkConnection* conn, bool new_conn); - TQValueList createWidgetsForGSM(TDENetworkConnection* conn, bool new_conn); - - TDENetworkConnection* _conn; - TQValueList _widgetIds; - bool _new_conn; -}; - -#endif /* KNETWORKMANAGER_CONNECTION_SETTINGS_DIALOG_H*/ diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.cpp new file mode 100644 index 0000000..4036518 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.cpp @@ -0,0 +1,93 @@ +/*************************************************************************** + * + * tdenetman-connection_setting_cdma_widget.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include + +// knm headers +#include "tdenetman-connection_setting_cdma_widget.h" + +// ui headers +#include "connection_setting_cdma.h" + +using namespace ConnectionSettings; + +CDMAWidgetImpl::CDMAWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) + : WidgetInterface(parent, name, fl) +{ + _cdmasetting = dynamic_cast(conn); + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingCdmaWidget(this); + layout->addWidget(_mainWid); + + Init(); +} + +void +CDMAWidgetImpl::Init() +{ + if (_cdmasetting->cdmaConfig.valid) { + _mainWid->mUsername->setText( _cdmasetting->cdmaConfig.username ); + _mainWid->mNumber->setText( _cdmasetting->cdmaConfig.providerDataNumber ); + if (_cdmasetting->cdmaConfig.secretsValid) { + _mainWid->mPassword->setText( _cdmasetting->cdmaConfig.password ); + } + } + 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->cdmaConfig.username = _mainWid->mUsername->text(); + _cdmasetting->cdmaConfig.password = _mainWid->mPassword->text(); + _cdmasetting->cdmaConfig.providerDataNumber = _mainWid->mNumber->text(); + _cdmasetting->cdmaConfig.valid = true; + _cdmasetting->cdmaConfig.secretsValid = true; +} + + +#include "tdenetman-connection_setting_cdma_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.h new file mode 100644 index 0000000..36c9224 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.h @@ -0,0 +1,67 @@ +/*************************************************************************** + * + * tdenetman-connection_setting_cdma_widget.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2008 Novell, Inc. + * + * Author: Will Stephenson + * + * 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 + + +// tqt headers +#include +#include + +// tde headers +#include +#include + +// knm headers +#include "tdenetman-connection_setting_widget_interface.h" + +//class VPNService; +class ConnectionSettingCdmaWidget; + +namespace ConnectionSettings +{ + +class CDMAWidgetImpl : public WidgetInterface +{ + Q_OBJECT + + public: + CDMAWidgetImpl(TDENetworkConnection* 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); + + + TDEModemConnection* _cdmasetting; + ConnectionSettingCdmaWidget* _mainWid; +}; + +} +#endif /* KNETWORKMANAGER_CONNECTION_SETTING_CDMA_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.cpp new file mode 100644 index 0000000..3df8804 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.cpp @@ -0,0 +1,156 @@ +/*************************************************************************** + * + * tdenetman-connection_setting_gsm_widget.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// knm headers +#include "tdenetman-connection_setting_gsm_widget.h" + +#include "connection_setting_gsm.h" + +using namespace ConnectionSettings; + +GSMWidgetImpl::GSMWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) + : WidgetInterface(parent, name, fl) +{ + _gsmsetting = dynamic_cast(conn); + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingGsmWidget(this); + layout->addWidget(_mainWid); + + Init(); +} + +void +GSMWidgetImpl::Init() +{ + if (_gsmsetting->gsmConfig.valid) { + _mainWid->mUsername->setText( _gsmsetting->gsmConfig.username ); + _mainWid->mNumber->setText( _gsmsetting->gsmConfig.providerDataNumber ); + _mainWid->mApn->setText( _gsmsetting->gsmConfig.accessPointName ); + _mainWid->mNetworkId->setText( _gsmsetting->gsmConfig.networkID ); + setNetworkType( _gsmsetting->gsmConfig.networkType ); + _mainWid->mBand->setValue( _gsmsetting->gsmConfig.allowedFrequencyBands ); + if (_gsmsetting->gsmConfig.secretsValid) { + _mainWid->mPassword->setText( _gsmsetting->gsmConfig.password ); + _mainWid->mPin->setText( _gsmsetting->gsmConfig.pin ); + } + } + + 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->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->gsmConfig.username = _mainWid->mUsername->text(); + _gsmsetting->gsmConfig.password = _mainWid->mPassword->text(); + _gsmsetting->gsmConfig.pin = _mainWid->mPin->text(); + _gsmsetting->gsmConfig.providerDataNumber = _mainWid->mNumber->text(); + _gsmsetting->gsmConfig.accessPointName = _mainWid->mApn->text(); + _gsmsetting->gsmConfig.networkID = _mainWid->mNetworkId->text(); + _gsmsetting->gsmConfig.networkType = getNetworkType(); + _gsmsetting->gsmConfig.allowedFrequencyBands = _mainWid->mBand->value(); + + _gsmsetting->gsmConfig.valid = true; + _gsmsetting->gsmConfig.secretsValid = true; +} + +void +GSMWidgetImpl::setNetworkType(TDEGSMNetworkType::TDEGSMNetworkType type) +{ + if (type == TDEGSMNetworkType::Any) { + _mainWid->mBand->setValue(0); + } + else if (type == TDEGSMNetworkType::Only3G) { + _mainWid->mBand->setValue(1); + } + else if (type == TDEGSMNetworkType::GPRSEdge) { + _mainWid->mBand->setValue(2); + } + else if (type == TDEGSMNetworkType::Prefer3G) { + _mainWid->mBand->setValue(3); + } + else if (type == TDEGSMNetworkType::Prefer2G) { + _mainWid->mBand->setValue(4); + } + else { + _mainWid->mBand->setValue(0); + } +} + +TDEGSMNetworkType::TDEGSMNetworkType +GSMWidgetImpl::getNetworkType() +{ + int itemNo = _mainWid->mNetworkType->currentItem(); + if (itemNo == 0) { + return TDEGSMNetworkType::Any; + } + else if (itemNo == 1) { + return TDEGSMNetworkType::Only3G; + } + else if (itemNo == 2) { + return TDEGSMNetworkType::GPRSEdge; + } + else if (itemNo == 3) { + return TDEGSMNetworkType::Prefer3G; + } + else if (itemNo == 4) { + return TDEGSMNetworkType::Prefer2G; + } + else { + return TDEGSMNetworkType::Any; + } +} + +#include "tdenetman-connection_setting_gsm_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.h new file mode 100644 index 0000000..6010d3f --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.h @@ -0,0 +1,71 @@ +/*************************************************************************** + * + * tdenetman-connection_setting_gsm_widget.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2008 Novell, Inc. + * + * Author: Will Stephenson + * + * 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 + + +// tqt headers +#include +#include + +// tde headers +#include +#include + +// knm headers +#include "tdenetman-connection_setting_widget_interface.h" + +//class VPNService; +class ConnectionSettingGsmWidget; + +namespace ConnectionSettings +{ + +class Connection; + +class GSMWidgetImpl : public WidgetInterface +{ + Q_OBJECT + + public: + GSMWidgetImpl(TDENetworkConnection* 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); + + void setNetworkType(TDEGSMNetworkType::TDEGSMNetworkType); + TDEGSMNetworkType::TDEGSMNetworkType getNetworkType(); + + TDEModemConnection* _gsmsetting; + ConnectionSettingGsmWidget* _mainWid; +}; + +} +#endif /* KNETWORKMANAGER_CONNECTION_SETTING_GSM_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.cpp new file mode 100644 index 0000000..48a22f7 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.cpp @@ -0,0 +1,76 @@ +/*************************************************************************** + * + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Valentine Sinitsyn + * + * 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 +#include +#include +#include + +// knm headers +#include "tdenetman-connection_setting_info_widget.h" + +using namespace ConnectionSettings; + +InfoWidgetImpl::InfoWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) + : WidgetInterface(parent, name, fl) +{ + _infosetting = conn; + + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingInfoWidget(this); + layout->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->friendlyName); + _mainWid->chkAutoConnect->setChecked(_infosetting->autoConnect); +} + +void +InfoWidgetImpl::slotNameChanged(const TQString& name) +{ + _infosetting->friendlyName = name; +} + +void +InfoWidgetImpl::slotAutoconnectChanged(bool autoconnect) +{ + _infosetting->autoConnect = autoconnect; +} + +#include "tdenetman-connection_setting_info_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.h new file mode 100644 index 0000000..8cad6c6 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.h @@ -0,0 +1,68 @@ +/*************************************************************************** + * + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Valentine Sinitsyn + * + * 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 + + +// tqt headers +#include +#include + +// tde headers +#include +#include + +// knm headers +#include "connection_setting_info.h" +#include "tdenetman-connection_setting_widget_interface.h" + +namespace ConnectionSettings +{ + +class Info; +class Connection; + +class InfoWidgetImpl : public WidgetInterface +{ + Q_OBJECT + + public: + InfoWidgetImpl(TDENetworkConnection* 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(); + + TDENetworkConnection* _infosetting; + ConnectionSettingInfoWidget* _mainWid; +}; + +} +#endif /* KNETWORKMANAGER_CONNECTION_SETTING_INFO_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp new file mode 100644 index 0000000..e229b2f --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp @@ -0,0 +1,208 @@ +/*************************************************************************** + * + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Valentine Sinitsyn + * + * 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 +#include +#include +#include +#include + +#include "tdenetman-connection_setting_ipv4_widget.h" + +using namespace ConnectionSettings; + +#define IP_INPUT_MASK "900.900.900.900" + +IPv4WidgetImpl::IPv4WidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) + : WidgetInterface(parent, name, fl) +{ + _ipv4_setting = conn; + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingIPv4Widget(this); + layout->addWidget(_mainWid); + + Init(); +} + +void +IPv4WidgetImpl::Init() +{ + _mainWid->groupIPConfig->setChecked(!(_ipv4_setting->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPIP)); + + 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->ipConfig.ipConfigurations.isEmpty()) + { + _mainWid->txtIP->setText(_ipv4_setting->ipConfig.ipConfigurations[0].ipAddress.toString()); + _mainWid->txtNetmask->setText(_ipv4_setting->ipConfig.ipConfigurations[0].networkMask.toString()); + _mainWid->txtGateway->setText(_ipv4_setting->ipConfig.ipConfigurations[0].gateway.toString()); + } + + if (!_ipv4_setting->ipConfig.resolvers.isEmpty()) + { + TDENetworkAddressList hosts = _ipv4_setting->ipConfig.resolvers; + TQStringList list; + for (TDENetworkAddressList::Iterator it = hosts.begin(); it != hosts.end(); ++it) + { + list.append((*it).toString()); + } + _mainWid->txtDNSAddresses->setText(list.join(" ")); + } + + if (!_ipv4_setting->ipConfig.searchDomains.isEmpty()) + { + TDENetworkSearchDomainList domains = _ipv4_setting->ipConfig.searchDomains; + TQStringList list; + for (TDENetworkSearchDomainList::Iterator it = domains.begin(); it != domains.end(); ++it) + { + list.append((*it).searchDomain()); + } + _mainWid->txtDNSSearch->setText(list.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); + TDENetworkAddressList hosts; + for (TQStringList::Iterator it = list.begin(); it != list.end(); ++it) + { + TQHostAddress host(*it); + if (!host.isNull()) + { + hosts.append(host); + } + } + _ipv4_setting->ipConfig.resolvers = hosts; +} + + +void +IPv4WidgetImpl::slotDNSSearchChanged(const TQString& search) +{ + // TODO: use , and ; for splitting too + + TQStringList list = TQStringList::split(" ", search); + TDENetworkSearchDomainList domains; + for (TQStringList::Iterator it = list.begin(); it != list.end(); ++it) + { + if ((*it) != "") { + TDENetworkSearchDomain domain(*it); + domains.append(domain); + } + } + _ipv4_setting->ipConfig.searchDomains = domains; +} + +void +IPv4WidgetImpl::slotIPConfigEnabled(bool enabled) +{ + if (enabled) + { + _ipv4_setting->ipConfig.connectionFlags &= (~TDENetworkIPConfigurationFlags::IPV4DHCPIP); + } + else + { + _ipv4_setting->ipConfig.connectionFlags |= TDENetworkIPConfigurationFlags::IPV4DHCPIP; + } +} + +void +IPv4WidgetImpl::slotIPAddressChanged(const TQString& ip) +{ + TQHostAddress ipadr(ip); + if (!ipadr.isNull()) + { + TDENetworkSingleIPConfigurationList addrs = _ipv4_setting->ipConfig.ipConfigurations; + if (addrs.size() > 0) + { + addrs[0].ipAddress = ipadr; + } + else + { + TDENetworkSingleIPConfiguration adr; + adr.ipAddress = ipadr; + addrs.append(adr); + } + _ipv4_setting->ipConfig.ipConfigurations = 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) +{ + TDENetworkSingleIPConfigurationList addrs = _ipv4_setting->ipConfig.ipConfigurations; + TDENetMask mask; + mask.fromString(ip); + addrs[0].networkMask = mask; + _ipv4_setting->ipConfig.ipConfigurations = addrs; +} + +void +IPv4WidgetImpl::slotGatewayChanged(const TQString& ip) +{ + TDENetworkSingleIPConfigurationList addrs = _ipv4_setting->ipConfig.ipConfigurations; + addrs[0].gateway = TQHostAddress(ip); + _ipv4_setting->ipConfig.ipConfigurations = addrs; +} + +#include "tdenetman-connection_setting_ipv4_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.h new file mode 100644 index 0000000..61fdb12 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.h @@ -0,0 +1,67 @@ +/*************************************************************************** + * + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * + * 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 + +// tde headers +#include +#include + +// ui headers +#include "connection_setting_ipv4.h" + +// tdenetman headers +#include "tdenetman-connection_setting_widget_interface.h" + +namespace ConnectionSettings +{ + class IPv4; + + class IPv4WidgetImpl : public WidgetInterface + { + Q_OBJECT + + + public: + IPv4WidgetImpl(TDENetworkConnection* 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(); + + TDENetworkConnection* _ipv4_setting; + ConnectionSettingIPv4Widget* _mainWid; + }; + +} +#endif /* KNETWORKMANAGER_CONNECTION_SETTING_IPv4_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.cpp new file mode 100644 index 0000000..e3688e0 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.cpp @@ -0,0 +1,143 @@ +/*************************************************************************** + * + * tdenetman-connection_setting_ppp_widget.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2008 Novell, Inc. + * + * Author: Will Stephenson + * + * 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 + +// qt headers +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// knm headers +#include "tdenetman-connection_setting_ppp_widget.h" +#include "connection_setting_ppp.h" + +using namespace ConnectionSettings; + +PPPWidgetImpl::PPPWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) + : WidgetInterface(parent, name, fl) +{ + _pppsetting = conn; + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingPppWidget(this); + layout->addWidget(_mainWid); + + Init(); +} + +void +PPPWidgetImpl::Init() +{ + if (_pppsetting->pppConfig.valid) { + _mainWid->mNoAuth->setChecked( !(_pppsetting->pppConfig.requireServerAuthentication) ); + _mainWid->mRefuseEap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableEAP ); + _mainWid->mRefusePap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisablePAP ); + _mainWid->mRefuseChap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableCHAP ); + _mainWid->mRefuseMschap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableMSCHAP ); + _mainWid->mRefuseMschapV2->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableMSCHAPv2 ); + _mainWid->mNoBsd->setChecked( !(_pppsetting->pppConfig.flags & TDENetworkPPPFlags::AllowBSDCompression) ); + _mainWid->mNoDeflate->setChecked( !(_pppsetting->pppConfig.flags & TDENetworkPPPFlags::AllowDeflateCompression) ); + _mainWid->mNoVjComp->setChecked( !(_pppsetting->pppConfig.flags & TDENetworkPPPFlags::AllowVJCompression) ); + _mainWid->mRequireMppe->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::RequireMPPE ); + _mainWid->mRequireMppe128->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::RequireMPPE128 ); + _mainWid->mStatefulMppe->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::StatefulMPPE ); + _mainWid->mCrtscts->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::UseHardwareFlowControl ); + + _mainWid->mBaudRate->setValue(_pppsetting->pppConfig.baudRate); + _mainWid->mMru->setValue(_pppsetting->pppConfig.mru); + _mainWid->mMtu->setValue(_pppsetting->pppConfig.mtu); + _mainWid->mLcpEchoFailure->setValue(_pppsetting->pppConfig.lcpEchoFailureThreshold); + _mainWid->mLcpEchoInterval->setValue(_pppsetting->pppConfig.lcpEchoPingInterval); + } + + 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->mCrtscts, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); +} + +void +PPPWidgetImpl::Deactivate() +{ +} + +void +PPPWidgetImpl::Activate() +{ + +} + +#define SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(x,y,z) { \ + if (z) { \ + x |= y; \ + } \ + else { \ + x &= (~y); \ + } \ + } + +void +PPPWidgetImpl::dirty() +{ + _pppsetting->pppConfig.requireServerAuthentication = ( !(_mainWid->mNoAuth->isChecked()) ); + + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableEAP, _mainWid->mRefuseEap->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisablePAP, _mainWid->mRefusePap->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableCHAP, _mainWid->mRefuseChap->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableMSCHAP, _mainWid->mRefuseMschap->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableMSCHAPv2, _mainWid->mRefuseMschapV2->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::AllowBSDCompression, !(_mainWid->mNoBsd->isChecked()) ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::AllowDeflateCompression, !(_mainWid->mNoDeflate->isChecked()) ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::AllowVJCompression, !(_mainWid->mNoVjComp->isChecked()) ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::RequireMPPE, _mainWid->mRequireMppe->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::RequireMPPE128, _mainWid->mRequireMppe128->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::StatefulMPPE, _mainWid->mStatefulMppe->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::UseHardwareFlowControl, _mainWid->mCrtscts->isChecked() ); + + _pppsetting->pppConfig.baudRate = _mainWid->mBaudRate->value(); + _pppsetting->pppConfig.mru = _mainWid->mMru->value(); + _pppsetting->pppConfig.mtu = _mainWid->mMtu->value(); + _pppsetting->pppConfig.lcpEchoFailureThreshold = _mainWid->mLcpEchoFailure->value(); + _pppsetting->pppConfig.lcpEchoPingInterval = _mainWid->mLcpEchoInterval->value(); + + _pppsetting->pppConfig.valid = true; +} + +#include "tdenetman-connection_setting_ppp_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.h new file mode 100644 index 0000000..983369d --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.h @@ -0,0 +1,67 @@ +/*************************************************************************** + * + * tdenetman-connection_setting_ppp_widget.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2008 Novell, Inc. + * + * Author: Will Stephenson + * + * 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 + + +// tqt headers +#include +#include + +// tde headers +#include +#include + +// knm headers +#include "tdenetman-connection_setting_widget_interface.h" + +//class VPNService; +class ConnectionSettingPppWidget; + +namespace ConnectionSettings +{ + +class Connection; + +class PPPWidgetImpl : public WidgetInterface +{ + Q_OBJECT + + public: + PPPWidgetImpl(TDENetworkConnection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); + void Activate(); + void Deactivate(); + public slots: + void dirty(); + + private: + void Init(); + + TDENetworkConnection* _pppsetting; + ConnectionSettingPppWidget* _mainWid; +}; + +} +#endif /* KNETWORKMANAGER_CONNECTION_SETTING_PPP_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.cpp new file mode 100644 index 0000000..fe1b937 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.cpp @@ -0,0 +1,133 @@ +/*************************************************************************** + * + * tdenetman-connection_setting_serial_widget.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2008 Novell, Inc. + * + * Author: Will Stephenson + * + * 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 +// qt headers +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// knm headers +#include "tdenetman-connection_setting_serial_widget.h" + +#include "connection_setting_serial.h" + +using namespace ConnectionSettings; + +SerialWidgetImpl::SerialWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) + : WidgetInterface(parent, name, fl) +{ + _serialsetting = conn; + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingSerialWidget(this); + layout->addWidget(_mainWid); + _mainWid->mBaudRate->setMaxValue(INT_MAX); + Init(); +} + +void +SerialWidgetImpl::Init() +{ + if (_serialsetting->serialConfig.valid) { + _mainWid->mBaudRate->setValue(_serialsetting->serialConfig.baudRate); + _mainWid->mDataBits->setCurrentItem(_serialsetting->serialConfig.byteWidth - 7); + setParityType(_serialsetting->serialConfig.parity); + _mainWid->mStopBits->setCurrentItem(_serialsetting->serialConfig.stopBits); + _mainWid->mSendDelay->setValue(_serialsetting->serialConfig.txDelay); + } + + 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->serialConfig.baudRate = _mainWid->mBaudRate->value(); + _serialsetting->serialConfig.byteWidth = _mainWid->mDataBits->currentItem() + 7; + _serialsetting->serialConfig.parity = getParityType(); + _serialsetting->serialConfig.stopBits = _mainWid->mStopBits->currentItem(); + _serialsetting->serialConfig.txDelay = _mainWid->mSendDelay->value(); + + _serialsetting->serialConfig.valid = true; +} + +void +SerialWidgetImpl::setParityType(TDENetworkParity::TDENetworkParity type) +{ + if (type == TDENetworkParity::None) { + _mainWid->mParity->setCurrentItem(0); + } + else if (type == TDENetworkParity::Even) { + _mainWid->mParity->setCurrentItem(1); + } + else if (type == TDENetworkParity::Odd) { + _mainWid->mParity->setCurrentItem(2); + } + else { + _mainWid->mParity->setCurrentItem(0); + } +} + +TDENetworkParity::TDENetworkParity +SerialWidgetImpl::getParityType() +{ + int itemNo = _mainWid->mParity->currentItem(); + if (itemNo == 0) { + return TDENetworkParity::None; + } + else if (itemNo == 1) { + return TDENetworkParity::Even; + } + else if (itemNo == 2) { + return TDENetworkParity::Odd; + } + else { + return TDENetworkParity::None; + } +} + +#include "tdenetman-connection_setting_serial_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.h new file mode 100644 index 0000000..d597c9b --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.h @@ -0,0 +1,70 @@ +/*************************************************************************** + * + * tdenetman-connection_setting_serial_widget.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2008 Novell, Inc. + * + * Author: Will Stephenson + * + * 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 + + +// tqt headers +#include +#include + +// tde headers +#include +#include + +// knm headers +#include "tdenetman-connection_setting_widget_interface.h" + +//class VPNService; +class ConnectionSettingSerialWidget; + +namespace ConnectionSettings +{ + +class Connection; + +class SerialWidgetImpl : public WidgetInterface +{ + Q_OBJECT + + public: + SerialWidgetImpl(TDENetworkConnection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); + void Activate(); + void Deactivate(); + public slots: + void dirty(); + + private: + void Init(); + + void setParityType(TDENetworkParity::TDENetworkParity type); + TDENetworkParity::TDENetworkParity getParityType(); + + TDENetworkConnection* _serialsetting; + ConnectionSettingSerialWidget* _mainWid; +}; + +} +#endif /* KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp new file mode 100644 index 0000000..4196989 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp @@ -0,0 +1,206 @@ +/*************************************************************************** + * + * tdenetman-connection_setting_vpn_widget.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * Author: Timothy Pearson + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include + +// knm headers +#include "tdenetman-connection.h" +#include "tdenetman-connection_setting_vpn.h" +#include "tdenetman-connection_setting_vpn_widget.h" +#include "tdenetman-device.h" +#include "tdenetman-vpnmanager.h" +#include "tdenetman-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 (conn->getSetting(NM_SETTING_VPN_SETTING_NAME)); + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingVPNWidget(this); + layout->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 "tdenetman-connection_setting_vpn_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h new file mode 100644 index 0000000..a00ec17 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h @@ -0,0 +1,69 @@ +/*************************************************************************** + * + * tdenetman-connection_setting_vpn_widget.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include + +// knm headers +#include "connection_setting_vpn.h" +#include "tdenetman-connection_setting_widget_interface.h" +#include "tdenetman-device.h" + +class VPNService; +class VPNConfigWidget; + +namespace ConnectionSettings +{ + +class Connection; + +class VPNWidgetImpl : public WidgetInterface +{ + Q_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 _mapServiceCombo; + TQMap _mapServiceWidget; +}; + +} +#endif /* KNETWORKMANAGER_CONNECTION_SETTING_VPN_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.cpp new file mode 100644 index 0000000..2be4796 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.cpp @@ -0,0 +1,37 @@ +/*************************************************************************** + * + * tdenetman-connection_setting_widget_interface.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include "tdenetman-connection_setting_widget_interface.h" + +using namespace ConnectionSettings; + +WidgetInterface::WidgetInterface(TQWidget* parent, const char* name, WFlags fl) + : TQWidget(parent, name, fl) +{ + +} + +#include "tdenetman-connection_setting_widget_interface.moc" diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.h new file mode 100644 index 0000000..82755b5 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.h @@ -0,0 +1,47 @@ +/*************************************************************************** + * + * tdenetman-connection_setting_widget_interface.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 + +namespace ConnectionSettings +{ + + class WidgetInterface : public TQWidget + { + Q_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/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp new file mode 100644 index 0000000..7647136 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp @@ -0,0 +1,1029 @@ +/*************************************************************************** + * + * tdenetman-connection_setting_wireless_security_widget.cpp + * - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include + +/* kde headers */ +#include +#include +#include +#include + +/* tdenetman headers */ +#include "tdenetman-connection_setting_wireless_security_widget.h" +#include "sha1.h" +#include "md5.h" +#include "tdenetman-wireless_manager.h" + +#define WPA_PMK_LEN 32 + +#define SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(x,y,z) { \ + if (z) { \ + x |= y; \ + } \ + else { \ + x &= (~y); \ + } \ + } + +using namespace ConnectionSettings; + +/* + class WirelessSecurityWEPImpl +*/ +WirelessSecurityWEPImpl::WirelessSecurityWEPImpl(TDEWiFiConnection* 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->securitySettings.authType == TDENetworkWiFiAuthType::Open) { + cboAuthentication->setCurrentItem(0); + } + else if (_security_setting->securitySettings.authType == TDENetworkWiFiAuthType::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->securitySettings.wepKey0); + txtWEPKey1->setText(_security_setting->securitySettings.wepKey1); + txtWEPKey2->setText(_security_setting->securitySettings.wepKey2); + txtWEPKey3->setText(_security_setting->securitySettings.wepKey3); + + switch(_security_setting->securitySettings.wepKeyIndex) + { + 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->securitySettings.authType =TDENetworkWiFiAuthType::Open; + } + else if (index == 1) { + _security_setting->securitySettings.authType = TDENetworkWiFiAuthType::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->securitySettings.wepKey0 = hashed; +} + +void WirelessSecurityWEPImpl::slotWepKey1Changed(const TQString &key) +{ + TQCString hashed = getHashedWEPKey(key, _wepKeyType); + _security_setting->securitySettings.wepKey1 = hashed; +} + +void WirelessSecurityWEPImpl::slotWepKey2Changed(const TQString &key) +{ + TQCString hashed = getHashedWEPKey(key, _wepKeyType); + _security_setting->securitySettings.wepKey2 = hashed; +} + +void WirelessSecurityWEPImpl::slotWepKey3Changed(const TQString& key) +{ + TQCString hashed = getHashedWEPKey(key, _wepKeyType); + _security_setting->securitySettings.wepKey3 = hashed; +} + +void WirelessSecurityWEPImpl::slotWepIdx0Checked(bool check) +{ + if (check) { + _security_setting->securitySettings.wepKeyIndex = 0; + } +} + +void WirelessSecurityWEPImpl::slotWepIdx1Checked(bool check) +{ + if (check) { + _security_setting->securitySettings.wepKeyIndex = 1; + } +} + +void WirelessSecurityWEPImpl::slotWepIdx2Checked(bool check) +{ + if (check) { + _security_setting->securitySettings.wepKeyIndex = 2; + } +} + +void WirelessSecurityWEPImpl::slotWepIdx3Checked(bool check) +{ + if (check) { + _security_setting->securitySettings.wepKeyIndex = 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(TDEWiFiConnection* 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(TDEWiFiConnection* security_setting, TQWidget* parent, const char* name, WFlags fl) + : ConnectionSettingWirelessSecurityWPAVersion(parent, name, fl) + , _security_setting(security_setting) +{ + cbWPA->setChecked(_security_setting->securitySettings.wpaVersion & TDENetworkWiFiWPAVersionFlags::WPA); + cbRSN->setChecked(_security_setting->securitySettings.wpaVersion & TDENetworkWiFiWPAVersionFlags::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->securitySettings.wpaVersion = TDENetworkWiFiWPAVersionFlags::Any; + } + else { + // use selected wpa-version + TDENetworkWiFiWPAVersionFlags::TDENetworkWiFiWPAVersionFlags proto = TDENetworkWiFiWPAVersionFlags::None; + if (cbWPA->isChecked()) { + proto |= TDENetworkWiFiWPAVersionFlags::WPA; + } + if (cbRSN->isChecked()) { + proto |= TDENetworkWiFiWPAVersionFlags::RSN; + } + _security_setting->securitySettings.wpaVersion = proto; + } +} + +void +WirelessSecurityWPAVersionImpl::slotWPA1(bool on) +{ + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(_security_setting->securitySettings.wpaVersion, TDENetworkWiFiWPAVersionFlags::WPA, on); +} + +void +WirelessSecurityWPAVersionImpl::slotWPA2(bool on) +{ + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(_security_setting->securitySettings.wpaVersion, TDENetworkWiFiWPAVersionFlags::RSN, on); +} + +/* + class WirelessSecurityWPACipherImpl +*/ +WirelessSecurityWPACipherImpl::WirelessSecurityWPACipherImpl(TDEWiFiConnection* 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->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)); + chkPairwiseCipherTKIP->setChecked(_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)); + + chkGroupCipherCCMP->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)); + chkGroupCipherTKIP->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)); + chkGroupCipherWEP40->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40)); + chkGroupCipherWEP104->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104)); + +} + +void +WirelessSecurityWPACipherImpl::slotCipherChangedAuto(bool checked) +{ + if (!checked) + { + // select auto for both ciphers + _security_setting->securitySettings.allowedGroupWiseCiphers.clear(); + _security_setting->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::Any); + _security_setting->securitySettings.allowedPairWiseCiphers.clear(); + _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::Any); + } + else + { + // use the already selected ciphers + + // group cipher + TDENetworkWiFiConnectionCipherList cipher; + if (chkGroupCipherTKIP->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherTKIP); + } + if (chkGroupCipherCCMP->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherCCMP); + } + if (chkGroupCipherWEP40->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherWEP40); + } + if (chkGroupCipherWEP104->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherWEP104); + } + _security_setting->securitySettings.allowedGroupWiseCiphers = cipher; + + // pairwise cipher + cipher.clear(); + if (chkPairwiseCipherTKIP->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherTKIP); + } + if (chkPairwiseCipherCCMP->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherCCMP); + } + _security_setting->securitySettings.allowedPairWiseCiphers = cipher; + + } +} + +void +WirelessSecurityWPACipherImpl::slotGroupCipherChangedTKIP(bool checked) +{ + if (checked) { + if (!_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)) _security_setting->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherTKIP); + } + else { + _security_setting->securitySettings.allowedGroupWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherTKIP); + } +} + +void +WirelessSecurityWPACipherImpl::slotGroupCipherChangedCCMP(bool checked) +{ + if (checked) { + if (!_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)) _security_setting->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherCCMP); + } + else { + _security_setting->securitySettings.allowedGroupWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherCCMP); + } +} + +void +WirelessSecurityWPACipherImpl::slotGroupCipherChangedWEP40(bool checked) +{ + if (checked) { + if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP40); + } + else { + _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherWEP40); + } +} + +void +WirelessSecurityWPACipherImpl::slotGroupCipherChangedWEP104(bool checked) +{ + if (checked) { + if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP104); + } + else { + _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherWEP104); + } +} + +void +WirelessSecurityWPACipherImpl::slotPairwiseCipherChangedTKIP(bool checked) +{ + if (checked) { + if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherTKIP); + } + else { + _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherTKIP); + } +} + +void +WirelessSecurityWPACipherImpl::slotPairwiseCipherChangedCCMP(bool checked) +{ + if (checked) { + if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherCCMP); + } + else { + _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherCCMP); + } +} + +/* + class WirelessSecurityWPAPSK +*/ +WirelessSecurityWPAPSKImpl::WirelessSecurityWPAPSKImpl(TDEWiFiConnection* security_setting, TDEWiFiConnection* wireless_setting, TQWidget* parent, const char* name, WFlags fl) + : ConnectionSettingWirelessSecurityWPAPSK(parent, name, fl) + , _security_setting(security_setting) + , _wireless_setting(wireless_setting) +{ + if (_security_setting->securitySettings.secretsValid) { + txtPSK->setText(_security_setting->securitySettings.psk); + } + connect(txtPSK, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotPSKChanged(const TQString&))); +} + +void +WirelessSecurityWPAPSKImpl::slotPSKChanged(const TQString& psk) +{ + if (_wireless_setting) + { + _security_setting->securitySettings.psk = psk; + _security_setting->securitySettings.secretsValid = true; + } +} + +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(TDEWiFiConnection* 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] = TDENetworkIEEE8021xType::None; + + cboMethod->insertItem(i18n("TTLS"), ++index); + _eapIndexMap[index] = TDENetworkIEEE8021xType::TTLS; + + cboMethod->insertItem(i18n("PEAP"), ++index); + _eapIndexMap[index] = TDENetworkIEEE8021xType::PEAP; + + cboMethod->insertItem(i18n("TLS"), ++index); + _eapIndexMap[index] = TDENetworkIEEE8021xType::TLS; + + cboMethod->insertItem(i18n("Leap"), ++index); + _eapIndexMap[index] = TDENetworkIEEE8021xType::LEAP; + + cboMethod->insertItem(i18n("MD5"), ++index); + _eapIndexMap[index] = TDENetworkIEEE8021xType::MD5; + + cboMethod->insertItem(i18n("FAST"), ++index); + _eapIndexMap[index] = TDENetworkIEEE8021xType::Fast; + + cboMethod->insertItem(i18n("SIM"), ++index); + _eapIndexMap[index] = TDENetworkIEEE8021xType::SIM; + + // preselect the correct method + TQBiDirectionalMap::Iterator it = _eapIndexMap.findData(_security_setting->eapConfig.type); + cboMethod->setCurrentItem(it.key()); + + // update phase2 combobox + _phase2_widget->setAllowedPhase2Methods(_security_setting->eapConfig.allowedPhase2EAPMethods); + + txtIdentity->setText(_security_setting->eapConfig.userName); + txtAnonIdentity->setText(_security_setting->eapConfig.anonymousUserName); + if (_security_setting->eapConfig.secretsValid) { + txtPassword->setText(_security_setting->eapConfig.password); + } + + chkCAStore->setChecked(_security_setting->eapConfig.forceSystemCaCertificates); + kURLCACert->setEnabled(!_security_setting->eapConfig.forceSystemCaCertificates); + + // 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->eapConfig.forceSystemCaCertificates = on; + kURLCACert->setEnabled(!on); +} + +void WirelessSecurityEAPImpl::slotMethodChanged(int index) +{ + // new method choosen + TDENetworkIEEE8021xType::TDENetworkIEEE8021xType eap = _eapIndexMap[index]; + _security_setting->eapConfig.type = eap; + + _phase2_widget->setAllowedPhase2Methods(_security_setting->eapConfig.allowedPhase2EAPMethods); +} + +void WirelessSecurityEAPImpl::slotIdentityChanged(const TQString& identity) +{ + _security_setting->eapConfig.userName = identity; +} + +void WirelessSecurityEAPImpl::slotAnonIdentityChanged(const TQString& identity) +{ + _security_setting->eapConfig.anonymousUserName = identity; +} + +void WirelessSecurityEAPImpl::slotPasswordChanged(const TQString& pwd) +{ + _security_setting->eapConfig.password = TQString(txtPassword->password()); + _security_setting->eapConfig.secretsValid = true; +} + +/* + class WirelessSecurityPhase2Impl +*/ +WirelessSecurityPhase2Impl::WirelessSecurityPhase2Impl(TDEWiFiConnection* security_setting, TQWidget* parent, const char* name, WFlags fl) + : ConnectionSettingWirelessSecurityPhase2(parent, name, fl) + , _security_setting(security_setting) +{ + _allowed_methods.append(TDENetworkIEEE8021xType::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::Iterator it = _allowed_methods.begin(); it != _allowed_methods.end(); ++it) + { + if ((*it) == TDENetworkIEEE8021xType::None) + { + cboPhase2Method->insertItem(i18n("None"), index); + _eapIndexMap[index] = TDENetworkIEEE8021xType::None; + index++; + } + else if ((*it) == TDENetworkIEEE8021xType::MSCHAPV2) + { + cboPhase2Method->insertItem(i18n("MSCHAPv2"), index); + _eapIndexMap[index] = TDENetworkIEEE8021xType::MSCHAPV2; + index++; + } + else if ((*it) == TDENetworkIEEE8021xType::PAP) + { + cboPhase2Method->insertItem(i18n("PAP"), index); + _eapIndexMap[index] = TDENetworkIEEE8021xType::PAP; + index++; + } + else if ((*it) == TDENetworkIEEE8021xType::CHAP) + { + cboPhase2Method->insertItem(i18n("CHAP"), index); + _eapIndexMap[index] = TDENetworkIEEE8021xType::CHAP; + index++; + } + else if ((*it) == TDENetworkIEEE8021xType::MSCHAP) + { + cboPhase2Method->insertItem(i18n("MSCHAP"), index); + _eapIndexMap[index] = TDENetworkIEEE8021xType::MSCHAP; + index++; + } + else if ((*it) == TDENetworkIEEE8021xType::GTC) + { + cboPhase2Method->insertItem(i18n("GTC"), index); + _eapIndexMap[index] = TDENetworkIEEE8021xType::GTC; + index++; + } + else if ((*it) == TDENetworkIEEE8021xType::OTP) + { + cboPhase2Method->insertItem(i18n("OTP"), index); + _eapIndexMap[index] = TDENetworkIEEE8021xType::OTP; + index++; + } + else if ((*it) == TDENetworkIEEE8021xType::MD5) + { + cboPhase2Method->insertItem(i18n("MD5"), index); + _eapIndexMap[index] = TDENetworkIEEE8021xType::MD5; + index++; + } + else if ((*it) == TDENetworkIEEE8021xType::TLS) + { + cboPhase2Method->insertItem(i18n("TLS"), index); + _eapIndexMap[index] = TDENetworkIEEE8021xType::TLS; + index++; + } + } + + // preselect the correct method + TQBiDirectionalMap::Iterator it = _eapIndexMap.findData(_security_setting->eapConfig.phase2EAPAuthMethod); + if (it != _eapIndexMap.end()) + { + cboPhase2Method->setCurrentItem(it.key()); + _security_setting->eapConfig.phase2EAPAuthMethod = it.data(); + } + else + { + cboPhase2Method->setCurrentItem(0); + _security_setting->eapConfig.phase2EAPAuthMethod = _eapIndexMap[0]; + } +} + +void WirelessSecurityPhase2Impl::setAllowedPhase2Methods(const TQValueList& list) +{ + _allowed_methods = list; + updateMethodComboBox(); +} + +void WirelessSecurityPhase2Impl::slotPhase2MethodChanged(int index) +{ + // new method choosen + TDENetworkIEEE8021xType::TDENetworkIEEE8021xType eap = _eapIndexMap[index]; + _security_setting->eapConfig.phase2EAPAuthMethod = eap; +} + +/* + class WirelessSecurityWidgetImpl +*/ + +WirelessSecurityWidgetImpl::WirelessSecurityWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl) + : WidgetInterface(parent, name, fl) +{ + _security_setting = dynamic_cast (conn); + _wireless_setting = dynamic_cast (conn); + _ieee8021x_setting = dynamic_cast (conn); + _new_conn = new_conn; + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingWirelessSecurityWidget(this); + layout->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 allowed_methods; + _mainWid->cboSecurity->clear(); + + // TODO: Preselect the right security method + // We should have an Essid already, fetch all possible APs + TQValueList aps; + if (_new_conn && !_wireless_setting->SSID.isEmpty()) { + aps = WirelessManager::getAccessPointsForEssid(_wireless_setting->SSID); +#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::Iterator it = aps.begin(); it != aps.end(); ++it) { + if (((*it)->wpaFlags & TDENetworkWiFiAPFlags::PrivacySupport) || ((*it)->rsnFlags & TDENetworkWiFiAPFlags::PrivacySupport)) { + kdDebug() << "AP " << (*it)->friendlySSID().ascii() << " is encrypted" << endl; + if ((((*it)->rsnFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None) || (((*it)->wpaFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None)) { + // WPA or RSN + if ((*it)->rsnFlags & TDENetworkWiFiAPFlags::KeyManagementPSK || (*it)->wpaFlags & TDENetworkWiFiAPFlags::KeyManagementPSK) { + if (!allowed_methods.contains(SECURITY_WPA_PSK)) { + allowed_methods.append(SECURITY_WPA_PSK); + } + } + + if ((*it)->rsnFlags & TDENetworkWiFiAPFlags::KeyManagement80211 || (*it)->wpaFlags & TDENetworkWiFiAPFlags::KeyManagement80211) { + 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->securitySettings.keyType) + { + case TDENetworkWiFiKeyType::WEP: + if (_security_setting->securitySettings.authType == TDENetworkWiFiAuthType::Shared || + !_security_setting->securitySettings.wepKey0.isEmpty() || + !_security_setting->securitySettings.wepKey1.isEmpty() || + !_security_setting->securitySettings.wepKey2.isEmpty() || + !_security_setting->securitySettings.wepKey3.isEmpty() ) + { + _mainWid->groupUseEncryption->setChecked(true); + _mainWid->cboSecurity->setCurrentItem(SECURITY_WEP); + slotComboSecurityActivated(_securityComboMap[SECURITY_WEP]); + } + else + _mainWid->groupUseEncryption->setChecked(false); + break; + case TDENetworkWiFiKeyType::WPAInfrastructure: + _mainWid->groupUseEncryption->setChecked(true); + _mainWid->cboSecurity->setCurrentItem(SECURITY_WPA_PSK); + slotComboSecurityActivated(_securityComboMap[SECURITY_WPA_PSK]); + break; + case TDENetworkWiFiKeyType::WPAEnterprise: + _mainWid->groupUseEncryption->setChecked(true); + _mainWid->cboSecurity->setCurrentItem(SECURITY_WPA_EAP); + slotComboSecurityActivated(_securityComboMap[SECURITY_WPA_EAP]); + break; + case TDENetworkWiFiKeyType::DynamicWEP: + _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->securityRequired = on; +} + +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::iterator it = _widgets[i].begin(); it != _widgets[i].end(); ++it) + { + _mainWid->groupUseEncryption->layout()->remove(*it); + (*it)->hide(); + } + // remove extra widgets too + for (TQValueList::iterator it = _extra_widgets[i].begin(); it != _extra_widgets[i].end(); ++it) + { + _mainWid->groupUseEncryption->layout()->remove(*it); + (*it)->hide(); + } + } + } + + // show all widgets widgets for the selected security method + for (TQValueList::iterator it = _widgets[method].begin(); it != _widgets[method].end(); ++it) + { + _mainWid->groupUseEncryption->layout()->add(*it); + (*it)->show(); + } + + if (_mainWid->pbExtra->isOn()) + for (TQValueList::iterator it = _extra_widgets[method].begin(); it != _extra_widgets[method].end(); ++it) + { + _mainWid->groupUseEncryption->layout()->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::iterator it = _extra_widgets[_currentMethod].begin(); it != _extra_widgets[_currentMethod].end(); ++it) + { + _mainWid->groupUseEncryption->layout()->add(*it); + (*it)->show(); + } + else + for (TQValueList::iterator it = _extra_widgets[_currentMethod].begin(); it != _extra_widgets[_currentMethod].end(); ++it) + { + _mainWid->groupUseEncryption->layout()->remove(*it); + (*it)->hide(); + } +} + +void +WirelessSecurityWidgetImpl::configureForWEP() +{ + _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::WEP; + configureWidgets(SECURITY_WEP); +} + +void +WirelessSecurityWidgetImpl::configureForWPAPSK() +{ + _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::WPAInfrastructure; + configureWidgets(SECURITY_WPA_PSK); +} + +void +WirelessSecurityWidgetImpl::configureForWPAEAP() +{ + _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::WPAEnterprise; + configureWidgets(SECURITY_WPA_EAP); +} + +void +WirelessSecurityWidgetImpl::configureForIEEE8021X() +{ + _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::DynamicWEP; + configureWidgets(SECURITY_IEEE8021X); +} + + + + +#include "tdenetman-connection_setting_wireless_security_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h new file mode 100644 index 0000000..e0605db --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h @@ -0,0 +1,240 @@ +/*************************************************************************** + * + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 + +/* ui 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" + +// tde headers +#include +#include + +/* tdenetman headers */ +#include "qbidirectionalmap.h" +#include "tdenetman-connection_setting_widget_interface.h" + +namespace ConnectionSettings +{ + /* class declarations */ + class WirelessSecurity; + class Wireless; + class WirelessSecurityPhase2Impl; + + class WirelessSecurityWEPImpl : public ConnectionSettingWirelessSecurityWEP + { + Q_OBJECT + + public: + enum WEPKEY_TYPE + { + WEPKEY_TYPE_ASCII = 0 + , WEPKEY_TYPE_HEX + , WEPKEY_TYPE_PASSPHRASE + }; + + WirelessSecurityWEPImpl(TDEWiFiConnection* 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: + TDEWiFiConnection* _security_setting; + WEPKEY_TYPE _wepKeyType; + }; + + class WirelessSecurityWEPEncryptionImpl : public ConnectionSettingWirelessSecurityWEPEncryption + { + Q_OBJECT + + public: + WirelessSecurityWEPEncryptionImpl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + private: + TDEWiFiConnection* _security_setting; + }; + + class WirelessSecurityWPAVersionImpl : public ConnectionSettingWirelessSecurityWPAVersion + { + Q_OBJECT + + public: + WirelessSecurityWPAVersionImpl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + + public slots: + void slotAuto(bool); + void slotWPA1(bool); + void slotWPA2(bool); + + private: + TDEWiFiConnection* _security_setting; + + }; + + class WirelessSecurityWPACipherImpl : public ConnectionSettingWirelessSecurityWPACipher + { + Q_OBJECT + + private: + enum WPA_CIPHERS + { + WPA_CIPHER_AUTO = 0 + , WPA_CIPHER_TKIP + , WPA_CIPHER_CCMP + , WPA_CIPHER_LAST + }; + public: + WirelessSecurityWPACipherImpl(TDEWiFiConnection* 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: + TDEWiFiConnection* _security_setting; + }; + + class WirelessSecurityWPAPSKImpl : public ConnectionSettingWirelessSecurityWPAPSK + { + Q_OBJECT + + public: + WirelessSecurityWPAPSKImpl(TDEWiFiConnection* security_setting, TDEWiFiConnection* 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: + TDEWiFiConnection* _security_setting; + TDEWiFiConnection* _wireless_setting; + }; + + class WirelessSecurityEAPImpl : public ConnectionSettingWirelessSecurityEAP + { + Q_OBJECT + + public: + WirelessSecurityEAPImpl(TDEWiFiConnection* 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: + TDEWiFiConnection* _security_setting; + TQBiDirectionalMap _eapIndexMap; + WirelessSecurityPhase2Impl* _phase2_widget; + }; + + class WirelessSecurityPhase2Impl : public ConnectionSettingWirelessSecurityPhase2 + { + Q_OBJECT + + public: + WirelessSecurityPhase2Impl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + public slots: + void setAllowedPhase2Methods(const TQValueList&); + void slotPhase2MethodChanged(int index); + private: + void updateMethodComboBox(); + + TDEWiFiConnection* _security_setting; + TQBiDirectionalMap _eapIndexMap; + TQValueList _allowed_methods; + }; + + class WirelessSecurityWidgetImpl : public WidgetInterface + { + Q_OBJECT + + private: + enum SecurityMethods + { + SECURITY_WEP = 0 + , SECURITY_WPA_PSK + , SECURITY_WPA_EAP + , SECURITY_IEEE8021X + , SECURITY_COUNT + }; + + public: + WirelessSecurityWidgetImpl(TDENetworkConnection*, 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 _widgets[SECURITY_COUNT]; + TQValueList _extra_widgets[SECURITY_COUNT]; + TDEWiFiConnection* _security_setting; + TDEWiFiConnection* _wireless_setting; + TDEWiFiConnection* _ieee8021x_setting; + ConnectionSettingWirelessSecurityWidget* _mainWid; + bool _new_conn; + TQMap _securityComboMap; + }; +} + +#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp new file mode 100644 index 0000000..c5b70bd --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp @@ -0,0 +1,230 @@ +/*************************************************************************** + * + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Valentine Sinitsyn + * + * 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 +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "tdenetman-connection_setting_widget_interface.h" +#include "tdenetman-connection_setting_wireless_widget.h" +#include "tdenetman-wireless_manager.h" + +using namespace ConnectionSettings; + +class NetworkListViewItem : public KListViewItem +{ + public: + + NetworkListViewItem(TQListView* parent, WirelessNetwork& net) + : KListViewItem(parent, TQString::fromUtf8(net.getDisplaySsid()), TQString("%1\%").arg(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(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl) + : WidgetInterface(parent, name, fl) +{ + _wireless_setting = dynamic_cast(conn); + _info_setting = dynamic_cast(conn); + _security_setting = dynamic_cast(conn); + _hasName = !_info_setting->friendlyName.isEmpty(); + _new_conn = new_conn; + + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _mainWid = new ConnectionSettingWirelessWidget(this); + layout->addWidget(_mainWid); + + // FIXME hide this button until it is implemented + _mainWid->pbExpert->hide(); + + Init(); +} + +void +WirelessWidgetImpl::Init() +{ + TQVBoxLayout* layout = new TQVBoxLayout(_mainWid->framePlaceholder, 1, 1); + _searchLine = new KListViewSearchLineWidget(_mainWid->lvEssids, _mainWid->framePlaceholder); + layout->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 nets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID); + + _mainWid->lvEssids->clear(); + + for (TQValueList::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->SSID); +} + +void WirelessWidgetImpl::slotEssidChanged(TQListViewItem* item) +{ + NetworkListViewItem* net_item = dynamic_cast(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(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->SSID = essid; + + if (!_hasName) + { + // the connection has no name yet -> just take the essid for it + _info_setting->friendlyName = TQString(essid); + if (_info_setting->friendlyName == "") { + _info_setting->friendlyName = "<" + i18n("hidden") + ">"; + } + } +} + +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(bytes[i]); + } + return tmp; +} + +#include "tdenetman-connection_setting_wireless_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h new file mode 100644 index 0000000..da78621 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h @@ -0,0 +1,74 @@ +/*************************************************************************** + * + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Valentine Sinitsyn + * + * 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 + +// tde headers +#include +#include + +#include "tdenetman-connection_setting_widget_interface.h" +#include "connection_setting_wireless.h" + +class KListViewSearchLineWidget; + +namespace ConnectionSettings +{ + class Wireless; + class WirelessSecurity; + class Info; + + + class WirelessWidgetImpl : public WidgetInterface + { + Q_OBJECT + + public: + WirelessWidgetImpl(TDENetworkConnection* 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; + TDEWiFiConnection* _wireless_setting; + TDEWiFiConnection* _info_setting; + TDEWiFiConnection* _security_setting; + ConnectionSettingWirelessWidget* _mainWid; + KListViewSearchLineWidget* _searchLine; + bool _new_conn; + }; +} +#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp new file mode 100644 index 0000000..a783d23 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp @@ -0,0 +1,461 @@ +/*************************************************************************** + * + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * Author: Timothy Pearson + * + * 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 +#include +#include +#include +#include +#include +#include + +// kde headers +#include +#include +#include + +// TQt DBus headers +#include +#include + +// knm headers +#include "tdenetman-connection_setting_widget_interface.h" +#include "tdenetman-connection_settings_dialog.h" +#include "tdenetman-connection_setting_cdma_widget.h" +#include "tdenetman-connection_setting_gsm_widget.h" +#include "tdenetman-connection_setting_ppp_widget.h" +#include "tdenetman-connection_setting_serial_widget.h" +#include "tdenetman-connection_setting_wireless_widget.h" +#include "tdenetman-connection_setting_wireless_security_widget.h" +#include "tdenetman-connection_setting_ipv4_widget.h" +#include "tdenetman-connection_setting_info_widget.h" +#include "tdenetman-wireless_network.h" +#include "tdenetman-wireless_manager.h" + +char use_new_wireless_essid = 0; +TQByteArray new_wireless_essid; + +using namespace ConnectionSettings; + +ConnectionSettingsDialogImpl::ConnectionSettingsDialogImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, bool modal, WFlags fl) + : ConnectionSettingsDialog(parent, name, modal, fl) + , _conn(conn) + , _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 +ConnectionSettingsDialogImpl::createWidgetsForWireless(TDENetworkConnection* conn, bool new_conn) +{ + TQValueList 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 +ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(TDENetworkConnection* conn, bool new_conn, const TQByteArray& essid) +{ + TQValueList ret; + + // Set ESSID +// _wireless_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); +// _info_setting = dynamic_cast (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 +ConnectionSettingsDialogImpl::createWidgetsForWired(TDENetworkConnection* conn, bool new_conn) +{ + TQValueList ret; + + // widgetlist for wired connection + ret.append(new ConnectionSettings::IPv4WidgetImpl(conn)); + ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); + + return ret; +} + +TQValueList +ConnectionSettingsDialogImpl::createWidgetsForVPN(TDENetworkConnection* conn, bool new_conn) +{ + TQValueList ret; + + // widgetlist for wired connection +// ret.append(new ConnectionSettings::VPNWidgetImpl(conn, new_conn)); + ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); + + return ret; +} + +TQValueList +ConnectionSettingsDialogImpl::createWidgetsForCDMA(TDENetworkConnection* conn, bool new_conn) +{ + TQValueList 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 +ConnectionSettingsDialogImpl::createWidgetsForGSM(TDENetworkConnection* conn, bool new_conn) +{ + TQValueList 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(TDENetworkConnection* conn, bool new_conn) +{ + /* + 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 widgets; + // TODO: move to a factory class + if (conn->type() == TDENetworkConnectionType::WiFi) { + if (use_new_wireless_essid == 0) { + widgets = createWidgetsForWireless(conn, new_conn); + } + else { + createWidgetsForWirelessKnownESSID(conn, new_conn, new_wireless_essid); + new_wireless_essid = TQByteArray(); + } + } + else if (conn->type() == TDENetworkConnectionType::WiredEthernet) { + widgets = createWidgetsForWired(conn, new_conn); + } + else if (conn->type() == TDENetworkConnectionType::Modem) { + TDEModemConnection* modemconn = dynamic_cast(conn); + if (modemconn) { + if (modemconn->type == TDEModemConnectionType::CDMA) { + widgets = createWidgetsForCDMA(conn, new_conn); + } + else if (modemconn->type == TDEModemConnectionType::GSM) { + widgets = createWidgetsForGSM(conn, new_conn); + } + else { + kdWarning() << k_funcinfo << "Specific modem type not handled yet" << endl; + } + } + } +// else if (conn->getType() == NM_SETTING_VPN_SETTING_NAME) { +// widgets = createWidgetsForVPN(conn, new_conn); +// } + else { + kdWarning() << k_funcinfo << "Not handled yet" << endl; + } + + int id; + for (TQValueList::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) { + createWidgetsForConnection(_conn, _new_conn); + } + else { + // this should never happen + TQLabel* lbl = new TQLabel(wstackSettings, "Unknown Device Type"); + wstackSettings->addWidget(lbl); + + wstackSettings->raiseWidget(lbl); + } +} + +int +ConnectionSettingsDialogImpl::getDeviceTypeFromConnection(TDENetworkConnection* conn) +{ + if (conn->type() == TDENetworkConnectionType::WiFi) { + return TDENetworkDeviceType::WiFi; + } + else if (conn->type() == TDENetworkConnectionType::WiredEthernet) { + return TDENetworkDeviceType::WiredEthernet; + } + else if (conn->type() == TDENetworkConnectionType::Modem) { + return TDENetworkDeviceType::Modem; + } + + return TDENetworkDeviceType::Other; +} + +void +ConnectionSettingsDialogImpl::slotConnect() +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + // add/save the connection + nm->saveConnection(_conn); + + // activate device + if (_conn && nm) { +// // 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); +// nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), device, act_conn, err); +// } +// else { + // we need to call ActivateDevice async + nm->initiateConnection(_conn->UUID); +// } + } + + emit connectionSaved(); + this->close(true); +} + +void +ConnectionSettingsDialogImpl::slotSave() +{ + // Make sure settings are committed + TQValueList::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(wstackSettings->widget(*current)); + if (widget) { + deactivateWidget(widget); + } + } + + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + // save the connection + nm->saveConnection(_conn); + + emit connectionSaved(); + this->close(true); +} + +void +ConnectionSettingsDialogImpl::slotCancel() +{ + close(); +} + +void +ConnectionSettingsDialogImpl::slotNext() +{ + TQValueList::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(wstackSettings->widget(*current)); + if (widget) + deactivateWidget(widget); + + // next widget + current++; + + // let the widget know about it being the active one + widget = dynamic_cast(wstackSettings->widget(*current)); + if (widget) + activateWidget(widget); + } + slotEnableButtons(); +} + +void +ConnectionSettingsDialogImpl::slotBack() +{ + TQValueList::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(wstackSettings->widget(*current)); + if (widget) + deactivateWidget(widget); + + // one back + current--; + + // let the widget know about it being the active one + widget = dynamic_cast(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::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) { + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + btnConnect->setEnabled(nm->verifyConnectionSettings(_conn)); + pbSave->setEnabled(nm->verifyConnectionSettings(_conn)); + } +} + +#include "tdenetman-connection_settings_dialog.moc" diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h new file mode 100644 index 0000000..8337338 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h @@ -0,0 +1,87 @@ +/*************************************************************************** + * + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 + +// tqt headers +#include +#include + +// tde headers +#include +#include + +// ui autogenerated headers +#include "connection_settings.h" + +class TQWidget; +class Device; + +namespace ConnectionSettings +{ + class WidgetInterface; + class ConnectionSetting; +} + +class ConnectionSettingsDialogImpl : public ConnectionSettingsDialog +{ + Q_OBJECT + + public: + ConnectionSettingsDialogImpl(TDENetworkConnection* conn, bool new_conn, 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(TDENetworkConnection*, bool new_conn); + void activateWidget(ConnectionSettings::WidgetInterface* widget); + void deactivateWidget(ConnectionSettings::WidgetInterface* widget); + int getDeviceTypeFromConnection(TDENetworkConnection* conn); + + // TODO: To be moved to a factory class + TQValueList createWidgetsForWired(TDENetworkConnection* conn, bool new_conn); + TQValueList createWidgetsForWireless(TDENetworkConnection* conn, bool new_conn); + TQValueList createWidgetsForWirelessKnownESSID(TDENetworkConnection* conn, bool new_conn, const TQByteArray& essid); + TQValueList createWidgetsForVPN(TDENetworkConnection* conn, bool new_conn); + TQValueList createWidgetsForCDMA(TDENetworkConnection* conn, bool new_conn); + TQValueList createWidgetsForGSM(TDENetworkConnection* conn, bool new_conn); + + TDENetworkConnection* _conn; + TQValueList _widgetIds; + bool _new_conn; +}; + +#endif /* KNETWORKMANAGER_CONNECTION_SETTINGS_DIALOG_H*/ diff --git a/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp b/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp deleted file mode 100644 index d3d23d5..0000000 --- a/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-cellular_device_tray.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 // for TQt::WidgetFlags - -// KDE includes -#include -#include -#include - -// KNM includes -#include "knetworkmanager-cellular_device_tray.h" -#include "knetworkmanager-menuitem.h" -#include "knetworkmanager-menu_subhead.h" - -#include "knetworkmanager-connection_settings_dialog.h" - -using namespace ConnectionSettings; - -class CellularDeviceTrayPrivate -{ - public: - CellularDeviceTrayPrivate() {} - ~CellularDeviceTrayPrivate() {} - - TDENetworkDevice* dev; -}; - -void CellularDeviceTray::newConnection() -{ - // create an appropriate connection - TDENetworkConnection* conn = 0; - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); - switch (deviceConnMan->deviceType()) { - case TDENetworkDeviceType::Modem: - conn = new TDEModemConnection(); - break; - - default: - break; - } - - // edit the new connection - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, tray(), "connect_something", false, TQt::WDestructiveClose); - dlg->show(); -} - - -void CellularDeviceTray::addMenuItems(KPopupMenu* menu) -{ - // device title - Subhead* subhead = new Subhead (menu, "subhead", d->dev->deviceNode(), SmallIcon("nm_device_wwan", TQIconSet::Automatic)); - menu->insertItem (subhead, -1, -1); - - //menu->insertSeparator(); - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); - TDENetworkConnection* active_conn = NULL; - if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected)) - && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) { - active_conn = nm->findConnectionByUUID(deviceConnMan->deviceInformation().activeConnectionUUID); - } - - // get all available Connections for cellular devices - - TDENetworkConnectionList* allconmap = nm->connections(); - for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) { - TDEModemConnection* conn = dynamic_cast(*it); - if (!conn) { - continue; - } - - // lets create a nice name for this connection - TQString title = conn->friendlyName; - if (conn->ipConfig.valid) { - title += TQString(" (%1)").arg((conn->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPIP) ? i18n("DHCP") : i18n("Manual IP config")); - } - - NetworkMenuItem* item = new NetworkMenuItem(d->dev, conn, 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 (TDENetworkDevice* dev, KSystemTray * parent, const char * name) - : DeviceTrayComponent (dev, parent, name) -{ - d = new CellularDeviceTrayPrivate(); - d->dev = dev; - - setPixmapForState(TDENetworkConnectionStatus::Connected, "nm_device_wwan"); -} - -CellularDeviceTray::~CellularDeviceTray () -{ - delete d; -} - - -#include "knetworkmanager-cellular_device_tray.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.h b/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.h deleted file mode 100644 index 323a559..0000000 --- a/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.h +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * Helmut Schaa , - * - * 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 - - public: - CellularDeviceTray (TDENetworkDevice*, 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/tdenetworkmanager/src/knetworkmanager-connection_editor.cpp b/tdenetworkmanager/src/knetworkmanager-connection_editor.cpp deleted file mode 100644 index 6d2368f..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_editor.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_editor.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * Author: Timothy Pearson - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -// kde headers -#include -#include -#include -#include -#include -#include - -// knm headers -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-connection_editor.h" -#include "knetworkmanager-connection_settings_dialog.h" - -using namespace ConnectionSettings; - -/* - * ConnectionListViewItem - */ -class ConnectionListViewItem : public KListViewItem -{ - public: - - ConnectionListViewItem(TQListView* parent, TDENetworkConnection* connection) - : KListViewItem(parent) - , _conn(connection) - { - if (_conn) { - setText(0, _conn->friendlyName); - setText(1, TDENetworkConnectionManager::friendlyConnectionTypeName(_conn->type())); - // TODO: Move to a Factory - if (_conn->type() == TDENetworkConnectionType::WiredEthernet) { - setPixmap(0, KGlobal::iconLoader()->loadIcon("wired", KIcon::Small)); - } - else if (_conn->type() == TDENetworkConnectionType::WiFi) { - setPixmap(0, KGlobal::iconLoader()->loadIcon("wireless", KIcon::Small)); - } -// else if (_conn->type() == TDENetworkConnectionType::VPN) { -// setPixmap(0, KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small)); -// } - else { - setPixmap(0, KGlobal::iconLoader()->loadIcon("help", KIcon::Small)); - } - } - } - - TDENetworkConnection* _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 TDEWiFiConnection()); -} - -/* - * New Wired connection - */ -void ConnectionEditorImpl::slotNewWiredConnection() -{ - slotEditNewConnection(new TDEWiredEthernetConnection()); -} - -/* - * New VPN connection - */ -void ConnectionEditorImpl::slotNewVPNConnection() -{ -// slotEditNewConnection(new TDEVPNConnection()); -} - -/* - * - */ -void ConnectionEditorImpl::slotEditNewConnection(TDENetworkConnection* conn) -{ - // open a dialog for editing the connection - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, this, "connect_something", false, TQt::WDestructiveClose); - connect(dlg, TQT_SIGNAL(connectionSaved()), this, TQT_SLOT(slotRefreshConnectionList())); - dlg->show(); -} - -void ConnectionEditorImpl::slotRefreshConnectionList() -{ - fillConnectionList(); -} - -/* - * Edit the selected connection - */ -void ConnectionEditorImpl::slotEditCurrentConnection() -{ - ConnectionListViewItem* item = dynamic_cast(lvConnections->currentItem()); - if (!item) { - return; - } - - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - if (!nm) { - return; - } - - TDENetworkConnection* conn = item->_conn; - - // we need the secrets for editing - nm->loadConnectionSecrets(conn->UUID); - - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, false, this, "connect_something", false, TQt::WDestructiveClose); - dlg->show(); - - // save all connections (if not done already) - nm->saveConnection(conn); -} - - -/* - * Delete the selected connection - */ -void ConnectionEditorImpl::slotRemoveCurrentConnection() -{ - ConnectionListViewItem* item = dynamic_cast(lvConnections->currentItem()); - if (!item) { - return; - } - - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - if (!nm) { - return; - } - - TDENetworkConnection* conn = item->_conn; - - lvConnections->takeItem(item); - delete item; - - nm->deleteConnection(conn->UUID); -} - -/* - * Fill the connection list - */ -void ConnectionEditorImpl::fillConnectionList() -{ - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - if (!nm) { - return; - } - - lvConnections->clear(); - - TDENetworkConnectionList* allconmap = nm->connections(); - for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) { - TDENetworkConnection* conn = *it; - new ConnectionListViewItem(lvConnections, conn); - } -} - -#include "knetworkmanager-connection_editor.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-connection_editor.h b/tdenetworkmanager/src/knetworkmanager-connection_editor.h deleted file mode 100644 index 83ec029..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection_editor.h +++ /dev/null @@ -1,71 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection_editor.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -// tqt headers -#include - -// tqt autogenerated headers -#include "connection_editor.h" - -// TDE headers -#include -#include - -// knm headers -#include "knetworkmanager-connection_setting.h" - -class TQWidget; -class Device; - -namespace ConnectionSettings -{ - class WidgetInterface; - class ConnectionSetting; -} - -class ConnectionEditorImpl : public ConnectionEditor -{ - Q_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(TDENetworkConnection* conn); - void slotRefreshConnectionList(); - void slotNewVPNConnection(); - - private: - void fillConnectionList(); -}; - -#endif /* KNETWORKMANAGER_CONNECTION_EDITOR_H*/ diff --git a/tdenetworkmanager/src/knetworkmanager-device_tray.cpp b/tdenetworkmanager/src/knetworkmanager-device_tray.cpp deleted file mode 100644 index 493582a..0000000 --- a/tdenetworkmanager/src/knetworkmanager-device_tray.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-device_tray.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// TDE includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// KNM includes -#include "knetworkmanager-device_tray.h" -#include "knetworkmanager-menu_subhead.h" -#include "knetworkmanager-connection_settings_dialog.h" -#include "knetworkmanager-connection_setting_info.h" - -using namespace ConnectionSettings; - -class DeviceTrayPrivate -{ - public: - - DeviceTrayPrivate() - : dev(NULL) - { - tooltips[TDENetworkConnectionStatus::Invalid] = i18n("Unknown"); - tooltips[TDENetworkConnectionStatus::LinkUnavailable] = i18n("Down"); - tooltips[TDENetworkConnectionStatus::UnManaged] = i18n("Unmanaged"); - tooltips[TDENetworkConnectionStatus::Disconnected] = i18n("Disconnected"); - tooltips[TDENetworkConnectionStatus::EstablishingLink] = i18n("Preparing"); - tooltips[TDENetworkConnectionStatus::ConfiguringProtocols] = i18n("Configuration"); - tooltips[TDENetworkConnectionStatus::NeedAuthorization] = i18n("Awaiting authentication"); - tooltips[TDENetworkConnectionStatus::VerifyingProtocols] = i18n("IP configuration"); - tooltips[TDENetworkConnectionStatus::Connected] = i18n("Activated"); - tooltips[TDENetworkConnectionStatus::Failed] = i18n("Failed"); - } - - ~DeviceTrayPrivate() {} - - TDENetworkDevice* dev; - TQMap movies; - TQMap pixmaps; - TQMap tooltips; - - TQPixmap pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); - TQMovie movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); - TQString tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); -}; - -TQPixmap DeviceTrayPrivate::pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { - TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; - while (flag > 0) { - if (state & flag) { - if (pixmaps.contains(flag)) { - return pixmaps[flag]; - } - } - flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); - } - return TQPixmap(); -} - -TQMovie DeviceTrayPrivate::movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { - TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; - while (flag > 0) { - if (state & flag) { - if (movies.contains(flag)) { - return movies[flag]; - } - } - flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); - } - return TQMovie(); -} - -TQString DeviceTrayPrivate::tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { - TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; - while (flag > 0) { - if (state & flag) { - if (tooltips.contains(flag)) { - return tooltips[flag]; - } - } - flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); - } - return TQString::null; -} - -TDENetworkDevice* DeviceTray::getDevice() const -{ - return d->dev; -} - -TQString DeviceTray::getTooltipText() -{ - - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); - TDENetworkConnectionStatus::TDENetworkConnectionStatus state = deviceConnMan->deviceInformation().statusFlags; - TQString tooltip = TQString(); - - if (!d->tooltipForConnState(state).isEmpty()) { - tooltip += i18n("State: %1").arg(d->tooltipForConnState(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(TDENetworkConnectionStatus::TDENetworkConnectionStatus state, TQMovie movie) -{ - d->movies[state] = movie; - slotUpdateDeviceState(); -} - -void DeviceTray::setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state, TQPixmap pixmap) -{ - d->pixmaps[state] = pixmap; - slotUpdateDeviceState(); -} - -void DeviceTray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) -{ - // stop the old movie to avoid unnecessary wakups - if (movie()) { - movie()->pause(); - } - - if (!d->movieForConnState(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->movieForConnState(state)); - - // start at the same frame as the movie before - if (frame > 0) - movie()->step(frame); - - // start the animation - movie()->unpause(); - } - else if (!d->pixmapForConnState(state).isNull()) { - setPixmap(d->pixmapForConnState(state)); - } - else { - setPixmap(loadSizedIcon("KNetworkManager", width())); - } - - m_currentIconState = state; -} - -void DeviceTray::updateActions(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) -{ - // allow device deactivation only when device is activated - KAction* deactivate = actionCollection()->action("deactivate_device"); - if (deactivate) - deactivate->setEnabled( (state & TDENetworkConnectionStatus::Connected || - state & TDENetworkConnectionStatus::VerifyingProtocols || - state & TDENetworkConnectionStatus::EstablishingLink || - state & TDENetworkConnectionStatus::ConfiguringProtocols || - state & TDENetworkConnectionStatus::NeedAuthorization) ); -} - -void DeviceTray::updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) -{ - if (!(state & TDENetworkConnectionStatus::Connected)) { - return; - } -} - -void DeviceTray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) -{ - updateTrayIcon(state); - updateActions(state); - updateActiveConnection(state); -} - -void DeviceTray::slotUpdateDeviceState() -{ - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); - slotUpdateDeviceState(deviceConnMan->deviceInformation().statusFlags); -} - -void DeviceTray::loadIcons() { - d->pixmaps[TDENetworkConnectionStatus::Invalid] = loadSizedIcon("nm_no_connection", width()); - d->pixmaps[TDENetworkConnectionStatus::UnManaged] = loadSizedIcon("nm_no_connection", width()); - d->pixmaps[TDENetworkConnectionStatus::LinkUnavailable] = loadSizedIcon("nm_no_connection", width()); - d->pixmaps[TDENetworkConnectionStatus::Disconnected] = loadSizedIcon("nm_no_connection", width()); - - d->movies[TDENetworkConnectionStatus::EstablishingLink] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage01_connecting", KIcon::Panel)); - d->movies[TDENetworkConnectionStatus::EstablishingLink].pause(); - - d->movies[TDENetworkConnectionStatus::ConfiguringProtocols] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage02_connecting", KIcon::Panel)); - d->movies[TDENetworkConnectionStatus::ConfiguringProtocols].pause(); - - d->movies[TDENetworkConnectionStatus::VerifyingProtocols] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage03_connecting", KIcon::Panel)); - d->movies[TDENetworkConnectionStatus::VerifyingProtocols].pause(); - - d->movies[TDENetworkConnectionStatus::NeedAuthorization] = d->movies[TDENetworkConnectionStatus::ConfiguringProtocols]; - d->movies[TDENetworkConnectionStatus::NeedAuthorization].pause(); - - d->pixmaps[TDENetworkConnectionStatus::Connected] = loadSizedIcon("ok", width()); - - d->pixmaps[TDENetworkConnectionStatus::Failed] = loadSizedIcon("nm_no_connection", width()); -} - -DeviceTray::DeviceTray (TDENetworkDevice* dev) : KSystemTray () -{ - d = new DeviceTrayPrivate(); - d->dev = dev; - - m_currentIconState = TDENetworkConnectionStatus::Invalid; - loadIcons(); - - // get notified when the device state changes - connect(dev, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), this, TQT_SLOT(slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus))); - - 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/tdenetworkmanager/src/knetworkmanager-device_tray.h b/tdenetworkmanager/src/knetworkmanager-device_tray.h deleted file mode 100644 index 2ee1c87..0000000 --- a/tdenetworkmanager/src/knetworkmanager-device_tray.h +++ /dev/null @@ -1,88 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-device_tray.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include "knetworkmanager.h" - -class DeviceTrayPrivate; - -class DeviceTray : public KSystemTray -{ - Q_OBJECT - - - public: - DeviceTray (TDENetworkDevice*); - ~DeviceTray (); - - void contextMenuAboutToShow (KPopupMenu* menu); - virtual void addMenuItems(KPopupMenu* menu) = 0; - TDENetworkDevice* getDevice() const; - - protected: - void setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQMovie); - void setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQPixmap); - void resizeEvent ( TQResizeEvent * ); - - virtual TQString getTooltipText(); - - public slots: - void setPixmap(const TQPixmap &); - void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus); - void slotUpdateDeviceState(); - - private: - void updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus); - void updateActions(TDENetworkConnectionStatus::TDENetworkConnectionStatus); - void updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus); - void enterEvent (TQEvent*); - void loadIcons(); - - DeviceTrayPrivate* d; - TDENetworkConnectionStatus::TDENetworkConnectionStatus m_currentIconState; -}; - -#endif /* KNETWORKMANAGER_DEVICE_TRAY_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-menu_subhead.cpp b/tdenetworkmanager/src/knetworkmanager-menu_subhead.cpp deleted file mode 100644 index 5a69cd5..0000000 --- a/tdenetworkmanager/src/knetworkmanager-menu_subhead.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-tray.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * Valentine Sinitsyn - * Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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/tdenetworkmanager/src/knetworkmanager-menu_subhead.h b/tdenetworkmanager/src/knetworkmanager-menu_subhead.h deleted file mode 100644 index 8891fc4..0000000 --- a/tdenetworkmanager/src/knetworkmanager-menu_subhead.h +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * Helmut Schaa , - * - * 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 -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#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/tdenetworkmanager/src/knetworkmanager-menuitem.cpp b/tdenetworkmanager/src/knetworkmanager-menuitem.cpp deleted file mode 100644 index 927f1ae..0000000 --- a/tdenetworkmanager/src/knetworkmanager-menuitem.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-menuitem.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006, 2008 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * Valentine Sinitsyn - * Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ConnectionSettings; - -class NetworkMenuItemPrivate -{ - public: - NetworkMenuItemPrivate(TDENetworkDevice* device, TDENetworkConnection* connection) - : dev(device), conn(connection) - { - - } - ~NetworkMenuItemPrivate() {} - - TQGuardedPtr dev; - TQGuardedPtr conn; -}; - -void NetworkMenuItem::slotActivate() -{ - kdDebug() << "NetworkMenuItem::slotActivate()" << endl; - - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - - if (d->dev && d->conn) - { - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); - if (deviceConnMan) - { - kdDebug() << "Activate Connection " << d->conn->UUID.ascii() << " on Device " << d->dev->deviceNode().ascii() << endl; - printf("Activate Connection %s on Device %s\n\r", d->conn->UUID.ascii(), d->dev->deviceNode().ascii()); - - TDENetworkConnectionStatus::TDENetworkConnectionStatus result = deviceConnMan->initiateConnection(d->conn->UUID); - if ((result == TDENetworkConnectionStatus::Disconnected) - || (result == TDENetworkConnectionStatus::Invalid)) { - // - } - 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->UUID.ascii()); - - TDENetworkConnectionStatus::TDENetworkConnectionStatus result = nm->initiateConnection(d->conn->UUID); - if ((result == TDENetworkConnectionStatus::Disconnected) - || (result == TDENetworkConnectionStatus::Invalid)) { - // - } - else { - kdDebug() << "ActivateConnection failed" << endl; - } - } - else - kdDebug() << "Device or Connection invalid" << endl; -} - -NetworkMenuItem::NetworkMenuItem (TDENetworkDevice* dev, TDENetworkConnection* 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/tdenetworkmanager/src/knetworkmanager-menuitem.h b/tdenetworkmanager/src/knetworkmanager-menuitem.h deleted file mode 100644 index 86552dc..0000000 --- a/tdenetworkmanager/src/knetworkmanager-menuitem.h +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-menuitem.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006, 2008 Novell, Inc. - * - * Author: Helmut Schaa , - * Will Stephenson , - * - * 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 - -#include -#include - -class Device; -class NetworkMenuItemPrivate; - -namespace ConnectionSettings -{ - class Connection; -} - -class NetworkMenuItem : public TQObject -{ - Q_OBJECT - - public: - NetworkMenuItem (TDENetworkDevice* dev, TDENetworkConnection* conn, TQObject* parent = 0, const char* name = 0); - ~NetworkMenuItem (); - - public slots: - void slotActivate(); - - private: - NetworkMenuItemPrivate* d; -}; - -#endif /* KNETWORKMANAGER_MENUITEM_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-nm_vpn_proxy.cpp b/tdenetworkmanager/src/knetworkmanager-nm_vpn_proxy.cpp deleted file mode 100644 index 737f4ef..0000000 --- a/tdenetworkmanager/src/knetworkmanager-nm_vpn_proxy.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-device.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * - * 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 - -// TQtDBus includes -#include -#include -#include -#include -#include -#include - -// NM includes -#include -#include - -// 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/tdenetworkmanager/src/knetworkmanager-nm_vpn_proxy.h b/tdenetworkmanager/src/knetworkmanager-nm_vpn_proxy.h deleted file mode 100644 index af5f8ec..0000000 --- a/tdenetworkmanager/src/knetworkmanager-nm_vpn_proxy.h +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-nm_proxy.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - - public: - static NMVPNProxy* getInstance(); - - protected: - NMVPNProxy (); - ~NMVPNProxy (); - - private: - NMVPNProxyPrivate * d; -}; - -#endif /* KNETWORKMANAGER_NMVPNPROXY_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-plugin.cpp b/tdenetworkmanager/src/knetworkmanager-plugin.cpp deleted file mode 100644 index cb1d2b7..0000000 --- a/tdenetworkmanager/src/knetworkmanager-plugin.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-plugin.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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/tdenetworkmanager/src/knetworkmanager-plugin.h b/tdenetworkmanager/src/knetworkmanager-plugin.h deleted file mode 100644 index 3a500ac..0000000 --- a/tdenetworkmanager/src/knetworkmanager-plugin.h +++ /dev/null @@ -1,39 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-plugin.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -class Plugin : public TQObject -{ - Q_OBJECT - - public: - Plugin(TQObject*, const char*, const TQStringList&); - ~Plugin(); -}; - -#endif /* KNETWORKMANAGER_PLUGIN_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-pluginmanager.cpp b/tdenetworkmanager/src/knetworkmanager-pluginmanager.cpp deleted file mode 100644 index 7654ccd..0000000 --- a/tdenetworkmanager/src/knetworkmanager-pluginmanager.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-pluginmanager.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include - -#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::fromLatin1( "KNetworkManager/Plugin" ))); - - // a bit debug output - for(TQValueList::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it) - kdDebug() << k_funcinfo << TQString("Found Plugin '%1'").arg((*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::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::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::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( TQString::fromLatin1( "KNetworkManager/Plugin" ), - TQString::fromLatin1( "[X-KDE-PluginInfo-Name]=='%1'" ).arg( pluginID ), this, 0, TQStringList(), &error ); - - // plugin loaded? - if (plugin) - { - kdDebug() << k_funcinfo << TQString(i18n("successfully loaded plugin '%1'")).arg(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::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/tdenetworkmanager/src/knetworkmanager-pluginmanager.h b/tdenetworkmanager/src/knetworkmanager-pluginmanager.h deleted file mode 100644 index efe6c63..0000000 --- a/tdenetworkmanager/src/knetworkmanager-pluginmanager.h +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-pluginmanager.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include - -#include "knetworkmanager-plugin.h" -#include "knetworkmanager.h" - -class KPluginInfo; - -typedef TQMap PluginMap; - -class PluginManager : public TQObject -{ - Q_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 _plugins; - PluginMap _loadedPlugins; - - Plugin* loadPlugin(const TQString& pluginID); - KPluginInfo* infoForPluginID(const TQString& pluginID) const; - - static PluginManager* _instance; -}; - -#endif /* KNETWORKMANAGER_PLUGINMANAGER_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-tray.cpp b/tdenetworkmanager/src/knetworkmanager-tray.cpp deleted file mode 100644 index 7a818cc..0000000 --- a/tdenetworkmanager/src/knetworkmanager-tray.cpp +++ /dev/null @@ -1,766 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-tray.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * Valentine Sinitsyn - * Helmut Schaa , - * Alexander Naumov , - * Author: Timothy Pearson - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "devicetraycomponent.h" -#include "knetworkmanager-tray.h" - -#include "knetworkmanager-connection_settings_dialog.h" -#include "knetworkmanager-connection_editor.h" -#include "knetworkmanager-menu_subhead.h" - -#include "knetworkmanager-wired_device_tray.h" -#include "knetworkmanager-wireless_device_tray.h" -#include "knetworkmanager-cellular_device_tray.h" - -#include - -TDENetworkConnectionStatus::TDENetworkConnectionStatus nm_device_state_global; - -NewSecretsDialog::NewSecretsDialog(TDENetworkConnection *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, Tray::getInstance(), "Edit connection"); - dlg->show(); - close(); -} - -void NewSecretsDialog::reject() -{ - TQDialog::reject(); -} - -void NewSecretsDialog::init() -{ - TDENetworkConnection* conn = _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 ").arg(conn->friendlyName), 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 trayComponents; - DeviceTrayComponent * foregroundTrayComponent; - TQSignalMapper signalMapper; - TQMap 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() -{ - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - if (!nm) return; - nm->enableWiFi(true); -} - -void Tray::slotDisableWireless() -{ - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - if (!nm) return; - nm->enableWiFi(false); -} - -void Tray::slotOfflineMode() -{ - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - if (!nm) return; - nm->enableNetworking(false); -} - -void Tray::slotOnlineMode() -{ - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - if (!nm) return; - nm->enableNetworking(true); -} - -void Tray::contextMenuAboutToShow (KPopupMenu* menu) -{ - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - - // clear menu - menu->clear(); - - if (!(nm->backendStatus() & TDENetworkGlobalManagerFlags::BackendUnavailable)) { - // actions for each Device - for (TQValueList::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(newConnAction); - newConnActionMenu->popupMenu()->clear(); - TQValueList::Iterator it; - for (it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) { - DeviceTrayComponent* dev_comp = dynamic_cast (*it); - KAction * deviceNewConnAction = 0; - if (dev_comp) { - TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->deviceNode()); - TQString menuCaption = TQString("%1").arg(dev_comp->device()->deviceNode()); - 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); - } - } - } - 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(actionCollection ()->action ("deactivate_menu") ); - disableStuffActionMenu->popupMenu()->clear(); - TDENetworkConnectionList* map = nm->connections(); - d->act_conn_map.clear(); - - for (TDENetworkConnectionList::Iterator it = map->begin(); it != map->end(); ++it) { - TDENetworkConnection* conn = (*it); - - if (!conn) { - continue; - } - - if ((nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Disconnected) - || (nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Invalid)) { - continue; - } - - TQString actionName = TQString("disable_connection_%1").arg(conn->UUID); - KAction * deviceNewConnAction = actionCollection ()->action (actionName); - TQString actionText = conn->friendlyName; - - 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, conn); - d->current_idx++; - disableStuffActionMenu->insert(deviceNewConnAction); - } - - // disable wireless - if (nm->wiFiHardwareEnabled()) { - KAction* wireless = NULL; - if (nm->wiFiEnabled()) { - wireless = actionCollection ()->action ("disable_wireless"); - } else { - wireless = actionCollection ()->action ("enable_wireless"); - } - disableStuffActionMenu->insert(wireless); - } - - // offline vs. online mode - KAction* switch_mode = NULL; - if (nm->backendStatus() != TDENetworkGlobalManagerFlags::Sleeping) { - 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(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState) -{ - TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags nm_state = newState; - // change tray icon according to NM's state - - if ((nm_state & TDENetworkGlobalManagerFlags::Unknown) - || (nm_state & TDENetworkGlobalManagerFlags::Sleeping) - || (nm_state & TDENetworkGlobalManagerFlags::EstablishingLink) - || (nm_state & TDENetworkGlobalManagerFlags::Disconnected) - || (nm_state & TDENetworkGlobalManagerFlags::BackendUnavailable)) { - setPixmap (loadIcon ("knetworkmanager_disabled")); - } - else if (nm_state & TDENetworkGlobalManagerFlags::Connected) { - setPixmap (loadIcon ("knetworkmanager")); - } - - 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::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::slotSecretsNeeded(TDENetworkConnection* connection, const TQStringList& hints, bool request_new) -{ - // For now assume secrets are already in NM... -} - -void Tray::slotAddDeviceTrayComponent(TDENetworkDevice* dev) -{ - if (dev) { - createDeviceTrayComponent(dev); - } -} - -void Tray::slotRemoveDeviceTrayComponent(TDENetworkDevice* dev) -{ - for (TQValueList::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) - { - DeviceTrayComponent* dev_comp = dynamic_cast(*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").arg(dev_comp->device()->deviceNode()); - 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(TDENetworkDevice* dev) -{ - bool trayExists = false; - - if (!dev) return; - - // check if we have already a trayicon for this device - for (TQValueList::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) - { - DeviceTrayComponent* dev_comp = dynamic_cast (*it); - if (dev_comp) - if (dev_comp->device() == dev) - { - trayExists = true; - break; - } - } - - // create the appropriate device tray icon - if (!trayExists) - { - DeviceTrayComponent* devTray = 0; - TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); - // different tray icons for different device types! - switch (deviceConnMan->deviceType()) - { - case TDENetworkDeviceType::WiredEthernet: - devTray = new WiredDeviceTray(dev, this, "wired_device_tray"); - break; - case TDENetworkDeviceType::WiFi: - devTray = new WirelessDeviceTray(dev, this, "wireless_device_tray"); - break; - case TDENetworkDeviceType::Modem: - devTray = new CellularDeviceTray(dev, this, "cellular_device_tray"); - break; - default: - kdWarning() << k_funcinfo << "UDI: " << dev->uniqueID() << " has unknown devicetype: " << deviceConnMan->deviceType() << 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::updateDeviceTrays() -{ - TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); - if (!hwdevices) return; - - // create one tray-icon for each device - TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network); - - // check for newly added devices - for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) - { - TDENetworkDevice* dev = dynamic_cast(*it); - if (dev) { - createDeviceTrayComponent(dev); - } - else { - kdWarning() << k_funcinfo << "got a NULL-Device" << endl; - } - } -} - -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) -{ - TDENetworkConnection* conn = d->act_conn_map[index]; - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - if (!nm) return; - - if (conn) { - nm->deactivateConnection(conn->UUID); - } -} - -void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt) -{ - DeviceTrayComponent * dtc = dynamic_cast(component); - if (dtc) { - kdDebug() << k_funcinfo << dtc->device()->deviceNode() << " : " << needsIt << endl; - TDENetworkDevice * 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 -#if 0 - // FIXME - // The TDE network backend has no concept of a default device - // Should it? - device = nm->getDefaultDevice(); - if ( device ) { - // identify the new foreground - for (TQValueList::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) - { - DeviceTrayComponent* newDtc = dynamic_cast (*it); - if ( newDtc && newDtc->device() == device ) { - d->foregroundTrayComponent = newDtc; - break; - } - } - kdDebug() << " Device " << dtc->device()->deviceNode() << " background, new foreground device: " << device->deviceNode() << endl; - connect(device, TQT_SIGNAL(StateChanged(NMDeviceState)), - TQT_SLOT(slotUpdateDeviceState(NMDeviceState))); - slotUpdateDeviceState(device->getState()); - } -#endif - } - } -} - -void Tray::slotUpdateDeviceState() -{ - // FIXME -} - -void Tray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) -{ - updateTrayIcon(state); - updateActiveConnection(state); -} - -void Tray::trayUiChanged() -{ - DeviceTrayComponent * dtc = d->foregroundTrayComponent; - if (dtc) { - TDENetworkConnectionManager* deviceConnMan = dtc->device()->connectionManager(); - updateTrayIcon(deviceConnMan->deviceInformation().statusFlags); - } -} -void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) -{ - // Get all active connections - char found_any_active_connection=0; - - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - - found_any_active_connection = 0; - // Get all active connections - TDENetworkConnectionList* allconmap = nm->connections(); - for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) { - TDENetworkConnection* conn = (*it); - - if (!conn) { - continue; - } - - if ((nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Disconnected) - || (nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Invalid)) { - continue; - } - - // Found an active connection - found_any_active_connection = 1; - } - -// if (found_any_active_connection == 1) { -// printf("Active connection found\n\r"); -// } - - // 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")); - } - - nm_device_state_global = state; - //printf("Device state: %d\n\r", nm_device_state_global); -} - -void Tray::updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) -{ - if (state != TDENetworkConnectionStatus::Connected) { - return; - } -} - -void Tray::slotDeviceAddedNotify(TDENetworkDevice* dev) -{ - kdDebug() << "Tray::slotDeviceAddedNotify" << endl; - KNotifyClient::event( winId(), "knm-nm-device-added", i18n("New network device %1 found").arg(dev->deviceNode()) ); -} - -void Tray::slotDeviceRemovedNotify(TDENetworkDevice* dev) -{ - kdDebug() << "Tray::slotDeviceRemovedNotify" << endl; - KNotifyClient::event( winId(), "knm-nm-device-removed", i18n("Network device %1 removed").arg(dev->deviceNode()) ); -} - -void Tray::slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState) -{ - TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags nm_state = newState; - - // change tray icon according to NM's state - if (nm_state & TDENetworkGlobalManagerFlags::EstablishingLink) { - KNotifyClient::event( winId(), "knm-nm-connecting", i18n("NetworkManager is connecting") ); - } - else if (nm_state & TDENetworkGlobalManagerFlags::Disconnected) { - KNotifyClient::event( winId(), "knm-nm-disconnected", i18n("NetworkManager is now disconnected") ); - } - else if (nm_state & TDENetworkGlobalManagerFlags::Connected) { - KNotifyClient::event( winId(), "knm-nm-connected", i18n("NetworkManager is now connected") ); - } - else if (nm_state & TDENetworkGlobalManagerFlags::Sleeping) { - KNotifyClient::event( winId(), "knm-nm-sleeping", i18n("KNetworkManager Offline") ); - } - else if (nm_state & TDENetworkGlobalManagerFlags::Unknown) { - // - } -} - -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 - connect(KGlobal::networkManager(), TQT_SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, TQT_SLOT(slotStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags))); - - // get notified about new/removed devices - // FIXME -// DeviceStore* store = DeviceStore::getInstance(); -// connect(store, TQT_SIGNAL(DeviceStoreChanged()), this, TQT_SLOT(updateDeviceTrays())); -// connect(store, TQT_SIGNAL(DeviceAdded(TDENetworkDevice*)), this, TQT_SLOT(slotAddDeviceTrayComponent(TDENetworkDevice*))); -// connect(store, TQT_SIGNAL(DeviceRemoved(TDENetworkDevice*)), this, TQT_SLOT(slotRemoveDeviceTrayComponent(TDENetworkDevice*))); - - // Notifications - connect(KGlobal::networkManager(), TQT_SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, TQT_SLOT(slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags))); -// connect(store, TQT_SIGNAL(DeviceAdded(TDENetworkDevice*)), this, TQT_SLOT(slotDeviceAddedNotify(TDENetworkDevice*))); -// connect(store, TQT_SIGNAL(DeviceRemoved(TDENetworkDevice*)), this, TQT_SLOT(slotDeviceRemovedNotify(TDENetworkDevice*))); - - - // initial setup of the device-trays - updateDeviceTrays(); - - slotStateChanged(KGlobal::networkManager()->backendStatus(), TDENetworkGlobalManagerFlags::Unknown); -} - -Tray::~Tray () -{ - delete d; -} - -#include "knetworkmanager-tray.moc" - diff --git a/tdenetworkmanager/src/knetworkmanager-tray.h b/tdenetworkmanager/src/knetworkmanager-tray.h deleted file mode 100644 index 6f39948..0000000 --- a/tdenetworkmanager/src/knetworkmanager-tray.h +++ /dev/null @@ -1,135 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * Helmut Schaa , - * Alexander Naumov , - * Author: Timothy Pearson - * - * 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 -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -#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 - - - 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(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState); - void slotSecretsNeeded(TDENetworkConnection* connection, const TQStringList& hints, bool request_new); - - void slotDeviceAddedNotify(TDENetworkDevice*); - void slotDeviceRemovedNotify(TDENetworkDevice*); - void slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState); - - void slotUpdateDeviceState(); - void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus); - - protected slots: - void updateDeviceTrays(); - void slotAddDeviceTrayComponent(TDENetworkDevice*); - void slotRemoveDeviceTrayComponent(TDENetworkDevice*); - void slotDeactivateConnection(int); - void trayComponentNeedsCenterStage(TrayComponent*, bool); - void trayUiChanged(); - void slotEditNotifications(); - - private: - void updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus); - void updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus); - void mousePressEvent(TQMouseEvent *e); - void createDeviceTrayComponent(TDENetworkDevice*); - void enterEvent(TQEvent*); - - TrayPrivate* d; - -}; - -class NewSecretsDialog : public TQDialog -{ - Q_OBJECT - - - public: - NewSecretsDialog(TDENetworkConnection* connection, TQWidget * parent, const char * name, bool modal = false, TQt::WFlags f = 0); - ~NewSecretsDialog(); - void init(); - - public slots: - void slotDialogEdit(); - void reject(); - - private: - TDENetworkConnection* _connection; -}; - -#endif /* KNETWORKMANAGER_TRAY_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-vpn_plugin.cpp b/tdenetworkmanager/src/knetworkmanager-vpn_plugin.cpp deleted file mode 100644 index f56b221..0000000 --- a/tdenetworkmanager/src/knetworkmanager-vpn_plugin.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-vpn_plugin.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * Author: Timothy Pearson - * - * 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 - -// TQt includes -#include - -// TQT_DBus includes -#include -#include -#include - -// NM includes -#include -#include - -// 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/tdenetworkmanager/src/knetworkmanager-vpn_plugin.h b/tdenetworkmanager/src/knetworkmanager-vpn_plugin.h deleted file mode 100644 index 88c63e0..0000000 --- a/tdenetworkmanager/src/knetworkmanager-vpn_plugin.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wired_device.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * Author: Timothy Pearson - * - * 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 - -// KNM includes -#include "knetworkmanager.h" - -class KNetworkManager; - -class VPNDBUSPluginPrivate; - -class VPNDBUSPlugin : public TQObject -{ - Q_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/tdenetworkmanager/src/knetworkmanager-vpnauthenticationdialog.cpp b/tdenetworkmanager/src/knetworkmanager-vpnauthenticationdialog.cpp deleted file mode 100644 index ffeb933..0000000 --- a/tdenetworkmanager/src/knetworkmanager-vpnauthenticationdialog.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-vpnauthenticationdialog.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#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").arg(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(minimumSizeHint()); -} - -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 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(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/tdenetworkmanager/src/knetworkmanager-vpnauthenticationdialog.h b/tdenetworkmanager/src/knetworkmanager-vpnauthenticationdialog.h deleted file mode 100644 index 8c43e7d..0000000 --- a/tdenetworkmanager/src/knetworkmanager-vpnauthenticationdialog.h +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-authenticationdialog.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include - -#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 - - 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/tdenetworkmanager/src/knetworkmanager-vpnmanager.cpp b/tdenetworkmanager/src/knetworkmanager-vpnmanager.cpp deleted file mode 100644 index 5b7e64e..0000000 --- a/tdenetworkmanager/src/knetworkmanager-vpnmanager.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-vpnmanager.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Helmut Schaa , - * - * 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 -#include -#include -#include - -#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/tdenetworkmanager/src/knetworkmanager-vpnmanager.h b/tdenetworkmanager/src/knetworkmanager-vpnmanager.h deleted file mode 100644 index 769d2c3..0000000 --- a/tdenetworkmanager/src/knetworkmanager-vpnmanager.h +++ /dev/null @@ -1,53 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-vpnmanager.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Helmut Schaa - * - * 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 -#include - -#include -#include - -#include "knetworkmanager.h" -#include "knetworkmanager-vpnplugin.h" - -class KNetworkManager; -class VPNService; - -typedef TQValueList VPNServiceList; - -class VPNManager : public TQObject -{ - Q_OBJECT - - - public: - static VPNService* getVPNService(TQString); - static VPNServiceList getVPNServices (); -}; - -#endif /* KNETWORKMANAGER_VPNMANAGER_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-vpnplugin.cpp b/tdenetworkmanager/src/knetworkmanager-vpnplugin.cpp deleted file mode 100644 index 02ef8fe..0000000 --- a/tdenetworkmanager/src/knetworkmanager-vpnplugin.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-vpnplugin.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -#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& /*properties*/) -{ - -} - -TQMap VPNConfigWidget::getVPNProperties() -{ - return TQMap(); -} - -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 VPNAuthenticationWidget::getPasswords() -{ - return TQMap(); -} - -void VPNAuthenticationWidget::setPasswords(TQString name, TQString value) -{ - -} - -void VPNAuthenticationWidget::setVPNData(const TQStringList& /*routes*/, const TQMap& /*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/tdenetworkmanager/src/knetworkmanager-vpnplugin.h b/tdenetworkmanager/src/knetworkmanager-vpnplugin.h deleted file mode 100644 index 3b8b625..0000000 --- a/tdenetworkmanager/src/knetworkmanager-vpnplugin.h +++ /dev/null @@ -1,79 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-vpnplugin.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include "knetworkmanager-plugin.h" - -#define KNETWORKMANAGER_VPNPLUGIN "KNetworkManager/VPNPlugin" - -class VPNConfigWidget : public TQWidget -{ - Q_OBJECT - - public: - virtual ~VPNConfigWidget(); - VPNConfigWidget(TQWidget* parent = NULL, const char* name = NULL); - - virtual void setVPNData(const TQStringList&, const TQMap&); - virtual TQMap getVPNProperties(); - virtual TQStringList getVPNRoutes(); - virtual bool hasChanged(); - virtual bool isValid(TQStringList&); -}; - -class VPNAuthenticationWidget : public TQWidget -{ - Q_OBJECT - - public: - virtual ~VPNAuthenticationWidget(); - VPNAuthenticationWidget(TQWidget* parent = NULL, const char* name = NULL); - - virtual void setVPNData(const TQStringList&, const TQMap&); - virtual TQMap getPasswords(); - virtual void setPasswords(TQString value, TQString data); - virtual bool needsUserInteraction(); -}; - -class VPNPlugin : public Plugin -{ - Q_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/tdenetworkmanager/src/knetworkmanager-vpnservice.cpp b/tdenetworkmanager/src/knetworkmanager-vpnservice.cpp deleted file mode 100644 index 84daa0c..0000000 --- a/tdenetworkmanager/src/knetworkmanager-vpnservice.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-vpnservice.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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( plugMan->getPlugin(list.first()) ); - if (vpnPlugin) - { - kdDebug() << k_funcinfo << i18n("Using VPN plugin '%1' for service '%2'").arg(list.first()).arg(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/tdenetworkmanager/src/knetworkmanager-vpnservice.h b/tdenetworkmanager/src/knetworkmanager-vpnservice.h deleted file mode 100644 index 51a03f6..0000000 --- a/tdenetworkmanager/src/knetworkmanager-vpnservice.h +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-vpnservice.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Helmut Schaa - * - * 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 -#include - -#include -#include - -#include "knetworkmanager.h" -#include "knetworkmanager-vpnplugin.h" - -class KNetworkManager; -class VPNService; -class KConfigGroup; - -class VPNService : public TQObject -{ - Q_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; -}; - -#endif /* KNETWORKMANAGER_VPN_SERVICE_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-wired_device_tray.cpp b/tdenetworkmanager/src/knetworkmanager-wired_device_tray.cpp deleted file mode 100644 index c399a7a..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wired_device_tray.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wired_device_tray.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// KDE includes -#include -#include -#include - -// TQt DBus -#include - - -// KNM includes -#include "knetworkmanager-wired_device_tray.h" -#include "knetworkmanager-menuitem.h" -#include "knetworkmanager-menu_subhead.h" - -#include "knetworkmanager-connection_setting_wired.h" -#include "knetworkmanager-connection_settings_dialog.h" - -using namespace ConnectionSettings; - -class WiredDeviceTrayPrivate -{ - public: - WiredDeviceTrayPrivate() {} - ~WiredDeviceTrayPrivate() {} - - TDENetworkDevice* dev; -}; - -void WiredDeviceTray::newConnection() -{ - // create a new wired connection - TDENetworkConnection* conn = new TDEWiredEthernetConnection(); - - // edit the new connection - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, tray(), "connect_something", false, TQt::WDestructiveClose); - dlg->show(); -} - - -void WiredDeviceTray::addMenuItems(KPopupMenu* menu) -{ - // device title - Subhead* subhead = new Subhead (menu, "subhead", TQString("Wired Connection (%1)").arg(d->dev->deviceNode()), SmallIcon("wired", TQIconSet::Automatic)); - menu->insertItem (subhead, -1, -1); - - // bolding subhead instead - //menu->insertSeparator(); - - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); - if (deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::LinkUnavailable) { - // 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 { - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); - TDENetworkConnection* active_conn = NULL; - if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected)) - && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) { - active_conn = nm->findConnectionByUUID(deviceConnMan->deviceInformation().activeConnectionUUID); - } - - // get all available Connections for wired devices - TDENetworkConnectionList* connections = nm->connections(); - int connectionItems = 0; - for (TDENetworkConnectionList::Iterator it = connections->begin(); it != connections->end(); ++it) { - TDEWiredEthernetConnection* conn = dynamic_cast(*it); - if (!conn) { - continue; - } - - // wired connection found :) - // lets create a nice name for this connection - TQString title = conn->friendlyName; - if (conn->ipConfig.valid) { - title += TQString(" (%1)").arg((conn->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPIP) ? i18n("DHCP") : i18n("Manual IP config")); - } - - NetworkMenuItem* item = new NetworkMenuItem(d->dev, conn, 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(); - 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 (TDENetworkDevice* dev, KSystemTray * parent, const char * name ) - : DeviceTrayComponent (dev, parent, name) -{ - d = new WiredDeviceTrayPrivate(); - d->dev = dev; - - setPixmapForState(TDENetworkConnectionStatus::Connected, "nm_device_wired"); -} - -WiredDeviceTray::~WiredDeviceTray () -{ - delete d; -} - -#include "knetworkmanager-wired_device_tray.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-wired_device_tray.h b/tdenetworkmanager/src/knetworkmanager-wired_device_tray.h deleted file mode 100644 index b2a2f7d..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wired_device_tray.h +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * Helmut Schaa , - * - * 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 - - - public: - WiredDeviceTray (TDENetworkDevice*, 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/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp deleted file mode 100644 index 996ea1e..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp +++ /dev/null @@ -1,417 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wireless_device_tray.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// KDE includes -#include -#include -#include -#include - -// KNM includes -#include "knetworkmanager-wireless_device_tray.h" -#include "knetworkmanager-wireless_menuitem.h" -#include "knetworkmanager-wireless_network.h" -#include "knetworkmanager-menu_subhead.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() {} - - TDENetworkDevice* dev; - TQGuardedPtr activeAccessPoint; -}; - -TQStringList WirelessDeviceTray::getToolTipText() -{ - TQStringList tooltip = DeviceTrayComponent::getToolTipText(); - - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); - TDENetworkWiFiAPInfo * ap = deviceConnMan->findAccessPointByBSSID(deviceConnMan->deviceInformation().wiFiInfo.activeAccessPointBSSID); - if (ap) { - tooltip.append(i18n("Network: %1").arg(ap->friendlySSID())); - } - - return tooltip; -} - -void WirelessDeviceTray::newConnection() -{ - // create a new wireless connection - TDENetworkConnection* conn = new TDEWiFiConnection(); - - // open a dialog for editing the connection - use_new_wireless_essid = 0; // deactivate autofill for now - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, tray(), "connect_something", false, TQt::WDestructiveClose); - dlg->show(); -} - -bool WirelessDeviceTray::findMatchingNetwork(const TDEWiFiConnection* conn, const TQValueList& nets, WirelessNetwork& net) -{ - const TDEWiFiConnection* wireless = dynamic_cast(conn); - - if (!wireless) { - return false; - } - - for (TQValueList::ConstIterator it = nets.begin(); it != nets.end(); ++it) { - if (wireless->SSID == (*it).getSsid()) { - net = *it; - return true; - } - } - return false; -} - -TDEWiFiConnection* WirelessDeviceTray::findMatchingConnection(const WirelessNetwork& net, const TQValueList& connections) -{ - // try to find a connection matching this network - for (TQValueList::ConstIterator it = connections.begin(); it != connections.end(); ++it) { - const TDEWiFiConnection* wireless = dynamic_cast(*it); - - if (!wireless) { - continue; - } - - if (wireless->SSID == net.getSsid()) - { - return *it; - } - } - - return NULL; -} - -void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) -{ - printf("Updating wireless network list\n\r"); - - // get all wireless networks - TQValueList nets = WirelessManager::getWirelessNetworks(d->dev); - - // get all wireless connections - TQValueList conns = WirelessManager::getWirelessConnections(); - - // get the currently active connection - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); - TDENetworkConnection* active_conn = NULL; - if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected)) - && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) { - active_conn = nm->findConnectionByUUID(deviceConnMan->deviceInformation().activeConnectionUUID); - } - - // add all wireless connections in range - // (we may have more then one connection per network) - for (TQValueList::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, ((TDENetworkConnection*)(*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::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; - - TDEWiFiConnection* wireless = dynamic_cast(*it); - - if (!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); - uint newnetworkItemsAdded = 0; - TQValueList newnets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID); - - for (TQValueList::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) -{ - // get the currently active connection - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - - // device title - Subhead* subhead = new Subhead (menu, "subhead", TQString("Wireless Connection (%1)").arg(d->dev->deviceNode()), SmallIcon("wireless", TQIconSet::Automatic)); - menu->insertItem (subhead, -1, -1); - - // bolding subhead instead - //menu->insertSeparator(); - - if (!nm->wiFiEnabled()) - { - // 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->wiFiHardwareEnabled()) - { - // 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::setPixmapForStates(TDENetworkConnectionStatus::TDENetworkConnectionStatus states, TQString pixmap) { - TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; - while (flag > 0) { - if (states & flag) { - setPixmapForState(flag, pixmap); - } - flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); - } -} - -void WirelessDeviceTray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) -{ - slotCheckActiveAccessPoint(); - - if (state == TDENetworkConnectionStatus::Connected) { - // trigger an update of the connections seen bssids property - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); - TDENetworkWiFiAPInfo * ap = deviceConnMan->findAccessPointByBSSID(deviceConnMan->deviceInformation().wiFiInfo.activeAccessPointBSSID); - if (ap) { - int strength = (ap->signalQuality*100.0); - - if (strength > 80) { - setPixmapForStates(state, "nm_signal_100"); - } - else if (strength > 55) { - setPixmapForStates(state, "nm_signal_75"); - } - else if (strength > 30) { - setPixmapForStates(state, "nm_signal_50"); - } - else if (strength > 5) { - setPixmapForStates(state, "nm_signal_25"); - } - else { - setPixmapForStates(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 - - // get the currently active connection - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); - TDENetworkConnection* active_conn = NULL; - if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected)) - && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) { - active_conn = nm->findConnectionByUUID(deviceConnMan->deviceInformation().activeConnectionUUID); - } - - if (active_conn && deviceConnMan->deviceInformation().statusFlags == TDENetworkConnectionStatus::Connected) { - TDENetworkWiFiAPInfo * activeap = deviceConnMan->findAccessPointByBSSID(deviceConnMan->deviceInformation().wiFiInfo.activeAccessPointBSSID); - if ( activeap != d->activeAccessPoint) { - if (!d->activeAccessPoint.isNull()) { - disconnect( deviceConnMan, TQT_SIGNAL(accessPointStatusChanged(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType)), this, TQT_SLOT(apPropertyChanged(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType))); - } - - d->activeAccessPoint = activeap; - if ( d->activeAccessPoint ) { - connect( deviceConnMan, TQT_SIGNAL(accessPointStatusChanged(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType)), this, TQT_SLOT(apPropertyChanged(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType))); - TDEWiFiConnection* wireless = dynamic_cast(active_conn); - if (wireless) { - if (!(wireless->heardBSSIDs.contains(d->activeAccessPoint->BSSID))) { - wireless->heardBSSIDs.append(d->activeAccessPoint->BSSID); - } - } - } - } - } -} - -void WirelessDeviceTray::apPropertyChanged(TDEMACAddress BSSID, TDENetworkAPEventType::TDENetworkAPEventType event) -{ - if (event == TDENetworkAPEventType::SignalStrengthChanged) { - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); - TDENetworkWiFiAPInfo * ap = deviceConnMan->findAccessPointByBSSID(BSSID); - if (ap) { - TQ_UINT32 strength = (ap->signalQuality*100.0); - kdDebug() << k_funcinfo << strength << endl; - TDENetworkConnectionStatus::TDENetworkConnectionStatus state = deviceConnMan->deviceInformation().statusFlags; - if (strength > 80) { - setPixmapForStates(state, "nm_signal_100"); - } - else if (strength > 55) { - setPixmapForStates(state, "nm_signal_75"); - } - else if (strength > 30) { - setPixmapForStates(state, "nm_signal_50"); - } - else if (strength > 5) { - setPixmapForStates(state, "nm_signal_25"); - } - else { - setPixmapForStates(state, "nm_signal_00"); - } - emit uiUpdated(); - } - } -} - -void WirelessDeviceTray::slotAccessPointAdded(TDENetworkWiFiAPInfo* 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 (TDENetworkDevice* dev, KSystemTray * parent, const char * name) - : DeviceTrayComponent (dev, parent, name) -{ - d = new WirelessDeviceTrayPrivate(); - d->dev = dev; - - // we want other icons for wireless devices - setPixmapForState(TDENetworkConnectionStatus::Invalid, "wireless_off"); - setPixmapForState(TDENetworkConnectionStatus::LinkUnavailable, "wireless_off"); - setPixmapForState(TDENetworkConnectionStatus::UnManaged, "wireless_off"); - setPixmapForState(TDENetworkConnectionStatus::Disconnected, "wireless"); - setPixmapForState(TDENetworkConnectionStatus::Connected, "nm_signal_50"); - - // get notified when the device state changes - connect(dev, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), this, TQT_SLOT(slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus))); - - // 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(TDENetworkWiFiAPInfo*)), this, TQT_SLOT(slotAccessPointAdded(TDENetworkWiFiAPInfo*))); - 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/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h b/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h deleted file mode 100644 index a987b77..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h +++ /dev/null @@ -1,77 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * Helmut Schaa , - * - * 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; - -class WirelessDeviceTray : public DeviceTrayComponent -{ - Q_OBJECT - - - public: - WirelessDeviceTray (TDENetworkDevice*, KSystemTray * parent = 0, const char * name = 0); - ~WirelessDeviceTray (); - - void addMenuItems(KPopupMenu* menu); - - protected: - /** - * Reimplementation - */ - TQStringList getToolTipText(); - - public slots: - void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus); - void slotCheckActiveAccessPoint(); - void newConnection(); - protected slots: - void apPropertyChanged(TDEMACAddress BSSID, TDENetworkAPEventType::TDENetworkAPEventType event); - void slotAccessPointAdded(TDENetworkWiFiAPInfo*); - void slotAccessPointRemoved(const TQString&); - - private: - void addWirelessNetworks(KPopupMenu* menu); - TQValueList getWirelessNetworks(); - TQValueList getWirelessConnections(); - TDEWiFiConnection* findMatchingConnection(const WirelessNetwork& net, const TQValueList& connection); - bool findMatchingNetwork(const TDEWiFiConnection* conn, const TQValueList& nets, WirelessNetwork& net); - void setPixmapForStates(TDENetworkConnectionStatus::TDENetworkConnectionStatus states, TQString pixmap); - - WirelessDeviceTrayPrivate* d; - -}; - -#endif /* KNETWORKMANAGER_WIRELESS_DEVICE_TRAY_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp deleted file mode 100644 index baec85f..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wireless_manager.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -// KNM includes -#include "knetworkmanager-wireless_manager.h" - -TQValueList WirelessManager::getWirelessNetworks(TDENetworkDevice* dev, TQ_UINT32 match) -{ - TQValueList nets; - TQValueList aps; - // fetch all APs - aps = WirelessManager::getAccessPoints(dev); - - // now group the APs together according to their security settings - for (TQValueList::Iterator apit = aps.begin(); apit != aps.end(); ++apit) - { - bool found = false; - - // no hidden APs - TDENetworkWiFiAPInfo * ap = *apit; - if ( ap ) { - if (ap->SSID.count() == 0) { - continue; - } - - // check if we have a network matching this AP - for (TQValueList::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 internalGetAccessPoints(TDENetworkDevice* dev) { - TQValueList list; - if (dev) { - TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); - TDENetworkHWNeighbor* neighbor; - TDENetworkHWNeighborList* neighbors = deviceConnMan->siteSurvey(); - for (neighbor = neighbors->first(); neighbor; neighbor = neighbors->next()) { - TDENetworkWiFiAPInfo* apInfo = dynamic_cast(neighbor); - if (!apInfo) { - continue; - } - list.append(apInfo); - } - } - return list; -} - -TQValueList WirelessManager::getAccessPoints(TDENetworkDevice* dev) -{ - // build up AP list depending on one device or on all devices - if (dev) { - return internalGetAccessPoints(dev); - } - else { - TQValueList aps; - TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); - if (hwdevices) { - TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network); - for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) { - TDENetworkDevice* wdev = dynamic_cast(*it); - if (wdev) { - aps += internalGetAccessPoints(wdev); - } - } - } - return aps; - } -} - -TQValueList WirelessManager::getWirelessConnections() -{ - TQValueList conns; - - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - if (nm) { - // get all wireless connections - TDENetworkConnectionList* allconmap = nm->connections(); - for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) { - TDEWiFiConnection* wireless_conn = dynamic_cast(*it); - if (!wireless_conn) { - continue; - } - conns.append(wireless_conn); - } - } - - return conns; -} - -TQValueList internalGetAccessPointsWithESSID(TQByteArray essid, TDENetworkDevice* dev) { - TQValueList list; - if (dev) { - TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); - TDENetworkHWNeighbor* neighbor; - TDENetworkHWNeighborList* neighbors = deviceConnMan->siteSurvey(); - for (neighbor = neighbors->first(); neighbor; neighbor = neighbors->next()) { - TDENetworkWiFiAPInfo* apInfo = dynamic_cast(neighbor); - if (!apInfo) { - continue; - } - if (apInfo->SSID == essid) { - list.append(apInfo); - } - } - } - return list; -} - -TQValueList WirelessManager::getAccessPointsForEssid(TQByteArray essid, TDENetworkDevice* dev) -{ - // build up AP list depending on one device or on all devices - if (dev) { - return internalGetAccessPointsWithESSID(essid, dev); - } - else { - TQValueList aps; - TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); - if (hwdevices) { - TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network); - for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) { - TDENetworkDevice* wdev = dynamic_cast(*it); - if (wdev) { - aps += internalGetAccessPointsWithESSID(essid, wdev); - } - } - } - return aps; - } -} - - diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_manager.h b/tdenetworkmanager/src/knetworkmanager-wireless_manager.h deleted file mode 100644 index 75d9f4a..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wireless_manager.h +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wireless_manager.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-device_tray.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 getWirelessNetworks(TDENetworkDevice* dev = 0, TQ_UINT32 match = WirelessNetwork::MATCH_SSID); - - // get all aps from either one device or from all available devices - static TQValueList getAccessPoints(TDENetworkDevice* dev = 0); - - // get a list of all known wireless connections - static TQValueList getWirelessConnections(); - - // get a list of all APs with a specific SSID - static TQValueList getAccessPointsForEssid(TQByteArray, TDENetworkDevice* dev = 0); - -}; - -#endif /* KNETWORKMANAGER_WIRELESS_MANAGER_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.cpp deleted file mode 100644 index dd7fc81..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-tray.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig , - * Will Stephenson , - * Valentine Sinitsyn - * Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "knetworkmanager-wireless_menuitem.h" -#include "knetworkmanager-wireless_network.h" -#include "knetworkmanager-connection_setting_info.h" - -using namespace ConnectionSettings; - -void WirelessNetworkItem::slotActivate() -{ - - TDENetworkConnectionManager* deviceConnMan = _dev->connectionManager(); - - printf("slotActivate\n\r"); - if (_dev && deviceConnMan) - { - if ( _conn ) - { - kdDebug() << "Activate Connection " << _conn->UUID.ascii() << " on Device " << _dev->deviceNode().ascii() << endl; - TDENetworkConnectionStatus::TDENetworkConnectionStatus result = deviceConnMan->initiateConnection(_conn->UUID); - if ((result == TDENetworkConnectionStatus::Disconnected) - || (result == TDENetworkConnectionStatus::Invalid)) { - 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() & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None) && ((_net.getRsnFlags() & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None)) { - security = TQString("(%1/%2)").arg(i18n("WPA")).arg(i18n("RSN")); - } - else if ((_net.getWpaFlags() & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None) { - security = TQString("(%1)").arg(i18n("WPA")); - } - else if ((_net.getRsnFlags() & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None) { - security = TQString("(%2)").arg(i18n("RSN")); - } - - if (_conn && (_conn->friendlyName != _net.getDisplaySsid())) { - return TQString("%2/%1 %3").arg(TQString::fromUtf8(_net.getDisplaySsid())).arg(_conn->friendlyName).arg(security); - } - else { - return TQString("%1 %2").arg(TQString::fromUtf8(_net.getDisplaySsid())).arg(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->setSizePolicy (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->palette ().active ().highlightedText ()); - pbarStrength->setBackgroundMode( TQt::PaletteHighlight, TQt::PaletteHighlight ); - } else { - p->setPen(parent->palette ().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->sizeHint ().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->sizeHint ().width () - pbarStrength->width () - _space - pmAdHoc.size ().width () - spacer - 6, y + _border, pmAdHoc); - } - - p->drawPixmap (parent->sizeHint ().width () - pbarStrength->width () - _space, y +_border, TQPixmap::grabWidget (pbarStrength)); -} - -TQSize -WirelessNetworkItem::sizeHint () -{ - return TQSize (_width, _height); -} - -WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, TDENetworkDevice* dev, WirelessNetwork& net, TDEWiFiConnection* 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->style ().pixelMetric (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->style ().pixelMetric (TQStyle::PM_DefaultFrameWidth)) - _border += 2 * kapp->style ().pixelMetric (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, TDENetworkDevice* 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->style ().pixelMetric (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->style ().pixelMetric (TQStyle::PM_DefaultFrameWidth)) - _border += 2 * kapp->style ().pixelMetric (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/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.h b/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.h deleted file mode 100644 index 960258e..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.h +++ /dev/null @@ -1,87 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "knetworkmanager-wireless_network.h" - -class WirelessNetworkItem : public NetworkMenuItem, public TQCustomMenuItem -{ - Q_OBJECT - - public: - WirelessNetworkItem (TQWidget*, TDENetworkDevice* dev, WirelessNetwork& net, TDEWiFiConnection* conn, bool adhoc); - WirelessNetworkItem (TQWidget*, TDENetworkDevice* dev, WirelessNetwork& net, bool adhoc); - ~WirelessNetworkItem (); - - TQWidget* parent; - TQProgressBar* pbarStrength; - - void paint (TQPainter*, const TQColorGroup&, bool, bool, int, int, int, int); - TQSize sizeHint (); - - public slots: - void slotActivate(); - - private: - TQString getDisplayText(); - - bool _adhoc; - WirelessNetwork _net; - TDENetworkDevice* _dev; - TDEWiFiConnection* _conn; - - /* menu item */ - int _width; - int _height; - int _border; - - /* elements */ - int _textHeight; - int _widgetHeight; - - int _space; -}; - -#endif /* KNETWORKMANAGER_WIRELESSMENUITEM_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp deleted file mode 100644 index b8328ee..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wireless_network.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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.h" -#include "knetworkmanager-wireless_network.h" - -// TDE includes -#include - -// TQt includes -#include -#include - -class WirelessNetworkPrivate -{ - public: - WirelessNetworkPrivate() - : active(false) - { - } - - ~WirelessNetworkPrivate() - { - } - - bool active; - - TQ_UINT32 match; - TQValueList 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 TDENetworkWiFiAPInfo * const ap) -{ - if ( (d->match & MATCH_SSID) && getSsid() != ap->SSID) { - return false; - } - - // AP matches - return true; -} - -bool WirelessNetwork::addAP(const TDENetworkWiFiAPInfo * 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()))->SSID; - } - else { - return TQByteArray(); - } -} - -TQString WirelessNetwork::getDisplaySsid() const -{ - if (!d->aps.isEmpty()) { - return (*(d->aps.begin()))->friendlySSID(); - } - else { - return TQString(); - } -} - -TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getFlags() const -{ - TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; - for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { - flags |= ((*it)->wpaFlags & TDENetworkWiFiAPFlags::GeneralFlagsMask); - flags |= ((*it)->rsnFlags & TDENetworkWiFiAPFlags::GeneralFlagsMask); - } - return flags; -} - -TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getWpaFlags() const -{ - TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; - for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) - { - flags |= ((*it)->wpaFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask); - } - return flags; -} - -TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getRsnFlags() const -{ - TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; - for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) - { - flags |= ((*it)->rsnFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask); - } - return flags; -} - -bool WirelessNetwork::isEncrypted() const -{ - return (getFlags() & TDENetworkWiFiAPFlags::PrivacySupport); -} - -TQ_UINT8 WirelessNetwork::getStrength() const -{ - TQ_UINT8 strength = 0; - for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { - if (((*it)->signalQuality*100.0) > strength) { - strength = ((*it)->signalQuality*100.0); - } - } - return strength; -} - -void WirelessNetwork::setActive(bool a) -{ - d->active=a; -} - -bool WirelessNetwork::getActive() const -{ - return d->active; -} - diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_network.h b/tdenetworkmanager/src/knetworkmanager-wireless_network.h deleted file mode 100644 index 979eddc..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wireless_network.h +++ /dev/null @@ -1,92 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wireless_network.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - -#include -#include - -class KNetworkManager; -class WirelessNetworkPrivate; - -/* - 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 TDENetworkWiFiAPInfo * const); - - // add an AP to the Network - bool addAP(const TDENetworkWiFiAPInfo * const); - - // combined flags of all APs - TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags getFlags() const; - - // combined wpa-flags of all APs - TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags getWpaFlags() const; - - // combined rsn-flags of all APs - TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags 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/tdenetworkmanager/src/knetworkmanager.cpp b/tdenetworkmanager/src/knetworkmanager.cpp deleted file mode 100644 index 5a3d281..0000000 --- a/tdenetworkmanager/src/knetworkmanager.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 - * - **************************************************************************/ - -// TDE includes -#include -#include -#include -#include - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-tray.h" - -#include - -// TQt includes -#include -#include - -// KDE includes -#include -#include - -extern TDENetworkConnectionStatus::TDENetworkConnectionStatus nm_device_state_global; - -class KNetworkManagerPrivate -{ - public: - KNetworkManagerPrivate() {} - ~KNetworkManagerPrivate() {} - static KNetworkManager* _ctx; -}; - -KNetworkManager* KNetworkManagerPrivate::_ctx = NULL; - -KNetworkManager* KNetworkManager::getInstance() -{ - return KNetworkManagerPrivate::_ctx; -} - -void -KNetworkManager::slotShutDown() -{ - // -} - -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())); - - // create the main-tray-icon - Tray* tray = Tray::getInstance(); - tray->show(); - setMainWidget(tray); -} - -KNetworkManager::~KNetworkManager() -{ - delete d; -} - -#include "knetworkmanager.moc" - diff --git a/tdenetworkmanager/src/knetworkmanager.desktop b/tdenetworkmanager/src/knetworkmanager.desktop deleted file mode 100644 index fc9b45f..0000000 --- a/tdenetworkmanager/src/knetworkmanager.desktop +++ /dev/null @@ -1,47 +0,0 @@ -[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 TDE frontend for NetworkManager -Comment[bg]=Интерфейс за NetworkManager (TDE) -Comment[bn]=নেটওয়ার্ক-ম্যানেজারের জন্য একটি কেডিই ফ্রন্ট-এন্ড -Comment[ca]=Un frontal del TDE per al NetworkManager -Comment[da]=En TDE-grænseflade for Networkmanager -Comment[de]=Eine TDE-Oberfläche für NetworkManager -Comment[el]=Μια διασύνδεση περιβάλλοντος για το NetworkManager -Comment[es]=Una interfaz de TDE a NetworkManager -Comment[et]=TDE NetworkManageri kasutajaliides -Comment[it]=Un front-end di NetworkManager per TDE -Comment[ja]=NetworkManager の TDE フロントエンド -Comment[nl]=Een TDE-schil voor NetworkManager -Comment[pt]=Uma interface para TDE do NetworkManager -Comment[sr]=TDE програм за NetworkManager -Comment[sr@Latn]=TDE program za NetworkManager -Comment[sv]=Ett gränssnitt till Networkmanager för TDE -Comment[tr]=NetworkManager için bir TDE ön yüzü -X-TDE-autostart-after=panel -X-TDE-StartupNotify=false -X-TDE-UniqueApplet=true -X-DCOP-ServiceType=Unique -X-TDE-autostart-condition=knetworkmanagerrc:General:Autostart:true -Categories=Qt;TDE;Network;Applet; diff --git a/tdenetworkmanager/src/knetworkmanager.h b/tdenetworkmanager/src/knetworkmanager.h deleted file mode 100644 index cb48772..0000000 --- a/tdenetworkmanager/src/knetworkmanager.h +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005 Novell, Inc. - * - * Author: Timo Hoenig , - * - * 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 - -// KNM includes -#include "config.h" - -class KNetworkManagerPrivate; -class Device; - -class KNetworkManager : public KUniqueApplication -{ - Q_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/tdenetworkmanager/src/knetworkmanager.la.cpp b/tdenetworkmanager/src/knetworkmanager.la.cpp deleted file mode 100644 index 3d480c4..0000000 --- a/tdenetworkmanager/src/knetworkmanager.la.cpp +++ /dev/null @@ -1,2 +0,0 @@ -extern "C" int kdemain(int argc, char* argv[]); -int main(int argc, char* argv[]) { return kdemain(argc,argv); } diff --git a/tdenetworkmanager/src/knetworkmanager_dummy.cpp b/tdenetworkmanager/src/knetworkmanager_dummy.cpp deleted file mode 100644 index efd89d8..0000000 --- a/tdenetworkmanager/src/knetworkmanager_dummy.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include -extern "C" int kdemain(int argc, char* argv[]); -extern "C" KDE_EXPORT int tdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); } diff --git a/tdenetworkmanager/src/knetworkmanager_plugin.desktop b/tdenetworkmanager/src/knetworkmanager_plugin.desktop deleted file mode 100644 index ec85a19..0000000 --- a/tdenetworkmanager/src/knetworkmanager_plugin.desktop +++ /dev/null @@ -1,31 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Type=ServiceType -X-TDE-ServiceType=KNetworkManager/Plugin -X-TDE-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/tdenetworkmanager/src/knetworkmanager_vpnplugin.desktop b/tdenetworkmanager/src/knetworkmanager_vpnplugin.desktop deleted file mode 100644 index 4cf28dc..0000000 --- a/tdenetworkmanager/src/knetworkmanager_vpnplugin.desktop +++ /dev/null @@ -1,33 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Type=ServiceType -X-TDE-ServiceType=KNetworkManager/VPNPlugin -X-TDE-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=TQString diff --git a/tdenetworkmanager/src/main.cpp b/tdenetworkmanager/src/main.cpp index fd11c11..db41130 100644 --- a/tdenetworkmanager/src/main.cpp +++ b/tdenetworkmanager/src/main.cpp @@ -32,7 +32,7 @@ #include // KNM includes -#include "knetworkmanager.h" +#include "tdenetman.h" static const char* knm_version = I18N_NOOP(KNETWORKMANAGER_VERSION_STRING); diff --git a/tdenetworkmanager/src/settings.kcfgc b/tdenetworkmanager/src/settings.kcfgc index 35e7882..a7ab93a 100644 --- a/tdenetworkmanager/src/settings.kcfgc +++ b/tdenetworkmanager/src/settings.kcfgc @@ -1,5 +1,5 @@ # Code generation options for kconfig_compiler -File=knetworkmanager.kcfg +File=tdenetworkmanager.kcfg ClassName=Settings Singleton=true Mutators=true diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.cpp index 50d7423..e4337a9 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,10 +34,10 @@ #include #include -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection_setting.h" -#include "knetworkmanager-connection.h" +/* tdenetman headers */ +#include "tdenetman.h" +#include "tdenetman-connection_setting.h" +#include "tdenetman-connection.h" using namespace ConnectionSettings; @@ -103,4 +103,4 @@ ConnectionSetting::emitValidityChanged() emit validityChanged(); } -#include "knetworkmanager-connection_setting.moc" +#include "tdenetman-connection_setting.moc" diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.h index f189117..08b3ba7 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-connection_setting.h - A NetworkManager frontend for KDE + * tdenetman-connection_setting.h - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.cpp index 4904f01..21beba8 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-connection_setting_8021x.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_8021x.cpp - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,12 +34,12 @@ #include #include -/* 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" +/* tdenetman headers */ +#include "tdenetman.h" +#include "tdenetman-connection_setting_8021x.h" +#include "tdenetman-accesspoint.h" +#include "tdenetman-connection_setting_wireless.h" +#include "tdenetman-connection.h" #include "sha1.h" #include "md5.h" diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.h index a5c593e..a86a3c7 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-connection_setting_8021x.h - A NetworkManager frontend for KDE + * tdenetman-connection_setting_8021x.h - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" #include "qbidirectionalmap.h" /* NM */ #include diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.cpp index 854590c..5e8886e 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-connection_setting_serial.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_serial.cpp - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,10 +34,10 @@ #include #include -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting_cdma.h" +/* tdenetman headers */ +#include "tdenetman.h" +#include "tdenetman-connection.h" +#include "tdenetman-connection_setting_cdma.h" using namespace ConnectionSettings; diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.h index c0825b3..a145988 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-connection_setting_cdma.h - A NetworkManager frontend for KDE + * tdenetman-connection_setting_cdma.h - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" /* NM headers */ #include diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.cpp index cd38c3f..b0714e0 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-connection_setting_gsm.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_gsm.cpp - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,10 +34,10 @@ #include #include -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting_gsm.h" +/* tdenetman headers */ +#include "tdenetman.h" +#include "tdenetman-connection.h" +#include "tdenetman-connection_setting_gsm.h" /* network-manager headers */ #include diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.h index ac912ae..9ca5e07 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-connection_setting_gsm.h - A NetworkManager frontend for KDE + * tdenetman-connection_setting_gsm.h - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" /* NM headers */ #include diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.cpp index 225d002..a433bf5 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,10 +34,10 @@ #include #include -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-accesspoint.h" +/* tdenetman headers */ +#include "tdenetman.h" +#include "tdenetman-connection_setting_info.h" +#include "tdenetman-accesspoint.h" using namespace ConnectionSettings; diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.h index 705387b..facf9c7 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include #include -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" /* NM headers */ #include diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.cpp index 15f8978..263f65e 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,9 +34,9 @@ #include #include -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection_setting_ipv4.h" +/* tdenetman headers */ +#include "tdenetman.h" +#include "tdenetman-connection_setting_ipv4.h" using namespace ConnectionSettings; diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.h index 7788769..506631d 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" /* NM headers */ #include diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.cpp index 257a012..513a3ca 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-connection_setting_ppp.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_ppp.cpp - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -37,10 +37,10 @@ #include #include -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting_ppp.h" +/* tdenetman headers */ +#include "tdenetman.h" +#include "tdenetman-connection.h" +#include "tdenetman-connection_setting_ppp.h" using namespace ConnectionSettings; diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.h index 9f72e42..ddb966a 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-connection_setting_ppp.h - A NetworkManager frontend for KDE + * tdenetman-connection_setting_ppp.h - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" namespace ConnectionSettings { diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.cpp index 4861e7b..d7245a9 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-connection_setting_serial.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_serial.cpp - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,10 +34,10 @@ #include #include -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting_serial.h" +/* tdenetman headers */ +#include "tdenetman.h" +#include "tdenetman-connection.h" +#include "tdenetman-connection_setting_serial.h" using namespace ConnectionSettings; diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.h index 40099a7..956e3c2 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-connection_setting_serial.h - A NetworkManager frontend for KDE + * tdenetman-connection_setting_serial.h - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" /* NM headers */ #include diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.cpp index 22e8b20..4d45f2b 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-connection_setting_vpn.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_vpn.cpp - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,9 +34,9 @@ #include #include -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection_setting_vpn.h" +/* tdenetman headers */ +#include "tdenetman.h" +#include "tdenetman-connection_setting_vpn.h" using namespace ConnectionSettings; diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.h index 6850fc2..e1c1a7a 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-connection_setting_vpn.h - A NetworkManager frontend for KDE + * tdenetman-connection_setting_vpn.h - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include #include -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" /* NM headers */ #include diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.cpp index 03aa61f..068592c 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -37,10 +37,10 @@ /* NM headers */ #include -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection_setting_wired.h" -#include "knetworkmanager-accesspoint.h" +/* tdenetman headers */ +#include "tdenetman.h" +#include "tdenetman-connection_setting_wired.h" +#include "tdenetman-accesspoint.h" using namespace ConnectionSettings; diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.h index 9da930e..ba430f0 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -32,7 +32,7 @@ #include #include -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" #include namespace ConnectionSettings diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.cpp index 2e1db8e..1076994 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -35,11 +35,11 @@ #include #include -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection_setting_wireless.h" -#include "knetworkmanager-connection_setting_wireless_security.h" -#include "knetworkmanager-accesspoint.h" +/* tdenetman headers */ +#include "tdenetman.h" +#include "tdenetman-connection_setting_wireless.h" +#include "tdenetman-connection_setting_wireless_security.h" +#include "tdenetman-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}" diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.h index acdec94..83acae2 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -32,7 +32,7 @@ #include #include -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" #include "qbidirectionalmap.h" /* NM headers */ #include diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.cpp index a01f8f6..7b72a83 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.cpp @@ -1,6 +1,6 @@ /************************************************************************** * - * knetworkmanager-connection_setting_wireless_security.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_wireless_security.cpp - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,12 +34,12 @@ #include #include -/* 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" +/* tdenetman headers */ +#include "tdenetman.h" +#include "tdenetman-connection_setting_wireless_security.h" +#include "tdenetman-accesspoint.h" +#include "tdenetman-connection_setting_wireless.h" +#include "tdenetman-connection.h" #include "sha1.h" #include "md5.h" diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.h index 187fd37..34db7b0 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" #include "qbidirectionalmap.h" /* NM */ #include diff --git a/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp new file mode 100644 index 0000000..cdfa153 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp @@ -0,0 +1,130 @@ +/*************************************************************************** + * + * tdenetman-cellular_device_tray.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 // for TQt::WidgetFlags + +// KDE includes +#include +#include +#include + +// KNM includes +#include "tdenetman-cellular_device_tray.h" +#include "tdenetman-menuitem.h" +#include "tdenetman-menu_subhead.h" + +#include "tdenetman-connection_settings_dialog.h" + +using namespace ConnectionSettings; + +class CellularDeviceTrayPrivate +{ + public: + CellularDeviceTrayPrivate() {} + ~CellularDeviceTrayPrivate() {} + + TDENetworkDevice* dev; +}; + +void CellularDeviceTray::newConnection() +{ + // create an appropriate connection + TDENetworkConnection* conn = 0; + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + switch (deviceConnMan->deviceType()) { + case TDENetworkDeviceType::Modem: + conn = new TDEModemConnection(); + break; + + default: + break; + } + + // edit the new connection + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, tray(), "connect_something", false, TQt::WDestructiveClose); + dlg->show(); +} + + +void CellularDeviceTray::addMenuItems(KPopupMenu* menu) +{ + // device title + Subhead* subhead = new Subhead (menu, "subhead", d->dev->deviceNode(), SmallIcon("nm_device_wwan", TQIconSet::Automatic)); + menu->insertItem (subhead, -1, -1); + + //menu->insertSeparator(); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnection* active_conn = NULL; + if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected)) + && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) { + active_conn = nm->findConnectionByUUID(deviceConnMan->deviceInformation().activeConnectionUUID); + } + + // get all available Connections for cellular devices + + TDENetworkConnectionList* allconmap = nm->connections(); + for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) { + TDEModemConnection* conn = dynamic_cast(*it); + if (!conn) { + continue; + } + + // lets create a nice name for this connection + TQString title = conn->friendlyName; + if (conn->ipConfig.valid) { + title += TQString(" (%1)").arg((conn->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPIP) ? i18n("DHCP") : i18n("Manual IP config")); + } + + NetworkMenuItem* item = new NetworkMenuItem(d->dev, conn, 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 (TDENetworkDevice* dev, KSystemTray * parent, const char * name) + : DeviceTrayComponent (dev, parent, name) +{ + d = new CellularDeviceTrayPrivate(); + d->dev = dev; + + setPixmapForState(TDENetworkConnectionStatus::Connected, "nm_device_wwan"); +} + +CellularDeviceTray::~CellularDeviceTray () +{ + delete d; +} + + +#include "tdenetman-cellular_device_tray.moc" diff --git a/tdenetworkmanager/src/tdenetman-cellular_device_tray.h b/tdenetworkmanager/src/tdenetman-cellular_device_tray.h new file mode 100644 index 0000000..f6fdf89 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-cellular_device_tray.h @@ -0,0 +1,55 @@ +/*************************************************************************** + * + * tdenetman.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Will Stephenson , + * Helmut Schaa , + * + * 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 "tdenetman.h" +#include "devicetraycomponent.h" + +// predefs +class CellularDevice; +class CellularDeviceTrayPrivate; + +class CellularDeviceTray : public DeviceTrayComponent +{ + Q_OBJECT + + public: + CellularDeviceTray (TDENetworkDevice*, 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/tdenetworkmanager/src/tdenetman-connection_editor.cpp b/tdenetworkmanager/src/tdenetman-connection_editor.cpp new file mode 100644 index 0000000..5c3ea1a --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-connection_editor.cpp @@ -0,0 +1,242 @@ +/*************************************************************************** + * + * tdenetman-connection_editor.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * Author: Timothy Pearson + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +// kde headers +#include +#include +#include +#include +#include +#include + +// knm headers +#include "tdenetman-connection_editor.h" +#include "tdenetman-connection_settings_dialog.h" + +using namespace ConnectionSettings; + +/* + * ConnectionListViewItem + */ +class ConnectionListViewItem : public KListViewItem +{ + public: + + ConnectionListViewItem(TQListView* parent, TDENetworkConnection* connection) + : KListViewItem(parent) + , _conn(connection) + { + if (_conn) { + setText(0, _conn->friendlyName); + setText(1, TDENetworkConnectionManager::friendlyConnectionTypeName(_conn->type())); + // TODO: Move to a Factory + if (_conn->type() == TDENetworkConnectionType::WiredEthernet) { + setPixmap(0, KGlobal::iconLoader()->loadIcon("wired", KIcon::Small)); + } + else if (_conn->type() == TDENetworkConnectionType::WiFi) { + setPixmap(0, KGlobal::iconLoader()->loadIcon("wireless", KIcon::Small)); + } +// else if (_conn->type() == TDENetworkConnectionType::VPN) { +// setPixmap(0, KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small)); +// } + else { + setPixmap(0, KGlobal::iconLoader()->loadIcon("help", KIcon::Small)); + } + } + } + + TDENetworkConnection* _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 TDEWiFiConnection()); +} + +/* + * New Wired connection + */ +void ConnectionEditorImpl::slotNewWiredConnection() +{ + slotEditNewConnection(new TDEWiredEthernetConnection()); +} + +/* + * New VPN connection + */ +void ConnectionEditorImpl::slotNewVPNConnection() +{ +// slotEditNewConnection(new TDEVPNConnection()); +} + +/* + * + */ +void ConnectionEditorImpl::slotEditNewConnection(TDENetworkConnection* conn) +{ + // open a dialog for editing the connection + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, this, "connect_something", false, TQt::WDestructiveClose); + connect(dlg, TQT_SIGNAL(connectionSaved()), this, TQT_SLOT(slotRefreshConnectionList())); + dlg->show(); +} + +void ConnectionEditorImpl::slotRefreshConnectionList() +{ + fillConnectionList(); +} + +/* + * Edit the selected connection + */ +void ConnectionEditorImpl::slotEditCurrentConnection() +{ + ConnectionListViewItem* item = dynamic_cast(lvConnections->currentItem()); + if (!item) { + return; + } + + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (!nm) { + return; + } + + TDENetworkConnection* conn = item->_conn; + + // we need the secrets for editing + nm->loadConnectionSecrets(conn->UUID); + + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, false, this, "connect_something", false, TQt::WDestructiveClose); + dlg->show(); + + // save all connections (if not done already) + nm->saveConnection(conn); +} + + +/* + * Delete the selected connection + */ +void ConnectionEditorImpl::slotRemoveCurrentConnection() +{ + ConnectionListViewItem* item = dynamic_cast(lvConnections->currentItem()); + if (!item) { + return; + } + + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (!nm) { + return; + } + + TDENetworkConnection* conn = item->_conn; + + lvConnections->takeItem(item); + delete item; + + nm->deleteConnection(conn->UUID); +} + +/* + * Fill the connection list + */ +void ConnectionEditorImpl::fillConnectionList() +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (!nm) { + return; + } + + lvConnections->clear(); + + TDENetworkConnectionList* allconmap = nm->connections(); + for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) { + TDENetworkConnection* conn = *it; + new ConnectionListViewItem(lvConnections, conn); + } +} + +#include "tdenetman-connection_editor.moc" diff --git a/tdenetworkmanager/src/tdenetman-connection_editor.h b/tdenetworkmanager/src/tdenetman-connection_editor.h new file mode 100644 index 0000000..8026b8d --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-connection_editor.h @@ -0,0 +1,68 @@ +/*************************************************************************** + * + * tdenetman-connection_editor.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 + +// tqt headers +#include + +// tqt autogenerated headers +#include "connection_editor.h" + +// TDE headers +#include +#include + +class TQWidget; +class Device; + +namespace ConnectionSettings +{ + class WidgetInterface; + class ConnectionSetting; +} + +class ConnectionEditorImpl : public ConnectionEditor +{ + Q_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(TDENetworkConnection* conn); + void slotRefreshConnectionList(); + void slotNewVPNConnection(); + + private: + void fillConnectionList(); +}; + +#endif /* KNETWORKMANAGER_CONNECTION_EDITOR_H*/ diff --git a/tdenetworkmanager/src/tdenetman-device_tray.cpp b/tdenetworkmanager/src/tdenetman-device_tray.cpp new file mode 100644 index 0000000..d9bedc0 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-device_tray.cpp @@ -0,0 +1,379 @@ +/*************************************************************************** + * + * tdenetman-device_tray.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// TDE includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// KNM includes +#include "tdenetman-device_tray.h" +#include "tdenetman-menu_subhead.h" +#include "tdenetman-connection_settings_dialog.h" + +using namespace ConnectionSettings; + +class DeviceTrayPrivate +{ + public: + + DeviceTrayPrivate() + : dev(NULL) + { + tooltips[TDENetworkConnectionStatus::Invalid] = i18n("Unknown"); + tooltips[TDENetworkConnectionStatus::LinkUnavailable] = i18n("Down"); + tooltips[TDENetworkConnectionStatus::UnManaged] = i18n("Unmanaged"); + tooltips[TDENetworkConnectionStatus::Disconnected] = i18n("Disconnected"); + tooltips[TDENetworkConnectionStatus::EstablishingLink] = i18n("Preparing"); + tooltips[TDENetworkConnectionStatus::ConfiguringProtocols] = i18n("Configuration"); + tooltips[TDENetworkConnectionStatus::NeedAuthorization] = i18n("Awaiting authentication"); + tooltips[TDENetworkConnectionStatus::VerifyingProtocols] = i18n("IP configuration"); + tooltips[TDENetworkConnectionStatus::Connected] = i18n("Activated"); + tooltips[TDENetworkConnectionStatus::Failed] = i18n("Failed"); + } + + ~DeviceTrayPrivate() {} + + TDENetworkDevice* dev; + TQMap movies; + TQMap pixmaps; + TQMap tooltips; + + TQPixmap pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); + TQMovie movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); + TQString tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); +}; + +TQPixmap DeviceTrayPrivate::pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { + TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; + while (flag > 0) { + if (state & flag) { + if (pixmaps.contains(flag)) { + return pixmaps[flag]; + } + } + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); + } + return TQPixmap(); +} + +TQMovie DeviceTrayPrivate::movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { + TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; + while (flag > 0) { + if (state & flag) { + if (movies.contains(flag)) { + return movies[flag]; + } + } + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); + } + return TQMovie(); +} + +TQString DeviceTrayPrivate::tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { + TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; + while (flag > 0) { + if (state & flag) { + if (tooltips.contains(flag)) { + return tooltips[flag]; + } + } + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); + } + return TQString::null; +} + +TDENetworkDevice* DeviceTray::getDevice() const +{ + return d->dev; +} + +TQString DeviceTray::getTooltipText() +{ + + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnectionStatus::TDENetworkConnectionStatus state = deviceConnMan->deviceInformation().statusFlags; + TQString tooltip = TQString(); + + if (!d->tooltipForConnState(state).isEmpty()) { + tooltip += i18n("State: %1").arg(d->tooltipForConnState(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 ("tdenetman", 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(TDENetworkConnectionStatus::TDENetworkConnectionStatus state, TQMovie movie) +{ + d->movies[state] = movie; + slotUpdateDeviceState(); +} + +void DeviceTray::setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state, TQPixmap pixmap) +{ + d->pixmaps[state] = pixmap; + slotUpdateDeviceState(); +} + +void DeviceTray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) +{ + // stop the old movie to avoid unnecessary wakups + if (movie()) { + movie()->pause(); + } + + if (!d->movieForConnState(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->movieForConnState(state)); + + // start at the same frame as the movie before + if (frame > 0) + movie()->step(frame); + + // start the animation + movie()->unpause(); + } + else if (!d->pixmapForConnState(state).isNull()) { + setPixmap(d->pixmapForConnState(state)); + } + else { + setPixmap(loadSizedIcon("KNetworkManager", width())); + } + + m_currentIconState = state; +} + +void DeviceTray::updateActions(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) +{ + // allow device deactivation only when device is activated + KAction* deactivate = actionCollection()->action("deactivate_device"); + if (deactivate) + deactivate->setEnabled( (state & TDENetworkConnectionStatus::Connected || + state & TDENetworkConnectionStatus::VerifyingProtocols || + state & TDENetworkConnectionStatus::EstablishingLink || + state & TDENetworkConnectionStatus::ConfiguringProtocols || + state & TDENetworkConnectionStatus::NeedAuthorization) ); +} + +void DeviceTray::updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) +{ + if (!(state & TDENetworkConnectionStatus::Connected)) { + return; + } +} + +void DeviceTray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) +{ + updateTrayIcon(state); + updateActions(state); + updateActiveConnection(state); +} + +void DeviceTray::slotUpdateDeviceState() +{ + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + slotUpdateDeviceState(deviceConnMan->deviceInformation().statusFlags); +} + +void DeviceTray::loadIcons() { + d->pixmaps[TDENetworkConnectionStatus::Invalid] = loadSizedIcon("nm_no_connection", width()); + d->pixmaps[TDENetworkConnectionStatus::UnManaged] = loadSizedIcon("nm_no_connection", width()); + d->pixmaps[TDENetworkConnectionStatus::LinkUnavailable] = loadSizedIcon("nm_no_connection", width()); + d->pixmaps[TDENetworkConnectionStatus::Disconnected] = loadSizedIcon("nm_no_connection", width()); + + d->movies[TDENetworkConnectionStatus::EstablishingLink] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage01_connecting", KIcon::Panel)); + d->movies[TDENetworkConnectionStatus::EstablishingLink].pause(); + + d->movies[TDENetworkConnectionStatus::ConfiguringProtocols] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage02_connecting", KIcon::Panel)); + d->movies[TDENetworkConnectionStatus::ConfiguringProtocols].pause(); + + d->movies[TDENetworkConnectionStatus::VerifyingProtocols] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage03_connecting", KIcon::Panel)); + d->movies[TDENetworkConnectionStatus::VerifyingProtocols].pause(); + + d->movies[TDENetworkConnectionStatus::NeedAuthorization] = d->movies[TDENetworkConnectionStatus::ConfiguringProtocols]; + d->movies[TDENetworkConnectionStatus::NeedAuthorization].pause(); + + d->pixmaps[TDENetworkConnectionStatus::Connected] = loadSizedIcon("ok", width()); + + d->pixmaps[TDENetworkConnectionStatus::Failed] = loadSizedIcon("nm_no_connection", width()); +} + +DeviceTray::DeviceTray (TDENetworkDevice* dev) : KSystemTray () +{ + d = new DeviceTrayPrivate(); + d->dev = dev; + + m_currentIconState = TDENetworkConnectionStatus::Invalid; + loadIcons(); + + // get notified when the device state changes + connect(dev, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), this, TQT_SLOT(slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus))); + + 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 "tdenetman-device_tray.moc" diff --git a/tdenetworkmanager/src/tdenetman-device_tray.h b/tdenetworkmanager/src/tdenetman-device_tray.h new file mode 100644 index 0000000..82f7732 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-device_tray.h @@ -0,0 +1,88 @@ +/*************************************************************************** + * + * tdenetman-device_tray.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include "tdenetman.h" + +class DeviceTrayPrivate; + +class DeviceTray : public KSystemTray +{ + Q_OBJECT + + + public: + DeviceTray (TDENetworkDevice*); + ~DeviceTray (); + + void contextMenuAboutToShow (KPopupMenu* menu); + virtual void addMenuItems(KPopupMenu* menu) = 0; + TDENetworkDevice* getDevice() const; + + protected: + void setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQMovie); + void setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQPixmap); + void resizeEvent ( TQResizeEvent * ); + + virtual TQString getTooltipText(); + + public slots: + void setPixmap(const TQPixmap &); + void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + void slotUpdateDeviceState(); + + private: + void updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + void updateActions(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + void updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + void enterEvent (TQEvent*); + void loadIcons(); + + DeviceTrayPrivate* d; + TDENetworkConnectionStatus::TDENetworkConnectionStatus m_currentIconState; +}; + +#endif /* KNETWORKMANAGER_DEVICE_TRAY_H */ diff --git a/tdenetworkmanager/src/tdenetman-menu_subhead.cpp b/tdenetworkmanager/src/tdenetman-menu_subhead.cpp new file mode 100644 index 0000000..3821b80 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-menu_subhead.cpp @@ -0,0 +1,76 @@ +/*************************************************************************** + * + * tdenetman-tray.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Will Stephenson , + * Valentine Sinitsyn + * Helmut Schaa , + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tdenetman-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/tdenetworkmanager/src/tdenetman-menu_subhead.h b/tdenetworkmanager/src/tdenetman-menu_subhead.h new file mode 100644 index 0000000..a142d3e --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-menu_subhead.h @@ -0,0 +1,56 @@ +/*************************************************************************** + * + * tdenetman.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Will Stephenson , + * Helmut Schaa , + * + * 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 +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "tdenetman.h" + +class Subhead : public TQWidget +{ + public: + Subhead (TQWidget*, const char *, const TQString &, const TQPixmap); + ~Subhead (); +}; + +#endif /* KNETWORKMANAGER_MENU_SUBHEAD_H */ diff --git a/tdenetworkmanager/src/tdenetman-menuitem.cpp b/tdenetworkmanager/src/tdenetman-menuitem.cpp new file mode 100644 index 0000000..e59102f --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-menuitem.cpp @@ -0,0 +1,123 @@ +/*************************************************************************** + * + * tdenetman-menuitem.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006, 2008 Novell, Inc. + * + * Author: Timo Hoenig , + * Will Stephenson , + * Valentine Sinitsyn + * Helmut Schaa , + * + * 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 "tdenetman-menuitem.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace ConnectionSettings; + +class NetworkMenuItemPrivate +{ + public: + NetworkMenuItemPrivate(TDENetworkDevice* device, TDENetworkConnection* connection) + : dev(device), conn(connection) + { + + } + ~NetworkMenuItemPrivate() {} + + TQGuardedPtr dev; + TQGuardedPtr conn; +}; + +void NetworkMenuItem::slotActivate() +{ + kdDebug() << "NetworkMenuItem::slotActivate()" << endl; + + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + if (d->dev && d->conn) + { + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + if (deviceConnMan) + { + kdDebug() << "Activate Connection " << d->conn->UUID.ascii() << " on Device " << d->dev->deviceNode().ascii() << endl; + printf("Activate Connection %s on Device %s\n\r", d->conn->UUID.ascii(), d->dev->deviceNode().ascii()); + + TDENetworkConnectionStatus::TDENetworkConnectionStatus result = deviceConnMan->initiateConnection(d->conn->UUID); + if ((result == TDENetworkConnectionStatus::Disconnected) + || (result == TDENetworkConnectionStatus::Invalid)) { + // + } + 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->UUID.ascii()); + + TDENetworkConnectionStatus::TDENetworkConnectionStatus result = nm->initiateConnection(d->conn->UUID); + if ((result == TDENetworkConnectionStatus::Disconnected) + || (result == TDENetworkConnectionStatus::Invalid)) { + // + } + else { + kdDebug() << "ActivateConnection failed" << endl; + } + } + else + kdDebug() << "Device or Connection invalid" << endl; +} + +NetworkMenuItem::NetworkMenuItem (TDENetworkDevice* dev, TDENetworkConnection* conn, TQObject* parent, const char* name) + : TQObject(parent, name) +{ + d = new NetworkMenuItemPrivate(dev, conn); +} + +NetworkMenuItem::~NetworkMenuItem () +{ + delete d; +} + + + +#include "tdenetman-menuitem.moc" diff --git a/tdenetworkmanager/src/tdenetman-menuitem.h b/tdenetworkmanager/src/tdenetman-menuitem.h new file mode 100644 index 0000000..be1584e --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-menuitem.h @@ -0,0 +1,57 @@ +/*************************************************************************** + * + * tdenetman-menuitem.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006, 2008 Novell, Inc. + * + * Author: Helmut Schaa , + * Will Stephenson , + * + * 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 + +#include +#include + +class Device; +class NetworkMenuItemPrivate; + +namespace ConnectionSettings +{ + class Connection; +} + +class NetworkMenuItem : public TQObject +{ + Q_OBJECT + + public: + NetworkMenuItem (TDENetworkDevice* dev, TDENetworkConnection* conn, TQObject* parent = 0, const char* name = 0); + ~NetworkMenuItem (); + + public slots: + void slotActivate(); + + private: + NetworkMenuItemPrivate* d; +}; + +#endif /* KNETWORKMANAGER_MENUITEM_H */ diff --git a/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.cpp b/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.cpp new file mode 100644 index 0000000..756f0cc --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.cpp @@ -0,0 +1,81 @@ +/*************************************************************************** + * + * tdenetman-device.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Will Stephenson , + * + * 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 + +// TQtDBus includes +#include +#include +#include +#include +#include +#include + +// NM includes +#include +#include + +// KNM includes +#include "tdenetman.h" +#include "tdenetman-nm_vpn_proxy.h" +#include "tdenetman-device.h" +#include "tdenetman-devicestore.h" +//#include "tdenetman-connection.h" +#include "tdenetman-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 "tdenetman-nm_vpn_proxy.moc" diff --git a/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.h b/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.h new file mode 100644 index 0000000..b7d5ca7 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.h @@ -0,0 +1,52 @@ +/*************************************************************************** + * + * tdenetman-nm_proxy.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 + + public: + static NMVPNProxy* getInstance(); + + protected: + NMVPNProxy (); + ~NMVPNProxy (); + + private: + NMVPNProxyPrivate * d; +}; + +#endif /* KNETWORKMANAGER_NMVPNPROXY_H */ diff --git a/tdenetworkmanager/src/tdenetman-plugin.cpp b/tdenetworkmanager/src/tdenetman-plugin.cpp new file mode 100644 index 0000000..017db8d --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-plugin.cpp @@ -0,0 +1,38 @@ +/*************************************************************************** + * + * tdenetman-plugin.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 "tdenetman-plugin.h" + +Plugin::Plugin(TQObject* parent, const char* name, const TQStringList& ) + : TQObject(parent, name) +{ + +} + +Plugin::~Plugin() +{ + +} + +#include "tdenetman-plugin.moc" diff --git a/tdenetworkmanager/src/tdenetman-plugin.h b/tdenetworkmanager/src/tdenetman-plugin.h new file mode 100644 index 0000000..7bd2e99 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-plugin.h @@ -0,0 +1,39 @@ +/*************************************************************************** + * + * tdenetman-plugin.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 + +class Plugin : public TQObject +{ + Q_OBJECT + + public: + Plugin(TQObject*, const char*, const TQStringList&); + ~Plugin(); +}; + +#endif /* KNETWORKMANAGER_PLUGIN_H */ diff --git a/tdenetworkmanager/src/tdenetman-pluginmanager.cpp b/tdenetworkmanager/src/tdenetman-pluginmanager.cpp new file mode 100644 index 0000000..3111385 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-pluginmanager.cpp @@ -0,0 +1,184 @@ +/*************************************************************************** + * + * tdenetman-pluginmanager.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include +#include +#include + +#include "tdenetman-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::fromLatin1( "KNetworkManager/Plugin" ))); + + // a bit debug output + for(TQValueList::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it) + kdDebug() << k_funcinfo << TQString("Found Plugin '%1'").arg((*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::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::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::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( TQString::fromLatin1( "KNetworkManager/Plugin" ), + TQString::fromLatin1( "[X-KDE-PluginInfo-Name]=='%1'" ).arg( pluginID ), this, 0, TQStringList(), &error ); + + // plugin loaded? + if (plugin) + { + kdDebug() << k_funcinfo << TQString(i18n("successfully loaded plugin '%1'")).arg(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::ConstIterator it; + for ( it = this->_plugins.begin(); it != this->_plugins.end(); ++it ) + { + if ( ( *it )->pluginName() == pluginID ) + return *it; + } + + return 0L; +} + +#include "tdenetman-pluginmanager.moc" diff --git a/tdenetworkmanager/src/tdenetman-pluginmanager.h b/tdenetworkmanager/src/tdenetman-pluginmanager.h new file mode 100644 index 0000000..d36ce10 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-pluginmanager.h @@ -0,0 +1,67 @@ +/*************************************************************************** + * + * tdenetman-pluginmanager.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include +#include + +#include "tdenetman-plugin.h" +#include "tdenetman.h" + +class KPluginInfo; + +typedef TQMap PluginMap; + +class PluginManager : public TQObject +{ + Q_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 _plugins; + PluginMap _loadedPlugins; + + Plugin* loadPlugin(const TQString& pluginID); + KPluginInfo* infoForPluginID(const TQString& pluginID) const; + + static PluginManager* _instance; +}; + +#endif /* KNETWORKMANAGER_PLUGINMANAGER_H */ diff --git a/tdenetworkmanager/src/tdenetman-tray.cpp b/tdenetworkmanager/src/tdenetman-tray.cpp new file mode 100644 index 0000000..36407e8 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-tray.cpp @@ -0,0 +1,766 @@ +/*************************************************************************** + * + * tdenetman-tray.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Will Stephenson , + * Valentine Sinitsyn + * Helmut Schaa , + * Alexander Naumov , + * Author: Timothy Pearson + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "devicetraycomponent.h" +#include "tdenetman-tray.h" + +#include "tdenetman-connection_settings_dialog.h" +#include "tdenetman-connection_editor.h" +#include "tdenetman-menu_subhead.h" + +#include "tdenetman-wired_device_tray.h" +#include "tdenetman-wireless_device_tray.h" +#include "tdenetman-cellular_device_tray.h" + +#include + +TDENetworkConnectionStatus::TDENetworkConnectionStatus nm_device_state_global; + +NewSecretsDialog::NewSecretsDialog(TDENetworkConnection *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, Tray::getInstance(), "Edit connection"); + dlg->show(); + close(); +} + +void NewSecretsDialog::reject() +{ + TQDialog::reject(); +} + +void NewSecretsDialog::init() +{ + TDENetworkConnection* conn = _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 ").arg(conn->friendlyName), 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 trayComponents; + DeviceTrayComponent * foregroundTrayComponent; + TQSignalMapper signalMapper; + TQMap 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() +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (!nm) return; + nm->enableWiFi(true); +} + +void Tray::slotDisableWireless() +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (!nm) return; + nm->enableWiFi(false); +} + +void Tray::slotOfflineMode() +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (!nm) return; + nm->enableNetworking(false); +} + +void Tray::slotOnlineMode() +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (!nm) return; + nm->enableNetworking(true); +} + +void Tray::contextMenuAboutToShow (KPopupMenu* menu) +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + // clear menu + menu->clear(); + + if (!(nm->backendStatus() & TDENetworkGlobalManagerFlags::BackendUnavailable)) { + // actions for each Device + for (TQValueList::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("tdenetworkmanager_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(newConnAction); + newConnActionMenu->popupMenu()->clear(); + TQValueList::Iterator it; + for (it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) { + DeviceTrayComponent* dev_comp = dynamic_cast (*it); + KAction * deviceNewConnAction = 0; + if (dev_comp) { + TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->deviceNode()); + TQString menuCaption = TQString("%1").arg(dev_comp->device()->deviceNode()); + 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); + } + } + } + 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(actionCollection ()->action ("deactivate_menu") ); + disableStuffActionMenu->popupMenu()->clear(); + TDENetworkConnectionList* map = nm->connections(); + d->act_conn_map.clear(); + + for (TDENetworkConnectionList::Iterator it = map->begin(); it != map->end(); ++it) { + TDENetworkConnection* conn = (*it); + + if (!conn) { + continue; + } + + if ((nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Disconnected) + || (nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Invalid)) { + continue; + } + + TQString actionName = TQString("disable_connection_%1").arg(conn->UUID); + KAction * deviceNewConnAction = actionCollection ()->action (actionName); + TQString actionText = conn->friendlyName; + + 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, conn); + d->current_idx++; + disableStuffActionMenu->insert(deviceNewConnAction); + } + + // disable wireless + if (nm->wiFiHardwareEnabled()) { + KAction* wireless = NULL; + if (nm->wiFiEnabled()) { + wireless = actionCollection ()->action ("disable_wireless"); + } else { + wireless = actionCollection ()->action ("enable_wireless"); + } + disableStuffActionMenu->insert(wireless); + } + + // offline vs. online mode + KAction* switch_mode = NULL; + if (nm->backendStatus() != TDENetworkGlobalManagerFlags::Sleeping) { + 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(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState) +{ + TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags nm_state = newState; + // change tray icon according to NM's state + + if ((nm_state & TDENetworkGlobalManagerFlags::Unknown) + || (nm_state & TDENetworkGlobalManagerFlags::Sleeping) + || (nm_state & TDENetworkGlobalManagerFlags::EstablishingLink) + || (nm_state & TDENetworkGlobalManagerFlags::Disconnected) + || (nm_state & TDENetworkGlobalManagerFlags::BackendUnavailable)) { + setPixmap (loadIcon ("tdenetworkmanager_disabled")); + } + else if (nm_state & TDENetworkGlobalManagerFlags::Connected) { + setPixmap (loadIcon ("tdenetworkmanager")); + } + + 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::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::slotSecretsNeeded(TDENetworkConnection* connection, const TQStringList& hints, bool request_new) +{ + // For now assume secrets are already in NM... +} + +void Tray::slotAddDeviceTrayComponent(TDENetworkDevice* dev) +{ + if (dev) { + createDeviceTrayComponent(dev); + } +} + +void Tray::slotRemoveDeviceTrayComponent(TDENetworkDevice* dev) +{ + for (TQValueList::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) + { + DeviceTrayComponent* dev_comp = dynamic_cast(*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").arg(dev_comp->device()->deviceNode()); + 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(TDENetworkDevice* dev) +{ + bool trayExists = false; + + if (!dev) return; + + // check if we have already a trayicon for this device + for (TQValueList::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) + { + DeviceTrayComponent* dev_comp = dynamic_cast (*it); + if (dev_comp) + if (dev_comp->device() == dev) + { + trayExists = true; + break; + } + } + + // create the appropriate device tray icon + if (!trayExists) + { + DeviceTrayComponent* devTray = 0; + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + // different tray icons for different device types! + switch (deviceConnMan->deviceType()) + { + case TDENetworkDeviceType::WiredEthernet: + devTray = new WiredDeviceTray(dev, this, "wired_device_tray"); + break; + case TDENetworkDeviceType::WiFi: + devTray = new WirelessDeviceTray(dev, this, "wireless_device_tray"); + break; + case TDENetworkDeviceType::Modem: + devTray = new CellularDeviceTray(dev, this, "cellular_device_tray"); + break; + default: + kdWarning() << k_funcinfo << "UDI: " << dev->uniqueID() << " has unknown devicetype: " << deviceConnMan->deviceType() << 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::updateDeviceTrays() +{ + TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); + if (!hwdevices) return; + + // create one tray-icon for each device + TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network); + + // check for newly added devices + for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) + { + TDENetworkDevice* dev = dynamic_cast(*it); + if (dev) { + createDeviceTrayComponent(dev); + } + else { + kdWarning() << k_funcinfo << "got a NULL-Device" << endl; + } + } +} + +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) +{ + TDENetworkConnection* conn = d->act_conn_map[index]; + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (!nm) return; + + if (conn) { + nm->deactivateConnection(conn->UUID); + } +} + +void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt) +{ + DeviceTrayComponent * dtc = dynamic_cast(component); + if (dtc) { + kdDebug() << k_funcinfo << dtc->device()->deviceNode() << " : " << needsIt << endl; + TDENetworkDevice * 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 +#if 0 + // FIXME + // The TDE network backend has no concept of a default device + // Should it? + device = nm->getDefaultDevice(); + if ( device ) { + // identify the new foreground + for (TQValueList::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) + { + DeviceTrayComponent* newDtc = dynamic_cast (*it); + if ( newDtc && newDtc->device() == device ) { + d->foregroundTrayComponent = newDtc; + break; + } + } + kdDebug() << " Device " << dtc->device()->deviceNode() << " background, new foreground device: " << device->deviceNode() << endl; + connect(device, TQT_SIGNAL(StateChanged(NMDeviceState)), + TQT_SLOT(slotUpdateDeviceState(NMDeviceState))); + slotUpdateDeviceState(device->getState()); + } +#endif + } + } +} + +void Tray::slotUpdateDeviceState() +{ + // FIXME +} + +void Tray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) +{ + updateTrayIcon(state); + updateActiveConnection(state); +} + +void Tray::trayUiChanged() +{ + DeviceTrayComponent * dtc = d->foregroundTrayComponent; + if (dtc) { + TDENetworkConnectionManager* deviceConnMan = dtc->device()->connectionManager(); + updateTrayIcon(deviceConnMan->deviceInformation().statusFlags); + } +} +void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) +{ + // Get all active connections + char found_any_active_connection=0; + + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + found_any_active_connection = 0; + // Get all active connections + TDENetworkConnectionList* allconmap = nm->connections(); + for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) { + TDENetworkConnection* conn = (*it); + + if (!conn) { + continue; + } + + if ((nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Disconnected) + || (nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Invalid)) { + continue; + } + + // Found an active connection + found_any_active_connection = 1; + } + +// if (found_any_active_connection == 1) { +// printf("Active connection found\n\r"); +// } + + // 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("tdenetworkmanager")); + } + else { + setPixmap(loadIcon("tdenetworkmanager")); + } + + nm_device_state_global = state; + //printf("Device state: %d\n\r", nm_device_state_global); +} + +void Tray::updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) +{ + if (state != TDENetworkConnectionStatus::Connected) { + return; + } +} + +void Tray::slotDeviceAddedNotify(TDENetworkDevice* dev) +{ + kdDebug() << "Tray::slotDeviceAddedNotify" << endl; + KNotifyClient::event( winId(), "knm-nm-device-added", i18n("New network device %1 found").arg(dev->deviceNode()) ); +} + +void Tray::slotDeviceRemovedNotify(TDENetworkDevice* dev) +{ + kdDebug() << "Tray::slotDeviceRemovedNotify" << endl; + KNotifyClient::event( winId(), "knm-nm-device-removed", i18n("Network device %1 removed").arg(dev->deviceNode()) ); +} + +void Tray::slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState) +{ + TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags nm_state = newState; + + // change tray icon according to NM's state + if (nm_state & TDENetworkGlobalManagerFlags::EstablishingLink) { + KNotifyClient::event( winId(), "knm-nm-connecting", i18n("NetworkManager is connecting") ); + } + else if (nm_state & TDENetworkGlobalManagerFlags::Disconnected) { + KNotifyClient::event( winId(), "knm-nm-disconnected", i18n("NetworkManager is now disconnected") ); + } + else if (nm_state & TDENetworkGlobalManagerFlags::Connected) { + KNotifyClient::event( winId(), "knm-nm-connected", i18n("NetworkManager is now connected") ); + } + else if (nm_state & TDENetworkGlobalManagerFlags::Sleeping) { + KNotifyClient::event( winId(), "knm-nm-sleeping", i18n("KNetworkManager Offline") ); + } + else if (nm_state & TDENetworkGlobalManagerFlags::Unknown) { + // + } +} + +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 ("tdenetworkmanager")); + 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 + connect(KGlobal::networkManager(), TQT_SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, TQT_SLOT(slotStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags))); + + // get notified about new/removed devices + // FIXME +// DeviceStore* store = DeviceStore::getInstance(); +// connect(store, TQT_SIGNAL(DeviceStoreChanged()), this, TQT_SLOT(updateDeviceTrays())); +// connect(store, TQT_SIGNAL(DeviceAdded(TDENetworkDevice*)), this, TQT_SLOT(slotAddDeviceTrayComponent(TDENetworkDevice*))); +// connect(store, TQT_SIGNAL(DeviceRemoved(TDENetworkDevice*)), this, TQT_SLOT(slotRemoveDeviceTrayComponent(TDENetworkDevice*))); + + // Notifications + connect(KGlobal::networkManager(), TQT_SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, TQT_SLOT(slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags))); +// connect(store, TQT_SIGNAL(DeviceAdded(TDENetworkDevice*)), this, TQT_SLOT(slotDeviceAddedNotify(TDENetworkDevice*))); +// connect(store, TQT_SIGNAL(DeviceRemoved(TDENetworkDevice*)), this, TQT_SLOT(slotDeviceRemovedNotify(TDENetworkDevice*))); + + + // initial setup of the device-trays + updateDeviceTrays(); + + slotStateChanged(KGlobal::networkManager()->backendStatus(), TDENetworkGlobalManagerFlags::Unknown); +} + +Tray::~Tray () +{ + delete d; +} + +#include "tdenetman-tray.moc" + diff --git a/tdenetworkmanager/src/tdenetman-tray.h b/tdenetworkmanager/src/tdenetman-tray.h new file mode 100644 index 0000000..6f49012 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-tray.h @@ -0,0 +1,135 @@ +/*************************************************************************** + * + * tdenetman.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Will Stephenson , + * Helmut Schaa , + * Alexander Naumov , + * Author: Timothy Pearson + * + * 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 +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include "tdenetman.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 + + + 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(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState); + void slotSecretsNeeded(TDENetworkConnection* connection, const TQStringList& hints, bool request_new); + + void slotDeviceAddedNotify(TDENetworkDevice*); + void slotDeviceRemovedNotify(TDENetworkDevice*); + void slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState); + + void slotUpdateDeviceState(); + void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + + protected slots: + void updateDeviceTrays(); + void slotAddDeviceTrayComponent(TDENetworkDevice*); + void slotRemoveDeviceTrayComponent(TDENetworkDevice*); + void slotDeactivateConnection(int); + void trayComponentNeedsCenterStage(TrayComponent*, bool); + void trayUiChanged(); + void slotEditNotifications(); + + private: + void updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + void updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + void mousePressEvent(TQMouseEvent *e); + void createDeviceTrayComponent(TDENetworkDevice*); + void enterEvent(TQEvent*); + + TrayPrivate* d; + +}; + +class NewSecretsDialog : public TQDialog +{ + Q_OBJECT + + + public: + NewSecretsDialog(TDENetworkConnection* connection, TQWidget * parent, const char * name, bool modal = false, TQt::WFlags f = 0); + ~NewSecretsDialog(); + void init(); + + public slots: + void slotDialogEdit(); + void reject(); + + private: + TDENetworkConnection* _connection; +}; + +#endif /* KNETWORKMANAGER_TRAY_H */ diff --git a/tdenetworkmanager/src/tdenetman-vpn_plugin.cpp b/tdenetworkmanager/src/tdenetman-vpn_plugin.cpp new file mode 100644 index 0000000..e2ab272 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-vpn_plugin.cpp @@ -0,0 +1,132 @@ +/*************************************************************************** + * + * tdenetman-vpn_plugin.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * Author: Timothy Pearson + * + * 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 + +// TQt includes +#include + +// TQT_DBus includes +#include +#include +#include + +// NM includes +#include +#include + +// KNM includes +#include "tdenetman.h" +#include "tdenetman-tray.h" +#include "tdenetman-vpn_plugin.h" +#include "dbus/vpnpluginproxy.h" +#include "tdenetman-hal_device_proxy.h" +#include "tdenetman-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 "tdenetman-vpn_plugin.moc" diff --git a/tdenetworkmanager/src/tdenetman-vpn_plugin.h b/tdenetworkmanager/src/tdenetman-vpn_plugin.h new file mode 100644 index 0000000..784de6d --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-vpn_plugin.h @@ -0,0 +1,62 @@ +/*************************************************************************** + * + * tdenetman-wired_device.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * Author: Timothy Pearson + * + * 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 + +// KNM includes +#include "tdenetman.h" + +class KNetworkManager; + +class VPNDBUSPluginPrivate; + +class VPNDBUSPlugin : public TQObject +{ + Q_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/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp new file mode 100644 index 0000000..e29d744 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp @@ -0,0 +1,179 @@ +/*************************************************************************** + * + * tdenetman-vpnauthenticationdialog.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "tdenetman-vpnservice.h" +#include "tdenetman-vpnmanager.h" +#include "tdenetman-vpnauthenticationdialog.h" +#include "tdenetman-vpn_connection.h" +#include "tdenetman-nm_proxy.h" +#include "tdenetman-connection_setting_vpn.h" +#include "tdenetman-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").arg(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(minimumSizeHint()); +} + +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 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(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 "tdenetman-vpnauthenticationdialog.moc" diff --git a/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h new file mode 100644 index 0000000..ee48410 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h @@ -0,0 +1,69 @@ +/*************************************************************************** + * + * tdenetman-authenticationdialog.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include +#include +#include + +#include "tdenetman.h" +#include "vpnauthentication.h" +#include "tdenetman-vpnplugin.h" +#include "tdenetman-vpnmanager.h" + +class KNetworkManager; +class ManageConnectionsDialog; +class VPNService; + +namespace ConnectionSettings +{ + class VPNConnection; +} + +class VPNAuthenticationDialog : public AuthenticationDialog +{ + Q_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/tdenetworkmanager/src/tdenetman-vpnmanager.cpp b/tdenetworkmanager/src/tdenetman-vpnmanager.cpp new file mode 100644 index 0000000..62a0b8f --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-vpnmanager.cpp @@ -0,0 +1,107 @@ +/*************************************************************************** + * + * tdenetman-vpnmanager.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Helmut Schaa , + * + * 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 +#include +#include +#include + +#include "tdenetman-vpnmanager.h" +#include "tdenetman-vpnservice.h" +#include "tdenetman-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 "tdenetman-vpnmanager.moc" diff --git a/tdenetworkmanager/src/tdenetman-vpnmanager.h b/tdenetworkmanager/src/tdenetman-vpnmanager.h new file mode 100644 index 0000000..3030c07 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-vpnmanager.h @@ -0,0 +1,53 @@ +/*************************************************************************** + * + * tdenetman-vpnmanager.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Helmut Schaa + * + * 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 +#include + +#include +#include + +#include "tdenetman.h" +#include "tdenetman-vpnplugin.h" + +class KNetworkManager; +class VPNService; + +typedef TQValueList VPNServiceList; + +class VPNManager : public TQObject +{ + Q_OBJECT + + + public: + static VPNService* getVPNService(TQString); + static VPNServiceList getVPNServices (); +}; + +#endif /* KNETWORKMANAGER_VPNMANAGER_H */ diff --git a/tdenetworkmanager/src/tdenetman-vpnplugin.cpp b/tdenetworkmanager/src/tdenetman-vpnplugin.cpp new file mode 100644 index 0000000..dbeeb18 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-vpnplugin.cpp @@ -0,0 +1,128 @@ +/*************************************************************************** + * + * tdenetman-vpnplugin.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 + +#include "tdenetman-vpnplugin.h" + +/*********************** +* class VPNConfigWidget +***********************/ + +VPNConfigWidget::~VPNConfigWidget() +{ + +} + +VPNConfigWidget::VPNConfigWidget(TQWidget* parent, const char* name) + : TQWidget(parent, name) +{ + +} + +void VPNConfigWidget::setVPNData(const TQStringList& /*routes*/, const TQMap& /*properties*/) +{ + +} + +TQMap VPNConfigWidget::getVPNProperties() +{ + return TQMap(); +} + +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 VPNAuthenticationWidget::getPasswords() +{ + return TQMap(); +} + +void VPNAuthenticationWidget::setPasswords(TQString name, TQString value) +{ + +} + +void VPNAuthenticationWidget::setVPNData(const TQStringList& /*routes*/, const TQMap& /*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 "tdenetman-vpnplugin.moc" diff --git a/tdenetworkmanager/src/tdenetman-vpnplugin.h b/tdenetworkmanager/src/tdenetman-vpnplugin.h new file mode 100644 index 0000000..10f5d25 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-vpnplugin.h @@ -0,0 +1,79 @@ +/*************************************************************************** + * + * tdenetman-vpnplugin.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include +#include +#include +#include "tdenetman-plugin.h" + +#define KNETWORKMANAGER_VPNPLUGIN "KNetworkManager/VPNPlugin" + +class VPNConfigWidget : public TQWidget +{ + Q_OBJECT + + public: + virtual ~VPNConfigWidget(); + VPNConfigWidget(TQWidget* parent = NULL, const char* name = NULL); + + virtual void setVPNData(const TQStringList&, const TQMap&); + virtual TQMap getVPNProperties(); + virtual TQStringList getVPNRoutes(); + virtual bool hasChanged(); + virtual bool isValid(TQStringList&); +}; + +class VPNAuthenticationWidget : public TQWidget +{ + Q_OBJECT + + public: + virtual ~VPNAuthenticationWidget(); + VPNAuthenticationWidget(TQWidget* parent = NULL, const char* name = NULL); + + virtual void setVPNData(const TQStringList&, const TQMap&); + virtual TQMap getPasswords(); + virtual void setPasswords(TQString value, TQString data); + virtual bool needsUserInteraction(); +}; + +class VPNPlugin : public Plugin +{ + Q_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/tdenetworkmanager/src/tdenetman-vpnservice.cpp b/tdenetworkmanager/src/tdenetman-vpnservice.cpp new file mode 100644 index 0000000..978a183 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-vpnservice.cpp @@ -0,0 +1,123 @@ +/*************************************************************************** + * + * tdenetman-vpnservice.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Helmut Schaa , + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tdenetman-pluginmanager.h" +#include "tdenetman-vpnservice.h" +#include "tdenetman-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( plugMan->getPlugin(list.first()) ); + if (vpnPlugin) + { + kdDebug() << k_funcinfo << i18n("Using VPN plugin '%1' for service '%2'").arg(list.first()).arg(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 "tdenetman-vpnservice.moc" diff --git a/tdenetworkmanager/src/tdenetman-vpnservice.h b/tdenetworkmanager/src/tdenetman-vpnservice.h new file mode 100644 index 0000000..baf87a5 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-vpnservice.h @@ -0,0 +1,63 @@ +/*************************************************************************** + * + * tdenetman-vpnservice.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Helmut Schaa + * + * 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 +#include + +#include +#include + +#include "tdenetman.h" +#include "tdenetman-vpnplugin.h" + +class KNetworkManager; +class VPNService; +class KConfigGroup; + +class VPNService : public TQObject +{ + Q_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; +}; + +#endif /* KNETWORKMANAGER_VPN_SERVICE_H */ diff --git a/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp new file mode 100644 index 0000000..68a6069 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp @@ -0,0 +1,149 @@ +/*************************************************************************** + * + * tdenetman-wired_device_tray.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// KDE includes +#include +#include +#include + +// TQt DBus +#include + + +// KNM includes +#include "tdenetman-wired_device_tray.h" +#include "tdenetman-menuitem.h" +#include "tdenetman-menu_subhead.h" + +#include "tdenetman-connection_settings_dialog.h" + +using namespace ConnectionSettings; + +class WiredDeviceTrayPrivate +{ + public: + WiredDeviceTrayPrivate() {} + ~WiredDeviceTrayPrivate() {} + + TDENetworkDevice* dev; +}; + +void WiredDeviceTray::newConnection() +{ + // create a new wired connection + TDENetworkConnection* conn = new TDEWiredEthernetConnection(); + + // edit the new connection + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, tray(), "connect_something", false, TQt::WDestructiveClose); + dlg->show(); +} + + +void WiredDeviceTray::addMenuItems(KPopupMenu* menu) +{ + // device title + Subhead* subhead = new Subhead (menu, "subhead", TQString("Wired Connection (%1)").arg(d->dev->deviceNode()), SmallIcon("wired", TQIconSet::Automatic)); + menu->insertItem (subhead, -1, -1); + + // bolding subhead instead + //menu->insertSeparator(); + + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + if (deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::LinkUnavailable) { + // 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 { + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnection* active_conn = NULL; + if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected)) + && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) { + active_conn = nm->findConnectionByUUID(deviceConnMan->deviceInformation().activeConnectionUUID); + } + + // get all available Connections for wired devices + TDENetworkConnectionList* connections = nm->connections(); + int connectionItems = 0; + for (TDENetworkConnectionList::Iterator it = connections->begin(); it != connections->end(); ++it) { + TDEWiredEthernetConnection* conn = dynamic_cast(*it); + if (!conn) { + continue; + } + + // wired connection found :) + // lets create a nice name for this connection + TQString title = conn->friendlyName; + if (conn->ipConfig.valid) { + title += TQString(" (%1)").arg((conn->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPIP) ? i18n("DHCP") : i18n("Manual IP config")); + } + + NetworkMenuItem* item = new NetworkMenuItem(d->dev, conn, 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(); + 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 (TDENetworkDevice* dev, KSystemTray * parent, const char * name ) + : DeviceTrayComponent (dev, parent, name) +{ + d = new WiredDeviceTrayPrivate(); + d->dev = dev; + + setPixmapForState(TDENetworkConnectionStatus::Connected, "nm_device_wired"); +} + +WiredDeviceTray::~WiredDeviceTray () +{ + delete d; +} + +#include "tdenetman-wired_device_tray.moc" diff --git a/tdenetworkmanager/src/tdenetman-wired_device_tray.h b/tdenetworkmanager/src/tdenetman-wired_device_tray.h new file mode 100644 index 0000000..1ec550e --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-wired_device_tray.h @@ -0,0 +1,57 @@ +/*************************************************************************** + * + * tdenetman.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Will Stephenson , + * Helmut Schaa , + * + * 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 "tdenetman.h" + +// predefs +class WiredDevice; +class WiredDeviceTrayPrivate; + +class WiredDeviceTray : public DeviceTrayComponent +{ + Q_OBJECT + + + public: + WiredDeviceTray (TDENetworkDevice*, 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/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp new file mode 100644 index 0000000..d1b209e --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp @@ -0,0 +1,417 @@ +/*************************************************************************** + * + * tdenetman-wireless_device_tray.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// KDE includes +#include +#include +#include +#include + +// KNM includes +#include "tdenetman-wireless_device_tray.h" +#include "tdenetman-wireless_menuitem.h" +#include "tdenetman-wireless_network.h" +#include "tdenetman-menu_subhead.h" +#include "tdenetman-wireless_manager.h" +#include "tdenetman-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() {} + + TDENetworkDevice* dev; + TQGuardedPtr activeAccessPoint; +}; + +TQStringList WirelessDeviceTray::getToolTipText() +{ + TQStringList tooltip = DeviceTrayComponent::getToolTipText(); + + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkWiFiAPInfo * ap = deviceConnMan->findAccessPointByBSSID(deviceConnMan->deviceInformation().wiFiInfo.activeAccessPointBSSID); + if (ap) { + tooltip.append(i18n("Network: %1").arg(ap->friendlySSID())); + } + + return tooltip; +} + +void WirelessDeviceTray::newConnection() +{ + // create a new wireless connection + TDENetworkConnection* conn = new TDEWiFiConnection(); + + // open a dialog for editing the connection + use_new_wireless_essid = 0; // deactivate autofill for now + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, tray(), "connect_something", false, TQt::WDestructiveClose); + dlg->show(); +} + +bool WirelessDeviceTray::findMatchingNetwork(const TDEWiFiConnection* conn, const TQValueList& nets, WirelessNetwork& net) +{ + const TDEWiFiConnection* wireless = dynamic_cast(conn); + + if (!wireless) { + return false; + } + + for (TQValueList::ConstIterator it = nets.begin(); it != nets.end(); ++it) { + if (wireless->SSID == (*it).getSsid()) { + net = *it; + return true; + } + } + return false; +} + +TDEWiFiConnection* WirelessDeviceTray::findMatchingConnection(const WirelessNetwork& net, const TQValueList& connections) +{ + // try to find a connection matching this network + for (TQValueList::ConstIterator it = connections.begin(); it != connections.end(); ++it) { + const TDEWiFiConnection* wireless = dynamic_cast(*it); + + if (!wireless) { + continue; + } + + if (wireless->SSID == net.getSsid()) + { + return *it; + } + } + + return NULL; +} + +void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) +{ + printf("Updating wireless network list\n\r"); + + // get all wireless networks + TQValueList nets = WirelessManager::getWirelessNetworks(d->dev); + + // get all wireless connections + TQValueList conns = WirelessManager::getWirelessConnections(); + + // get the currently active connection + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnection* active_conn = NULL; + if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected)) + && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) { + active_conn = nm->findConnectionByUUID(deviceConnMan->deviceInformation().activeConnectionUUID); + } + + // add all wireless connections in range + // (we may have more then one connection per network) + for (TQValueList::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, ((TDENetworkConnection*)(*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::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; + + TDEWiFiConnection* wireless = dynamic_cast(*it); + + if (!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); + uint newnetworkItemsAdded = 0; + TQValueList newnets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID); + + for (TQValueList::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) +{ + // get the currently active connection + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + // device title + Subhead* subhead = new Subhead (menu, "subhead", TQString("Wireless Connection (%1)").arg(d->dev->deviceNode()), SmallIcon("wireless", TQIconSet::Automatic)); + menu->insertItem (subhead, -1, -1); + + // bolding subhead instead + //menu->insertSeparator(); + + if (!nm->wiFiEnabled()) + { + // 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->wiFiHardwareEnabled()) + { + // 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::setPixmapForStates(TDENetworkConnectionStatus::TDENetworkConnectionStatus states, TQString pixmap) { + TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; + while (flag > 0) { + if (states & flag) { + setPixmapForState(flag, pixmap); + } + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); + } +} + +void WirelessDeviceTray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) +{ + slotCheckActiveAccessPoint(); + + if (state == TDENetworkConnectionStatus::Connected) { + // trigger an update of the connections seen bssids property + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkWiFiAPInfo * ap = deviceConnMan->findAccessPointByBSSID(deviceConnMan->deviceInformation().wiFiInfo.activeAccessPointBSSID); + if (ap) { + int strength = (ap->signalQuality*100.0); + + if (strength > 80) { + setPixmapForStates(state, "nm_signal_100"); + } + else if (strength > 55) { + setPixmapForStates(state, "nm_signal_75"); + } + else if (strength > 30) { + setPixmapForStates(state, "nm_signal_50"); + } + else if (strength > 5) { + setPixmapForStates(state, "nm_signal_25"); + } + else { + setPixmapForStates(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 + + // get the currently active connection + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnection* active_conn = NULL; + if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected)) + && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) { + active_conn = nm->findConnectionByUUID(deviceConnMan->deviceInformation().activeConnectionUUID); + } + + if (active_conn && deviceConnMan->deviceInformation().statusFlags == TDENetworkConnectionStatus::Connected) { + TDENetworkWiFiAPInfo * activeap = deviceConnMan->findAccessPointByBSSID(deviceConnMan->deviceInformation().wiFiInfo.activeAccessPointBSSID); + if ( activeap != d->activeAccessPoint) { + if (!d->activeAccessPoint.isNull()) { + disconnect( deviceConnMan, TQT_SIGNAL(accessPointStatusChanged(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType)), this, TQT_SLOT(apPropertyChanged(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType))); + } + + d->activeAccessPoint = activeap; + if ( d->activeAccessPoint ) { + connect( deviceConnMan, TQT_SIGNAL(accessPointStatusChanged(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType)), this, TQT_SLOT(apPropertyChanged(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType))); + TDEWiFiConnection* wireless = dynamic_cast(active_conn); + if (wireless) { + if (!(wireless->heardBSSIDs.contains(d->activeAccessPoint->BSSID))) { + wireless->heardBSSIDs.append(d->activeAccessPoint->BSSID); + } + } + } + } + } +} + +void WirelessDeviceTray::apPropertyChanged(TDEMACAddress BSSID, TDENetworkAPEventType::TDENetworkAPEventType event) +{ + if (event == TDENetworkAPEventType::SignalStrengthChanged) { + TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkWiFiAPInfo * ap = deviceConnMan->findAccessPointByBSSID(BSSID); + if (ap) { + TQ_UINT32 strength = (ap->signalQuality*100.0); + kdDebug() << k_funcinfo << strength << endl; + TDENetworkConnectionStatus::TDENetworkConnectionStatus state = deviceConnMan->deviceInformation().statusFlags; + if (strength > 80) { + setPixmapForStates(state, "nm_signal_100"); + } + else if (strength > 55) { + setPixmapForStates(state, "nm_signal_75"); + } + else if (strength > 30) { + setPixmapForStates(state, "nm_signal_50"); + } + else if (strength > 5) { + setPixmapForStates(state, "nm_signal_25"); + } + else { + setPixmapForStates(state, "nm_signal_00"); + } + emit uiUpdated(); + } + } +} + +void WirelessDeviceTray::slotAccessPointAdded(TDENetworkWiFiAPInfo* 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 (TDENetworkDevice* dev, KSystemTray * parent, const char * name) + : DeviceTrayComponent (dev, parent, name) +{ + d = new WirelessDeviceTrayPrivate(); + d->dev = dev; + + // we want other icons for wireless devices + setPixmapForState(TDENetworkConnectionStatus::Invalid, "wireless_off"); + setPixmapForState(TDENetworkConnectionStatus::LinkUnavailable, "wireless_off"); + setPixmapForState(TDENetworkConnectionStatus::UnManaged, "wireless_off"); + setPixmapForState(TDENetworkConnectionStatus::Disconnected, "wireless"); + setPixmapForState(TDENetworkConnectionStatus::Connected, "nm_signal_50"); + + // get notified when the device state changes + connect(dev, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), this, TQT_SLOT(slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus))); + + // 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(TDENetworkWiFiAPInfo*)), this, TQT_SLOT(slotAccessPointAdded(TDENetworkWiFiAPInfo*))); + connect(dev, TQT_SIGNAL(accessPointRemoved(const TQString&)), this, TQT_SLOT(slotAccessPointRemoved(const TQString&))); +} + +WirelessDeviceTray::~WirelessDeviceTray () +{ + delete d; +} + + +#include "tdenetman-wireless_device_tray.moc" diff --git a/tdenetworkmanager/src/tdenetman-wireless_device_tray.h b/tdenetworkmanager/src/tdenetman-wireless_device_tray.h new file mode 100644 index 0000000..9fb386e --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.h @@ -0,0 +1,77 @@ +/*************************************************************************** + * + * tdenetman.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Will Stephenson , + * Helmut Schaa , + * + * 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 "tdenetman.h" +#include "devicetraycomponent.h" +#include "tdenetman-wireless_network.h" + +// predefinitions +class WirelessDevice; +class WirelessDeviceTrayPrivate; + +class WirelessDeviceTray : public DeviceTrayComponent +{ + Q_OBJECT + + + public: + WirelessDeviceTray (TDENetworkDevice*, KSystemTray * parent = 0, const char * name = 0); + ~WirelessDeviceTray (); + + void addMenuItems(KPopupMenu* menu); + + protected: + /** + * Reimplementation + */ + TQStringList getToolTipText(); + + public slots: + void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + void slotCheckActiveAccessPoint(); + void newConnection(); + protected slots: + void apPropertyChanged(TDEMACAddress BSSID, TDENetworkAPEventType::TDENetworkAPEventType event); + void slotAccessPointAdded(TDENetworkWiFiAPInfo*); + void slotAccessPointRemoved(const TQString&); + + private: + void addWirelessNetworks(KPopupMenu* menu); + TQValueList getWirelessNetworks(); + TQValueList getWirelessConnections(); + TDEWiFiConnection* findMatchingConnection(const WirelessNetwork& net, const TQValueList& connection); + bool findMatchingNetwork(const TDEWiFiConnection* conn, const TQValueList& nets, WirelessNetwork& net); + void setPixmapForStates(TDENetworkConnectionStatus::TDENetworkConnectionStatus states, TQString pixmap); + + WirelessDeviceTrayPrivate* d; + +}; + +#endif /* KNETWORKMANAGER_WIRELESS_DEVICE_TRAY_H */ diff --git a/tdenetworkmanager/src/tdenetman-wireless_manager.cpp b/tdenetworkmanager/src/tdenetman-wireless_manager.cpp new file mode 100644 index 0000000..3f823b2 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-wireless_manager.cpp @@ -0,0 +1,181 @@ +/*************************************************************************** + * + * tdenetman-wireless_manager.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 + +// KNM includes +#include "tdenetman-wireless_manager.h" + +TQValueList WirelessManager::getWirelessNetworks(TDENetworkDevice* dev, TQ_UINT32 match) +{ + TQValueList nets; + TQValueList aps; + // fetch all APs + aps = WirelessManager::getAccessPoints(dev); + + // now group the APs together according to their security settings + for (TQValueList::Iterator apit = aps.begin(); apit != aps.end(); ++apit) + { + bool found = false; + + // no hidden APs + TDENetworkWiFiAPInfo * ap = *apit; + if ( ap ) { + if (ap->SSID.count() == 0) { + continue; + } + + // check if we have a network matching this AP + for (TQValueList::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 internalGetAccessPoints(TDENetworkDevice* dev) { + TQValueList list; + if (dev) { + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + TDENetworkHWNeighbor* neighbor; + TDENetworkHWNeighborList* neighbors = deviceConnMan->siteSurvey(); + for (neighbor = neighbors->first(); neighbor; neighbor = neighbors->next()) { + TDENetworkWiFiAPInfo* apInfo = dynamic_cast(neighbor); + if (!apInfo) { + continue; + } + list.append(apInfo); + } + } + return list; +} + +TQValueList WirelessManager::getAccessPoints(TDENetworkDevice* dev) +{ + // build up AP list depending on one device or on all devices + if (dev) { + return internalGetAccessPoints(dev); + } + else { + TQValueList aps; + TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); + if (hwdevices) { + TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network); + for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) { + TDENetworkDevice* wdev = dynamic_cast(*it); + if (wdev) { + aps += internalGetAccessPoints(wdev); + } + } + } + return aps; + } +} + +TQValueList WirelessManager::getWirelessConnections() +{ + TQValueList conns; + + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (nm) { + // get all wireless connections + TDENetworkConnectionList* allconmap = nm->connections(); + for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) { + TDEWiFiConnection* wireless_conn = dynamic_cast(*it); + if (!wireless_conn) { + continue; + } + conns.append(wireless_conn); + } + } + + return conns; +} + +TQValueList internalGetAccessPointsWithESSID(TQByteArray essid, TDENetworkDevice* dev) { + TQValueList list; + if (dev) { + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + TDENetworkHWNeighbor* neighbor; + TDENetworkHWNeighborList* neighbors = deviceConnMan->siteSurvey(); + for (neighbor = neighbors->first(); neighbor; neighbor = neighbors->next()) { + TDENetworkWiFiAPInfo* apInfo = dynamic_cast(neighbor); + if (!apInfo) { + continue; + } + if (apInfo->SSID == essid) { + list.append(apInfo); + } + } + } + return list; +} + +TQValueList WirelessManager::getAccessPointsForEssid(TQByteArray essid, TDENetworkDevice* dev) +{ + // build up AP list depending on one device or on all devices + if (dev) { + return internalGetAccessPointsWithESSID(essid, dev); + } + else { + TQValueList aps; + TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); + if (hwdevices) { + TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network); + for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) { + TDENetworkDevice* wdev = dynamic_cast(*it); + if (wdev) { + aps += internalGetAccessPointsWithESSID(essid, wdev); + } + } + } + return aps; + } +} + + diff --git a/tdenetworkmanager/src/tdenetman-wireless_manager.h b/tdenetworkmanager/src/tdenetman-wireless_manager.h new file mode 100644 index 0000000..59c3cae --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-wireless_manager.h @@ -0,0 +1,60 @@ +/*************************************************************************** + * + * tdenetman-wireless_manager.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include + +// KNM includes +#include "tdenetman.h" +#include "tdenetman-device_tray.h" +#include "tdenetman-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 getWirelessNetworks(TDENetworkDevice* dev = 0, TQ_UINT32 match = WirelessNetwork::MATCH_SSID); + + // get all aps from either one device or from all available devices + static TQValueList getAccessPoints(TDENetworkDevice* dev = 0); + + // get a list of all known wireless connections + static TQValueList getWirelessConnections(); + + // get a list of all APs with a specific SSID + static TQValueList getAccessPointsForEssid(TQByteArray, TDENetworkDevice* dev = 0); + +}; + +#endif /* KNETWORKMANAGER_WIRELESS_MANAGER_H */ diff --git a/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp b/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp new file mode 100644 index 0000000..de37cfb --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp @@ -0,0 +1,227 @@ +/*************************************************************************** + * + * tdenetman-tray.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Timo Hoenig , + * Will Stephenson , + * Valentine Sinitsyn + * Helmut Schaa , + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tdenetman-wireless_menuitem.h" +#include "tdenetman-wireless_network.h" + +using namespace ConnectionSettings; + +void WirelessNetworkItem::slotActivate() +{ + + TDENetworkConnectionManager* deviceConnMan = _dev->connectionManager(); + + printf("slotActivate\n\r"); + if (_dev && deviceConnMan) + { + if ( _conn ) + { + kdDebug() << "Activate Connection " << _conn->UUID.ascii() << " on Device " << _dev->deviceNode().ascii() << endl; + TDENetworkConnectionStatus::TDENetworkConnectionStatus result = deviceConnMan->initiateConnection(_conn->UUID); + if ((result == TDENetworkConnectionStatus::Disconnected) + || (result == TDENetworkConnectionStatus::Invalid)) { + 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() & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None) && ((_net.getRsnFlags() & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None)) { + security = TQString("(%1/%2)").arg(i18n("WPA")).arg(i18n("RSN")); + } + else if ((_net.getWpaFlags() & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None) { + security = TQString("(%1)").arg(i18n("WPA")); + } + else if ((_net.getRsnFlags() & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None) { + security = TQString("(%2)").arg(i18n("RSN")); + } + + if (_conn && (_conn->friendlyName != _net.getDisplaySsid())) { + return TQString("%2/%1 %3").arg(TQString::fromUtf8(_net.getDisplaySsid())).arg(_conn->friendlyName).arg(security); + } + else { + return TQString("%1 %2").arg(TQString::fromUtf8(_net.getDisplaySsid())).arg(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->setSizePolicy (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->palette ().active ().highlightedText ()); + pbarStrength->setBackgroundMode( TQt::PaletteHighlight, TQt::PaletteHighlight ); + } else { + p->setPen(parent->palette ().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->sizeHint ().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->sizeHint ().width () - pbarStrength->width () - _space - pmAdHoc.size ().width () - spacer - 6, y + _border, pmAdHoc); + } + + p->drawPixmap (parent->sizeHint ().width () - pbarStrength->width () - _space, y +_border, TQPixmap::grabWidget (pbarStrength)); +} + +TQSize +WirelessNetworkItem::sizeHint () +{ + return TQSize (_width, _height); +} + +WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, TDENetworkDevice* dev, WirelessNetwork& net, TDEWiFiConnection* 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->style ().pixelMetric (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->style ().pixelMetric (TQStyle::PM_DefaultFrameWidth)) + _border += 2 * kapp->style ().pixelMetric (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, TDENetworkDevice* 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->style ().pixelMetric (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->style ().pixelMetric (TQStyle::PM_DefaultFrameWidth)) + _border += 2 * kapp->style ().pixelMetric (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 "tdenetman-wireless_menuitem.moc" diff --git a/tdenetworkmanager/src/tdenetman-wireless_menuitem.h b/tdenetworkmanager/src/tdenetman-wireless_menuitem.h new file mode 100644 index 0000000..0be3726 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-wireless_menuitem.h @@ -0,0 +1,87 @@ +/*************************************************************************** + * + * tdenetman.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 "tdenetman-menuitem.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "tdenetman-wireless_network.h" + +class WirelessNetworkItem : public NetworkMenuItem, public TQCustomMenuItem +{ + Q_OBJECT + + public: + WirelessNetworkItem (TQWidget*, TDENetworkDevice* dev, WirelessNetwork& net, TDEWiFiConnection* conn, bool adhoc); + WirelessNetworkItem (TQWidget*, TDENetworkDevice* dev, WirelessNetwork& net, bool adhoc); + ~WirelessNetworkItem (); + + TQWidget* parent; + TQProgressBar* pbarStrength; + + void paint (TQPainter*, const TQColorGroup&, bool, bool, int, int, int, int); + TQSize sizeHint (); + + public slots: + void slotActivate(); + + private: + TQString getDisplayText(); + + bool _adhoc; + WirelessNetwork _net; + TDENetworkDevice* _dev; + TDEWiFiConnection* _conn; + + /* menu item */ + int _width; + int _height; + int _border; + + /* elements */ + int _textHeight; + int _widgetHeight; + + int _space; +}; + +#endif /* KNETWORKMANAGER_WIRELESSMENUITEM_H */ diff --git a/tdenetworkmanager/src/tdenetman-wireless_network.cpp b/tdenetworkmanager/src/tdenetman-wireless_network.cpp new file mode 100644 index 0000000..bd9dbff --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-wireless_network.cpp @@ -0,0 +1,174 @@ +/*************************************************************************** + * + * tdenetman-wireless_network.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 "tdenetman.h" +#include "tdenetman-wireless_network.h" + +// TDE includes +#include + +// TQt includes +#include +#include + +class WirelessNetworkPrivate +{ + public: + WirelessNetworkPrivate() + : active(false) + { + } + + ~WirelessNetworkPrivate() + { + } + + bool active; + + TQ_UINT32 match; + TQValueList 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 TDENetworkWiFiAPInfo * const ap) +{ + if ( (d->match & MATCH_SSID) && getSsid() != ap->SSID) { + return false; + } + + // AP matches + return true; +} + +bool WirelessNetwork::addAP(const TDENetworkWiFiAPInfo * 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()))->SSID; + } + else { + return TQByteArray(); + } +} + +TQString WirelessNetwork::getDisplaySsid() const +{ + if (!d->aps.isEmpty()) { + return (*(d->aps.begin()))->friendlySSID(); + } + else { + return TQString(); + } +} + +TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getFlags() const +{ + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; + for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { + flags |= ((*it)->wpaFlags & TDENetworkWiFiAPFlags::GeneralFlagsMask); + flags |= ((*it)->rsnFlags & TDENetworkWiFiAPFlags::GeneralFlagsMask); + } + return flags; +} + +TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getWpaFlags() const +{ + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; + for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) + { + flags |= ((*it)->wpaFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask); + } + return flags; +} + +TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getRsnFlags() const +{ + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; + for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) + { + flags |= ((*it)->rsnFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask); + } + return flags; +} + +bool WirelessNetwork::isEncrypted() const +{ + return (getFlags() & TDENetworkWiFiAPFlags::PrivacySupport); +} + +TQ_UINT8 WirelessNetwork::getStrength() const +{ + TQ_UINT8 strength = 0; + for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { + if (((*it)->signalQuality*100.0) > strength) { + strength = ((*it)->signalQuality*100.0); + } + } + return strength; +} + +void WirelessNetwork::setActive(bool a) +{ + d->active=a; +} + +bool WirelessNetwork::getActive() const +{ + return d->active; +} + diff --git a/tdenetworkmanager/src/tdenetman-wireless_network.h b/tdenetworkmanager/src/tdenetman-wireless_network.h new file mode 100644 index 0000000..0970df1 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-wireless_network.h @@ -0,0 +1,92 @@ +/*************************************************************************** + * + * tdenetman-wireless_network.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 "tdenetman.h" + +#include + +#include +#include + +class KNetworkManager; +class WirelessNetworkPrivate; + +/* + 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 TDENetworkWiFiAPInfo * const); + + // add an AP to the Network + bool addAP(const TDENetworkWiFiAPInfo * const); + + // combined flags of all APs + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags getFlags() const; + + // combined wpa-flags of all APs + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags getWpaFlags() const; + + // combined rsn-flags of all APs + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags 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/tdenetworkmanager/src/tdenetman.cpp b/tdenetworkmanager/src/tdenetman.cpp new file mode 100644 index 0000000..adc3cf2 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman.cpp @@ -0,0 +1,94 @@ +/*************************************************************************** + * + * tdenetman.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 + * + **************************************************************************/ + +// TDE includes +#include +#include +#include +#include + +// KNM includes +#include "tdenetman.h" +#include "tdenetman-tray.h" + +#include + +// TQt includes +#include +#include + +// KDE includes +#include +#include + +extern TDENetworkConnectionStatus::TDENetworkConnectionStatus nm_device_state_global; + +class KNetworkManagerPrivate +{ + public: + KNetworkManagerPrivate() {} + ~KNetworkManagerPrivate() {} + static KNetworkManager* _ctx; +}; + +KNetworkManager* KNetworkManagerPrivate::_ctx = NULL; + +KNetworkManager* KNetworkManager::getInstance() +{ + return KNetworkManagerPrivate::_ctx; +} + +void +KNetworkManager::slotShutDown() +{ + // +} + +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())); + + // create the main-tray-icon + Tray* tray = Tray::getInstance(); + tray->show(); + setMainWidget(tray); +} + +KNetworkManager::~KNetworkManager() +{ + delete d; +} + +#include "tdenetman.moc" + diff --git a/tdenetworkmanager/src/tdenetman.h b/tdenetworkmanager/src/tdenetman.h new file mode 100644 index 0000000..76dcb93 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman.h @@ -0,0 +1,57 @@ +/*************************************************************************** + * + * tdenetman.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2005 Novell, Inc. + * + * Author: Timo Hoenig , + * + * 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 + +// KNM includes +#include "config.h" + +class KNetworkManagerPrivate; +class Device; + +class KNetworkManager : public KUniqueApplication +{ + Q_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/tdenetworkmanager/src/tdenetman.la.cpp b/tdenetworkmanager/src/tdenetman.la.cpp new file mode 100644 index 0000000..3d480c4 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman.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/tdenetworkmanager/src/tdenetman_dummy.cpp b/tdenetworkmanager/src/tdenetman_dummy.cpp new file mode 100644 index 0000000..efd89d8 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman_dummy.cpp @@ -0,0 +1,3 @@ +#include +extern "C" int kdemain(int argc, char* argv[]); +extern "C" KDE_EXPORT int tdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); } diff --git a/tdenetworkmanager/src/tdenetworkmanager.desktop b/tdenetworkmanager/src/tdenetworkmanager.desktop new file mode 100644 index 0000000..c313d6f --- /dev/null +++ b/tdenetworkmanager/src/tdenetworkmanager.desktop @@ -0,0 +1,47 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=TDENetworkManager +Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার +Name[sv]=TDEnetworkmanager +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=tdenetworkmanager +Icon=tdenetworkmanager +Type=Application +Comment=A TDE frontend for NetworkManager +Comment[bg]=Интерфейс за NetworkManager (TDE) +Comment[bn]=নেটওয়ার্ক-ম্যানেজারের জন্য একটি কেডিই ফ্রন্ট-এন্ড +Comment[ca]=Un frontal del TDE per al NetworkManager +Comment[da]=En TDE-grænseflade for Networkmanager +Comment[de]=Eine TDE-Oberfläche für NetworkManager +Comment[el]=Μια διασύνδεση περιβάλλοντος για το NetworkManager +Comment[es]=Una interfaz de TDE a NetworkManager +Comment[et]=TDE NetworkManageri kasutajaliides +Comment[it]=Un front-end di NetworkManager per TDE +Comment[ja]=NetworkManager の TDE フロントエンド +Comment[nl]=Een TDE-schil voor NetworkManager +Comment[pt]=Uma interface para TDE do NetworkManager +Comment[sr]=TDE програм за NetworkManager +Comment[sr@Latn]=TDE program za NetworkManager +Comment[sv]=Ett gränssnitt till Networkmanager för TDE +Comment[tr]=NetworkManager için bir TDE ön yüzü +X-TDE-autostart-after=panel +X-TDE-StartupNotify=false +X-TDE-UniqueApplet=true +X-DCOP-ServiceType=Unique +X-TDE-autostart-condition=tdenetworkmanagerrc:General:Autostart:true +Categories=Qt;TDE;Network;Applet; diff --git a/tdenetworkmanager/src/tdenetworkmanager_plugin.desktop b/tdenetworkmanager/src/tdenetworkmanager_plugin.desktop new file mode 100644 index 0000000..d215c1f --- /dev/null +++ b/tdenetworkmanager/src/tdenetworkmanager_plugin.desktop @@ -0,0 +1,31 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=ServiceType +X-TDE-ServiceType=TDENetworkManager/Plugin +X-TDE-Derived=KPluginInfo +Name=TDENetworkManager Plugin +Name[et]=TDENetworkManageri plugin +Name[ja]=TDENetworkManager プラグイン +Name[sr]=Прикључак TDENetworkManager-а +Name[sr@Latn]=Прикључак TDENetworkManager-а +Name[sv]=Nätverkshantering insticksprogram +Comment=TDENetworkManager Plugin +Comment[bg]=Приставка за TDENetworkManager +Comment[bn]=কে-নেটওয়ার্ক-ম্যানেজার প্লাগিন +Comment[br]=Lugent TDENetworkManager +Comment[ca]=Connector del TDENetworkManager +Comment[da]=Netværkshåndtering-plugin +Comment[de]=TDENetworkManager-Modul +Comment[el]=Πρόσθετο του TDENetworkManager +Comment[es]=Complemento de TDENetworkManager +Comment[et]=TDENetworkManageri plugin +Comment[it]=Plugin di TDENetworkManager +Comment[ja]=TDENetworkManager プラグイン +Comment[nl]=TDENetworkManager-plugin +Comment[pt]='Plugin' do TDENetworkManager +Comment[sr]=Прикључак TDENetworkManager-а +Comment[sr@Latn]=Priključak TDENetworkManager-a +Comment[sv]=Nätverkshantering insticksprogram +Comment[tr]=TDENetworkManager Eklentisi +Comment[xx]=xxTDENetworkManager Pluginxx + diff --git a/tdenetworkmanager/src/tdenetworkmanager_vpnplugin.desktop b/tdenetworkmanager/src/tdenetworkmanager_vpnplugin.desktop new file mode 100644 index 0000000..9c7f5b3 --- /dev/null +++ b/tdenetworkmanager/src/tdenetworkmanager_vpnplugin.desktop @@ -0,0 +1,33 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=ServiceType +X-TDE-ServiceType=TDENetworkManager/VPNPlugin +X-TDE-Derived=TDENetworkManager/Plugin +Name=TDENetworkManager VPN Plugin +Name[et]=TDENetworkManageri VPN-plugin +Name[ja]=TDENetworkManager VPN プラグイン +Name[sr]=Прикључак TDENetworkManager-а за VPN +Name[sr@Latn]=Прикључак TDENetworkManager-а за VPN +Name[sv]=Nätverkshantering VPN-insticksprogram +Comment=TDENetworkManager VPN Plugin +Comment[bg]=VPN приставка за TDENetworkManager +Comment[bn]=কে-নেটওয়ার্ক-ম্যানেজার ভিপিএন প্লাগিন +Comment[br]=Lugent VPN evit TDENetworkManager +Comment[ca]=Connector VPN del TDENetworkManager +Comment[da]=TDENetworkManager VPN-plugin +Comment[de]=TDENetworkManager-VPN-Modul +Comment[el]=Πρόσθετο VPN του TDENetworkManager +Comment[es]=Complemento de VPN de TDENetworkManager +Comment[et]=TDENetworkManageri VPN-plugin +Comment[it]=Plugin VPN di TDENetworkManager +Comment[ja]=TDENetworkManager VPN プラグイン +Comment[nl]=TDENetworkManager VPN-plugin +Comment[pt]='Plugin' de VPN do TDENetworkManager +Comment[sr]=Прикључак TDENetworkManager-а за VPN +Comment[sr@Latn]=Priključak TDENetworkManager-a za VPN +Comment[sv]=Nätverkshantering VPN-insticksprogram +Comment[tr]=TDENetworkManager VPN Eklentisi +Comment[xx]=xxTDENetworkManager VPN Pluginxx + +[PropertyDef::X-NetworkManager-Services] +Type=TQString diff --git a/tdenetworkmanager/src/vpn_tray_component.cpp b/tdenetworkmanager/src/vpn_tray_component.cpp index 68ad8a1..f4f3534 100644 --- a/tdenetworkmanager/src/vpn_tray_component.cpp +++ b/tdenetworkmanager/src/vpn_tray_component.cpp @@ -33,15 +33,15 @@ // 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 "tdenetman-menuitem.h" +#include "tdenetman-menu_subhead.h" +#include "tdenetman-connection_store.h" +#include "tdenetman-vpn_connection.h" +#include "tdenetman-nm_proxy.h" + +#include "tdenetman-connection_setting_info.h" +#include "tdenetman-connection_setting_vpn.h" +#include "tdenetman-connection_settings_dialog.h" #include using namespace ConnectionSettings; diff --git a/tdenetworkmanager/src/vpn_tray_component.h b/tdenetworkmanager/src/vpn_tray_component.h index 2af5b55..a42ae83 100644 --- a/tdenetworkmanager/src/vpn_tray_component.h +++ b/tdenetworkmanager/src/vpn_tray_component.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager.h - A NetworkManager frontend for KDE + * tdenetman.h - A NetworkManager frontend for KDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -28,7 +28,7 @@ // KNM includes #include "traycomponent.h" -#include "knetworkmanager.h" +#include "tdenetman.h" class VPNTrayComponent : public TrayComponent { diff --git a/tdenetworkmanager/tdenetworkmanager.conf b/tdenetworkmanager/tdenetworkmanager.conf new file mode 100644 index 0000000..82a596f --- /dev/null +++ b/tdenetworkmanager/tdenetworkmanager.conf @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.1 From 42966fe6d5f1017b96f48260c61fdb187fe11ff7 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 6 Sep 2012 21:18:58 -0500 Subject: Remove more KDE references --- tdenetworkmanager/po/af.po | 2 +- tdenetworkmanager/po/ar.po | 4 ++-- tdenetworkmanager/po/bg.po | 4 ++-- tdenetworkmanager/po/bn.po | 2 +- tdenetworkmanager/po/bs.po | 2 +- tdenetworkmanager/po/ca.po | 4 ++-- tdenetworkmanager/po/cs.po | 4 ++-- tdenetworkmanager/po/cy.po | 2 +- tdenetworkmanager/po/da.po | 4 ++-- tdenetworkmanager/po/de.po | 4 ++-- tdenetworkmanager/po/el.po | 4 ++-- tdenetworkmanager/po/en_GB.po | 2 +- tdenetworkmanager/po/en_US.po | 2 +- tdenetworkmanager/po/es.po | 4 ++-- tdenetworkmanager/po/et.po | 4 ++-- tdenetworkmanager/po/fi.po | 4 ++-- tdenetworkmanager/po/fr.po | 4 ++-- tdenetworkmanager/po/gl.po | 4 ++-- tdenetworkmanager/po/gu.po | 2 +- tdenetworkmanager/po/he.po | 2 +- tdenetworkmanager/po/hi.po | 2 +- tdenetworkmanager/po/hr.po | 2 +- tdenetworkmanager/po/hu.po | 4 ++-- tdenetworkmanager/po/id.po | 2 +- tdenetworkmanager/po/it.po | 4 ++-- tdenetworkmanager/po/ja.po | 4 ++-- tdenetworkmanager/po/ka.po | 4 ++-- tdenetworkmanager/po/km.po | 4 ++-- tdenetworkmanager/po/ko.po | 4 ++-- tdenetworkmanager/po/lo.po | 2 +- tdenetworkmanager/po/lt.po | 4 ++-- tdenetworkmanager/po/mk.po | 2 +- tdenetworkmanager/po/mr.po | 2 +- tdenetworkmanager/po/nb.po | 2 +- tdenetworkmanager/po/nl.po | 4 ++-- tdenetworkmanager/po/pa.po | 4 ++-- tdenetworkmanager/po/pl.po | 4 ++-- tdenetworkmanager/po/pt.po | 4 ++-- tdenetworkmanager/po/pt_BR.po | 4 ++-- tdenetworkmanager/po/ro.po | 4 ++-- tdenetworkmanager/po/ru.po | 4 ++-- tdenetworkmanager/po/si.po | 2 +- tdenetworkmanager/po/sk.po | 4 ++-- tdenetworkmanager/po/sl.po | 2 +- tdenetworkmanager/po/sr.po | 2 +- tdenetworkmanager/po/sv.po | 4 ++-- tdenetworkmanager/po/ta.po | 2 +- tdenetworkmanager/po/th.po | 2 +- tdenetworkmanager/po/tr.po | 4 ++-- tdenetworkmanager/po/uk.po | 4 ++-- tdenetworkmanager/po/vi.po | 2 +- tdenetworkmanager/po/wa.po | 4 ++-- tdenetworkmanager/po/xh.po | 2 +- tdenetworkmanager/po/zh_CN.po | 6 +++--- tdenetworkmanager/po/zh_TW.po | 4 ++-- tdenetworkmanager/po/zu.po | 2 +- .../src/configwidgets/tdenetman-connection_setting_cdma_widget.cpp | 2 +- .../src/configwidgets/tdenetman-connection_setting_cdma_widget.h | 2 +- .../src/configwidgets/tdenetman-connection_setting_gsm_widget.cpp | 2 +- .../src/configwidgets/tdenetman-connection_setting_gsm_widget.h | 2 +- .../src/configwidgets/tdenetman-connection_setting_info_widget.cpp | 2 +- .../src/configwidgets/tdenetman-connection_setting_info_widget.h | 2 +- .../src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp | 2 +- .../src/configwidgets/tdenetman-connection_setting_ipv4_widget.h | 2 +- .../src/configwidgets/tdenetman-connection_setting_ppp_widget.cpp | 2 +- .../src/configwidgets/tdenetman-connection_setting_ppp_widget.h | 2 +- .../configwidgets/tdenetman-connection_setting_serial_widget.cpp | 2 +- .../src/configwidgets/tdenetman-connection_setting_serial_widget.h | 2 +- .../src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp | 2 +- .../src/configwidgets/tdenetman-connection_setting_vpn_widget.h | 2 +- .../configwidgets/tdenetman-connection_setting_widget_interface.cpp | 2 +- .../configwidgets/tdenetman-connection_setting_widget_interface.h | 2 +- .../tdenetman-connection_setting_wireless_security_widget.cpp | 2 +- .../tdenetman-connection_setting_wireless_security_widget.h | 2 +- .../configwidgets/tdenetman-connection_setting_wireless_widget.cpp | 2 +- .../configwidgets/tdenetman-connection_setting_wireless_widget.h | 2 +- .../src/configwidgets/tdenetman-connection_settings_dialog.cpp | 2 +- .../src/configwidgets/tdenetman-connection_settings_dialog.h | 2 +- tdenetworkmanager/src/devicetraycomponent.cpp | 4 ++-- tdenetworkmanager/src/devicetraycomponent.h | 4 ++-- tdenetworkmanager/src/main.cpp | 4 ++-- tdenetworkmanager/src/qbidirectionalmap.h | 2 +- .../src/settings/knetworkmanager-connection_setting.cpp | 2 +- tdenetworkmanager/src/settings/knetworkmanager-connection_setting.h | 2 +- .../src/settings/knetworkmanager-connection_setting_8021x.cpp | 2 +- .../src/settings/knetworkmanager-connection_setting_8021x.h | 2 +- .../src/settings/knetworkmanager-connection_setting_cdma.cpp | 2 +- .../src/settings/knetworkmanager-connection_setting_cdma.h | 2 +- .../src/settings/knetworkmanager-connection_setting_gsm.cpp | 2 +- .../src/settings/knetworkmanager-connection_setting_gsm.h | 2 +- .../src/settings/knetworkmanager-connection_setting_info.cpp | 2 +- .../src/settings/knetworkmanager-connection_setting_info.h | 2 +- .../src/settings/knetworkmanager-connection_setting_ipv4.cpp | 2 +- .../src/settings/knetworkmanager-connection_setting_ipv4.h | 2 +- .../src/settings/knetworkmanager-connection_setting_ppp.cpp | 2 +- .../src/settings/knetworkmanager-connection_setting_ppp.h | 2 +- .../src/settings/knetworkmanager-connection_setting_serial.cpp | 2 +- .../src/settings/knetworkmanager-connection_setting_serial.h | 2 +- .../src/settings/knetworkmanager-connection_setting_vpn.cpp | 2 +- .../src/settings/knetworkmanager-connection_setting_vpn.h | 2 +- .../src/settings/knetworkmanager-connection_setting_wired.cpp | 2 +- .../src/settings/knetworkmanager-connection_setting_wired.h | 2 +- .../src/settings/knetworkmanager-connection_setting_wireless.cpp | 2 +- .../src/settings/knetworkmanager-connection_setting_wireless.h | 2 +- .../knetworkmanager-connection_setting_wireless_security.cpp | 2 +- .../settings/knetworkmanager-connection_setting_wireless_security.h | 2 +- tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp | 4 ++-- tdenetworkmanager/src/tdenetman-cellular_device_tray.h | 2 +- tdenetworkmanager/src/tdenetman-connection_editor.cpp | 2 +- tdenetworkmanager/src/tdenetman-connection_editor.h | 2 +- tdenetworkmanager/src/tdenetman-device_tray.cpp | 2 +- tdenetworkmanager/src/tdenetman-device_tray.h | 2 +- tdenetworkmanager/src/tdenetman-menu_subhead.cpp | 2 +- tdenetworkmanager/src/tdenetman-menu_subhead.h | 2 +- tdenetworkmanager/src/tdenetman-menuitem.cpp | 2 +- tdenetworkmanager/src/tdenetman-menuitem.h | 2 +- tdenetworkmanager/src/tdenetman-nm_vpn_proxy.cpp | 4 ++-- tdenetworkmanager/src/tdenetman-nm_vpn_proxy.h | 2 +- tdenetworkmanager/src/tdenetman-plugin.cpp | 2 +- tdenetworkmanager/src/tdenetman-plugin.h | 2 +- tdenetworkmanager/src/tdenetman-pluginmanager.cpp | 4 ++-- tdenetworkmanager/src/tdenetman-pluginmanager.h | 2 +- tdenetworkmanager/src/tdenetman-tray.cpp | 2 +- tdenetworkmanager/src/tdenetman-tray.h | 2 +- tdenetworkmanager/src/tdenetman-vpn_plugin.cpp | 4 ++-- tdenetworkmanager/src/tdenetman-vpn_plugin.h | 2 +- tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp | 2 +- tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h | 2 +- tdenetworkmanager/src/tdenetman-vpnmanager.cpp | 2 +- tdenetworkmanager/src/tdenetman-vpnmanager.h | 2 +- tdenetworkmanager/src/tdenetman-vpnplugin.cpp | 2 +- tdenetworkmanager/src/tdenetman-vpnplugin.h | 2 +- tdenetworkmanager/src/tdenetman-vpnservice.cpp | 2 +- tdenetworkmanager/src/tdenetman-vpnservice.h | 2 +- tdenetworkmanager/src/tdenetman-wired_device_tray.cpp | 4 ++-- tdenetworkmanager/src/tdenetman-wired_device_tray.h | 2 +- tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp | 4 ++-- tdenetworkmanager/src/tdenetman-wireless_device_tray.h | 2 +- tdenetworkmanager/src/tdenetman-wireless_manager.cpp | 2 +- tdenetworkmanager/src/tdenetman-wireless_manager.h | 2 +- tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp | 2 +- tdenetworkmanager/src/tdenetman-wireless_menuitem.h | 2 +- tdenetworkmanager/src/tdenetman-wireless_network.cpp | 2 +- tdenetworkmanager/src/tdenetman-wireless_network.h | 2 +- tdenetworkmanager/src/tdenetman.cpp | 4 ++-- tdenetworkmanager/src/tdenetman.h | 4 ++-- tdenetworkmanager/src/traycomponent.cpp | 4 ++-- tdenetworkmanager/src/traycomponent.h | 4 ++-- tdenetworkmanager/src/vpn_tray_component.cpp | 4 ++-- tdenetworkmanager/src/vpn_tray_component.h | 2 +- .../vpn-plugins/openvpn/src/knetworkmanager-openvpn.cpp | 2 +- tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.h | 2 +- tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp | 2 +- tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.h | 2 +- .../vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp | 2 +- .../vpn-plugins/strongswan/src/knetworkmanager-strongswan.h | 2 +- tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp | 2 +- tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h | 2 +- 158 files changed, 206 insertions(+), 206 deletions(-) diff --git a/tdenetworkmanager/po/af.po b/tdenetworkmanager/po/af.po index 7dc7c3c..af6588e 100644 --- a/tdenetworkmanager/po/af.po +++ b/tdenetworkmanager/po/af.po @@ -301,7 +301,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/ar.po b/tdenetworkmanager/po/ar.po index dcefcb1..5a2267a 100644 --- a/tdenetworkmanager/po/ar.po +++ b/tdenetworkmanager/po/ar.po @@ -297,8 +297,8 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "الواجهة الامامية لميدير الشبكات الخاص بKDE" +msgid "A NetworkManager front-end for TDE" +msgstr "الواجهة الامامية لميدير الشبكات الخاص بTDE" #: main.cpp:40 #, fuzzy diff --git a/tdenetworkmanager/po/bg.po b/tdenetworkmanager/po/bg.po index 9a3a55e..1aca5cb 100644 --- a/tdenetworkmanager/po/bg.po +++ b/tdenetworkmanager/po/bg.po @@ -286,8 +286,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "NetworkManager - интерфейс за KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "NetworkManager - интерфейс за TDE" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/bn.po b/tdenetworkmanager/po/bn.po index 880cbf4..d48a916 100644 --- a/tdenetworkmanager/po/bn.po +++ b/tdenetworkmanager/po/bn.po @@ -297,7 +297,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/bs.po b/tdenetworkmanager/po/bs.po index ee0134d..b9286b8 100644 --- a/tdenetworkmanager/po/bs.po +++ b/tdenetworkmanager/po/bs.po @@ -284,7 +284,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/ca.po b/tdenetworkmanager/po/ca.po index 9f19b3e..92da3eb 100644 --- a/tdenetworkmanager/po/ca.po +++ b/tdenetworkmanager/po/ca.po @@ -298,8 +298,8 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "Un frontal del NetworkManager per KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "Un frontal del NetworkManager per TDE" #: main.cpp:40 #, fuzzy diff --git a/tdenetworkmanager/po/cs.po b/tdenetworkmanager/po/cs.po index b75e2c7..8322def 100644 --- a/tdenetworkmanager/po/cs.po +++ b/tdenetworkmanager/po/cs.po @@ -283,8 +283,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "NetworkManager rozhraní pro KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "NetworkManager rozhraní pro TDE" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/cy.po b/tdenetworkmanager/po/cy.po index d440c9f..feb5652 100644 --- a/tdenetworkmanager/po/cy.po +++ b/tdenetworkmanager/po/cy.po @@ -282,7 +282,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/da.po b/tdenetworkmanager/po/da.po index caa683f..ecc48c6 100644 --- a/tdenetworkmanager/po/da.po +++ b/tdenetworkmanager/po/da.po @@ -288,8 +288,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "En Networkmanager-frontend for KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "En Networkmanager-frontend for TDE" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/de.po b/tdenetworkmanager/po/de.po index 10f0bb9..a2fc36a 100644 --- a/tdenetworkmanager/po/de.po +++ b/tdenetworkmanager/po/de.po @@ -288,8 +288,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "NetworkManager-Oberfläche für KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "NetworkManager-Oberfläche für TDE" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/el.po b/tdenetworkmanager/po/el.po index 0f67634..1d230ef 100644 --- a/tdenetworkmanager/po/el.po +++ b/tdenetworkmanager/po/el.po @@ -319,8 +319,8 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "Μία διεπαφή περιβάλλοντος του NetworkManager για το KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "Μία διεπαφή περιβάλλοντος του NetworkManager για το TDE" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/en_GB.po b/tdenetworkmanager/po/en_GB.po index d29d844..a6f18b7 100644 --- a/tdenetworkmanager/po/en_GB.po +++ b/tdenetworkmanager/po/en_GB.po @@ -305,7 +305,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/en_US.po b/tdenetworkmanager/po/en_US.po index 13aa270..993cf8e 100644 --- a/tdenetworkmanager/po/en_US.po +++ b/tdenetworkmanager/po/en_US.po @@ -288,7 +288,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/es.po b/tdenetworkmanager/po/es.po index 043a67e..d301d4b 100644 --- a/tdenetworkmanager/po/es.po +++ b/tdenetworkmanager/po/es.po @@ -289,8 +289,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "Una interfaz de NetworkManager para KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "Una interfaz de NetworkManager para TDE" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/et.po b/tdenetworkmanager/po/et.po index 60fde3c..2921515 100644 --- a/tdenetworkmanager/po/et.po +++ b/tdenetworkmanager/po/et.po @@ -300,8 +300,8 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "KDE NetworkManageri kasutajaliides" +msgid "A NetworkManager front-end for TDE" +msgstr "TDE NetworkManageri kasutajaliides" #: main.cpp:40 #, fuzzy diff --git a/tdenetworkmanager/po/fi.po b/tdenetworkmanager/po/fi.po index df90383..9b85dab 100644 --- a/tdenetworkmanager/po/fi.po +++ b/tdenetworkmanager/po/fi.po @@ -286,8 +286,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "Verkkotyökalun käyttöliittymä KDE:lle" +msgid "A NetworkManager front-end for TDE" +msgstr "Verkkotyökalun käyttöliittymä TDE:lle" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/fr.po b/tdenetworkmanager/po/fr.po index 44bc4df..c2692ff 100644 --- a/tdenetworkmanager/po/fr.po +++ b/tdenetworkmanager/po/fr.po @@ -295,8 +295,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "Interface de NetworkManager pour KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "Interface de NetworkManager pour TDE" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/gl.po b/tdenetworkmanager/po/gl.po index fae1e72..3e93959 100644 --- a/tdenetworkmanager/po/gl.po +++ b/tdenetworkmanager/po/gl.po @@ -283,8 +283,8 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "Unha interface con NetworkManager para KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "Unha interface con NetworkManager para TDE" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/gu.po b/tdenetworkmanager/po/gu.po index a05cefe..0120471 100644 --- a/tdenetworkmanager/po/gu.po +++ b/tdenetworkmanager/po/gu.po @@ -305,7 +305,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/he.po b/tdenetworkmanager/po/he.po index 9ca4dfc..8cb9224 100644 --- a/tdenetworkmanager/po/he.po +++ b/tdenetworkmanager/po/he.po @@ -283,7 +283,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/hi.po b/tdenetworkmanager/po/hi.po index 0527e1a..a006ed5 100644 --- a/tdenetworkmanager/po/hi.po +++ b/tdenetworkmanager/po/hi.po @@ -302,7 +302,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/hr.po b/tdenetworkmanager/po/hr.po index e3ce240..9fde128 100644 --- a/tdenetworkmanager/po/hr.po +++ b/tdenetworkmanager/po/hr.po @@ -293,7 +293,7 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/hu.po b/tdenetworkmanager/po/hu.po index b219636..fe5c331 100644 --- a/tdenetworkmanager/po/hu.po +++ b/tdenetworkmanager/po/hu.po @@ -286,8 +286,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "NetworkManager felhasználói felület KDE-hez" +msgid "A NetworkManager front-end for TDE" +msgstr "NetworkManager felhasználói felület TDE-hez" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/id.po b/tdenetworkmanager/po/id.po index 063a624..847a48f 100644 --- a/tdenetworkmanager/po/id.po +++ b/tdenetworkmanager/po/id.po @@ -286,7 +286,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/it.po b/tdenetworkmanager/po/it.po index 4234ea4..e9049b5 100644 --- a/tdenetworkmanager/po/it.po +++ b/tdenetworkmanager/po/it.po @@ -292,8 +292,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "Un front-end per KDE di NetworkManager" +msgid "A NetworkManager front-end for TDE" +msgstr "Un front-end per TDE di NetworkManager" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/ja.po b/tdenetworkmanager/po/ja.po index 58bcb20..6a03dc8 100644 --- a/tdenetworkmanager/po/ja.po +++ b/tdenetworkmanager/po/ja.po @@ -286,8 +286,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "KDE 用の NetworkManager フロントエンド" +msgid "A NetworkManager front-end for TDE" +msgstr "TDE 用の NetworkManager フロントエンド" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/ka.po b/tdenetworkmanager/po/ka.po index 14f2a68..c764f73 100644 --- a/tdenetworkmanager/po/ka.po +++ b/tdenetworkmanager/po/ka.po @@ -280,8 +280,8 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "KDE-ს front-end ქსელის მმართველისთვის" +msgid "A NetworkManager front-end for TDE" +msgstr "TDE-ს front-end ქსელის მმართველისთვის" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/km.po b/tdenetworkmanager/po/km.po index 834ebc5..f386e69 100644 --- a/tdenetworkmanager/po/km.po +++ b/tdenetworkmanager/po/km.po @@ -284,8 +284,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "កម្មវិធី NetworkManager សម្រាប់ KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "កម្មវិធី NetworkManager សម្រាប់ TDE" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/ko.po b/tdenetworkmanager/po/ko.po index 4367a9b..2b0a020 100644 --- a/tdenetworkmanager/po/ko.po +++ b/tdenetworkmanager/po/ko.po @@ -290,8 +290,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "KDE용 네트워크 관리자 프론트엔드" +msgid "A NetworkManager front-end for TDE" +msgstr "TDE용 네트워크 관리자 프론트엔드" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/lo.po b/tdenetworkmanager/po/lo.po index 5b3b5c3..793288f 100644 --- a/tdenetworkmanager/po/lo.po +++ b/tdenetworkmanager/po/lo.po @@ -279,7 +279,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/lt.po b/tdenetworkmanager/po/lt.po index caacc6e..ba909d6 100644 --- a/tdenetworkmanager/po/lt.po +++ b/tdenetworkmanager/po/lt.po @@ -286,8 +286,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "KDE NetworkManager vartotojo sąsaja" +msgid "A NetworkManager front-end for TDE" +msgstr "TDE NetworkManager vartotojo sąsaja" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/mk.po b/tdenetworkmanager/po/mk.po index 75566d5..480bb50 100644 --- a/tdenetworkmanager/po/mk.po +++ b/tdenetworkmanager/po/mk.po @@ -286,7 +286,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/mr.po b/tdenetworkmanager/po/mr.po index 8f5aa68..171ce1e 100644 --- a/tdenetworkmanager/po/mr.po +++ b/tdenetworkmanager/po/mr.po @@ -302,7 +302,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/nb.po b/tdenetworkmanager/po/nb.po index ca3a397..cf872fa 100644 --- a/tdenetworkmanager/po/nb.po +++ b/tdenetworkmanager/po/nb.po @@ -311,7 +311,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/nl.po b/tdenetworkmanager/po/nl.po index a797b74..4b467fd 100644 --- a/tdenetworkmanager/po/nl.po +++ b/tdenetworkmanager/po/nl.po @@ -294,8 +294,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "Een NetworkManager-schil voor KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "Een NetworkManager-schil voor TDE" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/pa.po b/tdenetworkmanager/po/pa.po index 6cda331..b95315d 100644 --- a/tdenetworkmanager/po/pa.po +++ b/tdenetworkmanager/po/pa.po @@ -307,8 +307,8 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "KDE ਲਈ ਨੈੱਟਵਰਕਮੈਨੇਜਰ ਲਈ ਮੁੱਖ" +msgid "A NetworkManager front-end for TDE" +msgstr "TDE ਲਈ ਨੈੱਟਵਰਕਮੈਨੇਜਰ ਲਈ ਮੁੱਖ" #: main.cpp:40 #, fuzzy diff --git a/tdenetworkmanager/po/pl.po b/tdenetworkmanager/po/pl.po index 0011667..ec21361 100644 --- a/tdenetworkmanager/po/pl.po +++ b/tdenetworkmanager/po/pl.po @@ -315,8 +315,8 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "Nakładka na NetworkManager dla KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "Nakładka na NetworkManager dla TDE" #: main.cpp:40 #, fuzzy diff --git a/tdenetworkmanager/po/pt.po b/tdenetworkmanager/po/pt.po index 48e8bcc..2031d5a 100644 --- a/tdenetworkmanager/po/pt.po +++ b/tdenetworkmanager/po/pt.po @@ -296,8 +296,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "Uma interface do NetworkManager para KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "Uma interface do NetworkManager para TDE" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/pt_BR.po b/tdenetworkmanager/po/pt_BR.po index a20b2c9..84844d6 100644 --- a/tdenetworkmanager/po/pt_BR.po +++ b/tdenetworkmanager/po/pt_BR.po @@ -308,8 +308,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "Uma interface do NetworkManager para o KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "Uma interface do NetworkManager para o TDE" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/ro.po b/tdenetworkmanager/po/ro.po index 997c5c6..67eacc9 100644 --- a/tdenetworkmanager/po/ro.po +++ b/tdenetworkmanager/po/ro.po @@ -290,8 +290,8 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "O interfață pentru NetworkManager pe KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "O interfață pentru NetworkManager pe TDE" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/ru.po b/tdenetworkmanager/po/ru.po index e195ed0..055d4c8 100644 --- a/tdenetworkmanager/po/ru.po +++ b/tdenetworkmanager/po/ru.po @@ -295,8 +295,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "Интерфейс NetworkManager для KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "Интерфейс NetworkManager для TDE" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/si.po b/tdenetworkmanager/po/si.po index f3bd366..0c051c4 100644 --- a/tdenetworkmanager/po/si.po +++ b/tdenetworkmanager/po/si.po @@ -282,7 +282,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/sk.po b/tdenetworkmanager/po/sk.po index e7f06e6..b96e4c7 100644 --- a/tdenetworkmanager/po/sk.po +++ b/tdenetworkmanager/po/sk.po @@ -298,8 +298,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "KDE rozhranie pre NetworkManager" +msgid "A NetworkManager front-end for TDE" +msgstr "TDE rozhranie pre NetworkManager" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/sl.po b/tdenetworkmanager/po/sl.po index 2dcb14f..fee75ea 100644 --- a/tdenetworkmanager/po/sl.po +++ b/tdenetworkmanager/po/sl.po @@ -301,7 +301,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/sr.po b/tdenetworkmanager/po/sr.po index d025ffd..157d22f 100644 --- a/tdenetworkmanager/po/sr.po +++ b/tdenetworkmanager/po/sr.po @@ -290,7 +290,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "КДЕ-ово лице за NetworkManager-а" #: main.cpp:40 diff --git a/tdenetworkmanager/po/sv.po b/tdenetworkmanager/po/sv.po index ae1b7f2..05078f3 100644 --- a/tdenetworkmanager/po/sv.po +++ b/tdenetworkmanager/po/sv.po @@ -307,8 +307,8 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "Ett gränssnitt till Nätverkshantering för KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "Ett gränssnitt till Nätverkshantering för TDE" #: main.cpp:40 #, fuzzy diff --git a/tdenetworkmanager/po/ta.po b/tdenetworkmanager/po/ta.po index 5fe0e60..44307e4 100644 --- a/tdenetworkmanager/po/ta.po +++ b/tdenetworkmanager/po/ta.po @@ -303,7 +303,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/th.po b/tdenetworkmanager/po/th.po index c6cc2e5..8094726 100644 --- a/tdenetworkmanager/po/th.po +++ b/tdenetworkmanager/po/th.po @@ -300,7 +300,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/tr.po b/tdenetworkmanager/po/tr.po index ead37c3..49244e5 100644 --- a/tdenetworkmanager/po/tr.po +++ b/tdenetworkmanager/po/tr.po @@ -294,8 +294,8 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "KDE ön-yüzü için bir Ağ Yöneticisi" +msgid "A NetworkManager front-end for TDE" +msgstr "TDE ön-yüzü için bir Ağ Yöneticisi" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/uk.po b/tdenetworkmanager/po/uk.po index 62678f9..cd0a088 100644 --- a/tdenetworkmanager/po/uk.po +++ b/tdenetworkmanager/po/uk.po @@ -287,8 +287,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "Графічний інтерфейс NetworkManager для KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "Графічний інтерфейс NetworkManager для TDE" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/vi.po b/tdenetworkmanager/po/vi.po index 006c6e0..2ad2c7e 100644 --- a/tdenetworkmanager/po/vi.po +++ b/tdenetworkmanager/po/vi.po @@ -287,7 +287,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/wa.po b/tdenetworkmanager/po/wa.po index a5ce8a6..b661145 100644 --- a/tdenetworkmanager/po/wa.po +++ b/tdenetworkmanager/po/wa.po @@ -285,8 +285,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "En eterface grafike di Manaedjeu d' rantoele po KDE" +msgid "A NetworkManager front-end for TDE" +msgstr "En eterface grafike di Manaedjeu d' rantoele po TDE" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/xh.po b/tdenetworkmanager/po/xh.po index dafb189..2f461b9 100644 --- a/tdenetworkmanager/po/xh.po +++ b/tdenetworkmanager/po/xh.po @@ -301,7 +301,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/po/zh_CN.po b/tdenetworkmanager/po/zh_CN.po index fee2ec7..7d6d3db 100644 --- a/tdenetworkmanager/po/zh_CN.po +++ b/tdenetworkmanager/po/zh_CN.po @@ -297,8 +297,8 @@ msgid "RSN" msgstr "RSN" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "KDE 的网络管理器前端" +msgid "A NetworkManager front-end for TDE" +msgstr "TDE 的网络管理器前端" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." @@ -310,7 +310,7 @@ msgstr "http://opensuse.org/Projects/KNetworkManager" #: main.cpp:46 msgid "KNetworkManager" -msgstr "KDE 网络管理器" +msgstr "TDE 网络管理器" #: main.cpp:50 #: main.cpp:51 diff --git a/tdenetworkmanager/po/zh_TW.po b/tdenetworkmanager/po/zh_TW.po index f53bd40..97e1be2 100644 --- a/tdenetworkmanager/po/zh_TW.po +++ b/tdenetworkmanager/po/zh_TW.po @@ -292,8 +292,8 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" -msgstr "KDE 的網路管理員前端" +msgid "A NetworkManager front-end for TDE" +msgstr "TDE 的網路管理員前端" #: main.cpp:40 msgid "Copyright (C) 2005, 2006 Novell, Inc." diff --git a/tdenetworkmanager/po/zu.po b/tdenetworkmanager/po/zu.po index a8a3999..0b42b24 100644 --- a/tdenetworkmanager/po/zu.po +++ b/tdenetworkmanager/po/zu.po @@ -304,7 +304,7 @@ msgid "RSN" msgstr "" #: main.cpp:39 -msgid "A NetworkManager front-end for KDE" +msgid "A NetworkManager front-end for TDE" msgstr "" #: main.cpp:40 diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.cpp index 4036518..8255eaf 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_cdma_widget.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_cdma_widget.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.h index 36c9224..3ce30fc 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_cdma_widget.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_cdma_widget.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2008 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.cpp index 3df8804..131f4c0 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_gsm_widget.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_gsm_widget.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.h index 6010d3f..639e4fa 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_gsm_widget.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_gsm_widget.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2008 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.cpp index 48a22f7..fed5d15 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.h index 8cad6c6..3ffe23a 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp index e229b2f..e800390 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.h index 61fdb12..1abec3a 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.h - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.cpp index e3688e0..a4d0a65 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_ppp_widget.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_ppp_widget.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2008 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.h index 983369d..9772b1d 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_ppp_widget.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_ppp_widget.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2008 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.cpp index fe1b937..daa5f62 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_serial_widget.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_serial_widget.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2008 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.h index d597c9b..4dad72d 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_serial_widget.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_serial_widget.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2008 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp index 4196989..5b1faff 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_vpn_widget.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_vpn_widget.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h index a00ec17..780148a 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_vpn_widget.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_vpn_widget.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.cpp index 2be4796..08c264f 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_widget_interface.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_widget_interface.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.h index 82755b5..298e67e 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_widget_interface.h - A NetworkManager frontend for KDE + * tdenetman-connection_setting_widget_interface.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp index 7647136..bd4b593 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * * tdenetman-connection_setting_wireless_security_widget.cpp - * - A NetworkManager frontend for KDE + * - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h index e0605db..fb6313d 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.h - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp index c5b70bd..424ff81 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h index da78621..7c97a0b 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp index a783d23..b080343 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h index 8337338..8e80b3e 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.h - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/devicetraycomponent.cpp b/tdenetworkmanager/src/devicetraycomponent.cpp index 648ffa8..9782cd1 100644 --- a/tdenetworkmanager/src/devicetraycomponent.cpp +++ b/tdenetworkmanager/src/devicetraycomponent.cpp @@ -5,8 +5,8 @@ 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 +accepted by the membership of TDE e.V. (or its successor approved +by the membership of TDE 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, diff --git a/tdenetworkmanager/src/devicetraycomponent.h b/tdenetworkmanager/src/devicetraycomponent.h index 52a9bea..6f6c543 100644 --- a/tdenetworkmanager/src/devicetraycomponent.h +++ b/tdenetworkmanager/src/devicetraycomponent.h @@ -5,8 +5,8 @@ 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 +accepted by the membership of TDE e.V. (or its successor approved +by the membership of TDE 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, diff --git a/tdenetworkmanager/src/main.cpp b/tdenetworkmanager/src/main.cpp index db41130..7d1a6f1 100644 --- a/tdenetworkmanager/src/main.cpp +++ b/tdenetworkmanager/src/main.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * main.cpp - A NetworkManager frontend for KDE + * main.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -22,7 +22,7 @@ * **************************************************************************/ -// KDE includes +// TDE includes #include #include #include diff --git a/tdenetworkmanager/src/qbidirectionalmap.h b/tdenetworkmanager/src/qbidirectionalmap.h index 530c6cc..2f12896 100644 --- a/tdenetworkmanager/src/qbidirectionalmap.h +++ b/tdenetworkmanager/src/qbidirectionalmap.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * qbidiractionalmap.h - A NetworkManager frontend for KDE + * qbidiractionalmap.h - A NetworkManager frontend for TDE * * Copyright (C) 2005 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.cpp index e4337a9..48d09f0 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.h index 08b3ba7..8264df9 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting.h - A NetworkManager frontend for KDE + * tdenetman-connection_setting.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.cpp index 21beba8..b900ca5 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_8021x.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_8021x.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.h index a86a3c7..77f6ffa 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_8021x.h - A NetworkManager frontend for KDE + * tdenetman-connection_setting_8021x.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.cpp index 5e8886e..8b45362 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_serial.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_serial.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.h index a145988..5af53a2 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_cdma.h - A NetworkManager frontend for KDE + * tdenetman-connection_setting_cdma.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.cpp index b0714e0..c414ce2 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_gsm.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_gsm.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.h index 9ca5e07..8ea477b 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_gsm.h - A NetworkManager frontend for KDE + * tdenetman-connection_setting_gsm.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.cpp index a433bf5..11053c7 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.h index facf9c7..2cd0fce 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.h - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.cpp index 263f65e..e6de6ed 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.h index 506631d..773f4cf 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.h - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.cpp index 513a3ca..77481b0 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_ppp.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_ppp.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.h index ddb966a..f3625fa 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_ppp.h - A NetworkManager frontend for KDE + * tdenetman-connection_setting_ppp.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.cpp index d7245a9..25ce87d 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_serial.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_serial.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.h index 956e3c2..c401ef6 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_serial.h - A NetworkManager frontend for KDE + * tdenetman-connection_setting_serial.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.cpp index 4d45f2b..07fb9a8 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_vpn.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_vpn.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.h index e1c1a7a..1e0a174 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_setting_vpn.h - A NetworkManager frontend for KDE + * tdenetman-connection_setting_vpn.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.cpp index 068592c..237f841 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.h index ba430f0..475a00a 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.h - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.cpp index 1076994..c8fd100 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.h index 83acae2..3fdf87a 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.h - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.cpp index 7b72a83..3844ede 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.cpp +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.cpp @@ -1,6 +1,6 @@ /************************************************************************** * - * tdenetman-connection_setting_wireless_security.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_setting_wireless_security.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.h index 34db7b0..952f600 100644 --- a/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.h +++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-devicestore_dbus.h - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp index cdfa153..542f678 100644 --- a/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-cellular_device_tray.cpp - A NetworkManager frontend for KDE + * tdenetman-cellular_device_tray.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -25,7 +25,7 @@ /// TQt includes #include // for TQt::WidgetFlags -// KDE includes +// TDE includes #include #include #include diff --git a/tdenetworkmanager/src/tdenetman-cellular_device_tray.h b/tdenetworkmanager/src/tdenetman-cellular_device_tray.h index f6fdf89..9bde7d1 100644 --- a/tdenetworkmanager/src/tdenetman-cellular_device_tray.h +++ b/tdenetworkmanager/src/tdenetman-cellular_device_tray.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman.h - A NetworkManager frontend for KDE + * tdenetman.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-connection_editor.cpp b/tdenetworkmanager/src/tdenetman-connection_editor.cpp index 5c3ea1a..961946f 100644 --- a/tdenetworkmanager/src/tdenetman-connection_editor.cpp +++ b/tdenetworkmanager/src/tdenetman-connection_editor.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_editor.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_editor.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-connection_editor.h b/tdenetworkmanager/src/tdenetman-connection_editor.h index 8026b8d..66283e2 100644 --- a/tdenetworkmanager/src/tdenetman-connection_editor.h +++ b/tdenetworkmanager/src/tdenetman-connection_editor.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-connection_editor.h - A NetworkManager frontend for KDE + * tdenetman-connection_editor.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-device_tray.cpp b/tdenetworkmanager/src/tdenetman-device_tray.cpp index d9bedc0..14a218e 100644 --- a/tdenetworkmanager/src/tdenetman-device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-device_tray.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-device_tray.cpp - A NetworkManager frontend for KDE + * tdenetman-device_tray.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-device_tray.h b/tdenetworkmanager/src/tdenetman-device_tray.h index 82f7732..809174b 100644 --- a/tdenetworkmanager/src/tdenetman-device_tray.h +++ b/tdenetworkmanager/src/tdenetman-device_tray.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-device_tray.h - A NetworkManager frontend for KDE + * tdenetman-device_tray.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-menu_subhead.cpp b/tdenetworkmanager/src/tdenetman-menu_subhead.cpp index 3821b80..f370ba6 100644 --- a/tdenetworkmanager/src/tdenetman-menu_subhead.cpp +++ b/tdenetworkmanager/src/tdenetman-menu_subhead.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-tray.cpp - A NetworkManager frontend for KDE + * tdenetman-tray.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-menu_subhead.h b/tdenetworkmanager/src/tdenetman-menu_subhead.h index a142d3e..0ec811a 100644 --- a/tdenetworkmanager/src/tdenetman-menu_subhead.h +++ b/tdenetworkmanager/src/tdenetman-menu_subhead.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman.h - A NetworkManager frontend for KDE + * tdenetman.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-menuitem.cpp b/tdenetworkmanager/src/tdenetman-menuitem.cpp index e59102f..e5b68cf 100644 --- a/tdenetworkmanager/src/tdenetman-menuitem.cpp +++ b/tdenetworkmanager/src/tdenetman-menuitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-menuitem.cpp - A NetworkManager frontend for KDE + * tdenetman-menuitem.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006, 2008 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-menuitem.h b/tdenetworkmanager/src/tdenetman-menuitem.h index be1584e..6017758 100644 --- a/tdenetworkmanager/src/tdenetman-menuitem.h +++ b/tdenetworkmanager/src/tdenetman-menuitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-menuitem.h - A NetworkManager frontend for KDE + * tdenetman-menuitem.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006, 2008 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.cpp b/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.cpp index 756f0cc..8ef0ecb 100644 --- a/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.cpp +++ b/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-device.cpp - A NetworkManager frontend for KDE + * tdenetman-device.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -23,7 +23,7 @@ * **************************************************************************/ -// KDE includes +// TDE includes #include // TQtDBus includes diff --git a/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.h b/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.h index b7d5ca7..bbd29df 100644 --- a/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.h +++ b/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-nm_proxy.h - A NetworkManager frontend for KDE + * tdenetman-nm_proxy.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-plugin.cpp b/tdenetworkmanager/src/tdenetman-plugin.cpp index 017db8d..c39e8da 100644 --- a/tdenetworkmanager/src/tdenetman-plugin.cpp +++ b/tdenetworkmanager/src/tdenetman-plugin.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-plugin.cpp - A NetworkManager frontend for KDE + * tdenetman-plugin.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-plugin.h b/tdenetworkmanager/src/tdenetman-plugin.h index 7bd2e99..9d8a3cc 100644 --- a/tdenetworkmanager/src/tdenetman-plugin.h +++ b/tdenetworkmanager/src/tdenetman-plugin.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-plugin.h - A NetworkManager frontend for KDE + * tdenetman-plugin.h - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-pluginmanager.cpp b/tdenetworkmanager/src/tdenetman-pluginmanager.cpp index 3111385..c197da9 100644 --- a/tdenetworkmanager/src/tdenetman-pluginmanager.cpp +++ b/tdenetworkmanager/src/tdenetman-pluginmanager.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-pluginmanager.cpp - A NetworkManager frontend for KDE + * tdenetman-pluginmanager.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * @@ -126,7 +126,7 @@ Plugin* PluginManager::loadPlugin(const TQString& pluginID) int error = 0; KPluginInfo* info = infoForPluginID(pluginID); Plugin *plugin = KParts::ComponentFactory::createInstanceFromQuery( TQString::fromLatin1( "KNetworkManager/Plugin" ), - TQString::fromLatin1( "[X-KDE-PluginInfo-Name]=='%1'" ).arg( pluginID ), this, 0, TQStringList(), &error ); + TQString::fromLatin1( "[X-TDE-PluginInfo-Name]=='%1'" ).arg( pluginID ), this, 0, TQStringList(), &error ); // plugin loaded? if (plugin) diff --git a/tdenetworkmanager/src/tdenetman-pluginmanager.h b/tdenetworkmanager/src/tdenetman-pluginmanager.h index d36ce10..262da0f 100644 --- a/tdenetworkmanager/src/tdenetman-pluginmanager.h +++ b/tdenetworkmanager/src/tdenetman-pluginmanager.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-pluginmanager.h - A NetworkManager frontend for KDE + * tdenetman-pluginmanager.h - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-tray.cpp b/tdenetworkmanager/src/tdenetman-tray.cpp index 36407e8..36d2743 100644 --- a/tdenetworkmanager/src/tdenetman-tray.cpp +++ b/tdenetworkmanager/src/tdenetman-tray.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-tray.cpp - A NetworkManager frontend for KDE + * tdenetman-tray.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-tray.h b/tdenetworkmanager/src/tdenetman-tray.h index 6f49012..a4c6d52 100644 --- a/tdenetworkmanager/src/tdenetman-tray.h +++ b/tdenetworkmanager/src/tdenetman-tray.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman.h - A NetworkManager frontend for KDE + * tdenetman.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-vpn_plugin.cpp b/tdenetworkmanager/src/tdenetman-vpn_plugin.cpp index e2ab272..dc7351f 100644 --- a/tdenetworkmanager/src/tdenetman-vpn_plugin.cpp +++ b/tdenetworkmanager/src/tdenetman-vpn_plugin.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-vpn_plugin.cpp - A NetworkManager frontend for KDE + * tdenetman-vpn_plugin.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -23,7 +23,7 @@ * **************************************************************************/ -// KDE includes +// TDE includes #include // TQt includes diff --git a/tdenetworkmanager/src/tdenetman-vpn_plugin.h b/tdenetworkmanager/src/tdenetman-vpn_plugin.h index 784de6d..00d3c8e 100644 --- a/tdenetworkmanager/src/tdenetman-vpn_plugin.h +++ b/tdenetworkmanager/src/tdenetman-vpn_plugin.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-wired_device.h - A NetworkManager frontend for KDE + * tdenetman-wired_device.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp index e29d744..ae4c047 100644 --- a/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp +++ b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-vpnauthenticationdialog.cpp - A NetworkManager frontend for KDE + * tdenetman-vpnauthenticationdialog.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h index ee48410..f1af73b 100644 --- a/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h +++ b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-authenticationdialog.h - A NetworkManager frontend for KDE + * tdenetman-authenticationdialog.h - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-vpnmanager.cpp b/tdenetworkmanager/src/tdenetman-vpnmanager.cpp index 62a0b8f..530be61 100644 --- a/tdenetworkmanager/src/tdenetman-vpnmanager.cpp +++ b/tdenetworkmanager/src/tdenetman-vpnmanager.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-vpnmanager.cpp - A NetworkManager frontend for KDE + * tdenetman-vpnmanager.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-vpnmanager.h b/tdenetworkmanager/src/tdenetman-vpnmanager.h index 3030c07..89e8032 100644 --- a/tdenetworkmanager/src/tdenetman-vpnmanager.h +++ b/tdenetworkmanager/src/tdenetman-vpnmanager.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-vpnmanager.h - A NetworkManager frontend for KDE + * tdenetman-vpnmanager.h - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-vpnplugin.cpp b/tdenetworkmanager/src/tdenetman-vpnplugin.cpp index dbeeb18..e06ea39 100644 --- a/tdenetworkmanager/src/tdenetman-vpnplugin.cpp +++ b/tdenetworkmanager/src/tdenetman-vpnplugin.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-vpnplugin.cpp - A NetworkManager frontend for KDE + * tdenetman-vpnplugin.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-vpnplugin.h b/tdenetworkmanager/src/tdenetman-vpnplugin.h index 10f5d25..c89fc5e 100644 --- a/tdenetworkmanager/src/tdenetman-vpnplugin.h +++ b/tdenetworkmanager/src/tdenetman-vpnplugin.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-vpnplugin.h - A NetworkManager frontend for KDE + * tdenetman-vpnplugin.h - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-vpnservice.cpp b/tdenetworkmanager/src/tdenetman-vpnservice.cpp index 978a183..a43826d 100644 --- a/tdenetworkmanager/src/tdenetman-vpnservice.cpp +++ b/tdenetworkmanager/src/tdenetman-vpnservice.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-vpnservice.cpp - A NetworkManager frontend for KDE + * tdenetman-vpnservice.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-vpnservice.h b/tdenetworkmanager/src/tdenetman-vpnservice.h index baf87a5..03dda01 100644 --- a/tdenetworkmanager/src/tdenetman-vpnservice.h +++ b/tdenetworkmanager/src/tdenetman-vpnservice.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-vpnservice.h - A NetworkManager frontend for KDE + * tdenetman-vpnservice.h - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp index 68a6069..9bcbc39 100644 --- a/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-wired_device_tray.cpp - A NetworkManager frontend for KDE + * tdenetman-wired_device_tray.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -35,7 +35,7 @@ #include #include -// KDE includes +// TDE includes #include #include #include diff --git a/tdenetworkmanager/src/tdenetman-wired_device_tray.h b/tdenetworkmanager/src/tdenetman-wired_device_tray.h index 1ec550e..d5cb156 100644 --- a/tdenetworkmanager/src/tdenetman-wired_device_tray.h +++ b/tdenetworkmanager/src/tdenetman-wired_device_tray.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman.h - A NetworkManager frontend for KDE + * tdenetman.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp index d1b209e..b8be188 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-wireless_device_tray.cpp - A NetworkManager frontend for KDE + * tdenetman-wireless_device_tray.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -36,7 +36,7 @@ #include #include -// KDE includes +// TDE includes #include #include #include diff --git a/tdenetworkmanager/src/tdenetman-wireless_device_tray.h b/tdenetworkmanager/src/tdenetman-wireless_device_tray.h index 9fb386e..8970b3a 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_device_tray.h +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman.h - A NetworkManager frontend for KDE + * tdenetman.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-wireless_manager.cpp b/tdenetworkmanager/src/tdenetman-wireless_manager.cpp index 3f823b2..7692a00 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_manager.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_manager.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-wireless_manager.cpp - A NetworkManager frontend for KDE + * tdenetman-wireless_manager.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-wireless_manager.h b/tdenetworkmanager/src/tdenetman-wireless_manager.h index 59c3cae..6800930 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_manager.h +++ b/tdenetworkmanager/src/tdenetman-wireless_manager.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-wireless_manager.h - A NetworkManager frontend for KDE + * tdenetman-wireless_manager.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp b/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp index de37cfb..444bfbf 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-tray.cpp - A NetworkManager frontend for KDE + * tdenetman-tray.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-wireless_menuitem.h b/tdenetworkmanager/src/tdenetman-wireless_menuitem.h index 0be3726..935ace8 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_menuitem.h +++ b/tdenetworkmanager/src/tdenetman-wireless_menuitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman.h - A NetworkManager frontend for KDE + * tdenetman.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-wireless_network.cpp b/tdenetworkmanager/src/tdenetman-wireless_network.cpp index bd9dbff..c0e20ce 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_network.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_network.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-wireless_network.cpp - A NetworkManager frontend for KDE + * tdenetman-wireless_network.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman-wireless_network.h b/tdenetworkmanager/src/tdenetman-wireless_network.h index 0970df1..bf0ab03 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_network.h +++ b/tdenetworkmanager/src/tdenetman-wireless_network.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman-wireless_network.h - A NetworkManager frontend for KDE + * tdenetman-wireless_network.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/tdenetman.cpp b/tdenetworkmanager/src/tdenetman.cpp index adc3cf2..d8125f2 100644 --- a/tdenetworkmanager/src/tdenetman.cpp +++ b/tdenetworkmanager/src/tdenetman.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman.cpp - A NetworkManager frontend for KDE + * tdenetman.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -38,7 +38,7 @@ #include #include -// KDE includes +// TDE includes #include #include diff --git a/tdenetworkmanager/src/tdenetman.h b/tdenetworkmanager/src/tdenetman.h index 76dcb93..6ab2ca1 100644 --- a/tdenetworkmanager/src/tdenetman.h +++ b/tdenetworkmanager/src/tdenetman.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman.h - A NetworkManager frontend for KDE + * tdenetman.h - A NetworkManager frontend for TDE * * Copyright (C) 2005 Novell, Inc. * @@ -25,7 +25,7 @@ #ifndef KNETWORKMANAGER_H #define KNETWORKMANAGER_H -// KDE includes +// TDE includes #include // KNM includes diff --git a/tdenetworkmanager/src/traycomponent.cpp b/tdenetworkmanager/src/traycomponent.cpp index 26f31b7..5bfff55 100644 --- a/tdenetworkmanager/src/traycomponent.cpp +++ b/tdenetworkmanager/src/traycomponent.cpp @@ -5,8 +5,8 @@ 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 +accepted by the membership of TDE e.V. (or its successor approved +by the membership of TDE 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, diff --git a/tdenetworkmanager/src/traycomponent.h b/tdenetworkmanager/src/traycomponent.h index 2a4da49..df8483b 100644 --- a/tdenetworkmanager/src/traycomponent.h +++ b/tdenetworkmanager/src/traycomponent.h @@ -5,8 +5,8 @@ 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 +accepted by the membership of TDE e.V. (or its successor approved +by the membership of TDE 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, diff --git a/tdenetworkmanager/src/vpn_tray_component.cpp b/tdenetworkmanager/src/vpn_tray_component.cpp index f4f3534..04ceffc 100644 --- a/tdenetworkmanager/src/vpn_tray_component.cpp +++ b/tdenetworkmanager/src/vpn_tray_component.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * vpn_tray_componenet.cpp - A NetworkManager frontend for KDE + * vpn_tray_componenet.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -22,7 +22,7 @@ * **************************************************************************/ -// KDE includes +// TDE includes #include #include #include diff --git a/tdenetworkmanager/src/vpn_tray_component.h b/tdenetworkmanager/src/vpn_tray_component.h index a42ae83..eb0377d 100644 --- a/tdenetworkmanager/src/vpn_tray_component.h +++ b/tdenetworkmanager/src/vpn_tray_component.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * tdenetman.h - A NetworkManager frontend for KDE + * tdenetman.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.cpp b/tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.cpp index 020df5a..ad27368 100644 --- a/tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.cpp +++ b/tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-openvpn.cpp - A NetworkManager frontend for KDE + * knetworkmanager-openvpn.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * diff --git a/tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.h b/tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.h index 4b43b18..02c328f 100644 --- a/tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.h +++ b/tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-openvpn.h - A NetworkManager frontend for KDE + * knetworkmanager-openvpn.h - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * diff --git a/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp b/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp index 452fb23..e8180d1 100644 --- a/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp +++ b/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-pptp.cpp - A NetworkManager frontend for KDE + * knetworkmanager-pptp.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * diff --git a/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.h b/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.h index ca7b3b0..c286e16 100644 --- a/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.h +++ b/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-vpnc.h - A NetworkManager frontend for KDE + * knetworkmanager-vpnc.h - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * diff --git a/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp b/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp index 39a512c..7abe62d 100644 --- a/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp +++ b/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-strongswan.cpp - A NetworkManager frontend for KDE + * knetworkmanager-strongswan.cpp - A NetworkManager frontend for TDE * * Author: Thomas Kallenberg , * diff --git a/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h b/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h index ce2f739..341d25d 100644 --- a/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h +++ b/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-strongswan.h - A NetworkManager frontend for KDE + * knetworkmanager-strongswan.h - A NetworkManager frontend for TDE * * Author: Thomas Kallenberg , * diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp b/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp index 5bab84c..9804256 100644 --- a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp +++ b/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-vpnc.cpp - A NetworkManager frontend for KDE + * knetworkmanager-vpnc.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h b/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h index 35e2ee6..2a45ca0 100644 --- a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h +++ b/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-vpnc.h - A NetworkManager frontend for KDE + * knetworkmanager-vpnc.h - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * -- cgit v1.2.1 From 06534a8e3fd7b92d08743304c5dda8ab1c560598 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 7 Sep 2012 00:38:19 -0500 Subject: Additional branding updates --- tdenetworkmanager/README | 2 +- tdenetworkmanager/po/af.po | 4 +- tdenetworkmanager/po/ar.po | 6 +- tdenetworkmanager/po/bg.po | 8 +- tdenetworkmanager/po/bn.po | 4 +- tdenetworkmanager/po/bs.po | 4 +- tdenetworkmanager/po/ca.po | 6 +- tdenetworkmanager/po/cs.po | 8 +- tdenetworkmanager/po/cy.po | 4 +- tdenetworkmanager/po/da.po | 8 +- tdenetworkmanager/po/de.po | 8 +- tdenetworkmanager/po/el.po | 6 +- tdenetworkmanager/po/en_GB.po | 4 +- tdenetworkmanager/po/en_US.po | 4 +- tdenetworkmanager/po/es.po | 8 +- tdenetworkmanager/po/et.po | 6 +- tdenetworkmanager/po/fi.po | 6 +- tdenetworkmanager/po/fr.po | 8 +- tdenetworkmanager/po/gl.po | 8 +- tdenetworkmanager/po/gu.po | 4 +- tdenetworkmanager/po/he.po | 4 +- tdenetworkmanager/po/hi.po | 4 +- tdenetworkmanager/po/hr.po | 8 +- tdenetworkmanager/po/hu.po | 8 +- tdenetworkmanager/po/id.po | 4 +- tdenetworkmanager/po/it.po | 8 +- tdenetworkmanager/po/ja.po | 6 +- tdenetworkmanager/po/ka.po | 8 +- tdenetworkmanager/po/km.po | 8 +- tdenetworkmanager/po/ko.po | 6 +- tdenetworkmanager/po/lo.po | 4 +- tdenetworkmanager/po/lt.po | 8 +- tdenetworkmanager/po/mk.po | 4 +- tdenetworkmanager/po/mr.po | 4 +- tdenetworkmanager/po/nb.po | 4 +- tdenetworkmanager/po/nl.po | 6 +- tdenetworkmanager/po/pa.po | 6 +- tdenetworkmanager/po/pl.po | 4 +- tdenetworkmanager/po/pt.po | 8 +- tdenetworkmanager/po/pt_BR.po | 8 +- tdenetworkmanager/po/ro.po | 8 +- tdenetworkmanager/po/ru.po | 8 +- tdenetworkmanager/po/si.po | 4 +- tdenetworkmanager/po/sk.po | 8 +- tdenetworkmanager/po/sl.po | 4 +- tdenetworkmanager/po/sr.po | 6 +- tdenetworkmanager/po/sv.po | 6 +- tdenetworkmanager/po/ta.po | 4 +- tdenetworkmanager/po/th.po | 4 +- tdenetworkmanager/po/tr.po | 4 +- tdenetworkmanager/po/uk.po | 8 +- tdenetworkmanager/po/vi.po | 4 +- tdenetworkmanager/po/wa.po | 6 +- tdenetworkmanager/po/xh.po | 4 +- tdenetworkmanager/po/zh_CN.po | 6 +- tdenetworkmanager/po/zh_TW.po | 4 +- tdenetworkmanager/po/zu.po | 4 +- tdenetworkmanager/src/CMakeLists.txt | 2 +- tdenetworkmanager/src/configwidgets/CMakeLists.txt | 63 ++++++ tdenetworkmanager/src/eventsrc | 234 ++++++++++----------- tdenetworkmanager/src/main.cpp | 4 +- tdenetworkmanager/src/settings/CMakeLists.txt | 41 ++++ tdenetworkmanager/src/tdenetman-device_tray.cpp | 4 +- tdenetworkmanager/src/tdenetman-pluginmanager.cpp | 6 +- tdenetworkmanager/src/tdenetman-tray.cpp | 2 +- tdenetworkmanager/src/tdenetman-vpn_plugin.h | 2 +- .../src/tdenetman-vpnauthenticationdialog.h | 2 +- tdenetworkmanager/src/tdenetman-vpnmanager.cpp | 4 +- tdenetworkmanager/src/tdenetman-vpnmanager.h | 2 +- tdenetworkmanager/src/tdenetman-vpnplugin.h | 2 +- tdenetworkmanager/src/tdenetman-vpnservice.cpp | 2 +- tdenetworkmanager/src/tdenetman-vpnservice.h | 2 +- .../src/tdenetman-wireless_device_tray.cpp | 4 +- tdenetworkmanager/src/tdenetman-wireless_network.h | 2 +- tdenetworkmanager/src/tdenetman.cpp | 24 +-- tdenetworkmanager/src/tdenetman.h | 12 +- .../openvpn/knetworkmanager_openvpn.desktop | 2 +- .../vpn-plugins/pptp/knetworkmanager_pptp.desktop | 2 +- .../strongswan/knetworkmanager_strongswan.desktop | 2 +- .../vpn-plugins/vpnc/knetworkmanager_vpnc.desktop | 2 +- 80 files changed, 427 insertions(+), 323 deletions(-) create mode 100644 tdenetworkmanager/src/configwidgets/CMakeLists.txt create mode 100644 tdenetworkmanager/src/settings/CMakeLists.txt diff --git a/tdenetworkmanager/README b/tdenetworkmanager/README index e7eb541..437a922 100644 --- a/tdenetworkmanager/README +++ b/tdenetworkmanager/README @@ -1,4 +1,4 @@ -KNetworkManager is a system tray application for controlling network connections on systems that use the NetworkManager daemon. +TDENetworkManager is a system tray application for controlling network connections on systems that use the NetworkManager daemon. Currently the following things work: * Nothing! diff --git a/tdenetworkmanager/po/af.po b/tdenetworkmanager/po/af.po index af6588e..f61d0a7 100644 --- a/tdenetworkmanager/po/af.po +++ b/tdenetworkmanager/po/af.po @@ -310,12 +310,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Kopiereg © 2007 Novell Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Netwerkpasstukke" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/ar.po b/tdenetworkmanager/po/ar.po index 5a2267a..f063389 100644 --- a/tdenetworkmanager/po/ar.po +++ b/tdenetworkmanager/po/ar.po @@ -306,12 +306,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "حقوق النسخ © 2007 لشركة Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "الشبكة: بلا" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/bg.po b/tdenetworkmanager/po/bg.po index 1aca5cb..59fcf92 100644 --- a/tdenetworkmanager/po/bg.po +++ b/tdenetworkmanager/po/bg.po @@ -294,12 +294,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Авторско право (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 main.cpp:51 msgid "Maintainer" diff --git a/tdenetworkmanager/po/bn.po b/tdenetworkmanager/po/bn.po index d48a916..4d6325a 100644 --- a/tdenetworkmanager/po/bn.po +++ b/tdenetworkmanager/po/bn.po @@ -306,12 +306,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "স্বত্ত্বাধিকার © 2007 Novell, Inc. " #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "নেটওয়ার্ক নিয়ন্ত্রক" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/bs.po b/tdenetworkmanager/po/bs.po index b9286b8..f650e34 100644 --- a/tdenetworkmanager/po/bs.po +++ b/tdenetworkmanager/po/bs.po @@ -292,12 +292,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "" #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Mreža" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/ca.po b/tdenetworkmanager/po/ca.po index 92da3eb..42b5850 100644 --- a/tdenetworkmanager/po/ca.po +++ b/tdenetworkmanager/po/ca.po @@ -307,12 +307,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright © 2007 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Adaptadors de xarxa" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/cs.po b/tdenetworkmanager/po/cs.po index 8322def..f916751 100644 --- a/tdenetworkmanager/po/cs.po +++ b/tdenetworkmanager/po/cs.po @@ -291,12 +291,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 main.cpp:51 msgid "Maintainer" diff --git a/tdenetworkmanager/po/cy.po b/tdenetworkmanager/po/cy.po index feb5652..2ac2b6f 100644 --- a/tdenetworkmanager/po/cy.po +++ b/tdenetworkmanager/po/cy.po @@ -290,12 +290,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "" #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Rhyngwyneb Rhwydwaith" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/da.po b/tdenetworkmanager/po/da.po index ecc48c6..4eb56c6 100644 --- a/tdenetworkmanager/po/da.po +++ b/tdenetworkmanager/po/da.po @@ -296,12 +296,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright © 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 main.cpp:51 msgid "Maintainer" diff --git a/tdenetworkmanager/po/de.po b/tdenetworkmanager/po/de.po index a2fc36a..e3d0a12 100644 --- a/tdenetworkmanager/po/de.po +++ b/tdenetworkmanager/po/de.po @@ -296,12 +296,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 main.cpp:51 msgid "Maintainer" diff --git a/tdenetworkmanager/po/el.po b/tdenetworkmanager/po/el.po index 1d230ef..938aa55 100644 --- a/tdenetworkmanager/po/el.po +++ b/tdenetworkmanager/po/el.po @@ -327,12 +327,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Δικτυακοί Προσαρμοστές" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/en_GB.po b/tdenetworkmanager/po/en_GB.po index a6f18b7..feccfa6 100644 --- a/tdenetworkmanager/po/en_GB.po +++ b/tdenetworkmanager/po/en_GB.po @@ -314,12 +314,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright © 2007 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Network Adapters" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/en_US.po b/tdenetworkmanager/po/en_US.po index 993cf8e..d193bd1 100644 --- a/tdenetworkmanager/po/en_US.po +++ b/tdenetworkmanager/po/en_US.po @@ -296,12 +296,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "" #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Network address" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/es.po b/tdenetworkmanager/po/es.po index d301d4b..3829d0f 100644 --- a/tdenetworkmanager/po/es.po +++ b/tdenetworkmanager/po/es.po @@ -297,14 +297,14 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright (C) 2006, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" # # include/network/lan/address.ycp:102 #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 main.cpp:51 msgid "Maintainer" diff --git a/tdenetworkmanager/po/et.po b/tdenetworkmanager/po/et.po index 2921515..ae73607 100644 --- a/tdenetworkmanager/po/et.po +++ b/tdenetworkmanager/po/et.po @@ -309,12 +309,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Autoriõigus © 2007 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Võrk: puudub" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/fi.po b/tdenetworkmanager/po/fi.po index 9b85dab..2e173ed 100644 --- a/tdenetworkmanager/po/fi.po +++ b/tdenetworkmanager/po/fi.po @@ -294,11 +294,11 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Kverkkotyökalu" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/fr.po b/tdenetworkmanager/po/fr.po index c2692ff..22057c5 100644 --- a/tdenetworkmanager/po/fr.po +++ b/tdenetworkmanager/po/fr.po @@ -303,13 +303,13 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" # TLABEL lan_2002_01_04_0147__264 #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 main.cpp:51 msgid "Maintainer" diff --git a/tdenetworkmanager/po/gl.po b/tdenetworkmanager/po/gl.po index 3e93959..3d2a4fc 100644 --- a/tdenetworkmanager/po/gl.po +++ b/tdenetworkmanager/po/gl.po @@ -291,12 +291,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 main.cpp:51 msgid "Maintainer" diff --git a/tdenetworkmanager/po/gu.po b/tdenetworkmanager/po/gu.po index 0120471..5196355 100644 --- a/tdenetworkmanager/po/gu.po +++ b/tdenetworkmanager/po/gu.po @@ -313,12 +313,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "" #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "નેટવર્ક એડેપ્ટર્સ" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/he.po b/tdenetworkmanager/po/he.po index 8cb9224..1b6b16d 100644 --- a/tdenetworkmanager/po/he.po +++ b/tdenetworkmanager/po/he.po @@ -291,11 +291,11 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "" #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/hi.po b/tdenetworkmanager/po/hi.po index a006ed5..4976d2c 100644 --- a/tdenetworkmanager/po/hi.po +++ b/tdenetworkmanager/po/hi.po @@ -311,12 +311,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "कॉपीराइट © 2007 नोवेल, इंक." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "नेटवर्क: " #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/hr.po b/tdenetworkmanager/po/hr.po index 9fde128..2fae00a 100644 --- a/tdenetworkmanager/po/hr.po +++ b/tdenetworkmanager/po/hr.po @@ -301,12 +301,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 main.cpp:51 #, fuzzy diff --git a/tdenetworkmanager/po/hu.po b/tdenetworkmanager/po/hu.po index fe5c331..34040ab 100644 --- a/tdenetworkmanager/po/hu.po +++ b/tdenetworkmanager/po/hu.po @@ -294,12 +294,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Minden jog fenntartva (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 main.cpp:51 msgid "Maintainer" diff --git a/tdenetworkmanager/po/id.po b/tdenetworkmanager/po/id.po index 847a48f..95764d3 100644 --- a/tdenetworkmanager/po/id.po +++ b/tdenetworkmanager/po/id.po @@ -294,12 +294,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "" #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Folder Network" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/it.po b/tdenetworkmanager/po/it.po index e9049b5..59b4c5f 100644 --- a/tdenetworkmanager/po/it.po +++ b/tdenetworkmanager/po/it.po @@ -300,13 +300,13 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" # TLABEL modules/dialup/dialup.ycp:1187 #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 #: main.cpp:51 diff --git a/tdenetworkmanager/po/ja.po b/tdenetworkmanager/po/ja.po index 6a03dc8..9e96e8c 100644 --- a/tdenetworkmanager/po/ja.po +++ b/tdenetworkmanager/po/ja.po @@ -294,11 +294,11 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "ネットワークマネージャ" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/ka.po b/tdenetworkmanager/po/ka.po index c764f73..d4a2833 100644 --- a/tdenetworkmanager/po/ka.po +++ b/tdenetworkmanager/po/ka.po @@ -288,12 +288,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "საავტორო უფლებები (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 main.cpp:51 msgid "Maintainer" diff --git a/tdenetworkmanager/po/km.po b/tdenetworkmanager/po/km.po index f386e69..a109d5e 100644 --- a/tdenetworkmanager/po/km.po +++ b/tdenetworkmanager/po/km.po @@ -292,12 +292,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "រក្សាសិទ្ធិ​ឆ្នាំ ២០០៥ ២០០៦ ដោយ Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 main.cpp:51 msgid "Maintainer" diff --git a/tdenetworkmanager/po/ko.po b/tdenetworkmanager/po/ko.po index 2b0a020..3cc4a94 100644 --- a/tdenetworkmanager/po/ko.po +++ b/tdenetworkmanager/po/ko.po @@ -298,11 +298,11 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "K네트워크 관리자" #: main.cpp:50 diff --git a/tdenetworkmanager/po/lo.po b/tdenetworkmanager/po/lo.po index 793288f..936004b 100644 --- a/tdenetworkmanager/po/lo.po +++ b/tdenetworkmanager/po/lo.po @@ -287,11 +287,11 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "" #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/lt.po b/tdenetworkmanager/po/lt.po index ba909d6..a1b6172 100644 --- a/tdenetworkmanager/po/lt.po +++ b/tdenetworkmanager/po/lt.po @@ -294,12 +294,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 main.cpp:51 msgid "Maintainer" diff --git a/tdenetworkmanager/po/mk.po b/tdenetworkmanager/po/mk.po index 480bb50..0d19411 100644 --- a/tdenetworkmanager/po/mk.po +++ b/tdenetworkmanager/po/mk.po @@ -294,11 +294,11 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "" #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/mr.po b/tdenetworkmanager/po/mr.po index 171ce1e..92e7f0e 100644 --- a/tdenetworkmanager/po/mr.po +++ b/tdenetworkmanager/po/mr.po @@ -311,12 +311,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "कॉपीराईट © 2007 नॉव्हेल, इंक" #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "नेटवर्क अडॅप्टर्स" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/nb.po b/tdenetworkmanager/po/nb.po index cf872fa..5cce1f4 100644 --- a/tdenetworkmanager/po/nb.po +++ b/tdenetworkmanager/po/nb.po @@ -320,12 +320,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright © 2007 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Nettverkskort" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/nl.po b/tdenetworkmanager/po/nl.po index 4b467fd..b964618 100644 --- a/tdenetworkmanager/po/nl.po +++ b/tdenetworkmanager/po/nl.po @@ -302,12 +302,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" # /usr/lib/YaST2/clients/dialup_dev_cfg.ycp:71 #: main.cpp:46 -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "KNetwerkbeheer" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/pa.po b/tdenetworkmanager/po/pa.po index b95315d..7401649 100644 --- a/tdenetworkmanager/po/pa.po +++ b/tdenetworkmanager/po/pa.po @@ -316,12 +316,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright © 2007 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "ਨੈਟਵਰਕ ਅਡੈਪਟਰ" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/pl.po b/tdenetworkmanager/po/pl.po index ec21361..b2a4c6a 100644 --- a/tdenetworkmanager/po/pl.po +++ b/tdenetworkmanager/po/pl.po @@ -324,12 +324,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright © 2007 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Karty sieciowe" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/pt.po b/tdenetworkmanager/po/pt.po index 2031d5a..01c5175 100644 --- a/tdenetworkmanager/po/pt.po +++ b/tdenetworkmanager/po/pt.po @@ -304,12 +304,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 main.cpp:51 msgid "Maintainer" diff --git a/tdenetworkmanager/po/pt_BR.po b/tdenetworkmanager/po/pt_BR.po index 84844d6..10ac9af 100644 --- a/tdenetworkmanager/po/pt_BR.po +++ b/tdenetworkmanager/po/pt_BR.po @@ -316,12 +316,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 #: main.cpp:51 diff --git a/tdenetworkmanager/po/ro.po b/tdenetworkmanager/po/ro.po index 67eacc9..8407883 100644 --- a/tdenetworkmanager/po/ro.po +++ b/tdenetworkmanager/po/ro.po @@ -298,12 +298,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 main.cpp:51 msgid "Maintainer" diff --git a/tdenetworkmanager/po/ru.po b/tdenetworkmanager/po/ru.po index 055d4c8..cd18392 100644 --- a/tdenetworkmanager/po/ru.po +++ b/tdenetworkmanager/po/ru.po @@ -303,12 +303,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Авторские права © 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 main.cpp:51 msgid "Maintainer" diff --git a/tdenetworkmanager/po/si.po b/tdenetworkmanager/po/si.po index 0c051c4..993a6de 100644 --- a/tdenetworkmanager/po/si.po +++ b/tdenetworkmanager/po/si.po @@ -290,11 +290,11 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "" #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/sk.po b/tdenetworkmanager/po/sk.po index b96e4c7..ac1c8e8 100644 --- a/tdenetworkmanager/po/sk.po +++ b/tdenetworkmanager/po/sk.po @@ -306,12 +306,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright © 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 #: main.cpp:51 diff --git a/tdenetworkmanager/po/sl.po b/tdenetworkmanager/po/sl.po index fee75ea..f25ec2b 100644 --- a/tdenetworkmanager/po/sl.po +++ b/tdenetworkmanager/po/sl.po @@ -309,12 +309,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "" #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Omrežne kartice" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/sr.po b/tdenetworkmanager/po/sr.po index 157d22f..0957c59 100644 --- a/tdenetworkmanager/po/sr.po +++ b/tdenetworkmanager/po/sr.po @@ -298,12 +298,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Ауторска права (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Мрежне фасцикле" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/sv.po b/tdenetworkmanager/po/sv.po index 05078f3..d0370a4 100644 --- a/tdenetworkmanager/po/sv.po +++ b/tdenetworkmanager/po/sv.po @@ -316,12 +316,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright © 2007 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Nätverkskort" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/ta.po b/tdenetworkmanager/po/ta.po index 44307e4..22d3130 100644 --- a/tdenetworkmanager/po/ta.po +++ b/tdenetworkmanager/po/ta.po @@ -312,12 +312,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "பதிப்புரிமை © 2007 நோவெல், இன்க்." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "வலையமைப்பு: ஏதுமில்லை" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/th.po b/tdenetworkmanager/po/th.po index 8094726..d18b7dd 100644 --- a/tdenetworkmanager/po/th.po +++ b/tdenetworkmanager/po/th.po @@ -308,12 +308,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "" #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "ด้วย NetworkManager" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/tr.po b/tdenetworkmanager/po/tr.po index 49244e5..db2a1a4 100644 --- a/tdenetworkmanager/po/tr.po +++ b/tdenetworkmanager/po/tr.po @@ -302,13 +302,13 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Telif Hakkı (C) 2005,2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" # classnames.ycp:171 classnames.ycp:176 #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Ağ arabirimi" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/uk.po b/tdenetworkmanager/po/uk.po index cd0a088..6d3fdf5 100644 --- a/tdenetworkmanager/po/uk.po +++ b/tdenetworkmanager/po/uk.po @@ -295,12 +295,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright © 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" -msgstr "KNetworkManager" +msgid "TDENetworkManager" +msgstr "TDENetworkManager" #: main.cpp:50 main.cpp:51 msgid "Maintainer" diff --git a/tdenetworkmanager/po/vi.po b/tdenetworkmanager/po/vi.po index 2ad2c7e..16c6b59 100644 --- a/tdenetworkmanager/po/vi.po +++ b/tdenetworkmanager/po/vi.po @@ -295,11 +295,11 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "" #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/wa.po b/tdenetworkmanager/po/wa.po index b661145..9e29afc 100644 --- a/tdenetworkmanager/po/wa.po +++ b/tdenetworkmanager/po/wa.po @@ -293,11 +293,11 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright © 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "KManaedjeuRantoele" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/xh.po b/tdenetworkmanager/po/xh.po index 2f461b9..6a0c7ea 100644 --- a/tdenetworkmanager/po/xh.po +++ b/tdenetworkmanager/po/xh.po @@ -310,12 +310,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Ilungelo lokukopa © 2007-2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Izilungisi Zothungelwano" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/zh_CN.po b/tdenetworkmanager/po/zh_CN.po index 7d6d3db..91d5168 100644 --- a/tdenetworkmanager/po/zh_CN.po +++ b/tdenetworkmanager/po/zh_CN.po @@ -305,11 +305,11 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "版权所有 (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" -msgstr "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" +msgstr "http://opensuse.org/Projects/TDENetworkManager" #: main.cpp:46 -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "TDE 网络管理器" #: main.cpp:50 diff --git a/tdenetworkmanager/po/zh_TW.po b/tdenetworkmanager/po/zh_TW.po index 97e1be2..0623f17 100644 --- a/tdenetworkmanager/po/zh_TW.po +++ b/tdenetworkmanager/po/zh_TW.po @@ -300,11 +300,11 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Copyright (C) 2005, 2006 Novell, Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "網路管理員" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/po/zu.po b/tdenetworkmanager/po/zu.po index 0b42b24..49e4e73 100644 --- a/tdenetworkmanager/po/zu.po +++ b/tdenetworkmanager/po/zu.po @@ -313,12 +313,12 @@ msgid "Copyright (C) 2005, 2006 Novell, Inc." msgstr "Ilungelo Lokukopisha © 2007-2007 Novell Inc." #: main.cpp:41 -msgid "http://opensuse.org/Projects/KNetworkManager" +msgid "http://opensuse.org/Projects/TDENetworkManager" msgstr "" #: main.cpp:46 #, fuzzy -msgid "KNetworkManager" +msgid "TDENetworkManager" msgstr "Ama-adapter Enethiwekhi" #: main.cpp:50 main.cpp:51 diff --git a/tdenetworkmanager/src/CMakeLists.txt b/tdenetworkmanager/src/CMakeLists.txt index 28fa0f8..ac862e2 100644 --- a/tdenetworkmanager/src/CMakeLists.txt +++ b/tdenetworkmanager/src/CMakeLists.txt @@ -46,7 +46,7 @@ install( FILES tdenetworkmanager_plugin.desktop tdenetworkmanager_vpnplugin.desk ##### tdenetman (tdeinit) ################# -tde_add_tdeinit_executable( tdenetman AUTOMOC +tde_add_tdeinit_executable( tdenetworkmanager AUTOMOC SOURCES connection_editor.ui vpnauthentication.ui main.cpp tdenetman.cpp tdenetman-tray.cpp diff --git a/tdenetworkmanager/src/configwidgets/CMakeLists.txt b/tdenetworkmanager/src/configwidgets/CMakeLists.txt new file mode 100644 index 0000000..6233f98 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/CMakeLists.txt @@ -0,0 +1,63 @@ +################################################# +# +# (C) 2012 Timothy Pearson +# kb9vqf (AT) pearsoncomputing (DOT) net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/tdenetworkmanager/src + ${CMAKE_SOURCE_DIR}/tdenetworkmanager/src/settings + ${CMAKE_SOURCE_DIR}/tdenetworkmanager/src/configwidgets + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${DBUS_TQT_INCLUDE_DIRS} + ${NM_UTIL_INCLUDE_DIRS} +) + + +##### tdenetwork-connection-configwidgets ######## + +set( target tdenetwork-connection-configwidgets ) + +set( ${target}_SRCS + 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 + tdenetman-connection_setting_cdma_widget.cpp + tdenetman-connection_setting_gsm_widget.cpp + tdenetman-connection_setting_info_widget.cpp + tdenetman-connection_setting_ipv4_widget.cpp + tdenetman-connection_setting_ppp_widget.cpp + tdenetman-connection_setting_serial_widget.cpp + tdenetman-connection_setting_wireless_security_widget.cpp + tdenetman-connection_setting_wireless_widget.cpp +# tdenetman-connection_setting_vpn_widget.cpp + tdenetman-connection_setting_widget_interface.cpp + tdenetman-connection_settings_dialog.cpp +) + +tde_add_library( ${target} STATIC_PIC AUTOMOC + SOURCES ${${target}_SRCS} +) diff --git a/tdenetworkmanager/src/eventsrc b/tdenetworkmanager/src/eventsrc index 47723af..df039f5 100644 --- a/tdenetworkmanager/src/eventsrc +++ b/tdenetworkmanager/src/eventsrc @@ -1,6 +1,6 @@ [!Global!] IconName=network -Comment=KNetworkManager +Comment=TDENetworkManager Comment[bn]=কে-নেটওয়ার্ক-ম্যানেজার Comment[da]=Netværkshåndtering Comment[sv]=Nätverkshantering @@ -10,23 +10,23 @@ Comment=VPN Banner Notification Received default_presentation=0 [knm-nm-sleeping] -Name=KNetworkManager Offline -Name[bg]=KNetworkManager - изключен от Интернет +Name=TDENetworkManager Offline +Name[bg]=TDENetworkManager - изключен от Интернет Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার অফলাইন -Name[br]=Ezlinenn eo KNetworkManager -Name[ca]=El KNetworkManager està desconnectat -Name[cs]=KNetworkManager offline +Name[br]=Ezlinenn eo TDENetworkManager +Name[ca]=El TDENetworkManager està desconnectat +Name[cs]=TDENetworkManager 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[el]=Ο TDENetworkManager χωρίς σύνδεση +Name[es]=TDENetworkManager desconectado +Name[et]=TDENetworkManager võrguta režiimis +Name[it]=TDENetworkManager Non in linea +Name[ja]=TDENetworkManager オフライン +Name[pt]=TDENetworkManager Desligado +Name[sr]=TDENetworkManager ван везе +Name[sr@Latn]=TDENetworkManager van veze Name[sv]=Nätverkshantering nerkopplad -Name[tr]=KNetworkManager Çevrimdışı +Name[tr]=TDENetworkManager Çevrimdışı Comment=Switched to offline mode Comment[bg]=Преминаване в режим "Изключен от Интернет" Comment[bn]=অফলাইন মোড চালু করা হয়েছে @@ -48,25 +48,25 @@ Comment[tr]=Çevrimdışı kipe geçildi default_presentation=0 [knm-nm-connected] -Name=KNetworkManager Connected -Name[bg]=KNetworkManager - свързан +Name=TDENetworkManager Connected +Name[bg]=TDENetworkManager - свързан Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার সংযুক্ত -Name[br]=Kevreet eo KNetworkManager -Name[ca]=El KNetworkManager està connectat -Name[cs]=KNetworkManager připojen +Name[br]=Kevreet eo TDENetworkManager +Name[ca]=El TDENetworkManager està connectat +Name[cs]=TDENetworkManager 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[de]=TDENetworkManager Verbunden +Name[el]=Ο TDENetworkManager συνδέθηκε +Name[es]=TDENetworkManager conectado +Name[et]=TDENetworkManager ühendatud +Name[it]=TDENetworkManager Connesso +Name[ja]=TDENetworkManager 接続しました +Name[nl]=TDENetworkManager Verbonden +Name[pt]=TDENetworkManager Ligado +Name[sr]=TDENetworkManager је повезан +Name[sr@Latn]=TDENetworkManager je povezan Name[sv]=Nätverkshantering ansluten -Name[tr]=KNetworkManager Bağlandı +Name[tr]=TDENetworkManager Bağlandı Comment=NetworkManager is now connected Comment[bg]=NetworkManager е свързан Comment[bn]=এখন নেটওয়ার্ক-ম্যানেজার সংযুক্ত @@ -88,30 +88,30 @@ Comment[tr]=NetworkManager şimdi bağlı default_presentation=0 [knm-nm-connecting] -Name=KNetworkManager Connecting -Name[bg]=KNetworkManager се свързва +Name=TDENetworkManager Connecting +Name[bg]=TDENetworkManager се свързва Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার সংযোগ স্থাপন করছে -Name[ca]=El KNetworkManager s'està connectant +Name[ca]=El TDENetworkManager 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[de]=TDENetworkManager Verbinden +Name[el]=Ο TDENetworkManager συνδέεται +Name[es]=TDENetworkManager conectando +Name[et]=TDENetworkManager ühendub +Name[it]=TDENetworkManager Connessione in corso +Name[ja]=TDENetworkManager 接続中 +Name[nl]=TDENetworkManager Verbinden +Name[pt]=TDENetworkManager a Ligar +Name[sr]=TDENetworkManager се повезује +Name[sr@Latn]=TDENetworkManager se povezuje Name[sv]=Nätverkshantering kopplar upp -Name[tr]=KNetworkManager Bağlanıyor +Name[tr]=TDENetworkManager 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[el]=Ο TDENetworkManager συνδέεται Comment[es]=NetworkManager se está conectando Comment[et]=Võrguhaldur ühendub Comment[it]=NetworkManager si sta connettendo @@ -125,24 +125,24 @@ Comment[tr]=NetworkManager bağlanıyor default_presentation=0 [knm-nm-disconnected] -Name=KNetworkManager Disconnected -Name[bg]=KNetworkManager - изключен от Интернет +Name=TDENetworkManager Disconnected +Name[bg]=TDENetworkManager - изключен от Интернет Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার সংযোগ বিহীন -Name[br]=Digevreet eo KNetworkManager -Name[ca]=El KNetworkManager està desconnectat +Name[br]=Digevreet eo TDENetworkManager +Name[ca]=El TDENetworkManager 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[de]=TDENetworkManager Getrennt +Name[el]=Ο TDENetworkManager αποσυνδέθηκε +Name[es]=TDENetworkManager desconectado +Name[et]=TDENetworkManager lahutatud +Name[it]=TDENetworkManager Disconnesso +Name[ja]=TDENetworkManager 切断しました +Name[nl]=TDENetworkManager Niet verbonden +Name[pt]=TDENetworkManager Desligado +Name[sr]=TDENetworkManager је развезан +Name[sr@Latn]=TDENetworkManager je razvezan Name[sv]=Nätverkshantering nerkopplad -Name[tr]=KNetworkManager Bağlı Değil +Name[tr]=TDENetworkManager Bağlı Değil Comment=NetworkManager is now disconnected Comment[bg]=NetworkManager е изключен от Интернет Comment[bn]=এখন নেটওয়ার্ক-ম্যানেজার সংযোগ বিহীন @@ -163,23 +163,23 @@ Comment[tr]=NetworkManager artık bağlı değil default_presentation=0 [knm-nm-device-added] -Name=KNetworkManager Device Added -Name[bg]=KNetworkManager - добавено е устройство +Name=TDENetworkManager Device Added +Name[bg]=TDENetworkManager - добавено е устройство Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার ডিভাইস যোগ করা হয়েছে -Name[ca]=S'ha afegit un dispositiu del KNetworkManager +Name[ca]=S'ha afegit un dispositiu del TDENetworkManager 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[de]=TDENetworkManager Gerät hinzugefügt +Name[el]=Προστέθηκε συσκευή στον TDENetworkManager +Name[es]=Añadido dispositivo a TDENetworkManager +Name[et]=TDENetworkManager lisas seadme +Name[it]=TDENetworkManager Dispositivo aggiunto +Name[ja]=TDENetworkManager デバイスが追加されました +Name[nl]=TDENetworkManager Apparaat toegevoegd +Name[pt]=TDENetworkManager com Dispositivo Adicionado +Name[sr]=TDENetworkManager уређај додат +Name[sr@Latn]=TDENetworkManager uređaj dodat Name[sv]=Nätverkshantering enhet tillagd -Name[tr]=KNetworkManager Aygıt Eklendi +Name[tr]=TDENetworkManager Aygıt Eklendi Comment=New network device found Comment[bg]=Открито е ново мрежово устройство Comment[bn]=নতুন নেটওয়ার্ক ডিভাইস খুঁজে পেয়েছে @@ -201,23 +201,23 @@ Comment[tr]=Yeni ağ aygıtı bulundu default_presentation=0 [knm-nm-device-removed] -Name=KNetworkManager Device Removed -Name[bg]=KNetworkManager - устройството е премахнато +Name=TDENetworkManager Device Removed +Name[bg]=TDENetworkManager - устройството е премахнато Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার ডিভাইস অপসারিত করা হয়েছে -Name[ca]=S'ha eliminat un dispositiu del KNetworkManager +Name[ca]=S'ha eliminat un dispositiu del TDENetworkManager 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[de]=TDENetworkManager Gerät entfernt +Name[el]=Αφαιρέθηκε συσκευή από τον TDENetworkManager +Name[es]=Eliminado dispositivo de TDENetworkManager +Name[et]=TDENetworkManager eemaldas seadme +Name[it]=TDENetworkManager Dispositivo rimosso +Name[ja]=TDENetworkManager デバイスが削除されました +Name[nl]=TDENetworkManager Apparaat verwijderd +Name[pt]=TDENetworkManager com Dispositivo Removido +Name[sr]=TDENetworkManager уређај уклоњен +Name[sr@Latn]=TDENetworkManager uređaj uklonjen Name[sv]=Nätverkshantering enhet borttagen -Name[tr]=KNetworkManager Aygıt Kaldırıldı +Name[tr]=TDENetworkManager Aygıt Kaldırıldı Comment=Network device removed Comment[bg]=Мрежовото устройство е премахнато Comment[bn]=নেটওয়ার্ক ডিভাইস অপসারিত করা হয়েছে @@ -239,23 +239,23 @@ 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=TDENetworkManager New Wireless Network Found +Name[bg]=TDENetworkManager - намерена е нова безжична мрежа Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার নতুন ওয়্যারলেস নেটওয়ার্ক খুঁজে পেয়েছে -Name[ca]=S'ha trobat una nova xarxa sense fils del KNetworkManager +Name[ca]=S'ha trobat una nova xarxa sense fils del TDENetworkManager 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[de]=TDENetworkManager Neues drahtloses Netzwerk gefunden +Name[el]=Βρέθηκε νέο ασύρματο δίκτυο στον TDENetworkManager +Name[es]=Encontrada nueva red inalámbrica en TDENetworkManager +Name[et]=TDENetworkManager leidis uue traadita võrgu +Name[it]=TDENetworkManager Trovata nuova rete senza fili +Name[ja]=TDENetworkManager ワイヤレスネットワークを検出 +Name[nl]=TDENetworkManager Nieuw draadloos netwerk gevonden +Name[pt]=TDENetworkManager com Nova Rede Sem-Fios Encontrada +Name[sr]=TDENetworkManager нова бежична мрежа је нађена +Name[sr@Latn]=TDENetworkManager 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 +Name[tr]=TDENetworkManager Yeni Kablosuz Ağ Bulundu Comment=New wireless network found Comment[bg]=Намерена е нова безжична мрежа Comment[bn]=নতুন ওয়্যারলেস নেটওয়ার্ক খুঁজে পেয়েছে @@ -276,23 +276,23 @@ Comment[tr]=Yeni kablosuz ağ bulundu default_presentation=0 [knm-nm-network-gone] -Name=KNetworkManager Wireless Network Disappeared -Name[bg]=KNetworkManager - безжичната мрежа се изгуби +Name=TDENetworkManager Wireless Network Disappeared +Name[bg]=TDENetworkManager - безжичната мрежа се изгуби Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার ওয়্যারলেস নেটওয়ার্ক অন্তর্ধান করেছে -Name[ca]=Ha desaparegut la xarxa sense fils del KNetworkManager +Name[ca]=Ha desaparegut la xarxa sense fils del TDENetworkManager 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[de]=TDENetworkManager Drahtloses Netzwerk nicht mehr vorhanden +Name[el]=Ένα ασύρματο δίκτυο αφαιρέθηκε από τον TDENetworkManager +Name[es]=Desaparecida red inalámbrica en TDENetworkManager +Name[et]=TDENetworkManager kaotas traadita võrgu +Name[it]=TDENetworkManager È scomparsa la rete senza fili +Name[ja]=TDENetworkManager ワイヤレスネットワークが消失 +Name[nl]=TDENetworkManager Draadloos netwerk verdwenen +Name[pt]=TDENetworkManager Rede Sem-Fios Desaparecida +Name[sr]=TDENetworkManager бежична мрежа је нестала +Name[sr@Latn]=TDENetworkManager 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 +Name[tr]=TDENetworkManager Kablosuz Ağ Yok Oldu Comment=Wireless network disappeared Comment[bg]=Безжичната мрежа се изгуби Comment[bn]=ওয়্যারলেস নেটওয়ার্ক অন্তর্ধান করেছে diff --git a/tdenetworkmanager/src/main.cpp b/tdenetworkmanager/src/main.cpp index 7d1a6f1..08cd81e 100644 --- a/tdenetworkmanager/src/main.cpp +++ b/tdenetworkmanager/src/main.cpp @@ -56,8 +56,8 @@ kdemain (int argc, char* argv[]) KCmdLineArgs::init (argc, argv, &aboutData); - if (KNetworkManager::start ()) { - KNetworkManager app; + if (TDENetworkManager::start ()) { + TDENetworkManager app; app.disableSessionManagement (); return app.exec (); } diff --git a/tdenetworkmanager/src/settings/CMakeLists.txt b/tdenetworkmanager/src/settings/CMakeLists.txt new file mode 100644 index 0000000..cdaec6e --- /dev/null +++ b/tdenetworkmanager/src/settings/CMakeLists.txt @@ -0,0 +1,41 @@ +################################################# +# +# (C) 2012 Timothy Pearson +# kb9vqf (AT) pearsoncomputing (DOT) net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/tdenetworkmanager/src + ${CMAKE_SOURCE_DIR}/tdenetworkmanager/src/settings + ${CMAKE_SOURCE_DIR}/tdenetworkmanager/src/configwidgets + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${DBUS_TQT_INCLUDE_DIRS} + ${NM_UTIL_INCLUDE_DIRS} +) + + +##### tdenetwork-connection-settings ############ + +set( target tdenetwork-connection-settings ) + +set( ${target}_SRCS + 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 +) + +tde_add_library( ${target} STATIC_PIC AUTOMOC + SOURCES ${${target}_SRCS} +) diff --git a/tdenetworkmanager/src/tdenetman-device_tray.cpp b/tdenetworkmanager/src/tdenetman-device_tray.cpp index 14a218e..a58b3fc 100644 --- a/tdenetworkmanager/src/tdenetman-device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-device_tray.cpp @@ -220,7 +220,7 @@ void DeviceTray::contextMenuAboutToShow (KPopupMenu* menu) menu->clear(); // insert title - menu->insertTitle (SmallIcon ("tdenetman", TQIconSet::Automatic), "KNetworkManager", -1, -1); + menu->insertTitle (SmallIcon ("tdenetworkmanager", TQIconSet::Automatic), "TDENetworkManager", -1, -1); // let the specific device_tray add its items addMenuItems(menu); @@ -286,7 +286,7 @@ void DeviceTray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnection setPixmap(d->pixmapForConnState(state)); } else { - setPixmap(loadSizedIcon("KNetworkManager", width())); + setPixmap(loadSizedIcon("TDENetworkManager", width())); } m_currentIconState = state; diff --git a/tdenetworkmanager/src/tdenetman-pluginmanager.cpp b/tdenetworkmanager/src/tdenetman-pluginmanager.cpp index c197da9..a5dfce9 100644 --- a/tdenetworkmanager/src/tdenetman-pluginmanager.cpp +++ b/tdenetworkmanager/src/tdenetman-pluginmanager.cpp @@ -35,14 +35,14 @@ PluginManager* PluginManager::getInstance() { if (_instance) return _instance; - return new PluginManager(TQT_TQOBJECT(KNetworkManager::getInstance()), "pluginmanager"); + return new PluginManager(TQT_TQOBJECT(TDENetworkManager::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::fromLatin1( "KNetworkManager/Plugin" ))); + this->_plugins = KPluginInfo::fromServices( KTrader::self()->query( TQString::fromLatin1( "TDENetworkManager/Plugin" ))); // a bit debug output for(TQValueList::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it) @@ -125,7 +125,7 @@ Plugin* PluginManager::loadPlugin(const TQString& pluginID) // try to load Plugin int error = 0; KPluginInfo* info = infoForPluginID(pluginID); - Plugin *plugin = KParts::ComponentFactory::createInstanceFromQuery( TQString::fromLatin1( "KNetworkManager/Plugin" ), + Plugin *plugin = KParts::ComponentFactory::createInstanceFromQuery( TQString::fromLatin1( "TDENetworkManager/Plugin" ), TQString::fromLatin1( "[X-TDE-PluginInfo-Name]=='%1'" ).arg( pluginID ), this, 0, TQStringList(), &error ); // plugin loaded? diff --git a/tdenetworkmanager/src/tdenetman-tray.cpp b/tdenetworkmanager/src/tdenetman-tray.cpp index 36d2743..fae3a15 100644 --- a/tdenetworkmanager/src/tdenetman-tray.cpp +++ b/tdenetworkmanager/src/tdenetman-tray.cpp @@ -676,7 +676,7 @@ void Tray::slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobal KNotifyClient::event( winId(), "knm-nm-connected", i18n("NetworkManager is now connected") ); } else if (nm_state & TDENetworkGlobalManagerFlags::Sleeping) { - KNotifyClient::event( winId(), "knm-nm-sleeping", i18n("KNetworkManager Offline") ); + KNotifyClient::event( winId(), "knm-nm-sleeping", i18n("TDENetworkManager Offline") ); } else if (nm_state & TDENetworkGlobalManagerFlags::Unknown) { // diff --git a/tdenetworkmanager/src/tdenetman-vpn_plugin.h b/tdenetworkmanager/src/tdenetman-vpn_plugin.h index 00d3c8e..56a03d6 100644 --- a/tdenetworkmanager/src/tdenetman-vpn_plugin.h +++ b/tdenetworkmanager/src/tdenetman-vpn_plugin.h @@ -32,7 +32,7 @@ // KNM includes #include "tdenetman.h" -class KNetworkManager; +class TDENetworkManager; class VPNDBUSPluginPrivate; diff --git a/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h index f1af73b..5602518 100644 --- a/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h +++ b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h @@ -35,7 +35,7 @@ #include "tdenetman-vpnplugin.h" #include "tdenetman-vpnmanager.h" -class KNetworkManager; +class TDENetworkManager; class ManageConnectionsDialog; class VPNService; diff --git a/tdenetworkmanager/src/tdenetman-vpnmanager.cpp b/tdenetworkmanager/src/tdenetman-vpnmanager.cpp index 530be61..d3472c3 100644 --- a/tdenetworkmanager/src/tdenetman-vpnmanager.cpp +++ b/tdenetworkmanager/src/tdenetman-vpnmanager.cpp @@ -59,7 +59,7 @@ VPNManager::getVPNServices () 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())); + VPNService* vpnservice = new VPNService(kconfig->readEntry ("name", TQString()), kconfig->readEntry ("service", TQString()), TQT_TQOBJECT(TDENetworkManager::getInstance())); if (!vpnservice->getVPNPlugin()) delete vpnservice; else @@ -92,7 +92,7 @@ VPNManager::getVPNService(TQString service_type) 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())); + VPNService* vpnservice = new VPNService(kconfig->readEntry ("name", TQString()), kconfig->readEntry ("service", TQString()), TQT_TQOBJECT(TDENetworkManager::getInstance())); if (!vpnservice->getVPNPlugin()) delete vpnservice; else diff --git a/tdenetworkmanager/src/tdenetman-vpnmanager.h b/tdenetworkmanager/src/tdenetman-vpnmanager.h index 89e8032..d6e6002 100644 --- a/tdenetworkmanager/src/tdenetman-vpnmanager.h +++ b/tdenetworkmanager/src/tdenetman-vpnmanager.h @@ -35,7 +35,7 @@ #include "tdenetman.h" #include "tdenetman-vpnplugin.h" -class KNetworkManager; +class TDENetworkManager; class VPNService; typedef TQValueList VPNServiceList; diff --git a/tdenetworkmanager/src/tdenetman-vpnplugin.h b/tdenetworkmanager/src/tdenetman-vpnplugin.h index c89fc5e..d98db7e 100644 --- a/tdenetworkmanager/src/tdenetman-vpnplugin.h +++ b/tdenetworkmanager/src/tdenetman-vpnplugin.h @@ -31,7 +31,7 @@ #include #include "tdenetman-plugin.h" -#define KNETWORKMANAGER_VPNPLUGIN "KNetworkManager/VPNPlugin" +#define KNETWORKMANAGER_VPNPLUGIN "TDENetworkManager/VPNPlugin" class VPNConfigWidget : public TQWidget { diff --git a/tdenetworkmanager/src/tdenetman-vpnservice.cpp b/tdenetworkmanager/src/tdenetman-vpnservice.cpp index a43826d..b2643cf 100644 --- a/tdenetworkmanager/src/tdenetman-vpnservice.cpp +++ b/tdenetworkmanager/src/tdenetman-vpnservice.cpp @@ -56,7 +56,7 @@ VPNService::VPNService(const TQString& serviceName, const TQString& service, TQO PluginManager* plugMan = PluginManager::getInstance(); if (plugMan) { - TQStringList list = plugMan->getPluginList("KNetworkManager/VPNPlugin", "X-NetworkManager-Services", serviceName); + TQStringList list = plugMan->getPluginList("TDENetworkManager/VPNPlugin", "X-NetworkManager-Services", serviceName); if (list.size() > 0) { // get the first VPN Plugin handling our VPNService diff --git a/tdenetworkmanager/src/tdenetman-vpnservice.h b/tdenetworkmanager/src/tdenetman-vpnservice.h index 03dda01..d95fafa 100644 --- a/tdenetworkmanager/src/tdenetman-vpnservice.h +++ b/tdenetworkmanager/src/tdenetman-vpnservice.h @@ -35,7 +35,7 @@ #include "tdenetman.h" #include "tdenetman-vpnplugin.h" -class KNetworkManager; +class TDENetworkManager; class VPNService; class KConfigGroup; diff --git a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp index b8be188..a9ca359 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp @@ -376,12 +376,12 @@ void WirelessDeviceTray::apPropertyChanged(TDEMACAddress BSSID, TDENetworkAPEven void WirelessDeviceTray::slotAccessPointAdded(TDENetworkWiFiAPInfo* ap) { - KNotifyClient::event( tray()->winId(), "knm-nm-network-found", i18n("KNetworkManager New Wireless Network Found") ); + KNotifyClient::event( tray()->winId(), "knm-nm-network-found", i18n("TDENetworkManager New Wireless Network Found") ); } void WirelessDeviceTray::slotAccessPointRemoved(const TQString&) { - KNotifyClient::event( tray()->winId(), "knm-nm-network-gone", i18n("KNetworkManager Wireless Network Disappeared") ); + KNotifyClient::event( tray()->winId(), "knm-nm-network-gone", i18n("TDENetworkManager Wireless Network Disappeared") ); } WirelessDeviceTray::WirelessDeviceTray (TDENetworkDevice* dev, KSystemTray * parent, const char * name) diff --git a/tdenetworkmanager/src/tdenetman-wireless_network.h b/tdenetworkmanager/src/tdenetman-wireless_network.h index bf0ab03..8ace658 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_network.h +++ b/tdenetworkmanager/src/tdenetman-wireless_network.h @@ -32,7 +32,7 @@ #include #include -class KNetworkManager; +class TDENetworkManager; class WirelessNetworkPrivate; /* diff --git a/tdenetworkmanager/src/tdenetman.cpp b/tdenetworkmanager/src/tdenetman.cpp index d8125f2..9ef8f9f 100644 --- a/tdenetworkmanager/src/tdenetman.cpp +++ b/tdenetworkmanager/src/tdenetman.cpp @@ -44,36 +44,36 @@ extern TDENetworkConnectionStatus::TDENetworkConnectionStatus nm_device_state_global; -class KNetworkManagerPrivate +class TDENetworkManagerPrivate { public: - KNetworkManagerPrivate() {} - ~KNetworkManagerPrivate() {} - static KNetworkManager* _ctx; + TDENetworkManagerPrivate() {} + ~TDENetworkManagerPrivate() {} + static TDENetworkManager* _ctx; }; -KNetworkManager* KNetworkManagerPrivate::_ctx = NULL; +TDENetworkManager* TDENetworkManagerPrivate::_ctx = NULL; -KNetworkManager* KNetworkManager::getInstance() +TDENetworkManager* TDENetworkManager::getInstance() { - return KNetworkManagerPrivate::_ctx; + return TDENetworkManagerPrivate::_ctx; } void -KNetworkManager::slotShutDown() +TDENetworkManager::slotShutDown() { // } -void KNetworkManager::timerEvent( TQTimerEvent *e ) +void TDENetworkManager::timerEvent( TQTimerEvent *e ) { Tray* tray = Tray::getInstance(); tray->slotUpdateDeviceState(nm_device_state_global); } -KNetworkManager::KNetworkManager () : KUniqueApplication () +TDENetworkManager::TDENetworkManager () : KUniqueApplication () { - d = new KNetworkManagerPrivate(); + d = new TDENetworkManagerPrivate(); d->_ctx = this; // we need to get informed when shutting down @@ -85,7 +85,7 @@ KNetworkManager::KNetworkManager () : KUniqueApplication () setMainWidget(tray); } -KNetworkManager::~KNetworkManager() +TDENetworkManager::~TDENetworkManager() { delete d; } diff --git a/tdenetworkmanager/src/tdenetman.h b/tdenetworkmanager/src/tdenetman.h index 6ab2ca1..8fd1a05 100644 --- a/tdenetworkmanager/src/tdenetman.h +++ b/tdenetworkmanager/src/tdenetman.h @@ -31,24 +31,24 @@ // KNM includes #include "config.h" -class KNetworkManagerPrivate; +class TDENetworkManagerPrivate; class Device; -class KNetworkManager : public KUniqueApplication +class TDENetworkManager : public KUniqueApplication { Q_OBJECT public: - KNetworkManager (); - ~KNetworkManager (); + TDENetworkManager (); + ~TDENetworkManager (); - static KNetworkManager* getInstance (void); + static TDENetworkManager* getInstance (void); public slots: void slotShutDown(); private: - KNetworkManagerPrivate* d; + TDENetworkManagerPrivate* d; protected: void timerEvent( TQTimerEvent *e ); diff --git a/tdenetworkmanager/vpn-plugins/openvpn/knetworkmanager_openvpn.desktop b/tdenetworkmanager/vpn-plugins/openvpn/knetworkmanager_openvpn.desktop index ece3c52..2f8d837 100644 --- a/tdenetworkmanager/vpn-plugins/openvpn/knetworkmanager_openvpn.desktop +++ b/tdenetworkmanager/vpn-plugins/openvpn/knetworkmanager_openvpn.desktop @@ -2,7 +2,7 @@ Encoding=UTF-8 Type=Service Icon= -ServiceTypes=KNetworkManager/VPNPlugin +ServiceTypes=TDENetworkManager/VPNPlugin X-TDE-Library=knetworkmanager_openvpn X-NetworkManager-Services=openvpn X-TDE-PluginInfo-Author=Helmut Schaa diff --git a/tdenetworkmanager/vpn-plugins/pptp/knetworkmanager_pptp.desktop b/tdenetworkmanager/vpn-plugins/pptp/knetworkmanager_pptp.desktop index 68a0267..bbc0b4b 100644 --- a/tdenetworkmanager/vpn-plugins/pptp/knetworkmanager_pptp.desktop +++ b/tdenetworkmanager/vpn-plugins/pptp/knetworkmanager_pptp.desktop @@ -2,7 +2,7 @@ Encoding=UTF-8 Type=Service Icon= -ServiceTypes=KNetworkManager/VPNPlugin +ServiceTypes=TDENetworkManager/VPNPlugin X-TDE-Library=knetworkmanager_pptp X-NetworkManager-Services=pptp X-TDE-PluginInfo-Author=Helmut Schaa diff --git a/tdenetworkmanager/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop b/tdenetworkmanager/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop index f4c8f2f..2ea51d3 100644 --- a/tdenetworkmanager/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop +++ b/tdenetworkmanager/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop @@ -2,7 +2,7 @@ Encoding=UTF-8 Type=Service Icon= -ServiceTypes=KNetworkManager/VPNPlugin +ServiceTypes=TDENetworkManager/VPNPlugin X-TDE-Library=knetworkmanager_strongswan X-NetworkManager-Services=strongswan X-TDE-PluginInfo-Author=Thomas Kallenberg diff --git a/tdenetworkmanager/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop b/tdenetworkmanager/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop index e37900f..fd7d07c 100644 --- a/tdenetworkmanager/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop +++ b/tdenetworkmanager/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop @@ -2,7 +2,7 @@ Encoding=UTF-8 Type=Service Icon= -ServiceTypes=KNetworkManager/VPNPlugin +ServiceTypes=TDENetworkManager/VPNPlugin X-TDE-Library=knetworkmanager_vpnc X-NetworkManager-Services=vpnc X-TDE-PluginInfo-Author=Helmut Schaa -- cgit v1.2.1 From 10cd918b01306e12bddc1eb92c1f64c5a258f3bf Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 7 Sep 2012 00:48:03 -0500 Subject: Rename icons --- tdenetworkmanager/pics/hi16-app-tdenetman.png | Bin 954 -> 0 bytes tdenetworkmanager/pics/hi16-app-tdenetman_disabled.png | Bin 650 -> 0 bytes tdenetworkmanager/pics/hi16-app-tdenetworkmanager.png | Bin 0 -> 954 bytes .../pics/hi16-app-tdenetworkmanager_disabled.png | Bin 0 -> 650 bytes tdenetworkmanager/pics/hi32-app-tdenetman.png | Bin 2636 -> 0 bytes tdenetworkmanager/pics/hi32-app-tdenetman_disabled.png | Bin 2202 -> 0 bytes tdenetworkmanager/pics/hi32-app-tdenetworkmanager.png | Bin 0 -> 2636 bytes .../pics/hi32-app-tdenetworkmanager_disabled.png | Bin 0 -> 2202 bytes tdenetworkmanager/pics/hi48-app-tdenetman.png | Bin 7282 -> 0 bytes tdenetworkmanager/pics/hi48-app-tdenetman_disabled.png | Bin 8390 -> 0 bytes tdenetworkmanager/pics/hi48-app-tdenetworkmanager.png | Bin 0 -> 7282 bytes .../pics/hi48-app-tdenetworkmanager_disabled.png | Bin 0 -> 8390 bytes 12 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tdenetworkmanager/pics/hi16-app-tdenetman.png delete mode 100644 tdenetworkmanager/pics/hi16-app-tdenetman_disabled.png create mode 100644 tdenetworkmanager/pics/hi16-app-tdenetworkmanager.png create mode 100644 tdenetworkmanager/pics/hi16-app-tdenetworkmanager_disabled.png delete mode 100644 tdenetworkmanager/pics/hi32-app-tdenetman.png delete mode 100644 tdenetworkmanager/pics/hi32-app-tdenetman_disabled.png create mode 100644 tdenetworkmanager/pics/hi32-app-tdenetworkmanager.png create mode 100644 tdenetworkmanager/pics/hi32-app-tdenetworkmanager_disabled.png delete mode 100644 tdenetworkmanager/pics/hi48-app-tdenetman.png delete mode 100644 tdenetworkmanager/pics/hi48-app-tdenetman_disabled.png create mode 100644 tdenetworkmanager/pics/hi48-app-tdenetworkmanager.png create mode 100644 tdenetworkmanager/pics/hi48-app-tdenetworkmanager_disabled.png diff --git a/tdenetworkmanager/pics/hi16-app-tdenetman.png b/tdenetworkmanager/pics/hi16-app-tdenetman.png deleted file mode 100644 index db29bb8..0000000 Binary files a/tdenetworkmanager/pics/hi16-app-tdenetman.png and /dev/null differ diff --git a/tdenetworkmanager/pics/hi16-app-tdenetman_disabled.png b/tdenetworkmanager/pics/hi16-app-tdenetman_disabled.png deleted file mode 100644 index 971f7e3..0000000 Binary files a/tdenetworkmanager/pics/hi16-app-tdenetman_disabled.png and /dev/null differ diff --git a/tdenetworkmanager/pics/hi16-app-tdenetworkmanager.png b/tdenetworkmanager/pics/hi16-app-tdenetworkmanager.png new file mode 100644 index 0000000..db29bb8 Binary files /dev/null and b/tdenetworkmanager/pics/hi16-app-tdenetworkmanager.png differ diff --git a/tdenetworkmanager/pics/hi16-app-tdenetworkmanager_disabled.png b/tdenetworkmanager/pics/hi16-app-tdenetworkmanager_disabled.png new file mode 100644 index 0000000..971f7e3 Binary files /dev/null and b/tdenetworkmanager/pics/hi16-app-tdenetworkmanager_disabled.png differ diff --git a/tdenetworkmanager/pics/hi32-app-tdenetman.png b/tdenetworkmanager/pics/hi32-app-tdenetman.png deleted file mode 100644 index 5e98e9c..0000000 Binary files a/tdenetworkmanager/pics/hi32-app-tdenetman.png and /dev/null differ diff --git a/tdenetworkmanager/pics/hi32-app-tdenetman_disabled.png b/tdenetworkmanager/pics/hi32-app-tdenetman_disabled.png deleted file mode 100644 index a9ed5f9..0000000 Binary files a/tdenetworkmanager/pics/hi32-app-tdenetman_disabled.png and /dev/null differ diff --git a/tdenetworkmanager/pics/hi32-app-tdenetworkmanager.png b/tdenetworkmanager/pics/hi32-app-tdenetworkmanager.png new file mode 100644 index 0000000..5e98e9c Binary files /dev/null and b/tdenetworkmanager/pics/hi32-app-tdenetworkmanager.png differ diff --git a/tdenetworkmanager/pics/hi32-app-tdenetworkmanager_disabled.png b/tdenetworkmanager/pics/hi32-app-tdenetworkmanager_disabled.png new file mode 100644 index 0000000..a9ed5f9 Binary files /dev/null and b/tdenetworkmanager/pics/hi32-app-tdenetworkmanager_disabled.png differ diff --git a/tdenetworkmanager/pics/hi48-app-tdenetman.png b/tdenetworkmanager/pics/hi48-app-tdenetman.png deleted file mode 100644 index 8306829..0000000 Binary files a/tdenetworkmanager/pics/hi48-app-tdenetman.png and /dev/null differ diff --git a/tdenetworkmanager/pics/hi48-app-tdenetman_disabled.png b/tdenetworkmanager/pics/hi48-app-tdenetman_disabled.png deleted file mode 100644 index 53eafb4..0000000 Binary files a/tdenetworkmanager/pics/hi48-app-tdenetman_disabled.png and /dev/null differ diff --git a/tdenetworkmanager/pics/hi48-app-tdenetworkmanager.png b/tdenetworkmanager/pics/hi48-app-tdenetworkmanager.png new file mode 100644 index 0000000..8306829 Binary files /dev/null and b/tdenetworkmanager/pics/hi48-app-tdenetworkmanager.png differ diff --git a/tdenetworkmanager/pics/hi48-app-tdenetworkmanager_disabled.png b/tdenetworkmanager/pics/hi48-app-tdenetworkmanager_disabled.png new file mode 100644 index 0000000..53eafb4 Binary files /dev/null and b/tdenetworkmanager/pics/hi48-app-tdenetworkmanager_disabled.png differ -- cgit v1.2.1 From 1a6fd0dfad42fee3e6e829a25ef767e577c283d9 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 7 Sep 2012 22:54:21 -0500 Subject: Store UUIDs and UDIs internally instead of pointers to connection and device objects --- tdenetworkmanager/src/devicetraycomponent.cpp | 27 ++++-- tdenetworkmanager/src/devicetraycomponent.h | 10 +-- .../src/tdenetman-cellular_device_tray.cpp | 20 +++-- .../src/tdenetman-cellular_device_tray.h | 2 +- tdenetworkmanager/src/tdenetman-menuitem.cpp | 30 ++++--- tdenetworkmanager/src/tdenetman-menuitem.h | 2 +- tdenetworkmanager/src/tdenetman-tray.cpp | 97 +++++++++++++--------- tdenetworkmanager/src/tdenetman-tray.h | 6 +- .../src/tdenetman-wired_device_tray.cpp | 18 ++-- .../src/tdenetman-wired_device_tray.h | 2 +- .../src/tdenetman-wireless_device_tray.cpp | 63 ++++++++++---- .../src/tdenetman-wireless_device_tray.h | 2 +- .../src/tdenetman-wireless_menuitem.cpp | 24 ++++-- .../src/tdenetman-wireless_menuitem.h | 8 +- 14 files changed, 198 insertions(+), 113 deletions(-) diff --git a/tdenetworkmanager/src/devicetraycomponent.cpp b/tdenetworkmanager/src/devicetraycomponent.cpp index 9782cd1..b277ba1 100644 --- a/tdenetworkmanager/src/devicetraycomponent.cpp +++ b/tdenetworkmanager/src/devicetraycomponent.cpp @@ -5,8 +5,8 @@ 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 TDE e.V. (or its successor approved -by the membership of TDE e.V.), which shall act as a proxy +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, @@ -63,10 +63,17 @@ TQString DeviceTrayComponent::tooltipForConnState(TDENetworkConnectionStatus::TD return TQString::null; } -DeviceTrayComponent::DeviceTrayComponent(TDENetworkDevice * device, KSystemTray * parent, const char * name ) +DeviceTrayComponent::DeviceTrayComponent(TQString device, KSystemTray * parent, const char * name ) : TrayComponent(parent, name), m_device(device) { - connect( m_device, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), TQT_SLOT(deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus))); + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(m_device)); + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + + // TDENM FIXME + // This TQt connection will need to be re-established whenever the device list changes, e.g. after a call to TDEHardwareDevices::queryHardwareInformation() + // Therefore, this class should listen to hardwareEvent(TDEHardwareEvent::TDEHardwareEvent, TQString) and reload devices if TDEHardwareEvent::HardwareListModified is passed + connect(deviceConnMan, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), TQT_SLOT(deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus))); m_pixmaps[TDENetworkConnectionStatus::Invalid] = "nm_no_connection"; m_pixmaps[TDENetworkConnectionStatus::UnManaged] = "nm_no_connection"; @@ -96,18 +103,21 @@ DeviceTrayComponent::~DeviceTrayComponent() { } -TDENetworkDevice* DeviceTrayComponent::device() const +TQString DeviceTrayComponent::device() const { return m_device; } TQStringList DeviceTrayComponent::getToolTipText() { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(m_device)); + TQStringList list; - TDENetworkConnectionManager* deviceConnMan = m_device->connectionManager(); + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); TDENetworkConnectionStatus::TDENetworkConnectionStatus state = deviceConnMan->deviceInformation().statusFlags; if (tooltipForConnState(state) != "") { - list.append(i18n("Device: %1").arg(m_device->deviceNode())); + list.append(i18n("Device: %1").arg(dev->deviceNode())); list.append(i18n("State: %1").arg(tooltipForConnState(state))); } return list; @@ -146,6 +156,9 @@ void DeviceTrayComponent::setPixmapForState(TDENetworkConnectionStatus::TDENetwo void DeviceTrayComponent::deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { +// TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); +// TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(m_device)); + //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? diff --git a/tdenetworkmanager/src/devicetraycomponent.h b/tdenetworkmanager/src/devicetraycomponent.h index 6f6c543..50d5d6a 100644 --- a/tdenetworkmanager/src/devicetraycomponent.h +++ b/tdenetworkmanager/src/devicetraycomponent.h @@ -5,8 +5,8 @@ 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 TDE e.V. (or its successor approved -by the membership of TDE e.V.), which shall act as a proxy +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, @@ -40,12 +40,12 @@ class DeviceTrayComponent : public TrayComponent Q_OBJECT public: - DeviceTrayComponent(TDENetworkDevice * device, KSystemTray * parent, const char * name ); + DeviceTrayComponent(TQString device, KSystemTray * parent, const char * name ); virtual ~DeviceTrayComponent(); TQPixmap pixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); TQMovie movieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); virtual TQStringList getToolTipText(); - TDENetworkDevice* device() const; + TQString device() const; signals: void needsCenterStage(TrayComponent *, bool); @@ -66,7 +66,7 @@ class DeviceTrayComponent : public TrayComponent TQString tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); private: - TDENetworkDevice * m_device; + TQString m_device; TQMap m_movies; TQMap m_pixmaps; TQMap m_tooltips; diff --git a/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp index 542f678..c1a85f9 100644 --- a/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp @@ -45,17 +45,22 @@ class CellularDeviceTrayPrivate CellularDeviceTrayPrivate() {} ~CellularDeviceTrayPrivate() {} - TDENetworkDevice* dev; + TQString dev; }; void CellularDeviceTray::newConnection() { + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); + // create an appropriate connection TDENetworkConnection* conn = 0; - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); switch (deviceConnMan->deviceType()) { case TDENetworkDeviceType::Modem: conn = new TDEModemConnection(); + nm->loadConnectionAllowedValues(conn); break; default: @@ -70,13 +75,16 @@ void CellularDeviceTray::newConnection() void CellularDeviceTray::addMenuItems(KPopupMenu* menu) { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); + // device title - Subhead* subhead = new Subhead (menu, "subhead", d->dev->deviceNode(), SmallIcon("nm_device_wwan", TQIconSet::Automatic)); + Subhead* subhead = new Subhead (menu, "subhead", dev->deviceNode(), SmallIcon("nm_device_wwan", TQIconSet::Automatic)); menu->insertItem (subhead, -1, -1); //menu->insertSeparator(); TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); TDENetworkConnection* active_conn = NULL; if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected)) && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) { @@ -98,7 +106,7 @@ void CellularDeviceTray::addMenuItems(KPopupMenu* menu) title += TQString(" (%1)").arg((conn->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPIP) ? i18n("DHCP") : i18n("Manual IP config")); } - NetworkMenuItem* item = new NetworkMenuItem(d->dev, conn, TQT_TQOBJECT(menu)); + NetworkMenuItem* item = new NetworkMenuItem(d->dev, conn->UUID, TQT_TQOBJECT(menu)); int id = menu->insertItem(title, item, TQT_SLOT(slotActivate())); menu->setItemChecked(id, ((*it) == active_conn)); @@ -112,7 +120,7 @@ void CellularDeviceTray::addMenuItems(KPopupMenu* menu) menu->insertSeparator(); } -CellularDeviceTray::CellularDeviceTray (TDENetworkDevice* dev, KSystemTray * parent, const char * name) +CellularDeviceTray::CellularDeviceTray (TQString dev, KSystemTray * parent, const char * name) : DeviceTrayComponent (dev, parent, name) { d = new CellularDeviceTrayPrivate(); diff --git a/tdenetworkmanager/src/tdenetman-cellular_device_tray.h b/tdenetworkmanager/src/tdenetman-cellular_device_tray.h index 9bde7d1..ed7719b 100644 --- a/tdenetworkmanager/src/tdenetman-cellular_device_tray.h +++ b/tdenetworkmanager/src/tdenetman-cellular_device_tray.h @@ -40,7 +40,7 @@ class CellularDeviceTray : public DeviceTrayComponent Q_OBJECT public: - CellularDeviceTray (TDENetworkDevice*, KSystemTray * parent = 0, const char * name = 0); + CellularDeviceTray (TQString, KSystemTray * parent = 0, const char * name = 0); ~CellularDeviceTray (); void addMenuItems(KPopupMenu* menu); diff --git a/tdenetworkmanager/src/tdenetman-menuitem.cpp b/tdenetworkmanager/src/tdenetman-menuitem.cpp index e5b68cf..795273f 100644 --- a/tdenetworkmanager/src/tdenetman-menuitem.cpp +++ b/tdenetworkmanager/src/tdenetman-menuitem.cpp @@ -54,32 +54,36 @@ using namespace ConnectionSettings; class NetworkMenuItemPrivate { public: - NetworkMenuItemPrivate(TDENetworkDevice* device, TDENetworkConnection* connection) + NetworkMenuItemPrivate(TQString device, TQString connection) : dev(device), conn(connection) { } ~NetworkMenuItemPrivate() {} - - TQGuardedPtr dev; - TQGuardedPtr conn; + + TQString dev; + TQString conn; }; void NetworkMenuItem::slotActivate() { kdDebug() << "NetworkMenuItem::slotActivate()" << endl; + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - if (d->dev && d->conn) + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); + TDENetworkConnection* conn = nm->findConnectionByUUID(d->conn); + + if (dev && conn) { - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); if (deviceConnMan) { - kdDebug() << "Activate Connection " << d->conn->UUID.ascii() << " on Device " << d->dev->deviceNode().ascii() << endl; - printf("Activate Connection %s on Device %s\n\r", d->conn->UUID.ascii(), d->dev->deviceNode().ascii()); + kdDebug() << "Activate Connection " << conn->UUID.ascii() << " on Device " << dev->deviceNode().ascii() << endl; + printf("Activate Connection %s on Device %s\n\r", conn->UUID.ascii(), dev->deviceNode().ascii()); - TDENetworkConnectionStatus::TDENetworkConnectionStatus result = deviceConnMan->initiateConnection(d->conn->UUID); + TDENetworkConnectionStatus::TDENetworkConnectionStatus result = deviceConnMan->initiateConnection(conn->UUID); if ((result == TDENetworkConnectionStatus::Disconnected) || (result == TDENetworkConnectionStatus::Invalid)) { // @@ -89,12 +93,12 @@ void NetworkMenuItem::slotActivate() } } } - else if (d->conn) + else if (conn) { // no device given, just take the default device - printf("Activate Connection %s on default device\n\r", d->conn->UUID.ascii()); + printf("Activate Connection %s on default device\n\r", conn->UUID.ascii()); - TDENetworkConnectionStatus::TDENetworkConnectionStatus result = nm->initiateConnection(d->conn->UUID); + TDENetworkConnectionStatus::TDENetworkConnectionStatus result = nm->initiateConnection(conn->UUID); if ((result == TDENetworkConnectionStatus::Disconnected) || (result == TDENetworkConnectionStatus::Invalid)) { // @@ -107,7 +111,7 @@ void NetworkMenuItem::slotActivate() kdDebug() << "Device or Connection invalid" << endl; } -NetworkMenuItem::NetworkMenuItem (TDENetworkDevice* dev, TDENetworkConnection* conn, TQObject* parent, const char* name) +NetworkMenuItem::NetworkMenuItem (TQString dev, TQString conn, TQObject* parent, const char* name) : TQObject(parent, name) { d = new NetworkMenuItemPrivate(dev, conn); diff --git a/tdenetworkmanager/src/tdenetman-menuitem.h b/tdenetworkmanager/src/tdenetman-menuitem.h index 6017758..d7a3b48 100644 --- a/tdenetworkmanager/src/tdenetman-menuitem.h +++ b/tdenetworkmanager/src/tdenetman-menuitem.h @@ -44,7 +44,7 @@ class NetworkMenuItem : public TQObject Q_OBJECT public: - NetworkMenuItem (TDENetworkDevice* dev, TDENetworkConnection* conn, TQObject* parent = 0, const char* name = 0); + NetworkMenuItem (TQString dev, TQString conn, TQObject* parent = 0, const char* name = 0); ~NetworkMenuItem (); public slots: diff --git a/tdenetworkmanager/src/tdenetman-tray.cpp b/tdenetworkmanager/src/tdenetman-tray.cpp index fae3a15..5e0a9a1 100644 --- a/tdenetworkmanager/src/tdenetman-tray.cpp +++ b/tdenetworkmanager/src/tdenetman-tray.cpp @@ -191,8 +191,11 @@ void Tray::slotOnlineMode() void Tray::contextMenuAboutToShow (KPopupMenu* menu) { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + nm->loadConnectionInformation(); + // clear menu menu->clear(); @@ -218,8 +221,9 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu) DeviceTrayComponent* dev_comp = dynamic_cast (*it); KAction * deviceNewConnAction = 0; if (dev_comp) { - TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->deviceNode()); - TQString menuCaption = TQString("%1").arg(dev_comp->device()->deviceNode()); + TDENetworkDevice* dev_comp_dev = dynamic_cast(hwdevices->findByUniqueID(dev_comp->device())); + TQString actionName = TQString("new_connection_%1").arg(dev_comp_dev->deviceNode()); + TQString menuCaption = TQString("%1").arg(dev_comp_dev->deviceNode()); if (menuCaption.contains("eth", FALSE) > 0) { menuCaption = menuCaption.insert(0, "Wired Connection ("); } @@ -358,14 +362,17 @@ Tray::enterEvent (TQEvent* /*e*/) for (TQValueList::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) { TrayComponent* comp = *it; - if (comp->getToolTipText().isEmpty()) + if (comp->getToolTipText().isEmpty()) { continue; - if (!tooltip.isEmpty()) + } + if (!tooltip.isEmpty()) { tooltip += "\n\n"; + } tooltip += comp->getToolTipText().join("\n"); } - if (!tooltip.isEmpty()) + if (!tooltip.isEmpty()) { TQToolTip::add (this, tooltip); + } } void @@ -374,20 +381,21 @@ Tray::slotSecretsNeeded(TDENetworkConnection* connection, const TQStringList& hi // For now assume secrets are already in NM... } -void Tray::slotAddDeviceTrayComponent(TDENetworkDevice* dev) +void Tray::slotAddDeviceTrayComponent(TQString dev) { - if (dev) { - createDeviceTrayComponent(dev); - } + createDeviceTrayComponent(dev); } -void Tray::slotRemoveDeviceTrayComponent(TDENetworkDevice* dev) +void Tray::slotRemoveDeviceTrayComponent(TQString dev) { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + for (TQValueList::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) { DeviceTrayComponent* dev_comp = dynamic_cast(*it); - if (!dev_comp) + if (!dev_comp) { continue; + } if (dev_comp->device() == dev) { @@ -396,7 +404,8 @@ void Tray::slotRemoveDeviceTrayComponent(TDENetworkDevice* dev) } // remove the appropriate action - TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->deviceNode()); + TDENetworkDevice* dev_comp_dev = dynamic_cast(hwdevices->findByUniqueID(dev_comp->device())); + TQString actionName = TQString("new_connection_%1").arg(dev_comp_dev->deviceNode()); KAction * deviceNewConnAction = actionCollection ()->action (actionName); if (!deviceNewConnAction) @@ -417,15 +426,15 @@ void Tray::slotRemoveDeviceTrayComponent(TDENetworkDevice* dev) } } -void Tray::createDeviceTrayComponent(TDENetworkDevice* dev) +void Tray::createDeviceTrayComponent(TQString dev) { bool trayExists = false; - if (!dev) return; + TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); // check if we have already a trayicon for this device for (TQValueList::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) - { + { DeviceTrayComponent* dev_comp = dynamic_cast (*it); if (dev_comp) if (dev_comp->device() == dev) @@ -439,7 +448,8 @@ void Tray::createDeviceTrayComponent(TDENetworkDevice* dev) if (!trayExists) { DeviceTrayComponent* devTray = 0; - TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + TDENetworkDevice* new_tray_dev = dynamic_cast(hwdevices->findByUniqueID(dev)); + TDENetworkConnectionManager* deviceConnMan = new_tray_dev->connectionManager(); // different tray icons for different device types! switch (deviceConnMan->deviceType()) { @@ -453,15 +463,14 @@ void Tray::createDeviceTrayComponent(TDENetworkDevice* dev) devTray = new CellularDeviceTray(dev, this, "cellular_device_tray"); break; default: - kdWarning() << k_funcinfo << "UDI: " << dev->uniqueID() << " has unknown devicetype: " << deviceConnMan->deviceType() << endl; + kdWarning() << k_funcinfo << "UDI: " << dev << " has unknown devicetype: " << deviceConnMan->deviceType() << endl; } if(devTray) { - connect( devTray, TQT_SIGNAL(needsCenterStage(TrayComponent*,bool)), - TQT_SLOT(trayComponentNeedsCenterStage(TrayComponent*,bool))); + 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 + //WILLTODO: sort } } } @@ -479,7 +488,7 @@ void Tray::updateDeviceTrays() { TDENetworkDevice* dev = dynamic_cast(*it); if (dev) { - createDeviceTrayComponent(dev); + createDeviceTrayComponent(dev->uniqueID()); } else { kdWarning() << k_funcinfo << "got a NULL-Device" << endl; @@ -489,18 +498,18 @@ void Tray::updateDeviceTrays() 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; - } + 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) @@ -516,17 +525,21 @@ void Tray::slotDeactivateConnection(int index) void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt) { + TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); + if (!hwdevices) return; + DeviceTrayComponent * dtc = dynamic_cast(component); if (dtc) { - kdDebug() << k_funcinfo << dtc->device()->deviceNode() << " : " << needsIt << endl; - TDENetworkDevice * device = dtc->device(); + TDENetworkDevice* dtc_comp_dev = dynamic_cast(hwdevices->findByUniqueID(dtc->device())); + kdDebug() << k_funcinfo << dtc_comp_dev->deviceNode() << " : " << needsIt << endl; + TDENetworkDevice * device = dtc_comp_dev; if (needsIt) { if (d->foregroundTrayComponent) { - disconnect(d->foregroundTrayComponent->device(), TQT_SIGNAL(StateChanged(NMDeviceState)), this, 0 ); + TDENetworkDevice* foreground_tray_dev = dynamic_cast(hwdevices->findByUniqueID(d->foregroundTrayComponent->device())); + disconnect(foreground_tray_dev, TQT_SIGNAL(StateChanged(NMDeviceState)), this, 0 ); } d->foregroundTrayComponent = dtc; - connect(device, TQT_SIGNAL(StateChanged(NMDeviceState)), - TQT_SLOT(slotUpdateDeviceState(NMDeviceState))); + connect(device, TQT_SIGNAL(StateChanged(NMDeviceState)), TQT_SLOT(slotUpdateDeviceState(NMDeviceState))); } else { disconnect(device, TQT_SIGNAL(StateChanged(NMDeviceState)), this, 0 ); // use active default @@ -545,7 +558,7 @@ void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt) break; } } - kdDebug() << " Device " << dtc->device()->deviceNode() << " background, new foreground device: " << device->deviceNode() << endl; + kdDebug() << " Device " << dtc_comp_dev->deviceNode() << " background, new foreground device: " << device->deviceNode() << endl; connect(device, TQT_SIGNAL(StateChanged(NMDeviceState)), TQT_SLOT(slotUpdateDeviceState(NMDeviceState))); slotUpdateDeviceState(device->getState()); @@ -568,9 +581,13 @@ void Tray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectio void Tray::trayUiChanged() { + TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); + if (!hwdevices) return; + DeviceTrayComponent * dtc = d->foregroundTrayComponent; if (dtc) { - TDENetworkConnectionManager* deviceConnMan = dtc->device()->connectionManager(); + TDENetworkDevice* dtc_comp_dev = dynamic_cast(hwdevices->findByUniqueID(dtc->device())); + TDENetworkConnectionManager* deviceConnMan = dtc_comp_dev->connectionManager(); updateTrayIcon(deviceConnMan->deviceInformation().statusFlags); } } diff --git a/tdenetworkmanager/src/tdenetman-tray.h b/tdenetworkmanager/src/tdenetman-tray.h index a4c6d52..10744eb 100644 --- a/tdenetworkmanager/src/tdenetman-tray.h +++ b/tdenetworkmanager/src/tdenetman-tray.h @@ -96,8 +96,8 @@ class Tray : public KSystemTray protected slots: void updateDeviceTrays(); - void slotAddDeviceTrayComponent(TDENetworkDevice*); - void slotRemoveDeviceTrayComponent(TDENetworkDevice*); + void slotAddDeviceTrayComponent(TQString); + void slotRemoveDeviceTrayComponent(TQString); void slotDeactivateConnection(int); void trayComponentNeedsCenterStage(TrayComponent*, bool); void trayUiChanged(); @@ -107,7 +107,7 @@ class Tray : public KSystemTray void updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus); void updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus); void mousePressEvent(TQMouseEvent *e); - void createDeviceTrayComponent(TDENetworkDevice*); + void createDeviceTrayComponent(TQString); void enterEvent(TQEvent*); TrayPrivate* d; diff --git a/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp index 9bcbc39..59ceb33 100644 --- a/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp @@ -59,13 +59,16 @@ class WiredDeviceTrayPrivate WiredDeviceTrayPrivate() {} ~WiredDeviceTrayPrivate() {} - TDENetworkDevice* dev; + TQString dev; }; void WiredDeviceTray::newConnection() { + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + // create a new wired connection TDENetworkConnection* conn = new TDEWiredEthernetConnection(); + nm->loadConnectionAllowedValues(conn); // edit the new connection ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, tray(), "connect_something", false, TQt::WDestructiveClose); @@ -75,14 +78,17 @@ void WiredDeviceTray::newConnection() void WiredDeviceTray::addMenuItems(KPopupMenu* menu) { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); + // device title - Subhead* subhead = new Subhead (menu, "subhead", TQString("Wired Connection (%1)").arg(d->dev->deviceNode()), SmallIcon("wired", TQIconSet::Automatic)); + Subhead* subhead = new Subhead (menu, "subhead", TQString("Wired Connection (%1)").arg(dev->deviceNode()), SmallIcon("wired", TQIconSet::Automatic)); menu->insertItem (subhead, -1, -1); // bolding subhead instead //menu->insertSeparator(); - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); if (deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::LinkUnavailable) { // no carrier -> do not show any connections subhead = new Subhead(menu, "subhead2", i18n("Cable disconnected"), SmallIcon("no", TQIconSet::Automatic)); @@ -90,7 +96,7 @@ void WiredDeviceTray::addMenuItems(KPopupMenu* menu) } else { TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); TDENetworkConnection* active_conn = NULL; if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected)) && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) { @@ -113,7 +119,7 @@ void WiredDeviceTray::addMenuItems(KPopupMenu* menu) title += TQString(" (%1)").arg((conn->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPIP) ? i18n("DHCP") : i18n("Manual IP config")); } - NetworkMenuItem* item = new NetworkMenuItem(d->dev, conn, TQT_TQOBJECT(menu)); + NetworkMenuItem* item = new NetworkMenuItem(d->dev, conn->UUID, TQT_TQOBJECT(menu)); connectionItems += 1; int id = menu->insertItem(title, item, TQT_SLOT(slotActivate())); @@ -132,7 +138,7 @@ void WiredDeviceTray::addMenuItems(KPopupMenu* menu) } } -WiredDeviceTray::WiredDeviceTray (TDENetworkDevice* dev, KSystemTray * parent, const char * name ) +WiredDeviceTray::WiredDeviceTray (TQString dev, KSystemTray * parent, const char * name ) : DeviceTrayComponent (dev, parent, name) { d = new WiredDeviceTrayPrivate(); diff --git a/tdenetworkmanager/src/tdenetman-wired_device_tray.h b/tdenetworkmanager/src/tdenetman-wired_device_tray.h index d5cb156..c358790 100644 --- a/tdenetworkmanager/src/tdenetman-wired_device_tray.h +++ b/tdenetworkmanager/src/tdenetman-wired_device_tray.h @@ -42,7 +42,7 @@ class WiredDeviceTray : public DeviceTrayComponent public: - WiredDeviceTray (TDENetworkDevice*, KSystemTray * parent = 0, const char * name = 0); + WiredDeviceTray (TQString, KSystemTray * parent = 0, const char * name = 0); ~WiredDeviceTray (); void addMenuItems(KPopupMenu* menu); diff --git a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp index a9ca359..759d2e0 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp @@ -61,15 +61,18 @@ class WirelessDeviceTrayPrivate WirelessDeviceTrayPrivate() :dev(0), activeAccessPoint(0) { } ~WirelessDeviceTrayPrivate() {} - TDENetworkDevice* dev; + TQString dev; TQGuardedPtr activeAccessPoint; }; TQStringList WirelessDeviceTray::getToolTipText() { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); + TQStringList tooltip = DeviceTrayComponent::getToolTipText(); - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); TDENetworkWiFiAPInfo * ap = deviceConnMan->findAccessPointByBSSID(deviceConnMan->deviceInformation().wiFiInfo.activeAccessPointBSSID); if (ap) { tooltip.append(i18n("Network: %1").arg(ap->friendlySSID())); @@ -80,8 +83,11 @@ TQStringList WirelessDeviceTray::getToolTipText() void WirelessDeviceTray::newConnection() { + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + // create a new wireless connection TDENetworkConnection* conn = new TDEWiFiConnection(); + nm->loadConnectionAllowedValues(conn); // open a dialog for editing the connection use_new_wireless_essid = 0; // deactivate autofill for now @@ -127,17 +133,20 @@ TDEWiFiConnection* WirelessDeviceTray::findMatchingConnection(const WirelessNetw void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) { + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); + printf("Updating wireless network list\n\r"); // get all wireless networks - TQValueList nets = WirelessManager::getWirelessNetworks(d->dev); + TQValueList nets = WirelessManager::getWirelessNetworks(dev); // get all wireless connections TQValueList conns = WirelessManager::getWirelessConnections(); // get the currently active connection - TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); TDENetworkConnection* active_conn = NULL; if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected)) && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) { @@ -152,13 +161,14 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) WirelessNetwork net; // only show connections which are in range - if ( !findMatchingNetwork(*it, nets, net) ) + if ( !findMatchingNetwork(*it, nets, net) ) { continue; + } wirelessNetworkItem = new WirelessNetworkItem (menu, d->dev, net, - *it, + (*it)->UUID, false); int id = menu->insertItem (wirelessNetworkItem, -1, -1); menu->setItemChecked(id, ((TDENetworkConnection*)(*it) == active_conn)); @@ -187,7 +197,7 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) wirelessNetworkItem = new WirelessNetworkItem (menu, d->dev, net, - *it, + (*it)->UUID, false); int id = popup->insertItem (wirelessNetworkItem, -1, -1); @@ -234,11 +244,14 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) void WirelessDeviceTray::addMenuItems(KPopupMenu* menu) { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); + // get the currently active connection TDEGlobalNetworkManager* nm = KGlobal::networkManager(); // device title - Subhead* subhead = new Subhead (menu, "subhead", TQString("Wireless Connection (%1)").arg(d->dev->deviceNode()), SmallIcon("wireless", TQIconSet::Automatic)); + Subhead* subhead = new Subhead (menu, "subhead", TQString("Wireless Connection (%1)").arg(dev->deviceNode()), SmallIcon("wireless", TQIconSet::Automatic)); menu->insertItem (subhead, -1, -1); // bolding subhead instead @@ -282,11 +295,14 @@ void WirelessDeviceTray::setPixmapForStates(TDENetworkConnectionStatus::TDENetwo void WirelessDeviceTray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); + slotCheckActiveAccessPoint(); if (state == TDENetworkConnectionStatus::Connected) { // trigger an update of the connections seen bssids property - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); TDENetworkWiFiAPInfo * ap = deviceConnMan->findAccessPointByBSSID(deviceConnMan->deviceInformation().wiFiInfo.activeAccessPointBSSID); if (ap) { int strength = (ap->signalQuality*100.0); @@ -315,9 +331,12 @@ 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 + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); + // get the currently active connection TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); TDENetworkConnection* active_conn = NULL; if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected)) && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) { @@ -347,8 +366,11 @@ void WirelessDeviceTray::slotCheckActiveAccessPoint() void WirelessDeviceTray::apPropertyChanged(TDEMACAddress BSSID, TDENetworkAPEventType::TDENetworkAPEventType event) { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); + if (event == TDENetworkAPEventType::SignalStrengthChanged) { - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); TDENetworkWiFiAPInfo * ap = deviceConnMan->findAccessPointByBSSID(BSSID); if (ap) { TQ_UINT32 strength = (ap->signalQuality*100.0); @@ -384,12 +406,15 @@ void WirelessDeviceTray::slotAccessPointRemoved(const TQString&) KNotifyClient::event( tray()->winId(), "knm-nm-network-gone", i18n("TDENetworkManager Wireless Network Disappeared") ); } -WirelessDeviceTray::WirelessDeviceTray (TDENetworkDevice* dev, KSystemTray * parent, const char * name) +WirelessDeviceTray::WirelessDeviceTray (TQString dev, KSystemTray * parent, const char * name) : DeviceTrayComponent (dev, parent, name) { d = new WirelessDeviceTrayPrivate(); d->dev = dev; + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDENetworkDevice* hwdev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); + // we want other icons for wireless devices setPixmapForState(TDENetworkConnectionStatus::Invalid, "wireless_off"); setPixmapForState(TDENetworkConnectionStatus::LinkUnavailable, "wireless_off"); @@ -397,15 +422,19 @@ WirelessDeviceTray::WirelessDeviceTray (TDENetworkDevice* dev, KSystemTray * par setPixmapForState(TDENetworkConnectionStatus::Disconnected, "wireless"); setPixmapForState(TDENetworkConnectionStatus::Connected, "nm_signal_50"); + // TDENM FIXME + // These TQt connections will need to be re-established whenever the device list changes, e.g. after a call to TDEHardwareDevices::queryHardwareInformation() + // Therefore, this class should listen to hardwareEvent(TDEHardwareEvent::TDEHardwareEvent, TQString) and reload devices if TDEHardwareEvent::HardwareListModified is passed + // get notified when the device state changes - connect(dev, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), this, TQT_SLOT(slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus))); + connect(hwdev, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), this, TQT_SLOT(slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus))); // 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())); + connect(hwdev, TQT_SIGNAL(propertiesChanged()), this, TQT_SLOT(slotCheckActiveAccessPoint())); // get notified of all AP changes - connect(dev, TQT_SIGNAL(accessPointAdded(TDENetworkWiFiAPInfo*)), this, TQT_SLOT(slotAccessPointAdded(TDENetworkWiFiAPInfo*))); - connect(dev, TQT_SIGNAL(accessPointRemoved(const TQString&)), this, TQT_SLOT(slotAccessPointRemoved(const TQString&))); + connect(hwdev, TQT_SIGNAL(accessPointAdded(TDENetworkWiFiAPInfo*)), this, TQT_SLOT(slotAccessPointAdded(TDENetworkWiFiAPInfo*))); + connect(hwdev, TQT_SIGNAL(accessPointRemoved(const TQString&)), this, TQT_SLOT(slotAccessPointRemoved(const TQString&))); } WirelessDeviceTray::~WirelessDeviceTray () diff --git a/tdenetworkmanager/src/tdenetman-wireless_device_tray.h b/tdenetworkmanager/src/tdenetman-wireless_device_tray.h index 8970b3a..becae51 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_device_tray.h +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.h @@ -42,7 +42,7 @@ class WirelessDeviceTray : public DeviceTrayComponent public: - WirelessDeviceTray (TDENetworkDevice*, KSystemTray * parent = 0, const char * name = 0); + WirelessDeviceTray (TQString, KSystemTray * parent = 0, const char * name = 0); ~WirelessDeviceTray (); void addMenuItems(KPopupMenu* menu); diff --git a/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp b/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp index 444bfbf..40f28bd 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp @@ -53,16 +53,21 @@ using namespace ConnectionSettings; void WirelessNetworkItem::slotActivate() { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(_dev)); - TDENetworkConnectionManager* deviceConnMan = _dev->connectionManager(); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkConnection* conn = nm->findConnectionByUUID(_conn); + + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); printf("slotActivate\n\r"); if (_dev && deviceConnMan) { - if ( _conn ) + if ( conn ) { - kdDebug() << "Activate Connection " << _conn->UUID.ascii() << " on Device " << _dev->deviceNode().ascii() << endl; - TDENetworkConnectionStatus::TDENetworkConnectionStatus result = deviceConnMan->initiateConnection(_conn->UUID); + kdDebug() << "Activate Connection " << _conn.ascii() << " on Device " << dev->deviceNode().ascii() << endl; + TDENetworkConnectionStatus::TDENetworkConnectionStatus result = deviceConnMan->initiateConnection(_conn); if ((result == TDENetworkConnectionStatus::Disconnected) || (result == TDENetworkConnectionStatus::Invalid)) { kdDebug() << "ActivateDevice failed" << endl; @@ -80,6 +85,9 @@ void WirelessNetworkItem::slotActivate() TQString WirelessNetworkItem::getDisplayText() { + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkConnection* conn = nm->findConnectionByUUID(_conn); + TQString security = ""; if (((_net.getWpaFlags() & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None) && ((_net.getRsnFlags() & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None)) { security = TQString("(%1/%2)").arg(i18n("WPA")).arg(i18n("RSN")); @@ -91,8 +99,8 @@ TQString WirelessNetworkItem::getDisplayText() security = TQString("(%2)").arg(i18n("RSN")); } - if (_conn && (_conn->friendlyName != _net.getDisplaySsid())) { - return TQString("%2/%1 %3").arg(TQString::fromUtf8(_net.getDisplaySsid())).arg(_conn->friendlyName).arg(security); + if (conn && (conn->friendlyName != _net.getDisplaySsid())) { + return TQString("%2/%1 %3").arg(TQString::fromUtf8(_net.getDisplaySsid())).arg(conn->friendlyName).arg(security); } else { return TQString("%1 %2").arg(TQString::fromUtf8(_net.getDisplaySsid())).arg(security); @@ -137,7 +145,7 @@ WirelessNetworkItem::sizeHint () return TQSize (_width, _height); } -WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, TDENetworkDevice* dev, WirelessNetwork& net, TDEWiFiConnection* conn, bool adhoc) +WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, TQString dev, WirelessNetwork& net, TQString conn, bool adhoc) : NetworkMenuItem(dev, conn, 0, 0 ), TQCustomMenuItem () { parent = p; @@ -178,7 +186,7 @@ WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, TDENetworkDevice* dev, Wi _width += _space; /* pbarStrength -> contextMenu */ } -WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, TDENetworkDevice* dev, WirelessNetwork& net, bool adhoc) +WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, TQString dev, WirelessNetwork& net, bool adhoc) : NetworkMenuItem(dev, NULL, 0, 0 ), TQCustomMenuItem () { parent = p; diff --git a/tdenetworkmanager/src/tdenetman-wireless_menuitem.h b/tdenetworkmanager/src/tdenetman-wireless_menuitem.h index 935ace8..ea9b6a6 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_menuitem.h +++ b/tdenetworkmanager/src/tdenetman-wireless_menuitem.h @@ -51,8 +51,8 @@ class WirelessNetworkItem : public NetworkMenuItem, public TQCustomMenuItem Q_OBJECT public: - WirelessNetworkItem (TQWidget*, TDENetworkDevice* dev, WirelessNetwork& net, TDEWiFiConnection* conn, bool adhoc); - WirelessNetworkItem (TQWidget*, TDENetworkDevice* dev, WirelessNetwork& net, bool adhoc); + WirelessNetworkItem (TQWidget*, TQString dev, WirelessNetwork& net, TQString conn, bool adhoc); + WirelessNetworkItem (TQWidget*, TQString dev, WirelessNetwork& net, bool adhoc); ~WirelessNetworkItem (); TQWidget* parent; @@ -69,8 +69,8 @@ class WirelessNetworkItem : public NetworkMenuItem, public TQCustomMenuItem bool _adhoc; WirelessNetwork _net; - TDENetworkDevice* _dev; - TDEWiFiConnection* _conn; + TQString _dev; + TQString _conn; /* menu item */ int _width; -- cgit v1.2.1 From 2a9e4eac1f90251bb06d9fa1da06f46e46abd3f8 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 8 Sep 2012 15:37:58 -0500 Subject: Connect hardware change signals --- tdenetworkmanager/src/devicetraycomponent.cpp | 33 ++++++--- tdenetworkmanager/src/devicetraycomponent.h | 5 +- .../src/tdenetman-wireless_device_tray.cpp | 80 ++++++++++++++-------- .../src/tdenetman-wireless_device_tray.h | 9 ++- 4 files changed, 87 insertions(+), 40 deletions(-) diff --git a/tdenetworkmanager/src/devicetraycomponent.cpp b/tdenetworkmanager/src/devicetraycomponent.cpp index b277ba1..2381781 100644 --- a/tdenetworkmanager/src/devicetraycomponent.cpp +++ b/tdenetworkmanager/src/devicetraycomponent.cpp @@ -67,13 +67,11 @@ DeviceTrayComponent::DeviceTrayComponent(TQString device, KSystemTray * parent, : TrayComponent(parent, name), m_device(device) { TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); - TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(m_device)); - TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); - // TDENM FIXME - // This TQt connection will need to be re-established whenever the device list changes, e.g. after a call to TDEHardwareDevices::queryHardwareInformation() - // Therefore, this class should listen to hardwareEvent(TDEHardwareEvent::TDEHardwareEvent, TQString) and reload devices if TDEHardwareEvent::HardwareListModified is passed - connect(deviceConnMan, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), TQT_SLOT(deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus))); + // Listen for hardware change events + connect(hwdevices, TQT_SIGNAL(hardwareEvent(TDEHardwareEvent::TDEHardwareEvent, TQString)), this, TQT_SLOT(tdeHardwareEventHandler(TDEHardwareEvent::TDEHardwareEvent, TQString))); + // Trigger an initial hardware information update + tdeHardwareEventHandler(TDEHardwareEvent::HardwareListModified, TQString::null); m_pixmaps[TDENetworkConnectionStatus::Invalid] = "nm_no_connection"; m_pixmaps[TDENetworkConnectionStatus::UnManaged] = "nm_no_connection"; @@ -108,6 +106,17 @@ TQString DeviceTrayComponent::device() const return m_device; } +void DeviceTrayComponent::tdeHardwareEventHandler(TDEHardwareEvent::TDEHardwareEvent event, TQString) +{ + if (event == TDEHardwareEvent::HardwareListModified) { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(m_device)); + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + + connect(deviceConnMan, TQT_SIGNAL(networkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString)), TQT_SLOT(deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString))); + } +} + TQStringList DeviceTrayComponent::getToolTipText() { TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); @@ -154,15 +163,19 @@ void DeviceTrayComponent::setPixmapForState(TDENetworkConnectionStatus::TDENetwo m_pixmaps[state] = pixmap; } -void DeviceTrayComponent::deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) +void DeviceTrayComponent::deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus prevState, TQString hwAddress) { -// TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); -// TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(m_device)); + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(m_device)); + + if (dev->macAddress() != hwAddress) { + printf("[WARNING] Got networkDeviceStateChanged signal for HW address '%s', but my HW address is '%s'! Ignoring...\n\r", hwAddress.ascii(), dev->macAddress().ascii()); + } //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? - switch (state) { + switch (newState) { case TDENetworkConnectionStatus::EstablishingLink: emit needsCenterStage(this, true); break; diff --git a/tdenetworkmanager/src/devicetraycomponent.h b/tdenetworkmanager/src/devicetraycomponent.h index 50d5d6a..316790c 100644 --- a/tdenetworkmanager/src/devicetraycomponent.h +++ b/tdenetworkmanager/src/devicetraycomponent.h @@ -54,7 +54,10 @@ class DeviceTrayComponent : public TrayComponent virtual void newConnection() = 0; protected slots: - void deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + void deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString); + + private slots: + void tdeHardwareEventHandler(TDEHardwareEvent::TDEHardwareEvent, TQString); protected: void setMovieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString); diff --git a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp index 759d2e0..d66eeeb 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp @@ -293,14 +293,18 @@ void WirelessDeviceTray::setPixmapForStates(TDENetworkConnectionStatus::TDENetwo } } -void WirelessDeviceTray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) +void WirelessDeviceTray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus prevState, TQString hwAddress) { TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); + if (dev->macAddress() != hwAddress) { + printf("[WARNING] Got networkDeviceStateChanged signal for HW address '%s', but my HW address is '%s'! Ignoring...\n\r", hwAddress.ascii(), dev->macAddress().ascii()); + } + slotCheckActiveAccessPoint(); - if (state == TDENetworkConnectionStatus::Connected) { + if (newState == TDENetworkConnectionStatus::Connected) { // trigger an update of the connections seen bssids property TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); TDENetworkWiFiAPInfo * ap = deviceConnMan->findAccessPointByBSSID(deviceConnMan->deviceInformation().wiFiInfo.activeAccessPointBSSID); @@ -308,19 +312,19 @@ void WirelessDeviceTray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENe int strength = (ap->signalQuality*100.0); if (strength > 80) { - setPixmapForStates(state, "nm_signal_100"); + setPixmapForStates(newState, "nm_signal_100"); } else if (strength > 55) { - setPixmapForStates(state, "nm_signal_75"); + setPixmapForStates(newState, "nm_signal_75"); } else if (strength > 30) { - setPixmapForStates(state, "nm_signal_50"); + setPixmapForStates(newState, "nm_signal_50"); } else if (strength > 5) { - setPixmapForStates(state, "nm_signal_25"); + setPixmapForStates(newState, "nm_signal_25"); } else { - setPixmapForStates(state, "nm_signal_00"); + setPixmapForStates(newState, "nm_signal_00"); } } } @@ -346,13 +350,8 @@ void WirelessDeviceTray::slotCheckActiveAccessPoint() if (active_conn && deviceConnMan->deviceInformation().statusFlags == TDENetworkConnectionStatus::Connected) { TDENetworkWiFiAPInfo * activeap = deviceConnMan->findAccessPointByBSSID(deviceConnMan->deviceInformation().wiFiInfo.activeAccessPointBSSID); if ( activeap != d->activeAccessPoint) { - if (!d->activeAccessPoint.isNull()) { - disconnect( deviceConnMan, TQT_SIGNAL(accessPointStatusChanged(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType)), this, TQT_SLOT(apPropertyChanged(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType))); - } - d->activeAccessPoint = activeap; if ( d->activeAccessPoint ) { - connect( deviceConnMan, TQT_SIGNAL(accessPointStatusChanged(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType)), this, TQT_SLOT(apPropertyChanged(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType))); TDEWiFiConnection* wireless = dynamic_cast(active_conn); if (wireless) { if (!(wireless->heardBSSIDs.contains(d->activeAccessPoint->BSSID))) { @@ -401,11 +400,48 @@ void WirelessDeviceTray::slotAccessPointAdded(TDENetworkWiFiAPInfo* ap) KNotifyClient::event( tray()->winId(), "knm-nm-network-found", i18n("TDENetworkManager New Wireless Network Found") ); } -void WirelessDeviceTray::slotAccessPointRemoved(const TQString&) +void WirelessDeviceTray::slotAccessPointRemoved(TDEMACAddress) { KNotifyClient::event( tray()->winId(), "knm-nm-network-gone", i18n("TDENetworkManager Wireless Network Disappeared") ); } +void WirelessDeviceTray::tdeHardwareEventHandler(TDEHardwareEvent::TDEHardwareEvent event, TQString) +{ + if (event == TDEHardwareEvent::HardwareListModified) { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + + // get notified when the device state changes + connect(deviceConnMan, TQT_SIGNAL(networkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString)), this, TQT_SLOT(slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString))); + + // get notified of all AP changes + connect(deviceConnMan, TQT_SIGNAL(accessPointStatusChanged(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType)), this, TQT_SLOT(tdeAccessPointStatusChangedHandler(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType))); + } +} + +void WirelessDeviceTray::tdeAccessPointStatusChangedHandler(TDEMACAddress BSSID, TDENetworkAPEventType::TDENetworkAPEventType event) { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + + if (event == TDENetworkAPEventType::Discovered) { + TDENetworkWiFiAPInfo* apinfo = deviceConnMan->findAccessPointByBSSID(BSSID); + slotAccessPointAdded(apinfo); + } + else if (event == TDENetworkAPEventType::Lost) { + slotAccessPointRemoved(BSSID); + } + else if (event == TDENetworkAPEventType::SignalStrengthChanged) { + if (deviceConnMan->deviceInformation().wiFiInfo.activeAccessPointBSSID == BSSID) { + apPropertyChanged(BSSID, event); + } + } + else if (event == TDENetworkAPEventType::AccessPointChanged) { + slotCheckActiveAccessPoint(); + } +} + WirelessDeviceTray::WirelessDeviceTray (TQString dev, KSystemTray * parent, const char * name) : DeviceTrayComponent (dev, parent, name) { @@ -413,7 +449,6 @@ WirelessDeviceTray::WirelessDeviceTray (TQString dev, KSystemTray * parent, cons d->dev = dev; TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); - TDENetworkDevice* hwdev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); // we want other icons for wireless devices setPixmapForState(TDENetworkConnectionStatus::Invalid, "wireless_off"); @@ -422,19 +457,10 @@ WirelessDeviceTray::WirelessDeviceTray (TQString dev, KSystemTray * parent, cons setPixmapForState(TDENetworkConnectionStatus::Disconnected, "wireless"); setPixmapForState(TDENetworkConnectionStatus::Connected, "nm_signal_50"); - // TDENM FIXME - // These TQt connections will need to be re-established whenever the device list changes, e.g. after a call to TDEHardwareDevices::queryHardwareInformation() - // Therefore, this class should listen to hardwareEvent(TDEHardwareEvent::TDEHardwareEvent, TQString) and reload devices if TDEHardwareEvent::HardwareListModified is passed - - // get notified when the device state changes - connect(hwdev, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), this, TQT_SLOT(slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus))); - - // if the active access point changed but not the connection we roamed to a new AP - connect(hwdev, TQT_SIGNAL(propertiesChanged()), this, TQT_SLOT(slotCheckActiveAccessPoint())); - - // get notified of all AP changes - connect(hwdev, TQT_SIGNAL(accessPointAdded(TDENetworkWiFiAPInfo*)), this, TQT_SLOT(slotAccessPointAdded(TDENetworkWiFiAPInfo*))); - connect(hwdev, TQT_SIGNAL(accessPointRemoved(const TQString&)), this, TQT_SLOT(slotAccessPointRemoved(const TQString&))); + // Listen for hardware change events + connect(hwdevices, TQT_SIGNAL(hardwareEvent(TDEHardwareEvent::TDEHardwareEvent, TQString)), this, TQT_SLOT(tdeHardwareEventHandler(TDEHardwareEvent::TDEHardwareEvent, TQString))); + // Trigger an initial hardware information update + tdeHardwareEventHandler(TDEHardwareEvent::HardwareListModified, TQString::null); } WirelessDeviceTray::~WirelessDeviceTray () diff --git a/tdenetworkmanager/src/tdenetman-wireless_device_tray.h b/tdenetworkmanager/src/tdenetman-wireless_device_tray.h index becae51..c7eebb8 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_device_tray.h +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.h @@ -54,13 +54,18 @@ class WirelessDeviceTray : public DeviceTrayComponent TQStringList getToolTipText(); public slots: - void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString); void slotCheckActiveAccessPoint(); void newConnection(); protected slots: + void apPropertyChanged(TDEMACAddress BSSID, TDENetworkAPEventType::TDENetworkAPEventType event); void slotAccessPointAdded(TDENetworkWiFiAPInfo*); - void slotAccessPointRemoved(const TQString&); + void slotAccessPointRemoved(TDEMACAddress); + + private slots: + void tdeHardwareEventHandler(TDEHardwareEvent::TDEHardwareEvent, TQString); + void tdeAccessPointStatusChangedHandler(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType); private: void addWirelessNetworks(KPopupMenu* menu); -- cgit v1.2.1 From 756213b4f9699dc022b776810eade7dbd8082be3 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 8 Sep 2012 15:41:39 -0500 Subject: Additional rebranding --- tdenetworkmanager/src/eventsrc | 18 +++++++++--------- tdenetworkmanager/src/main.cpp | 14 +++++++------- .../src/tdenetman-cellular_device_tray.cpp | 2 +- tdenetworkmanager/src/tdenetman-cellular_device_tray.h | 2 +- tdenetworkmanager/src/tdenetman-connection_editor.cpp | 2 +- tdenetworkmanager/src/tdenetman-device_tray.cpp | 4 ++-- tdenetworkmanager/src/tdenetman-nm_vpn_proxy.cpp | 2 +- tdenetworkmanager/src/tdenetman-tray.cpp | 12 ++++++------ tdenetworkmanager/src/tdenetman-vpn_plugin.cpp | 2 +- tdenetworkmanager/src/tdenetman-vpn_plugin.h | 2 +- tdenetworkmanager/src/tdenetman-wired_device_tray.cpp | 2 +- tdenetworkmanager/src/tdenetman-wired_device_tray.h | 2 +- .../src/tdenetman-wireless_device_tray.cpp | 6 +++--- tdenetworkmanager/src/tdenetman-wireless_device_tray.h | 2 +- tdenetworkmanager/src/tdenetman-wireless_manager.cpp | 2 +- tdenetworkmanager/src/tdenetman-wireless_manager.h | 2 +- tdenetworkmanager/src/tdenetman-wireless_network.cpp | 2 +- tdenetworkmanager/src/tdenetman.cpp | 2 +- tdenetworkmanager/src/tdenetman.h | 2 +- tdenetworkmanager/src/vpn_tray_component.cpp | 2 +- tdenetworkmanager/src/vpn_tray_component.h | 2 +- 21 files changed, 43 insertions(+), 43 deletions(-) diff --git a/tdenetworkmanager/src/eventsrc b/tdenetworkmanager/src/eventsrc index df039f5..16438de 100644 --- a/tdenetworkmanager/src/eventsrc +++ b/tdenetworkmanager/src/eventsrc @@ -5,11 +5,11 @@ Comment[bn]=কে-নেটওয়ার্ক-ম্যানেজার Comment[da]=Netværkshåndtering Comment[sv]=Nätverkshantering -[knm-nm-vpn-banner] +[tdenm-nm-vpn-banner] Comment=VPN Banner Notification Received default_presentation=0 -[knm-nm-sleeping] +[tdenm-nm-sleeping] Name=TDENetworkManager Offline Name[bg]=TDENetworkManager - изключен от Интернет Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার অফলাইন @@ -47,7 +47,7 @@ Comment[sv]=Bytte till nerkopplat läge Comment[tr]=Çevrimdışı kipe geçildi default_presentation=0 -[knm-nm-connected] +[tdenm-nm-connected] Name=TDENetworkManager Connected Name[bg]=TDENetworkManager - свързан Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার সংযুক্ত @@ -87,7 +87,7 @@ Comment[sv]=Networkmanager är nu ansluten Comment[tr]=NetworkManager şimdi bağlı default_presentation=0 -[knm-nm-connecting] +[tdenm-nm-connecting] Name=TDENetworkManager Connecting Name[bg]=TDENetworkManager се свързва Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার সংযোগ স্থাপন করছে @@ -124,7 +124,7 @@ Comment[sv]=Networkmanager kopplar upp Comment[tr]=NetworkManager bağlanıyor default_presentation=0 -[knm-nm-disconnected] +[tdenm-nm-disconnected] Name=TDENetworkManager Disconnected Name[bg]=TDENetworkManager - изключен от Интернет Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার সংযোগ বিহীন @@ -162,7 +162,7 @@ Comment[sv]=Networkmanager är nu nerkopplad Comment[tr]=NetworkManager artık bağlı değil default_presentation=0 -[knm-nm-device-added] +[tdenm-nm-device-added] Name=TDENetworkManager Device Added Name[bg]=TDENetworkManager - добавено е устройство Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার ডিভাইস যোগ করা হয়েছে @@ -200,7 +200,7 @@ Comment[sv]=Ny nätverksenhet hittades Comment[tr]=Yeni ağ aygıtı bulundu default_presentation=0 -[knm-nm-device-removed] +[tdenm-nm-device-removed] Name=TDENetworkManager Device Removed Name[bg]=TDENetworkManager - устройството е премахнато Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার ডিভাইস অপসারিত করা হয়েছে @@ -238,7 +238,7 @@ Comment[sv]=Nätverksenhet borttagen Comment[tr]=Ağ aygıtı kaldırıldı default_presentation=0 -[knm-nm-network-found] +[tdenm-nm-network-found] Name=TDENetworkManager New Wireless Network Found Name[bg]=TDENetworkManager - намерена е нова безжична мрежа Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার নতুন ওয়্যারলেস নেটওয়ার্ক খুঁজে পেয়েছে @@ -275,7 +275,7 @@ Comment[sv]=Nytt trådlöst nätverk hittades Comment[tr]=Yeni kablosuz ağ bulundu default_presentation=0 -[knm-nm-network-gone] +[tdenm-nm-network-gone] Name=TDENetworkManager Wireless Network Disappeared Name[bg]=TDENetworkManager - безжичната мрежа се изгуби Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার ওয়্যারলেস নেটওয়ার্ক অন্তর্ধান করেছে diff --git a/tdenetworkmanager/src/main.cpp b/tdenetworkmanager/src/main.cpp index 08cd81e..f8c86cb 100644 --- a/tdenetworkmanager/src/main.cpp +++ b/tdenetworkmanager/src/main.cpp @@ -31,21 +31,21 @@ // TQt includes #include -// KNM includes +// TDENM includes #include "tdenetman.h" -static const char* knm_version = I18N_NOOP(KNETWORKMANAGER_VERSION_STRING); -static const char* knm_descr = I18N_NOOP("A NetworkManager front-end for TDE"); -static const char* knm_copy = I18N_NOOP("Copyright (C) 2012 Trinity Destop Project"); -static const char* knm_webpage = I18N_NOOP("http://www.trinitydesktop.org"); +static const char* tdenm_version = I18N_NOOP(KNETWORKMANAGER_VERSION_STRING); +static const char* tdenm_descr = I18N_NOOP("A NetworkManager front-end for TDE"); +static const char* tdenm_copy = I18N_NOOP("Copyright (C) 2012 Trinity Destop Project"); +static const char* tdenm_webpage = I18N_NOOP("http://www.trinitydesktop.org"); extern "C" KDE_EXPORT int kdemain (int argc, char* argv[]) { KAboutData aboutData ("tdenetworkmanager", I18N_NOOP("TDENetworkManager"), - knm_version, knm_descr, KAboutData::License_GPL, - knm_copy, 0, knm_webpage ); + tdenm_version, tdenm_descr, KAboutData::License_GPL, + tdenm_copy, 0, tdenm_webpage ); aboutData.addAuthor ("Timothy Pearson", I18N_NOOP("TDE Rewrite"), "kb9vqf@pearsoncomputing.net"); aboutData.addAuthor ("Helmut Schaa", I18N_NOOP("Maintainer"), "hschaa@suse.de"); diff --git a/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp index c1a85f9..d21e511 100644 --- a/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp @@ -30,7 +30,7 @@ #include #include -// KNM includes +// TDENM includes #include "tdenetman-cellular_device_tray.h" #include "tdenetman-menuitem.h" #include "tdenetman-menu_subhead.h" diff --git a/tdenetworkmanager/src/tdenetman-cellular_device_tray.h b/tdenetworkmanager/src/tdenetman-cellular_device_tray.h index ed7719b..28de864 100644 --- a/tdenetworkmanager/src/tdenetman-cellular_device_tray.h +++ b/tdenetworkmanager/src/tdenetman-cellular_device_tray.h @@ -27,7 +27,7 @@ #ifndef KNETWORKMANAGER_CELLULAR_DEVICE_TRAY_H #define KNETWORKMANAGER_CELLULAR_DEVICE_TRAY_H -// KNM includes +// TDENM includes #include "tdenetman.h" #include "devicetraycomponent.h" diff --git a/tdenetworkmanager/src/tdenetman-connection_editor.cpp b/tdenetworkmanager/src/tdenetman-connection_editor.cpp index 961946f..22886dd 100644 --- a/tdenetworkmanager/src/tdenetman-connection_editor.cpp +++ b/tdenetworkmanager/src/tdenetman-connection_editor.cpp @@ -41,7 +41,7 @@ #include #include -// knm headers +// tdenm headers #include "tdenetman-connection_editor.h" #include "tdenetman-connection_settings_dialog.h" diff --git a/tdenetworkmanager/src/tdenetman-device_tray.cpp b/tdenetworkmanager/src/tdenetman-device_tray.cpp index a58b3fc..798b707 100644 --- a/tdenetworkmanager/src/tdenetman-device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-device_tray.cpp @@ -55,7 +55,7 @@ class WirelessDialog; #include #include -// KNM includes +// TDENM includes #include "tdenetman-device_tray.h" #include "tdenetman-menu_subhead.h" #include "tdenetman-connection_settings_dialog.h" @@ -360,7 +360,7 @@ DeviceTray::DeviceTray (TDENetworkDevice* dev) : KSystemTray () setMouseTracking (true); - // defer the initial call to slotUpdateDeviceState as it will crash knm when called directly from here + // defer the initial call to slotUpdateDeviceState as it will crash tdenm when called directly from here // virtual method calls are not allowed in constructor TQTimer::singleShot(0, this, TQT_SLOT(slotUpdateDeviceState())); diff --git a/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.cpp b/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.cpp index 8ef0ecb..cfe48ab 100644 --- a/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.cpp +++ b/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.cpp @@ -38,7 +38,7 @@ #include #include -// KNM includes +// TDENM includes #include "tdenetman.h" #include "tdenetman-nm_vpn_proxy.h" #include "tdenetman-device.h" diff --git a/tdenetworkmanager/src/tdenetman-tray.cpp b/tdenetworkmanager/src/tdenetman-tray.cpp index 5e0a9a1..793e643 100644 --- a/tdenetworkmanager/src/tdenetman-tray.cpp +++ b/tdenetworkmanager/src/tdenetman-tray.cpp @@ -669,13 +669,13 @@ void Tray::updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnecti void Tray::slotDeviceAddedNotify(TDENetworkDevice* dev) { kdDebug() << "Tray::slotDeviceAddedNotify" << endl; - KNotifyClient::event( winId(), "knm-nm-device-added", i18n("New network device %1 found").arg(dev->deviceNode()) ); + KNotifyClient::event( winId(), "tdenm-nm-device-added", i18n("New network device %1 found").arg(dev->deviceNode()) ); } void Tray::slotDeviceRemovedNotify(TDENetworkDevice* dev) { kdDebug() << "Tray::slotDeviceRemovedNotify" << endl; - KNotifyClient::event( winId(), "knm-nm-device-removed", i18n("Network device %1 removed").arg(dev->deviceNode()) ); + KNotifyClient::event( winId(), "tdenm-nm-device-removed", i18n("Network device %1 removed").arg(dev->deviceNode()) ); } void Tray::slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState) @@ -684,16 +684,16 @@ void Tray::slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobal // change tray icon according to NM's state if (nm_state & TDENetworkGlobalManagerFlags::EstablishingLink) { - KNotifyClient::event( winId(), "knm-nm-connecting", i18n("NetworkManager is connecting") ); + KNotifyClient::event( winId(), "tdenm-nm-connecting", i18n("NetworkManager is connecting") ); } else if (nm_state & TDENetworkGlobalManagerFlags::Disconnected) { - KNotifyClient::event( winId(), "knm-nm-disconnected", i18n("NetworkManager is now disconnected") ); + KNotifyClient::event( winId(), "tdenm-nm-disconnected", i18n("NetworkManager is now disconnected") ); } else if (nm_state & TDENetworkGlobalManagerFlags::Connected) { - KNotifyClient::event( winId(), "knm-nm-connected", i18n("NetworkManager is now connected") ); + KNotifyClient::event( winId(), "tdenm-nm-connected", i18n("NetworkManager is now connected") ); } else if (nm_state & TDENetworkGlobalManagerFlags::Sleeping) { - KNotifyClient::event( winId(), "knm-nm-sleeping", i18n("TDENetworkManager Offline") ); + KNotifyClient::event( winId(), "tdenm-nm-sleeping", i18n("TDENetworkManager Offline") ); } else if (nm_state & TDENetworkGlobalManagerFlags::Unknown) { // diff --git a/tdenetworkmanager/src/tdenetman-vpn_plugin.cpp b/tdenetworkmanager/src/tdenetman-vpn_plugin.cpp index dc7351f..94f20b4 100644 --- a/tdenetworkmanager/src/tdenetman-vpn_plugin.cpp +++ b/tdenetworkmanager/src/tdenetman-vpn_plugin.cpp @@ -38,7 +38,7 @@ #include #include -// KNM includes +// TDENM includes #include "tdenetman.h" #include "tdenetman-tray.h" #include "tdenetman-vpn_plugin.h" diff --git a/tdenetworkmanager/src/tdenetman-vpn_plugin.h b/tdenetworkmanager/src/tdenetman-vpn_plugin.h index 56a03d6..674a402 100644 --- a/tdenetworkmanager/src/tdenetman-vpn_plugin.h +++ b/tdenetworkmanager/src/tdenetman-vpn_plugin.h @@ -29,7 +29,7 @@ // std includes #include -// KNM includes +// TDENM includes #include "tdenetman.h" class TDENetworkManager; diff --git a/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp index 59ceb33..e816f03 100644 --- a/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp @@ -44,7 +44,7 @@ #include -// KNM includes +// TDENM includes #include "tdenetman-wired_device_tray.h" #include "tdenetman-menuitem.h" #include "tdenetman-menu_subhead.h" diff --git a/tdenetworkmanager/src/tdenetman-wired_device_tray.h b/tdenetworkmanager/src/tdenetman-wired_device_tray.h index c358790..6200f91 100644 --- a/tdenetworkmanager/src/tdenetman-wired_device_tray.h +++ b/tdenetworkmanager/src/tdenetman-wired_device_tray.h @@ -27,7 +27,7 @@ #ifndef KNETWORKMANAGER_WIRED_DEVICE_TRAY_H #define KNETWORKMANAGER_WIRED_DEVICE_TRAY_H -// KNM includes +// TDENM includes #include "devicetraycomponent.h" #include "tdenetman.h" diff --git a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp index d66eeeb..cd5c786 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp @@ -42,7 +42,7 @@ #include #include -// KNM includes +// TDENM includes #include "tdenetman-wireless_device_tray.h" #include "tdenetman-wireless_menuitem.h" #include "tdenetman-wireless_network.h" @@ -397,12 +397,12 @@ void WirelessDeviceTray::apPropertyChanged(TDEMACAddress BSSID, TDENetworkAPEven void WirelessDeviceTray::slotAccessPointAdded(TDENetworkWiFiAPInfo* ap) { - KNotifyClient::event( tray()->winId(), "knm-nm-network-found", i18n("TDENetworkManager New Wireless Network Found") ); + KNotifyClient::event( tray()->winId(), "tdenm-nm-network-found", i18n("TDENetworkManager New Wireless Network Found") ); } void WirelessDeviceTray::slotAccessPointRemoved(TDEMACAddress) { - KNotifyClient::event( tray()->winId(), "knm-nm-network-gone", i18n("TDENetworkManager Wireless Network Disappeared") ); + KNotifyClient::event( tray()->winId(), "tdenm-nm-network-gone", i18n("TDENetworkManager Wireless Network Disappeared") ); } void WirelessDeviceTray::tdeHardwareEventHandler(TDEHardwareEvent::TDEHardwareEvent event, TQString) diff --git a/tdenetworkmanager/src/tdenetman-wireless_device_tray.h b/tdenetworkmanager/src/tdenetman-wireless_device_tray.h index c7eebb8..aad6325 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_device_tray.h +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.h @@ -27,7 +27,7 @@ #ifndef KNETWORKMANAGER_WIRELESS_DEVICE_TRAY_H #define KNETWORKMANAGER_WIRELESS_DEVICE_TRAY_H -// KNM includes +// TDENM includes #include "tdenetman.h" #include "devicetraycomponent.h" #include "tdenetman-wireless_network.h" diff --git a/tdenetworkmanager/src/tdenetman-wireless_manager.cpp b/tdenetworkmanager/src/tdenetman-wireless_manager.cpp index 7692a00..6a9b28c 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_manager.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_manager.cpp @@ -25,7 +25,7 @@ // other includes #include -// KNM includes +// TDENM includes #include "tdenetman-wireless_manager.h" TQValueList WirelessManager::getWirelessNetworks(TDENetworkDevice* dev, TQ_UINT32 match) diff --git a/tdenetworkmanager/src/tdenetman-wireless_manager.h b/tdenetworkmanager/src/tdenetman-wireless_manager.h index 6800930..3eacd6c 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_manager.h +++ b/tdenetworkmanager/src/tdenetman-wireless_manager.h @@ -29,7 +29,7 @@ #include #include -// KNM includes +// TDENM includes #include "tdenetman.h" #include "tdenetman-device_tray.h" #include "tdenetman-wireless_network.h" diff --git a/tdenetworkmanager/src/tdenetman-wireless_network.cpp b/tdenetworkmanager/src/tdenetman-wireless_network.cpp index c0e20ce..d3105df 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_network.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_network.cpp @@ -22,7 +22,7 @@ * **************************************************************************/ -// KNM includes +// TDENM includes #include "tdenetman.h" #include "tdenetman-wireless_network.h" diff --git a/tdenetworkmanager/src/tdenetman.cpp b/tdenetworkmanager/src/tdenetman.cpp index 9ef8f9f..19238b3 100644 --- a/tdenetworkmanager/src/tdenetman.cpp +++ b/tdenetworkmanager/src/tdenetman.cpp @@ -28,7 +28,7 @@ #include #include -// KNM includes +// TDENM includes #include "tdenetman.h" #include "tdenetman-tray.h" diff --git a/tdenetworkmanager/src/tdenetman.h b/tdenetworkmanager/src/tdenetman.h index 8fd1a05..6365b89 100644 --- a/tdenetworkmanager/src/tdenetman.h +++ b/tdenetworkmanager/src/tdenetman.h @@ -28,7 +28,7 @@ // TDE includes #include -// KNM includes +// TDENM includes #include "config.h" class TDENetworkManagerPrivate; diff --git a/tdenetworkmanager/src/vpn_tray_component.cpp b/tdenetworkmanager/src/vpn_tray_component.cpp index 04ceffc..49474b2 100644 --- a/tdenetworkmanager/src/vpn_tray_component.cpp +++ b/tdenetworkmanager/src/vpn_tray_component.cpp @@ -31,7 +31,7 @@ #include -// KNM includes +// TDENM includes #include "vpn_tray_component.h" #include "tdenetman-menuitem.h" #include "tdenetman-menu_subhead.h" diff --git a/tdenetworkmanager/src/vpn_tray_component.h b/tdenetworkmanager/src/vpn_tray_component.h index eb0377d..11107c4 100644 --- a/tdenetworkmanager/src/vpn_tray_component.h +++ b/tdenetworkmanager/src/vpn_tray_component.h @@ -25,7 +25,7 @@ #ifndef VPN_TRAY_COMPONENT_H #define VPN_TRAY_COMPONENT_H -// KNM includes +// TDENM includes #include "traycomponent.h" #include "tdenetman.h" -- cgit v1.2.1 From 083f3b3b0416cce1342e3710e0732a30d8fbe769 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 8 Sep 2012 21:11:17 -0500 Subject: Fix new connections Preselect specified SSID when creating new wireless connection from menu --- .../tdenetman-connection_setting_ipv4_widget.cpp | 1 + ...denetman-connection_setting_wireless_widget.cpp | 17 ++++++++++++- .../tdenetman-connection_setting_wireless_widget.h | 3 ++- .../tdenetman-connection_settings_dialog.cpp | 28 ++++++++++------------ .../tdenetman-connection_settings_dialog.h | 3 ++- .../src/tdenetman-cellular_device_tray.cpp | 4 ++-- .../src/tdenetman-connection_editor.cpp | 4 ++-- tdenetworkmanager/src/tdenetman-tray.cpp | 14 +++++------ .../src/tdenetman-wired_device_tray.cpp | 4 ++-- .../src/tdenetman-wireless_device_tray.cpp | 27 +++++++++++++-------- .../src/tdenetman-wireless_device_tray.h | 6 +++-- 11 files changed, 68 insertions(+), 43 deletions(-) diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp index e800390..f36efaa 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp @@ -164,6 +164,7 @@ IPv4WidgetImpl::slotIPAddressChanged(const TQString& ip) { TDENetworkSingleIPConfiguration adr; adr.ipAddress = ipadr; + adr.valid = true; addrs.append(adr); } _ipv4_setting->ipConfig.ipConfigurations = addrs; diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp index 424ff81..0b88c83 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp @@ -69,7 +69,7 @@ class NetworkListViewItem : public KListViewItem WirelessNetwork _net; }; -WirelessWidgetImpl::WirelessWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl) +WirelessWidgetImpl::WirelessWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQByteArray preselect_ssid, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { _wireless_setting = dynamic_cast(conn); @@ -77,6 +77,7 @@ WirelessWidgetImpl::WirelessWidgetImpl(TDENetworkConnection* conn, bool new_conn _security_setting = dynamic_cast(conn); _hasName = !_info_setting->friendlyName.isEmpty(); _new_conn = new_conn; + _preselect_ssid = preselect_ssid; TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingWirelessWidget(this); @@ -125,6 +126,20 @@ WirelessWidgetImpl::Activate() // FIXME, if essid contains unprintable characters show the essid in hex _mainWid->txtEssid->setText(_wireless_setting->SSID); + + if (!_preselect_ssid.isNull()) { + TQListViewItemIterator it(_mainWid->lvEssids); + while (it.current()) { + NetworkListViewItem* item = dynamic_cast(it.current()); + if (item) { + if (item->_net.getSsid() == _preselect_ssid) { + _mainWid->lvEssids->setSelected(item, true); + slotEssidChanged(item); + } + } + ++it; + } + } } void WirelessWidgetImpl::slotEssidChanged(TQListViewItem* item) diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h index 7c97a0b..843c419 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h @@ -47,7 +47,7 @@ namespace ConnectionSettings Q_OBJECT public: - WirelessWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + WirelessWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQByteArray preselect_ssid = TQByteArray(), TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); void Activate(); @@ -69,6 +69,7 @@ namespace ConnectionSettings ConnectionSettingWirelessWidget* _mainWid; KListViewSearchLineWidget* _searchLine; bool _new_conn; + TQByteArray _preselect_ssid; }; } #endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp index b080343..e0af90b 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp @@ -36,6 +36,7 @@ #include #include #include +#include // TQt DBus headers #include @@ -55,15 +56,13 @@ #include "tdenetman-wireless_network.h" #include "tdenetman-wireless_manager.h" -char use_new_wireless_essid = 0; -TQByteArray new_wireless_essid; - using namespace ConnectionSettings; -ConnectionSettingsDialogImpl::ConnectionSettingsDialogImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, bool modal, WFlags fl) +ConnectionSettingsDialogImpl::ConnectionSettingsDialogImpl(TDENetworkConnection* conn, bool new_conn, TQByteArray networkextid, TQWidget* parent, const char* name, bool modal, WFlags fl) : ConnectionSettingsDialog(parent, name, modal, fl) , _conn(conn) , _new_conn(new_conn) + , _networkextid(networkextid) { updateDialogForDeviceType(); @@ -115,17 +114,17 @@ ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(TDENetworkConne { TQValueList ret; - // Set ESSID -// _wireless_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); -// _info_setting = dynamic_cast (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); +// // Set ESSID +// TDEWiFiConnection* _wireless_setting = dynamic_cast(conn); +// _wireless_setting->SSID = essid; +// // The connection has no name yet -> just take the essid for it +// _wireless_setting->friendlyName = TQString(essid); +// if (_wireless_setting->friendlyName == "") { +// _wireless_setting->friendlyName = "<" + i18n("hidden") + ">"; // } // widgetlist for wireless connection + ret.append(new ConnectionSettings::WirelessWidgetImpl(conn, new_conn, essid)); ret.append(new ConnectionSettings::WirelessSecurityWidgetImpl(conn, new_conn)); ret.append(new ConnectionSettings::IPv4WidgetImpl(conn)); ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); @@ -210,12 +209,11 @@ ConnectionSettingsDialogImpl::createWidgetsForConnection(TDENetworkConnection* c TQValueList widgets; // TODO: move to a factory class if (conn->type() == TDENetworkConnectionType::WiFi) { - if (use_new_wireless_essid == 0) { + if (_networkextid.isNull()) { widgets = createWidgetsForWireless(conn, new_conn); } else { - createWidgetsForWirelessKnownESSID(conn, new_conn, new_wireless_essid); - new_wireless_essid = TQByteArray(); + widgets = createWidgetsForWirelessKnownESSID(conn, new_conn, _networkextid); } } else if (conn->type() == TDENetworkConnectionType::WiredEthernet) { diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h index 8e80b3e..b9f54f1 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h @@ -50,7 +50,7 @@ class ConnectionSettingsDialogImpl : public ConnectionSettingsDialog Q_OBJECT public: - ConnectionSettingsDialogImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); + ConnectionSettingsDialogImpl(TDENetworkConnection* conn, bool new_conn, TQByteArray networkextid = TQByteArray(), TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~ConnectionSettingsDialogImpl(); public slots: @@ -82,6 +82,7 @@ class ConnectionSettingsDialogImpl : public ConnectionSettingsDialog TDENetworkConnection* _conn; TQValueList _widgetIds; bool _new_conn; + TQByteArray _networkextid; }; #endif /* KNETWORKMANAGER_CONNECTION_SETTINGS_DIALOG_H*/ diff --git a/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp index d21e511..30dd26a 100644 --- a/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp @@ -30,7 +30,7 @@ #include #include -// TDENM includes +// KNM includes #include "tdenetman-cellular_device_tray.h" #include "tdenetman-menuitem.h" #include "tdenetman-menu_subhead.h" @@ -68,7 +68,7 @@ void CellularDeviceTray::newConnection() } // edit the new connection - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, tray(), "connect_something", false, TQt::WDestructiveClose); + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, TQByteArray(), tray(), "connect_something", false, TQt::WDestructiveClose); dlg->show(); } diff --git a/tdenetworkmanager/src/tdenetman-connection_editor.cpp b/tdenetworkmanager/src/tdenetman-connection_editor.cpp index 22886dd..6ea466f 100644 --- a/tdenetworkmanager/src/tdenetman-connection_editor.cpp +++ b/tdenetworkmanager/src/tdenetman-connection_editor.cpp @@ -159,7 +159,7 @@ void ConnectionEditorImpl::slotNewVPNConnection() void ConnectionEditorImpl::slotEditNewConnection(TDENetworkConnection* conn) { // open a dialog for editing the connection - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, this, "connect_something", false, TQt::WDestructiveClose); + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, TQByteArray(), this, "connect_something", false, TQt::WDestructiveClose); connect(dlg, TQT_SIGNAL(connectionSaved()), this, TQT_SLOT(slotRefreshConnectionList())); dlg->show(); } @@ -189,7 +189,7 @@ void ConnectionEditorImpl::slotEditCurrentConnection() // we need the secrets for editing nm->loadConnectionSecrets(conn->UUID); - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, false, this, "connect_something", false, TQt::WDestructiveClose); + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, false, TQByteArray(), this, "connect_something", false, TQt::WDestructiveClose); dlg->show(); // save all connections (if not done already) diff --git a/tdenetworkmanager/src/tdenetman-tray.cpp b/tdenetworkmanager/src/tdenetman-tray.cpp index 793e643..4f1e2bc 100644 --- a/tdenetworkmanager/src/tdenetman-tray.cpp +++ b/tdenetworkmanager/src/tdenetman-tray.cpp @@ -85,7 +85,7 @@ NewSecretsDialog::~NewSecretsDialog () void NewSecretsDialog::slotDialogEdit() { - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(_connection, false, Tray::getInstance(), "Edit connection"); + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(_connection, false, TQByteArray(), Tray::getInstance(), "Edit connection"); dlg->show(); close(); } @@ -669,13 +669,13 @@ void Tray::updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnecti void Tray::slotDeviceAddedNotify(TDENetworkDevice* dev) { kdDebug() << "Tray::slotDeviceAddedNotify" << endl; - KNotifyClient::event( winId(), "tdenm-nm-device-added", i18n("New network device %1 found").arg(dev->deviceNode()) ); + KNotifyClient::event( winId(), "knm-nm-device-added", i18n("New network device %1 found").arg(dev->deviceNode()) ); } void Tray::slotDeviceRemovedNotify(TDENetworkDevice* dev) { kdDebug() << "Tray::slotDeviceRemovedNotify" << endl; - KNotifyClient::event( winId(), "tdenm-nm-device-removed", i18n("Network device %1 removed").arg(dev->deviceNode()) ); + KNotifyClient::event( winId(), "knm-nm-device-removed", i18n("Network device %1 removed").arg(dev->deviceNode()) ); } void Tray::slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState) @@ -684,16 +684,16 @@ void Tray::slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobal // change tray icon according to NM's state if (nm_state & TDENetworkGlobalManagerFlags::EstablishingLink) { - KNotifyClient::event( winId(), "tdenm-nm-connecting", i18n("NetworkManager is connecting") ); + KNotifyClient::event( winId(), "knm-nm-connecting", i18n("NetworkManager is connecting") ); } else if (nm_state & TDENetworkGlobalManagerFlags::Disconnected) { - KNotifyClient::event( winId(), "tdenm-nm-disconnected", i18n("NetworkManager is now disconnected") ); + KNotifyClient::event( winId(), "knm-nm-disconnected", i18n("NetworkManager is now disconnected") ); } else if (nm_state & TDENetworkGlobalManagerFlags::Connected) { - KNotifyClient::event( winId(), "tdenm-nm-connected", i18n("NetworkManager is now connected") ); + KNotifyClient::event( winId(), "knm-nm-connected", i18n("NetworkManager is now connected") ); } else if (nm_state & TDENetworkGlobalManagerFlags::Sleeping) { - KNotifyClient::event( winId(), "tdenm-nm-sleeping", i18n("TDENetworkManager Offline") ); + KNotifyClient::event( winId(), "knm-nm-sleeping", i18n("TDENetworkManager Offline") ); } else if (nm_state & TDENetworkGlobalManagerFlags::Unknown) { // diff --git a/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp index e816f03..79415b9 100644 --- a/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp @@ -44,7 +44,7 @@ #include -// TDENM includes +// KNM includes #include "tdenetman-wired_device_tray.h" #include "tdenetman-menuitem.h" #include "tdenetman-menu_subhead.h" @@ -71,7 +71,7 @@ void WiredDeviceTray::newConnection() nm->loadConnectionAllowedValues(conn); // edit the new connection - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, tray(), "connect_something", false, TQt::WDestructiveClose); + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, TQByteArray(), tray(), "connect_something", false, TQt::WDestructiveClose); dlg->show(); } diff --git a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp index cd5c786..98954bc 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp @@ -42,7 +42,7 @@ #include #include -// TDENM includes +// KNM includes #include "tdenetman-wireless_device_tray.h" #include "tdenetman-wireless_menuitem.h" #include "tdenetman-wireless_network.h" @@ -52,9 +52,6 @@ using namespace ConnectionSettings; -extern char use_new_wireless_essid; -extern TQByteArray new_wireless_essid; - class WirelessDeviceTrayPrivate { public: @@ -82,6 +79,11 @@ TQStringList WirelessDeviceTray::getToolTipText() } void WirelessDeviceTray::newConnection() +{ + newConnection(0); +} + +void WirelessDeviceTray::newConnection(int id) { TDEGlobalNetworkManager* nm = KGlobal::networkManager(); @@ -90,8 +92,11 @@ void WirelessDeviceTray::newConnection() nm->loadConnectionAllowedValues(conn); // open a dialog for editing the connection - use_new_wireless_essid = 0; // deactivate autofill for now - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, tray(), "connect_something", false, TQt::WDestructiveClose); + char use_new_wireless_essid = 0; + if ((id < 0) && newWirelessPopupSSIDMap.contains(id)) { + use_new_wireless_essid = 1; + } + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, (use_new_wireless_essid)?newWirelessPopupSSIDMap[id]:TQByteArray(), tray(), "connect_something", false, TQt::WDestructiveClose); dlg->show(); } @@ -214,7 +219,8 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) TQPopupMenu* newpopup = new TQPopupMenu(menu); uint newnetworkItemsAdded = 0; TQValueList newnets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID); - + + newWirelessPopupSSIDMap.clear(); for (TQValueList::Iterator it = newnets.begin(); it != newnets.end(); ++it) { // Only display networks with no existing connnection @@ -229,7 +235,8 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) false); int id = newpopup->insertItem (wirelessNetworkItem, -1, -1); - newpopup->connectItem(id, this, TQT_SLOT(newConnection())); + newWirelessPopupSSIDMap[id] = (*it).getSsid(); + newpopup->connectItem(id, this, TQT_SLOT(newConnection(int))); newnetworkItemsAdded += 1; } @@ -397,12 +404,12 @@ void WirelessDeviceTray::apPropertyChanged(TDEMACAddress BSSID, TDENetworkAPEven void WirelessDeviceTray::slotAccessPointAdded(TDENetworkWiFiAPInfo* ap) { - KNotifyClient::event( tray()->winId(), "tdenm-nm-network-found", i18n("TDENetworkManager New Wireless Network Found") ); + KNotifyClient::event( tray()->winId(), "knm-nm-network-found", i18n("TDENetworkManager New Wireless Network Found") ); } void WirelessDeviceTray::slotAccessPointRemoved(TDEMACAddress) { - KNotifyClient::event( tray()->winId(), "tdenm-nm-network-gone", i18n("TDENetworkManager Wireless Network Disappeared") ); + KNotifyClient::event( tray()->winId(), "knm-nm-network-gone", i18n("TDENetworkManager Wireless Network Disappeared") ); } void WirelessDeviceTray::tdeHardwareEventHandler(TDEHardwareEvent::TDEHardwareEvent event, TQString) diff --git a/tdenetworkmanager/src/tdenetman-wireless_device_tray.h b/tdenetworkmanager/src/tdenetman-wireless_device_tray.h index aad6325..c4d639f 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_device_tray.h +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.h @@ -27,7 +27,7 @@ #ifndef KNETWORKMANAGER_WIRELESS_DEVICE_TRAY_H #define KNETWORKMANAGER_WIRELESS_DEVICE_TRAY_H -// TDENM includes +// KNM includes #include "tdenetman.h" #include "devicetraycomponent.h" #include "tdenetman-wireless_network.h" @@ -57,8 +57,9 @@ class WirelessDeviceTray : public DeviceTrayComponent void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString); void slotCheckActiveAccessPoint(); void newConnection(); - protected slots: + void newConnection(int); + protected slots: void apPropertyChanged(TDEMACAddress BSSID, TDENetworkAPEventType::TDENetworkAPEventType event); void slotAccessPointAdded(TDENetworkWiFiAPInfo*); void slotAccessPointRemoved(TDEMACAddress); @@ -74,6 +75,7 @@ class WirelessDeviceTray : public DeviceTrayComponent TDEWiFiConnection* findMatchingConnection(const WirelessNetwork& net, const TQValueList& connection); bool findMatchingNetwork(const TDEWiFiConnection* conn, const TQValueList& nets, WirelessNetwork& net); void setPixmapForStates(TDENetworkConnectionStatus::TDENetworkConnectionStatus states, TQString pixmap); + TQMap newWirelessPopupSSIDMap; WirelessDeviceTrayPrivate* d; -- cgit v1.2.1 From 69038478ebe36615fb749e82ee625a131416fe0c Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 8 Sep 2012 23:54:40 -0500 Subject: Use BSSID instead of storing APInfo pointers internally --- ...connection_setting_wireless_security_widget.cpp | 2 +- .../src/tdenetman-wireless_manager.cpp | 6 +- .../src/tdenetman-wireless_network.cpp | 154 ++++++++++++++++++--- tdenetworkmanager/src/tdenetman-wireless_network.h | 4 +- 4 files changed, 141 insertions(+), 25 deletions(-) diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp index bd4b593..654d1f8 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp @@ -121,7 +121,7 @@ WirelessSecurityWEPImpl::WirelessSecurityWEPImpl(TDEWiFiConnection* sec, TQWidge void WirelessSecurityWEPImpl::slotAuthAlgChanged(int index) { if (index == 0) { - _security_setting->securitySettings.authType =TDENetworkWiFiAuthType::Open; + _security_setting->securitySettings.authType = TDENetworkWiFiAuthType::Open; } else if (index == 1) { _security_setting->securitySettings.authType = TDENetworkWiFiAuthType::Shared; diff --git a/tdenetworkmanager/src/tdenetman-wireless_manager.cpp b/tdenetworkmanager/src/tdenetman-wireless_manager.cpp index 6a9b28c..747fc04 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_manager.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_manager.cpp @@ -49,12 +49,12 @@ TQValueList WirelessManager::getWirelessNetworks(TDENetworkDevi // check if we have a network matching this AP for (TQValueList::Iterator netIt = nets.begin(); netIt != nets.end(); ++netIt) { - if ((*netIt).contains(ap) ) { + if ((*netIt).contains(ap->BSSID) ) { // we alread have a network where this AP belongs to found = true; // attach this ap to the network - (*netIt).addAP(ap); + (*netIt).addAP(ap->BSSID, (dev)?dev->uniqueID():TQString::null); /* // FIXME active? if (active_ap) @@ -70,7 +70,7 @@ TQValueList WirelessManager::getWirelessNetworks(TDENetworkDevi if (!found) { // create a new network-descriptor according to this ap WirelessNetwork net(match); - net.addAP(ap); + net.addAP(ap->BSSID, (dev)?dev->uniqueID():TQString::null); nets.append(net); } } diff --git a/tdenetworkmanager/src/tdenetman-wireless_network.cpp b/tdenetworkmanager/src/tdenetman-wireless_network.cpp index d3105df..5e6770b 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_network.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_network.cpp @@ -48,7 +48,7 @@ class WirelessNetworkPrivate bool active; TQ_UINT32 match; - TQValueList aps; + TQMap aps; }; WirelessNetwork::WirelessNetwork(const WirelessNetwork& other) @@ -71,15 +71,35 @@ WirelessNetwork::~WirelessNetwork() WirelessNetwork& WirelessNetwork::operator= (const WirelessNetwork& other) { - if (d) + if (d) { delete d; + } d = new WirelessNetworkPrivate(*other.d); return *this; } -bool WirelessNetwork::contains (const TDENetworkWiFiAPInfo * const ap) +bool WirelessNetwork::contains(const TDEMACAddress ap) { - if ( (d->match & MATCH_SSID) && getSsid() != ap->SSID) { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->aps[ap])); + TDENetworkWiFiAPInfo* apInfo = NULL; + if (dev) { + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + apInfo = deviceConnMan->findAccessPointByBSSID(ap); + } + else if (d->aps[ap] == "") { + apInfo = nm->findAccessPointByBSSID(ap); + } + + if (apInfo) { + if ( (d->match & MATCH_SSID) && (getSsid() != apInfo->SSID)) { + return false; + } + } + else { + // AP was not found in list return false; } @@ -87,10 +107,10 @@ bool WirelessNetwork::contains (const TDENetworkWiFiAPInfo * const ap) return true; } -bool WirelessNetwork::addAP(const TDENetworkWiFiAPInfo * const ap) +bool WirelessNetwork::addAP(const TDEMACAddress ap, const TQString dev) { - if ( this->contains( ap ) || d->aps.isEmpty()) { - d->aps.append(ap); + if ( this->contains(ap) || d->aps.isEmpty()) { + d->aps[ap] = dev; return true; } return false; @@ -98,8 +118,26 @@ bool WirelessNetwork::addAP(const TDENetworkWiFiAPInfo * const ap) const TQByteArray WirelessNetwork::getSsid() const { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if ( !d->aps.isEmpty() ) { - return (*(d->aps.begin()))->SSID; + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->aps.begin().data())); + TDENetworkWiFiAPInfo* apInfo = NULL; + if (dev) { + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + apInfo = deviceConnMan->findAccessPointByBSSID(d->aps.begin().key()); + } + else if (d->aps.begin().data() == "") { + apInfo = nm->findAccessPointByBSSID(d->aps.begin().key()); + } + + if (apInfo) { + return apInfo->SSID; + } + else { + return TQByteArray(); + } } else { return TQByteArray(); @@ -108,8 +146,26 @@ const TQByteArray WirelessNetwork::getSsid() const TQString WirelessNetwork::getDisplaySsid() const { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (!d->aps.isEmpty()) { - return (*(d->aps.begin()))->friendlySSID(); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->aps.begin().data())); + TDENetworkWiFiAPInfo* apInfo = NULL; + if (dev) { + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + apInfo = deviceConnMan->findAccessPointByBSSID(d->aps.begin().key()); + } + else if (d->aps.begin().data() == "") { + apInfo = nm->findAccessPointByBSSID(d->aps.begin().key()); + } + + if (apInfo) { + return apInfo->friendlySSID(); + } + else { + return TQString(); + } } else { return TQString(); @@ -118,30 +174,75 @@ TQString WirelessNetwork::getDisplaySsid() const TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getFlags() const { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; - for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { - flags |= ((*it)->wpaFlags & TDENetworkWiFiAPFlags::GeneralFlagsMask); - flags |= ((*it)->rsnFlags & TDENetworkWiFiAPFlags::GeneralFlagsMask); + for (TQMap::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(it.data())); + TDENetworkWiFiAPInfo* apInfo = NULL; + if (dev) { + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + apInfo = deviceConnMan->findAccessPointByBSSID(it.key()); + } + else if (it.data() == "") { + apInfo = nm->findAccessPointByBSSID(it.key()); + } + + if (apInfo) { + flags |= (apInfo->wpaFlags & TDENetworkWiFiAPFlags::GeneralFlagsMask); + flags |= (apInfo->rsnFlags & TDENetworkWiFiAPFlags::GeneralFlagsMask); + } } return flags; } TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getWpaFlags() const { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; - for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) + for (TQMap::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { - flags |= ((*it)->wpaFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(it.data())); + TDENetworkWiFiAPInfo* apInfo = NULL; + if (dev) { + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + apInfo = deviceConnMan->findAccessPointByBSSID(it.key()); + } + else if (it.data() == "") { + apInfo = nm->findAccessPointByBSSID(it.key()); + } + + if (apInfo) { + flags |= (apInfo->wpaFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask); + } } return flags; } TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getRsnFlags() const { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; - for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) + for (TQMap::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { - flags |= ((*it)->rsnFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask); + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(it.data())); + TDENetworkWiFiAPInfo* apInfo = NULL; + if (dev) { + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + apInfo = deviceConnMan->findAccessPointByBSSID(it.key()); + } + else if (it.data() == "") { + apInfo = nm->findAccessPointByBSSID(it.key()); + } + + if (apInfo) { + flags |= (apInfo->rsnFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask); + } } return flags; } @@ -153,10 +254,25 @@ bool WirelessNetwork::isEncrypted() const TQ_UINT8 WirelessNetwork::getStrength() const { + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TQ_UINT8 strength = 0; - for (TQValueList::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { - if (((*it)->signalQuality*100.0) > strength) { - strength = ((*it)->signalQuality*100.0); + for (TQMap::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { + TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(it.data())); + TDENetworkWiFiAPInfo* apInfo = NULL; + if (dev) { + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + apInfo = deviceConnMan->findAccessPointByBSSID(it.key()); + } + else if (it.data() == "") { + apInfo = nm->findAccessPointByBSSID(it.key()); + } + + if (apInfo) { + if ((apInfo->signalQuality*100.0) > strength) { + strength = (apInfo->signalQuality*100.0); + } } } return strength; diff --git a/tdenetworkmanager/src/tdenetman-wireless_network.h b/tdenetworkmanager/src/tdenetman-wireless_network.h index 8ace658..473dbb6 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_network.h +++ b/tdenetworkmanager/src/tdenetman-wireless_network.h @@ -57,10 +57,10 @@ class WirelessNetwork WirelessNetwork& operator= (const WirelessNetwork&); // check if the AccessPoint represents the same net - bool contains(const TDENetworkWiFiAPInfo * const); + bool contains(const TDEMACAddress); // add an AP to the Network - bool addAP(const TDENetworkWiFiAPInfo * const); + bool addAP(const TDEMACAddress, const TQString); // combined flags of all APs TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags getFlags() const; -- cgit v1.2.1 From 323fad1f89abd58c624e73ed03f6399c356fb396 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 9 Sep 2012 19:12:51 -0500 Subject: Add connection editing support and clean up the code --- .../tdenetman-connection_setting_cdma_widget.cpp | 6 +- .../tdenetman-connection_setting_cdma_widget.h | 6 +- .../tdenetman-connection_setting_gsm_widget.cpp | 6 +- .../tdenetman-connection_setting_gsm_widget.h | 5 +- .../tdenetman-connection_setting_info_widget.cpp | 6 +- .../tdenetman-connection_setting_info_widget.h | 4 +- .../tdenetman-connection_setting_ipv4_widget.cpp | 13 ++ .../tdenetman-connection_setting_ipv4_widget.h | 2 + .../tdenetman-connection_setting_ppp_widget.cpp | 6 +- .../tdenetman-connection_setting_ppp_widget.h | 5 +- .../tdenetman-connection_setting_serial_widget.cpp | 6 +- .../tdenetman-connection_setting_serial_widget.h | 5 +- .../tdenetman-connection_setting_vpn_widget.cpp | 4 +- .../tdenetman-connection_setting_vpn_widget.h | 8 +- ...connection_setting_wireless_security_widget.cpp | 135 ++++++++++++++++++--- ...n-connection_setting_wireless_security_widget.h | 33 +++-- ...denetman-connection_setting_wireless_widget.cpp | 10 ++ .../tdenetman-connection_setting_wireless_widget.h | 3 + .../tdenetman-connection_settings_dialog.cpp | 85 ++++++------- .../src/tdenetman-cellular_device_tray.cpp | 5 +- .../src/tdenetman-cellular_device_tray.h | 1 + .../src/tdenetman-connection_editor.cpp | 3 - tdenetworkmanager/src/tdenetman-tray.cpp | 12 +- .../src/tdenetman-wired_device_tray.cpp | 4 +- .../src/tdenetman-wired_device_tray.h | 1 + .../src/tdenetman-wireless_device_tray.cpp | 17 +-- .../src/tdenetman-wireless_device_tray.h | 3 +- .../src/tdenetman-wireless_menuitem.cpp | 3 +- .../src/tdenetman-wireless_menuitem.h | 46 +++---- .../src/tdenetman-wireless_network.cpp | 9 +- tdenetworkmanager/src/tdenetman-wireless_network.h | 3 +- 31 files changed, 312 insertions(+), 143 deletions(-) diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.cpp index 8255eaf..7e95fd3 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.cpp @@ -33,7 +33,7 @@ #include #include -// knm headers +// tdenm headers #include "tdenetman-connection_setting_cdma_widget.h" // ui headers @@ -44,6 +44,8 @@ using namespace ConnectionSettings; CDMAWidgetImpl::CDMAWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { + _parentdialog = dynamic_cast(parent); + _cdmasetting = dynamic_cast(conn); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); @@ -87,6 +89,8 @@ CDMAWidgetImpl::dirty() _cdmasetting->cdmaConfig.providerDataNumber = _mainWid->mNumber->text(); _cdmasetting->cdmaConfig.valid = true; _cdmasetting->cdmaConfig.secretsValid = true; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.h index 3ce30fc..110b079 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.h @@ -34,7 +34,8 @@ #include #include -// knm headers +// tdenm headers +#include "tdenetman-connection_settings_dialog.h" #include "tdenetman-connection_setting_widget_interface.h" //class VPNService; @@ -58,9 +59,10 @@ class CDMAWidgetImpl : public WidgetInterface void Init(); //VPNConfigWidget* getVPNConfigWidget(VPNService* service); - TDEModemConnection* _cdmasetting; ConnectionSettingCdmaWidget* _mainWid; + + ConnectionSettingsDialogImpl* _parentdialog; }; } diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.cpp index 131f4c0..f373b04 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.cpp @@ -34,7 +34,7 @@ #include #include -// knm headers +// tdenm headers #include "tdenetman-connection_setting_gsm_widget.h" #include "connection_setting_gsm.h" @@ -44,6 +44,8 @@ using namespace ConnectionSettings; GSMWidgetImpl::GSMWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { + _parentdialog = dynamic_cast(parent); + _gsmsetting = dynamic_cast(conn); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); @@ -104,6 +106,8 @@ GSMWidgetImpl::dirty() _gsmsetting->gsmConfig.valid = true; _gsmsetting->gsmConfig.secretsValid = true; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.h index 639e4fa..221336e 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.h @@ -34,7 +34,8 @@ #include #include -// knm headers +// tdenm headers +#include "tdenetman-connection_settings_dialog.h" #include "tdenetman-connection_setting_widget_interface.h" //class VPNService; @@ -65,6 +66,8 @@ class GSMWidgetImpl : public WidgetInterface TDEModemConnection* _gsmsetting; ConnectionSettingGsmWidget* _mainWid; + + ConnectionSettingsDialogImpl* _parentdialog; }; } diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.cpp index fed5d15..e9962ee 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.cpp @@ -29,7 +29,7 @@ #include #include -// knm headers +// tdenm headers #include "tdenetman-connection_setting_info_widget.h" using namespace ConnectionSettings; @@ -38,7 +38,7 @@ InfoWidgetImpl::InfoWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, con : WidgetInterface(parent, name, fl) { _infosetting = conn; - + _parentdialog = dynamic_cast(parent); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingInfoWidget(this); @@ -65,12 +65,14 @@ void InfoWidgetImpl::slotNameChanged(const TQString& name) { _infosetting->friendlyName = name; + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void InfoWidgetImpl::slotAutoconnectChanged(bool autoconnect) { _infosetting->autoConnect = autoconnect; + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } #include "tdenetman-connection_setting_info_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.h index 3ffe23a..2ddb6e5 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.h @@ -35,8 +35,9 @@ #include #include -// knm headers +// tdenm headers #include "connection_setting_info.h" +#include "tdenetman-connection_settings_dialog.h" #include "tdenetman-connection_setting_widget_interface.h" namespace ConnectionSettings @@ -61,6 +62,7 @@ class InfoWidgetImpl : public WidgetInterface void Init(); TDENetworkConnection* _infosetting; + ConnectionSettingsDialogImpl* _parentdialog; ConnectionSettingInfoWidget* _mainWid; }; diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp index f36efaa..03db7b4 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp @@ -39,6 +39,7 @@ IPv4WidgetImpl::IPv4WidgetImpl(TDENetworkConnection* conn, TQWidget* parent, con : WidgetInterface(parent, name, fl) { _ipv4_setting = conn; + _parentdialog = dynamic_cast(parent); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingIPv4Widget(this); @@ -116,6 +117,8 @@ IPv4WidgetImpl::slotDNSAddressesChanged(const TQString& adr) } } _ipv4_setting->ipConfig.resolvers = hosts; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } @@ -134,6 +137,8 @@ IPv4WidgetImpl::slotDNSSearchChanged(const TQString& search) } } _ipv4_setting->ipConfig.searchDomains = domains; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void @@ -147,6 +152,8 @@ IPv4WidgetImpl::slotIPConfigEnabled(bool enabled) { _ipv4_setting->ipConfig.connectionFlags |= TDENetworkIPConfigurationFlags::IPV4DHCPIP; } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void @@ -186,6 +193,8 @@ IPv4WidgetImpl::slotIPAddressChanged(const TQString& ip) } } } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void @@ -196,6 +205,8 @@ IPv4WidgetImpl::slotNetmaskChanged(const TQString& ip) mask.fromString(ip); addrs[0].networkMask = mask; _ipv4_setting->ipConfig.ipConfigurations = addrs; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void @@ -204,6 +215,8 @@ IPv4WidgetImpl::slotGatewayChanged(const TQString& ip) TDENetworkSingleIPConfigurationList addrs = _ipv4_setting->ipConfig.ipConfigurations; addrs[0].gateway = TQHostAddress(ip); _ipv4_setting->ipConfig.ipConfigurations = addrs; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } #include "tdenetman-connection_setting_ipv4_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.h index 1abec3a..0b2e48f 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.h @@ -33,6 +33,7 @@ #include "connection_setting_ipv4.h" // tdenetman headers +#include "tdenetman-connection_settings_dialog.h" #include "tdenetman-connection_setting_widget_interface.h" namespace ConnectionSettings @@ -60,6 +61,7 @@ namespace ConnectionSettings void Init(); TDENetworkConnection* _ipv4_setting; + ConnectionSettingsDialogImpl* _parentdialog; ConnectionSettingIPv4Widget* _mainWid; }; diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.cpp index a4d0a65..3ab971e 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.cpp @@ -36,7 +36,7 @@ #include #include -// knm headers +// tdenm headers #include "tdenetman-connection_setting_ppp_widget.h" #include "connection_setting_ppp.h" @@ -45,6 +45,8 @@ using namespace ConnectionSettings; PPPWidgetImpl::PPPWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { + _parentdialog = dynamic_cast(parent); + _pppsetting = conn; TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); @@ -138,6 +140,8 @@ PPPWidgetImpl::dirty() _pppsetting->pppConfig.lcpEchoPingInterval = _mainWid->mLcpEchoInterval->value(); _pppsetting->pppConfig.valid = true; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } #include "tdenetman-connection_setting_ppp_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.h index 9772b1d..71ccc67 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.h @@ -34,7 +34,8 @@ #include #include -// knm headers +// tdenm headers +#include "tdenetman-connection_settings_dialog.h" #include "tdenetman-connection_setting_widget_interface.h" //class VPNService; @@ -61,6 +62,8 @@ class PPPWidgetImpl : public WidgetInterface TDENetworkConnection* _pppsetting; ConnectionSettingPppWidget* _mainWid; + + ConnectionSettingsDialogImpl* _parentdialog; }; } diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.cpp index daa5f62..0f9d7a6 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.cpp @@ -35,7 +35,7 @@ #include #include -// knm headers +// tdenm headers #include "tdenetman-connection_setting_serial_widget.h" #include "connection_setting_serial.h" @@ -45,6 +45,8 @@ using namespace ConnectionSettings; SerialWidgetImpl::SerialWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { + _parentdialog = dynamic_cast(parent); + _serialsetting = conn; TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); @@ -93,6 +95,8 @@ SerialWidgetImpl::dirty() _serialsetting->serialConfig.txDelay = _mainWid->mSendDelay->value(); _serialsetting->serialConfig.valid = true; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.h index 4dad72d..93e23fd 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.h @@ -34,8 +34,9 @@ #include #include -// knm headers +// tdenm headers #include "tdenetman-connection_setting_widget_interface.h" +#include "tdenetman-connection_settings_dialog.h" //class VPNService; class ConnectionSettingSerialWidget; @@ -64,6 +65,8 @@ class SerialWidgetImpl : public WidgetInterface TDENetworkConnection* _serialsetting; ConnectionSettingSerialWidget* _mainWid; + + ConnectionSettingsDialogImpl* _parentdialog; }; } diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp index 5b1faff..06509ec 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp @@ -23,7 +23,7 @@ * **************************************************************************/ -// qt headers +// tqt headers #include #include #include @@ -34,7 +34,7 @@ #include #include -// knm headers +// tdenm headers #include "tdenetman-connection.h" #include "tdenetman-connection_setting_vpn.h" #include "tdenetman-connection_setting_vpn_widget.h" diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h index 780148a..ad9cfde 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h @@ -26,14 +26,14 @@ #define KNETWORKMANAGER_CONNECTION_SETTING_VPN_WIDGET_H -// qt headers +// tqt headers #include #include -// knm headers +// tdenm headers #include "connection_setting_vpn.h" #include "tdenetman-connection_setting_widget_interface.h" -#include "tdenetman-device.h" +#include "tdenetman-connection_settings_dialog.h" class VPNService; class VPNConfigWidget; @@ -63,6 +63,8 @@ class VPNWidgetImpl : public WidgetInterface ConnectionSettingVPNWidget* _mainWid; TQMap _mapServiceCombo; TQMap _mapServiceWidget; + + ConnectionSettingsDialogImpl* _parentdialog; }; } diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp index 654d1f8..1e1500f 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp @@ -62,11 +62,13 @@ using namespace ConnectionSettings; /* class WirelessSecurityWEPImpl */ -WirelessSecurityWEPImpl::WirelessSecurityWEPImpl(TDEWiFiConnection* sec, TQWidget* parent, const char* name, WFlags fl) +WirelessSecurityWEPImpl::WirelessSecurityWEPImpl(TDEWiFiConnection* sec, TQWidget* parent, ConnectionSettingsDialogImpl* connsettings, const char* name, WFlags fl) : ConnectionSettingWirelessSecurityWEP(parent, name, fl) , _security_setting(sec) , _wepKeyType( WEPKEY_TYPE_HEX ) { + _parentdialog = connsettings; + cboAuthentication->insertItem(i18n("Open System"), 0); cboAuthentication->insertItem(i18n("Shared Key"), 1); if (_security_setting->securitySettings.authType == TDENetworkWiFiAuthType::Open) { @@ -75,11 +77,22 @@ WirelessSecurityWEPImpl::WirelessSecurityWEPImpl(TDEWiFiConnection* sec, TQWidge else if (_security_setting->securitySettings.authType == TDENetworkWiFiAuthType::Shared) { cboAuthentication->setCurrentItem(1); } + else { + // Set up defaults + _security_setting->securitySettings.authType = TDENetworkWiFiAuthType::Open; + cboAuthentication->setCurrentItem(0); + } 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 ); + cbKeyType->setCurrentItem( _wepKeyType ); + + if (_security_setting->securitySettings.authType == TDENetworkWiFiAuthType::Other) { + // Set up defaults + _security_setting->securitySettings.wepKeyType = TDENetworkWepKeyType::Hexadecimal; + cbKeyType->setCurrentItem(WEPKEY_TYPE_HEX); + } txtWEPKey0->setText(_security_setting->securitySettings.wepKey0); txtWEPKey1->setText(_security_setting->securitySettings.wepKey1); @@ -126,37 +139,64 @@ void WirelessSecurityWEPImpl::slotAuthAlgChanged(int index) else if (index == 1) { _security_setting->securitySettings.authType = TDENetworkWiFiAuthType::Shared; } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityWEPImpl::slotKeyTypeChanged(int index) { _wepKeyType = (WEPKEY_TYPE)index; + if (index == WEPKEY_TYPE_ASCII) { + _security_setting->securitySettings.wepKeyType = TDENetworkWepKeyType::Ascii; + } + else if (index == WEPKEY_TYPE_HEX) { + _security_setting->securitySettings.wepKeyType = TDENetworkWepKeyType::Hexadecimal; + } + else if (index == WEPKEY_TYPE_PASSPHRASE) { + _security_setting->securitySettings.wepKeyType = TDENetworkWepKeyType::Passphrase; + } + _security_setting->securitySettings.secretsValid = true; + // update all WEP-Keys here due to the new key_type + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityWEPImpl::slotWepKey0Changed(const TQString &key) { TQCString hashed = getHashedWEPKey(key, _wepKeyType); _security_setting->securitySettings.wepKey0 = hashed; + _security_setting->securitySettings.secretsValid = true; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityWEPImpl::slotWepKey1Changed(const TQString &key) { TQCString hashed = getHashedWEPKey(key, _wepKeyType); _security_setting->securitySettings.wepKey1 = hashed; + _security_setting->securitySettings.secretsValid = true; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityWEPImpl::slotWepKey2Changed(const TQString &key) { TQCString hashed = getHashedWEPKey(key, _wepKeyType); _security_setting->securitySettings.wepKey2 = hashed; + _security_setting->securitySettings.secretsValid = true; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityWEPImpl::slotWepKey3Changed(const TQString& key) { TQCString hashed = getHashedWEPKey(key, _wepKeyType); _security_setting->securitySettings.wepKey3 = hashed; + _security_setting->securitySettings.secretsValid = true; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityWEPImpl::slotWepIdx0Checked(bool check) @@ -164,6 +204,8 @@ void WirelessSecurityWEPImpl::slotWepIdx0Checked(bool check) if (check) { _security_setting->securitySettings.wepKeyIndex = 0; } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityWEPImpl::slotWepIdx1Checked(bool check) @@ -171,6 +213,8 @@ void WirelessSecurityWEPImpl::slotWepIdx1Checked(bool check) if (check) { _security_setting->securitySettings.wepKeyIndex = 1; } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityWEPImpl::slotWepIdx2Checked(bool check) @@ -178,6 +222,8 @@ void WirelessSecurityWEPImpl::slotWepIdx2Checked(bool check) if (check) { _security_setting->securitySettings.wepKeyIndex = 2; } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityWEPImpl::slotWepIdx3Checked(bool check) @@ -185,6 +231,8 @@ void WirelessSecurityWEPImpl::slotWepIdx3Checked(bool check) if (check) { _security_setting->securitySettings.wepKeyIndex = 3; } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } TQCString @@ -201,7 +249,7 @@ WirelessSecurityWEPImpl::getHashedWEPKey(TQString key, WEPKEY_TYPE type) const return hashed; break; case WEPKEY_TYPE_PASSPHRASE: - return getWEP128PassphraseHash(TQCString(key)); + return TQCString(key); break; } return hashed; @@ -253,10 +301,12 @@ WirelessSecurityWEPImpl::String2Hex(TQByteArray bytes, int final_len) const /* class WirelessSecurityWEPEncryptionImpl */ -WirelessSecurityWEPEncryptionImpl::WirelessSecurityWEPEncryptionImpl(TDEWiFiConnection* security_setting, TQWidget* parent, const char* name, WFlags fl) +WirelessSecurityWEPEncryptionImpl::WirelessSecurityWEPEncryptionImpl(TDEWiFiConnection* security_setting, TQWidget* parent, ConnectionSettingsDialogImpl* connsettings, const char* name, WFlags fl) : ConnectionSettingWirelessSecurityWEPEncryption(parent, name, fl) , _security_setting(security_setting) { + _parentdialog = connsettings; + cboEncryption->insertItem(i18n("None")); cboEncryption->insertItem(i18n("Dynamic WEP")); } @@ -265,10 +315,12 @@ WirelessSecurityWEPEncryptionImpl::WirelessSecurityWEPEncryptionImpl(TDEWiFiConn /* class WirelessSecurityWPAVersionImpl */ -WirelessSecurityWPAVersionImpl::WirelessSecurityWPAVersionImpl(TDEWiFiConnection* security_setting, TQWidget* parent, const char* name, WFlags fl) +WirelessSecurityWPAVersionImpl::WirelessSecurityWPAVersionImpl(TDEWiFiConnection* security_setting, TQWidget* parent, ConnectionSettingsDialogImpl* connsettings, const char* name, WFlags fl) : ConnectionSettingWirelessSecurityWPAVersion(parent, name, fl) , _security_setting(security_setting) { + _parentdialog = connsettings; + cbWPA->setChecked(_security_setting->securitySettings.wpaVersion & TDENetworkWiFiWPAVersionFlags::WPA); cbRSN->setChecked(_security_setting->securitySettings.wpaVersion & TDENetworkWiFiWPAVersionFlags::RSN); @@ -296,27 +348,35 @@ WirelessSecurityWPAVersionImpl::slotAuto(bool on) } _security_setting->securitySettings.wpaVersion = proto; } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityWPAVersionImpl::slotWPA1(bool on) { SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(_security_setting->securitySettings.wpaVersion, TDENetworkWiFiWPAVersionFlags::WPA, on); + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityWPAVersionImpl::slotWPA2(bool on) { SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(_security_setting->securitySettings.wpaVersion, TDENetworkWiFiWPAVersionFlags::RSN, on); + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } /* class WirelessSecurityWPACipherImpl */ -WirelessSecurityWPACipherImpl::WirelessSecurityWPACipherImpl(TDEWiFiConnection* security_setting, TQWidget* parent, const char* name, WFlags fl) +WirelessSecurityWPACipherImpl::WirelessSecurityWPACipherImpl(TDEWiFiConnection* security_setting, TQWidget* parent, ConnectionSettingsDialogImpl* connsettings, const char* name, WFlags fl) : ConnectionSettingWirelessSecurityWPACipher(parent, name, fl) , _security_setting(security_setting) { + _parentdialog = connsettings; + connect(grpUseCipher, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotCipherChangedAuto(bool))); connect(chkGroupCipherTKIP, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotGroupCipherChangedTKIP(bool))); @@ -334,7 +394,6 @@ WirelessSecurityWPACipherImpl::WirelessSecurityWPACipherImpl(TDEWiFiConnection* chkGroupCipherTKIP->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)); chkGroupCipherWEP40->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40)); chkGroupCipherWEP104->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104)); - } void @@ -377,8 +436,9 @@ WirelessSecurityWPACipherImpl::slotCipherChangedAuto(bool checked) cipher.append(TDENetworkWiFiConnectionCipher::CipherCCMP); } _security_setting->securitySettings.allowedPairWiseCiphers = cipher; - } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void @@ -390,6 +450,8 @@ WirelessSecurityWPACipherImpl::slotGroupCipherChangedTKIP(bool checked) else { _security_setting->securitySettings.allowedGroupWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherTKIP); } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void @@ -401,6 +463,8 @@ WirelessSecurityWPACipherImpl::slotGroupCipherChangedCCMP(bool checked) else { _security_setting->securitySettings.allowedGroupWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherCCMP); } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void @@ -412,6 +476,8 @@ WirelessSecurityWPACipherImpl::slotGroupCipherChangedWEP40(bool checked) else { _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherWEP40); } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void @@ -423,6 +489,8 @@ WirelessSecurityWPACipherImpl::slotGroupCipherChangedWEP104(bool checked) else { _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherWEP104); } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void @@ -434,6 +502,8 @@ WirelessSecurityWPACipherImpl::slotPairwiseCipherChangedTKIP(bool checked) else { _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherTKIP); } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void @@ -445,16 +515,20 @@ WirelessSecurityWPACipherImpl::slotPairwiseCipherChangedCCMP(bool checked) else { _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherCCMP); } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } /* class WirelessSecurityWPAPSK */ -WirelessSecurityWPAPSKImpl::WirelessSecurityWPAPSKImpl(TDEWiFiConnection* security_setting, TDEWiFiConnection* wireless_setting, TQWidget* parent, const char* name, WFlags fl) +WirelessSecurityWPAPSKImpl::WirelessSecurityWPAPSKImpl(TDEWiFiConnection* security_setting, TDEWiFiConnection* wireless_setting, TQWidget* parent, ConnectionSettingsDialogImpl* connsettings, const char* name, WFlags fl) : ConnectionSettingWirelessSecurityWPAPSK(parent, name, fl) , _security_setting(security_setting) , _wireless_setting(wireless_setting) { + _parentdialog = connsettings; + if (_security_setting->securitySettings.secretsValid) { txtPSK->setText(_security_setting->securitySettings.psk); } @@ -469,6 +543,8 @@ WirelessSecurityWPAPSKImpl::slotPSKChanged(const TQString& psk) _security_setting->securitySettings.psk = psk; _security_setting->securitySettings.secretsValid = true; } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } TQCString @@ -491,11 +567,13 @@ WirelessSecurityWPAPSKImpl::String2Hex(TQByteArray bytes, int final_len) const /* class WirelessSecurityEAPImpl */ -WirelessSecurityEAPImpl::WirelessSecurityEAPImpl(TDEWiFiConnection* security_setting, WirelessSecurityPhase2Impl* phase2_widget, TQWidget* parent, const char* name, WFlags fl) +WirelessSecurityEAPImpl::WirelessSecurityEAPImpl(TDEWiFiConnection* security_setting, WirelessSecurityPhase2Impl* phase2_widget, TQWidget* parent, ConnectionSettingsDialogImpl* connsettings, const char* name, WFlags fl) : ConnectionSettingWirelessSecurityEAP(parent, name, fl) , _security_setting(security_setting) , _phase2_widget(phase2_widget) { + _parentdialog = connsettings; + // insert all EAP-Methods int index = 0; cboMethod->insertItem(i18n("None"), index); @@ -550,6 +628,8 @@ void WirelessSecurityEAPImpl::slotUseSystemCaCertChanged(bool on) { _security_setting->eapConfig.forceSystemCaCertificates = on; kURLCACert->setEnabled(!on); + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityEAPImpl::slotMethodChanged(int index) @@ -559,31 +639,41 @@ void WirelessSecurityEAPImpl::slotMethodChanged(int index) _security_setting->eapConfig.type = eap; _phase2_widget->setAllowedPhase2Methods(_security_setting->eapConfig.allowedPhase2EAPMethods); + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityEAPImpl::slotIdentityChanged(const TQString& identity) { _security_setting->eapConfig.userName = identity; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityEAPImpl::slotAnonIdentityChanged(const TQString& identity) { _security_setting->eapConfig.anonymousUserName = identity; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityEAPImpl::slotPasswordChanged(const TQString& pwd) { _security_setting->eapConfig.password = TQString(txtPassword->password()); _security_setting->eapConfig.secretsValid = true; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } /* class WirelessSecurityPhase2Impl */ -WirelessSecurityPhase2Impl::WirelessSecurityPhase2Impl(TDEWiFiConnection* security_setting, TQWidget* parent, const char* name, WFlags fl) +WirelessSecurityPhase2Impl::WirelessSecurityPhase2Impl(TDEWiFiConnection* security_setting, TQWidget* parent, ConnectionSettingsDialogImpl* connsettings, const char* name, WFlags fl) : ConnectionSettingWirelessSecurityPhase2(parent, name, fl) , _security_setting(security_setting) { + _parentdialog = connsettings; + _allowed_methods.append(TDENetworkIEEE8021xType::None); updateMethodComboBox(); @@ -680,6 +770,8 @@ void WirelessSecurityPhase2Impl::slotPhase2MethodChanged(int index) // new method choosen TDENetworkIEEE8021xType::TDENetworkIEEE8021xType eap = _eapIndexMap[index]; _security_setting->eapConfig.phase2EAPAuthMethod = eap; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } /* @@ -689,6 +781,7 @@ void WirelessSecurityPhase2Impl::slotPhase2MethodChanged(int index) WirelessSecurityWidgetImpl::WirelessSecurityWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { + _parentdialog = dynamic_cast(parent); _security_setting = dynamic_cast (conn); _wireless_setting = dynamic_cast (conn); _ieee8021x_setting = dynamic_cast (conn); @@ -705,13 +798,13 @@ 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); + TQWidget* wep = new WirelessSecurityWEPImpl(_security_setting, _mainWid->groupUseEncryption, _parentdialog); + TQWidget* phase2 = new WirelessSecurityPhase2Impl(_ieee8021x_setting, _mainWid->groupUseEncryption, _parentdialog); + TQWidget* eap = new WirelessSecurityEAPImpl(_ieee8021x_setting, (WirelessSecurityPhase2Impl*)phase2, _mainWid->groupUseEncryption, _parentdialog); + TQWidget* wpaversion = new WirelessSecurityWPAVersionImpl(_security_setting, _mainWid->groupUseEncryption, _parentdialog); + TQWidget* wpacipher = new WirelessSecurityWPACipherImpl(_security_setting, _mainWid->groupUseEncryption, _parentdialog); + TQWidget* wpapsk = new WirelessSecurityWPAPSKImpl(_security_setting, _wireless_setting, _mainWid->groupUseEncryption, _parentdialog); + TQWidget* wepencryption = new WirelessSecurityWEPEncryptionImpl(_security_setting, _mainWid->groupUseEncryption, _parentdialog); wep->setHidden(true); eap->setHidden(true); @@ -903,6 +996,8 @@ void WirelessSecurityWidgetImpl::slotUseEncryptionToggled(bool on) { _wireless_setting->securityRequired = on; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void @@ -933,6 +1028,8 @@ WirelessSecurityWidgetImpl::slotComboSecurityActivated(int index) // should not happen, something is broken... break; } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void @@ -993,6 +1090,8 @@ WirelessSecurityWidgetImpl::slotExtraSettingsToggled(bool on) _mainWid->groupUseEncryption->layout()->remove(*it); (*it)->hide(); } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h index fb6313d..8f5a857 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h @@ -41,6 +41,7 @@ /* tdenetman headers */ #include "qbidirectionalmap.h" +#include "tdenetman-connection_settings_dialog.h" #include "tdenetman-connection_setting_widget_interface.h" namespace ConnectionSettings @@ -62,7 +63,7 @@ namespace ConnectionSettings , WEPKEY_TYPE_PASSPHRASE }; - WirelessSecurityWEPImpl(TDEWiFiConnection* security, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + WirelessSecurityWEPImpl(TDEWiFiConnection* security, TQWidget* parent = 0, ConnectionSettingsDialogImpl* connsettings = 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; @@ -78,9 +79,12 @@ namespace ConnectionSettings void slotWepIdx1Checked(bool); void slotWepIdx2Checked(bool); void slotWepIdx3Checked(bool); + private: TDEWiFiConnection* _security_setting; WEPKEY_TYPE _wepKeyType; + + ConnectionSettingsDialogImpl* _parentdialog; }; class WirelessSecurityWEPEncryptionImpl : public ConnectionSettingWirelessSecurityWEPEncryption @@ -88,9 +92,12 @@ namespace ConnectionSettings Q_OBJECT public: - WirelessSecurityWEPEncryptionImpl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + WirelessSecurityWEPEncryptionImpl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, ConnectionSettingsDialogImpl* connsettings = 0, const char* name = 0, WFlags fl = 0); + private: TDEWiFiConnection* _security_setting; + + ConnectionSettingsDialogImpl* _parentdialog; }; class WirelessSecurityWPAVersionImpl : public ConnectionSettingWirelessSecurityWPAVersion @@ -98,7 +105,7 @@ namespace ConnectionSettings Q_OBJECT public: - WirelessSecurityWPAVersionImpl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + WirelessSecurityWPAVersionImpl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, ConnectionSettingsDialogImpl* connsettings = 0, const char* name = 0, WFlags fl = 0); public slots: void slotAuto(bool); @@ -108,6 +115,8 @@ namespace ConnectionSettings private: TDEWiFiConnection* _security_setting; + ConnectionSettingsDialogImpl* _parentdialog; + }; class WirelessSecurityWPACipherImpl : public ConnectionSettingWirelessSecurityWPACipher @@ -123,7 +132,7 @@ namespace ConnectionSettings , WPA_CIPHER_LAST }; public: - WirelessSecurityWPACipherImpl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + WirelessSecurityWPACipherImpl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, ConnectionSettingsDialogImpl* connsettings = 0, const char* name = 0, WFlags fl = 0); public slots: void slotCipherChangedAuto(bool); @@ -136,6 +145,8 @@ namespace ConnectionSettings private: TDEWiFiConnection* _security_setting; + + ConnectionSettingsDialogImpl* _parentdialog; }; class WirelessSecurityWPAPSKImpl : public ConnectionSettingWirelessSecurityWPAPSK @@ -143,7 +154,7 @@ namespace ConnectionSettings Q_OBJECT public: - WirelessSecurityWPAPSKImpl(TDEWiFiConnection* security_setting, TDEWiFiConnection* wireless_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + WirelessSecurityWPAPSKImpl(TDEWiFiConnection* security_setting, TDEWiFiConnection* wireless_setting, TQWidget* parent = 0, ConnectionSettingsDialogImpl* connsettings = 0, const char* name = 0, WFlags fl = 0); TQCString String2Hex(TQByteArray bytes, int final_len) const; public slots: @@ -152,6 +163,8 @@ namespace ConnectionSettings private: TDEWiFiConnection* _security_setting; TDEWiFiConnection* _wireless_setting; + + ConnectionSettingsDialogImpl* _parentdialog; }; class WirelessSecurityEAPImpl : public ConnectionSettingWirelessSecurityEAP @@ -159,7 +172,7 @@ namespace ConnectionSettings Q_OBJECT public: - WirelessSecurityEAPImpl(TDEWiFiConnection* security_setting, WirelessSecurityPhase2Impl* phase2_widget, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + WirelessSecurityEAPImpl(TDEWiFiConnection* security_setting, WirelessSecurityPhase2Impl* phase2_widget, TQWidget* parent = 0, ConnectionSettingsDialogImpl* connsettings = 0, const char* name = 0, WFlags fl = 0); public slots: void slotMethodChanged(int index); @@ -172,6 +185,8 @@ namespace ConnectionSettings TDEWiFiConnection* _security_setting; TQBiDirectionalMap _eapIndexMap; WirelessSecurityPhase2Impl* _phase2_widget; + + ConnectionSettingsDialogImpl* _parentdialog; }; class WirelessSecurityPhase2Impl : public ConnectionSettingWirelessSecurityPhase2 @@ -179,7 +194,7 @@ namespace ConnectionSettings Q_OBJECT public: - WirelessSecurityPhase2Impl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); + WirelessSecurityPhase2Impl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, ConnectionSettingsDialogImpl* connsettings = 0, const char* name = 0, WFlags fl = 0); public slots: void setAllowedPhase2Methods(const TQValueList&); void slotPhase2MethodChanged(int index); @@ -189,6 +204,8 @@ namespace ConnectionSettings TDEWiFiConnection* _security_setting; TQBiDirectionalMap _eapIndexMap; TQValueList _allowed_methods; + + ConnectionSettingsDialogImpl* _parentdialog; }; class WirelessSecurityWidgetImpl : public WidgetInterface @@ -234,6 +251,8 @@ namespace ConnectionSettings ConnectionSettingWirelessSecurityWidget* _mainWid; bool _new_conn; TQMap _securityComboMap; + + ConnectionSettingsDialogImpl* _parentdialog; }; } diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp index 0b88c83..80f4f5b 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp @@ -72,6 +72,8 @@ class NetworkListViewItem : public KListViewItem WirelessWidgetImpl::WirelessWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQByteArray preselect_ssid, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { + _parentdialog = dynamic_cast(parent); + _wireless_setting = dynamic_cast(conn); _info_setting = dynamic_cast(conn); _security_setting = dynamic_cast(conn); @@ -153,6 +155,8 @@ void WirelessWidgetImpl::slotEssidChanged(TQListViewItem* item) // update the textbox to match the selected essid _mainWid->txtEssid->setText(net_item->_net.getDisplaySsid()); } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void @@ -165,6 +169,8 @@ WirelessWidgetImpl::slotEssidDoubleClicked(TQListViewItem* item, const TQPoint& // essid selected with double click -> goto the next setting emit next(); } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } @@ -182,6 +188,8 @@ WirelessWidgetImpl::slotEssidChanged(const TQString& new_essid) essid.resize(essid.size() - 1); updateEssid(essid); + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void @@ -197,6 +205,8 @@ WirelessWidgetImpl::updateEssid(const TQByteArray& essid) _info_setting->friendlyName = "<" + i18n("hidden") + ">"; } } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } TQByteArray WirelessWidgetImpl::byteArrayFromHexString(const TQCString& str) diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h index 843c419..b0b8ff0 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h @@ -31,6 +31,7 @@ #include #include "tdenetman-connection_setting_widget_interface.h" +#include "tdenetman-connection_settings_dialog.h" #include "connection_setting_wireless.h" class KListViewSearchLineWidget; @@ -70,6 +71,8 @@ namespace ConnectionSettings KListViewSearchLineWidget* _searchLine; bool _new_conn; TQByteArray _preselect_ssid; + + ConnectionSettingsDialogImpl* _parentdialog; }; } #endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H*/ diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp index e0af90b..7b98819 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp @@ -32,17 +32,14 @@ #include #include -// kde headers +// tde headers #include #include #include #include +#include -// TQt DBus headers -#include -#include - -// knm headers +// tdenm headers #include "tdenetman-connection_setting_widget_interface.h" #include "tdenetman-connection_settings_dialog.h" #include "tdenetman-connection_setting_cdma_widget.h" @@ -95,10 +92,10 @@ ConnectionSettingsDialogImpl::createWidgetsForWireless(TDENetworkConnection* con TQValueList 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)); + ret.append(new ConnectionSettings::WirelessWidgetImpl(conn, new_conn, TQByteArray(), this)); + ret.append(new ConnectionSettings::WirelessSecurityWidgetImpl(conn, new_conn, this)); + ret.append(new ConnectionSettings::IPv4WidgetImpl(conn, this)); + ret.append(new ConnectionSettings::InfoWidgetImpl(conn, this)); if (ret.isEmpty()) { @@ -114,20 +111,11 @@ ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(TDENetworkConne { TQValueList ret; -// // Set ESSID -// TDEWiFiConnection* _wireless_setting = dynamic_cast(conn); -// _wireless_setting->SSID = essid; -// // The connection has no name yet -> just take the essid for it -// _wireless_setting->friendlyName = TQString(essid); -// if (_wireless_setting->friendlyName == "") { -// _wireless_setting->friendlyName = "<" + i18n("hidden") + ">"; -// } - // widgetlist for wireless connection - ret.append(new ConnectionSettings::WirelessWidgetImpl(conn, new_conn, essid)); - ret.append(new ConnectionSettings::WirelessSecurityWidgetImpl(conn, new_conn)); - ret.append(new ConnectionSettings::IPv4WidgetImpl(conn)); - ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); + ret.append(new ConnectionSettings::WirelessWidgetImpl(conn, new_conn, essid, this)); + ret.append(new ConnectionSettings::WirelessSecurityWidgetImpl(conn, new_conn, this)); + ret.append(new ConnectionSettings::IPv4WidgetImpl(conn, this)); + ret.append(new ConnectionSettings::InfoWidgetImpl(conn, this)); if (ret.isEmpty()) { @@ -144,8 +132,8 @@ ConnectionSettingsDialogImpl::createWidgetsForWired(TDENetworkConnection* conn, TQValueList ret; // widgetlist for wired connection - ret.append(new ConnectionSettings::IPv4WidgetImpl(conn)); - ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); + ret.append(new ConnectionSettings::IPv4WidgetImpl(conn, this)); + ret.append(new ConnectionSettings::InfoWidgetImpl(conn, this)); return ret; } @@ -156,8 +144,8 @@ ConnectionSettingsDialogImpl::createWidgetsForVPN(TDENetworkConnection* conn, bo TQValueList ret; // widgetlist for wired connection -// ret.append(new ConnectionSettings::VPNWidgetImpl(conn, new_conn)); - ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); +// ret.append(new ConnectionSettings::VPNWidgetImpl(conn, new_conn, this)); + ret.append(new ConnectionSettings::InfoWidgetImpl(conn, this)); return ret; } @@ -168,11 +156,11 @@ ConnectionSettingsDialogImpl::createWidgetsForCDMA(TDENetworkConnection* conn, b TQValueList 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)); + ret.append(new ConnectionSettings::CDMAWidgetImpl(conn, this)); + ret.append(new ConnectionSettings::SerialWidgetImpl(conn, this)); + ret.append(new ConnectionSettings::PPPWidgetImpl(conn, this)); + ret.append(new ConnectionSettings::IPv4WidgetImpl(conn, this)); + ret.append(new ConnectionSettings::InfoWidgetImpl(conn, this)); return ret; } @@ -183,11 +171,11 @@ ConnectionSettingsDialogImpl::createWidgetsForGSM(TDENetworkConnection* conn, bo TQValueList 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)); + ret.append(new ConnectionSettings::GSMWidgetImpl(conn, this)); + ret.append(new ConnectionSettings::PPPWidgetImpl(conn, this)); + ret.append(new ConnectionSettings::SerialWidgetImpl(conn, this)); + ret.append(new ConnectionSettings::IPv4WidgetImpl(conn, this)); + ret.append(new ConnectionSettings::InfoWidgetImpl(conn, this)); return ret; } @@ -358,16 +346,18 @@ ConnectionSettingsDialogImpl::slotNext() // let the widget know about it being the active one widget = dynamic_cast(wstackSettings->widget(*current)); - if (widget) + if (widget) { deactivateWidget(widget); + } // next widget current++; // let the widget know about it being the active one widget = dynamic_cast(wstackSettings->widget(*current)); - if (widget) + if (widget) { activateWidget(widget); + } } slotEnableButtons(); } @@ -382,16 +372,18 @@ ConnectionSettingsDialogImpl::slotBack() // let the widget know about it being the active one widget = dynamic_cast(wstackSettings->widget(*current)); - if (widget) + if (widget) { deactivateWidget(widget); + } // one back current--; // let the widget know about it being the active one widget = dynamic_cast(wstackSettings->widget(*current)); - if (widget) + if (widget) { activateWidget(widget); + } } slotEnableButtons(); } @@ -451,7 +443,16 @@ ConnectionSettingsDialogImpl::slotEnableButtons() */ if (_conn) { TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - btnConnect->setEnabled(nm->verifyConnectionSettings(_conn)); + TDENetworkErrorStringMap errorStringMap; + TDENetworkConnectionErrorFlags::TDENetworkConnectionErrorFlags errorFlags; + bool ret; + ret = nm->verifyConnectionSettings(_conn, &errorFlags, &errorStringMap); + btnConnect->setEnabled(ret); + if (!ret) { + // FIXME + // Check the error flags and the current dialog type to determine if an error message is warranted + // KMessageBox::error(this, errorString, i18n("Invalid Settings Detected")); + } pbSave->setEnabled(nm->verifyConnectionSettings(_conn)); } } diff --git a/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp index 30dd26a..e43275b 100644 --- a/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp @@ -30,7 +30,7 @@ #include #include -// KNM includes +// TDENM includes #include "tdenetman-cellular_device_tray.h" #include "tdenetman-menuitem.h" #include "tdenetman-menu_subhead.h" @@ -51,7 +51,6 @@ class CellularDeviceTrayPrivate void CellularDeviceTray::newConnection() { TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); // create an appropriate connection @@ -75,7 +74,6 @@ void CellularDeviceTray::newConnection() void CellularDeviceTray::addMenuItems(KPopupMenu* menu) { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); // device title @@ -123,6 +121,7 @@ void CellularDeviceTray::addMenuItems(KPopupMenu* menu) CellularDeviceTray::CellularDeviceTray (TQString dev, KSystemTray * parent, const char * name) : DeviceTrayComponent (dev, parent, name) { + hwdevices = KGlobal::hardwareDevices(); d = new CellularDeviceTrayPrivate(); d->dev = dev; diff --git a/tdenetworkmanager/src/tdenetman-cellular_device_tray.h b/tdenetworkmanager/src/tdenetman-cellular_device_tray.h index 28de864..e5aa4cf 100644 --- a/tdenetworkmanager/src/tdenetman-cellular_device_tray.h +++ b/tdenetworkmanager/src/tdenetman-cellular_device_tray.h @@ -50,6 +50,7 @@ class CellularDeviceTray : public DeviceTrayComponent private: CellularDeviceTrayPrivate* d; + TDEHardwareDevices* hwdevices; }; #endif /* KNETWORKMANAGER_CELLULAR_DEVICE_TRAY_H */ diff --git a/tdenetworkmanager/src/tdenetman-connection_editor.cpp b/tdenetworkmanager/src/tdenetman-connection_editor.cpp index 6ea466f..906e158 100644 --- a/tdenetworkmanager/src/tdenetman-connection_editor.cpp +++ b/tdenetworkmanager/src/tdenetman-connection_editor.cpp @@ -191,9 +191,6 @@ void ConnectionEditorImpl::slotEditCurrentConnection() ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, false, TQByteArray(), this, "connect_something", false, TQt::WDestructiveClose); dlg->show(); - - // save all connections (if not done already) - nm->saveConnection(conn); } diff --git a/tdenetworkmanager/src/tdenetman-tray.cpp b/tdenetworkmanager/src/tdenetman-tray.cpp index 4f1e2bc..19af694 100644 --- a/tdenetworkmanager/src/tdenetman-tray.cpp +++ b/tdenetworkmanager/src/tdenetman-tray.cpp @@ -669,13 +669,13 @@ void Tray::updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnecti void Tray::slotDeviceAddedNotify(TDENetworkDevice* dev) { kdDebug() << "Tray::slotDeviceAddedNotify" << endl; - KNotifyClient::event( winId(), "knm-nm-device-added", i18n("New network device %1 found").arg(dev->deviceNode()) ); + KNotifyClient::event( winId(), "tdenm-nm-device-added", i18n("New network device %1 found").arg(dev->deviceNode()) ); } void Tray::slotDeviceRemovedNotify(TDENetworkDevice* dev) { kdDebug() << "Tray::slotDeviceRemovedNotify" << endl; - KNotifyClient::event( winId(), "knm-nm-device-removed", i18n("Network device %1 removed").arg(dev->deviceNode()) ); + KNotifyClient::event( winId(), "tdenm-nm-device-removed", i18n("Network device %1 removed").arg(dev->deviceNode()) ); } void Tray::slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState) @@ -684,16 +684,16 @@ void Tray::slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobal // change tray icon according to NM's state if (nm_state & TDENetworkGlobalManagerFlags::EstablishingLink) { - KNotifyClient::event( winId(), "knm-nm-connecting", i18n("NetworkManager is connecting") ); + KNotifyClient::event( winId(), "tdenm-nm-connecting", i18n("NetworkManager is connecting") ); } else if (nm_state & TDENetworkGlobalManagerFlags::Disconnected) { - KNotifyClient::event( winId(), "knm-nm-disconnected", i18n("NetworkManager is now disconnected") ); + KNotifyClient::event( winId(), "tdenm-nm-disconnected", i18n("NetworkManager is now disconnected") ); } else if (nm_state & TDENetworkGlobalManagerFlags::Connected) { - KNotifyClient::event( winId(), "knm-nm-connected", i18n("NetworkManager is now connected") ); + KNotifyClient::event( winId(), "tdenm-nm-connected", i18n("NetworkManager is now connected") ); } else if (nm_state & TDENetworkGlobalManagerFlags::Sleeping) { - KNotifyClient::event( winId(), "knm-nm-sleeping", i18n("TDENetworkManager Offline") ); + KNotifyClient::event( winId(), "tdenm-nm-sleeping", i18n("TDENetworkManager Offline") ); } else if (nm_state & TDENetworkGlobalManagerFlags::Unknown) { // diff --git a/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp index 79415b9..8855cd2 100644 --- a/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp @@ -44,7 +44,7 @@ #include -// KNM includes +// TDENM includes #include "tdenetman-wired_device_tray.h" #include "tdenetman-menuitem.h" #include "tdenetman-menu_subhead.h" @@ -78,7 +78,6 @@ void WiredDeviceTray::newConnection() void WiredDeviceTray::addMenuItems(KPopupMenu* menu) { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); // device title @@ -141,6 +140,7 @@ void WiredDeviceTray::addMenuItems(KPopupMenu* menu) WiredDeviceTray::WiredDeviceTray (TQString dev, KSystemTray * parent, const char * name ) : DeviceTrayComponent (dev, parent, name) { + hwdevices = KGlobal::hardwareDevices(); d = new WiredDeviceTrayPrivate(); d->dev = dev; diff --git a/tdenetworkmanager/src/tdenetman-wired_device_tray.h b/tdenetworkmanager/src/tdenetman-wired_device_tray.h index 6200f91..53d8ad1 100644 --- a/tdenetworkmanager/src/tdenetman-wired_device_tray.h +++ b/tdenetworkmanager/src/tdenetman-wired_device_tray.h @@ -52,6 +52,7 @@ class WiredDeviceTray : public DeviceTrayComponent private: WiredDeviceTrayPrivate* d; + TDEHardwareDevices* hwdevices; }; #endif /* KNETWORKMANAGER_WIRED_DEVICE_TRAY_H */ diff --git a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp index 98954bc..b9a4623 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp @@ -42,7 +42,7 @@ #include #include -// KNM includes +// TDENM includes #include "tdenetman-wireless_device_tray.h" #include "tdenetman-wireless_menuitem.h" #include "tdenetman-wireless_network.h" @@ -64,7 +64,6 @@ class WirelessDeviceTrayPrivate TQStringList WirelessDeviceTray::getToolTipText() { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); TQStringList tooltip = DeviceTrayComponent::getToolTipText(); @@ -139,7 +138,6 @@ TDEWiFiConnection* WirelessDeviceTray::findMatchingConnection(const WirelessNetw void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) { TDEGlobalNetworkManager* nm = KGlobal::networkManager(); - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); printf("Updating wireless network list\n\r"); @@ -251,7 +249,6 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) void WirelessDeviceTray::addMenuItems(KPopupMenu* menu) { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); // get the currently active connection @@ -302,7 +299,6 @@ void WirelessDeviceTray::setPixmapForStates(TDENetworkConnectionStatus::TDENetwo void WirelessDeviceTray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus prevState, TQString hwAddress) { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); if (dev->macAddress() != hwAddress) { @@ -342,7 +338,6 @@ 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 - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); // get the currently active connection @@ -372,7 +367,6 @@ void WirelessDeviceTray::slotCheckActiveAccessPoint() void WirelessDeviceTray::apPropertyChanged(TDEMACAddress BSSID, TDENetworkAPEventType::TDENetworkAPEventType event) { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); if (event == TDENetworkAPEventType::SignalStrengthChanged) { @@ -404,18 +398,17 @@ void WirelessDeviceTray::apPropertyChanged(TDEMACAddress BSSID, TDENetworkAPEven void WirelessDeviceTray::slotAccessPointAdded(TDENetworkWiFiAPInfo* ap) { - KNotifyClient::event( tray()->winId(), "knm-nm-network-found", i18n("TDENetworkManager New Wireless Network Found") ); + KNotifyClient::event( tray()->winId(), "tdenm-nm-network-found", i18n("TDENetworkManager New Wireless Network Found") ); } void WirelessDeviceTray::slotAccessPointRemoved(TDEMACAddress) { - KNotifyClient::event( tray()->winId(), "knm-nm-network-gone", i18n("TDENetworkManager Wireless Network Disappeared") ); + KNotifyClient::event( tray()->winId(), "tdenm-nm-network-gone", i18n("TDENetworkManager Wireless Network Disappeared") ); } void WirelessDeviceTray::tdeHardwareEventHandler(TDEHardwareEvent::TDEHardwareEvent event, TQString) { if (event == TDEHardwareEvent::HardwareListModified) { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); @@ -428,7 +421,6 @@ void WirelessDeviceTray::tdeHardwareEventHandler(TDEHardwareEvent::TDEHardwareEv } void WirelessDeviceTray::tdeAccessPointStatusChangedHandler(TDEMACAddress BSSID, TDENetworkAPEventType::TDENetworkAPEventType event) { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->dev)); TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); @@ -452,11 +444,10 @@ void WirelessDeviceTray::tdeAccessPointStatusChangedHandler(TDEMACAddress BSSID, WirelessDeviceTray::WirelessDeviceTray (TQString dev, KSystemTray * parent, const char * name) : DeviceTrayComponent (dev, parent, name) { + hwdevices = KGlobal::hardwareDevices(); d = new WirelessDeviceTrayPrivate(); d->dev = dev; - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); - // we want other icons for wireless devices setPixmapForState(TDENetworkConnectionStatus::Invalid, "wireless_off"); setPixmapForState(TDENetworkConnectionStatus::LinkUnavailable, "wireless_off"); diff --git a/tdenetworkmanager/src/tdenetman-wireless_device_tray.h b/tdenetworkmanager/src/tdenetman-wireless_device_tray.h index c4d639f..ee50a78 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_device_tray.h +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.h @@ -27,7 +27,7 @@ #ifndef KNETWORKMANAGER_WIRELESS_DEVICE_TRAY_H #define KNETWORKMANAGER_WIRELESS_DEVICE_TRAY_H -// KNM includes +// TDENM includes #include "tdenetman.h" #include "devicetraycomponent.h" #include "tdenetman-wireless_network.h" @@ -78,6 +78,7 @@ class WirelessDeviceTray : public DeviceTrayComponent TQMap newWirelessPopupSSIDMap; WirelessDeviceTrayPrivate* d; + TDEHardwareDevices* hwdevices; }; diff --git a/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp b/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp index 40f28bd..f41483a 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp @@ -53,7 +53,6 @@ using namespace ConnectionSettings; void WirelessNetworkItem::slotActivate() { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(_dev)); TDEGlobalNetworkManager* nm = KGlobal::networkManager(); @@ -189,6 +188,8 @@ WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, TQString dev, WirelessNet WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, TQString dev, WirelessNetwork& net, bool adhoc) : NetworkMenuItem(dev, NULL, 0, 0 ), TQCustomMenuItem () { + hwdevices = KGlobal::hardwareDevices(); + parent = p; _adhoc = adhoc; _net = net; diff --git a/tdenetworkmanager/src/tdenetman-wireless_menuitem.h b/tdenetworkmanager/src/tdenetman-wireless_menuitem.h index ea9b6a6..6bb5ef4 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_menuitem.h +++ b/tdenetworkmanager/src/tdenetman-wireless_menuitem.h @@ -49,17 +49,17 @@ class WirelessNetworkItem : public NetworkMenuItem, public TQCustomMenuItem { Q_OBJECT - - public: - WirelessNetworkItem (TQWidget*, TQString dev, WirelessNetwork& net, TQString conn, bool adhoc); - WirelessNetworkItem (TQWidget*, TQString dev, WirelessNetwork& net, bool adhoc); - ~WirelessNetworkItem (); - - TQWidget* parent; - TQProgressBar* pbarStrength; - void paint (TQPainter*, const TQColorGroup&, bool, bool, int, int, int, int); - TQSize sizeHint (); + public: + WirelessNetworkItem (TQWidget*, TQString dev, WirelessNetwork& net, TQString conn, bool adhoc); + WirelessNetworkItem (TQWidget*, TQString dev, WirelessNetwork& net, bool adhoc); + ~WirelessNetworkItem (); + + TQWidget* parent; + TQProgressBar* pbarStrength; + + void paint (TQPainter*, const TQColorGroup&, bool, bool, int, int, int, int); + TQSize sizeHint (); public slots: void slotActivate(); @@ -67,21 +67,23 @@ class WirelessNetworkItem : public NetworkMenuItem, public TQCustomMenuItem private: TQString getDisplayText(); - bool _adhoc; + bool _adhoc; WirelessNetwork _net; TQString _dev; TQString _conn; - - /* menu item */ - int _width; - int _height; - int _border; - - /* elements */ - int _textHeight; - int _widgetHeight; - - int _space; + + /* menu item */ + int _width; + int _height; + int _border; + + /* elements */ + int _textHeight; + int _widgetHeight; + + int _space; + + TDEHardwareDevices* hwdevices; }; #endif /* KNETWORKMANAGER_WIRELESSMENUITEM_H */ diff --git a/tdenetworkmanager/src/tdenetman-wireless_network.cpp b/tdenetworkmanager/src/tdenetman-wireless_network.cpp index 5e6770b..91ccffd 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_network.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_network.cpp @@ -53,11 +53,13 @@ class WirelessNetworkPrivate WirelessNetwork::WirelessNetwork(const WirelessNetwork& other) { + hwdevices = KGlobal::hardwareDevices(); d = new WirelessNetworkPrivate(*other.d); } WirelessNetwork::WirelessNetwork(TQ_UINT32 match) { + hwdevices = KGlobal::hardwareDevices(); d = new WirelessNetworkPrivate(); // which attributes have to match @@ -80,7 +82,6 @@ WirelessNetwork& WirelessNetwork::operator= (const WirelessNetwork& other) bool WirelessNetwork::contains(const TDEMACAddress ap) { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDEGlobalNetworkManager* nm = KGlobal::networkManager(); TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(d->aps[ap])); @@ -118,7 +119,6 @@ bool WirelessNetwork::addAP(const TDEMACAddress ap, const TQString dev) const TQByteArray WirelessNetwork::getSsid() const { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDEGlobalNetworkManager* nm = KGlobal::networkManager(); if ( !d->aps.isEmpty() ) { @@ -146,7 +146,6 @@ const TQByteArray WirelessNetwork::getSsid() const TQString WirelessNetwork::getDisplaySsid() const { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDEGlobalNetworkManager* nm = KGlobal::networkManager(); if (!d->aps.isEmpty()) { @@ -174,7 +173,6 @@ TQString WirelessNetwork::getDisplaySsid() const TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getFlags() const { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDEGlobalNetworkManager* nm = KGlobal::networkManager(); TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; @@ -199,7 +197,6 @@ TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getFlags() const TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getWpaFlags() const { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDEGlobalNetworkManager* nm = KGlobal::networkManager(); TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; @@ -224,7 +221,6 @@ TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getWpaFlags() cons TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getRsnFlags() const { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDEGlobalNetworkManager* nm = KGlobal::networkManager(); TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; @@ -254,7 +250,6 @@ bool WirelessNetwork::isEncrypted() const TQ_UINT8 WirelessNetwork::getStrength() const { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDEGlobalNetworkManager* nm = KGlobal::networkManager(); TQ_UINT8 strength = 0; diff --git a/tdenetworkmanager/src/tdenetman-wireless_network.h b/tdenetworkmanager/src/tdenetman-wireless_network.h index 473dbb6..8aec5cc 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_network.h +++ b/tdenetworkmanager/src/tdenetman-wireless_network.h @@ -86,7 +86,8 @@ class WirelessNetwork bool operator==(const WirelessNetwork&); private: - WirelessNetworkPrivate * d; + WirelessNetworkPrivate * d; + TDEHardwareDevices* hwdevices; }; #endif /* KNETWORKMANAGER_WIRELESS_NETWORK_H */ -- cgit v1.2.1 From 2ac42d4b7a4401a42bf90418c330bc23b3c5fee4 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 10 Sep 2012 00:58:52 -0500 Subject: Fix default device handling and clean up code --- tdenetworkmanager/src/devicetraycomponent.cpp | 58 ++++--- tdenetworkmanager/src/main.cpp | 17 +- .../src/tdenetman-cellular_device_tray.cpp | 3 +- tdenetworkmanager/src/tdenetman-device_tray.cpp | 12 +- tdenetworkmanager/src/tdenetman-tray.cpp | 188 +++++++++++++-------- tdenetworkmanager/src/tdenetman-tray.h | 14 +- .../src/tdenetman-wired_device_tray.cpp | 4 +- .../src/tdenetman-wireless_device_tray.cpp | 46 ++--- .../src/tdenetman-wireless_menuitem.cpp | 2 + tdenetworkmanager/src/tdenetman.cpp | 9 +- 10 files changed, 223 insertions(+), 130 deletions(-) diff --git a/tdenetworkmanager/src/devicetraycomponent.cpp b/tdenetworkmanager/src/devicetraycomponent.cpp index 2381781..ede0e9f 100644 --- a/tdenetworkmanager/src/devicetraycomponent.cpp +++ b/tdenetworkmanager/src/devicetraycomponent.cpp @@ -26,39 +26,39 @@ along with this program. If not, see . TQString DeviceTrayComponent::pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; - while (flag > 0) { + while (flag != 0) { if (state & flag) { if (m_pixmaps.contains(flag)) { return m_pixmaps[flag]; } } - flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)((TQ_UINT32)flag >> 1); } return TQString::null; } TQString DeviceTrayComponent::movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; - while (flag > 0) { + while (flag != 0) { if (state & flag) { if (m_movies.contains(flag)) { return m_movies[flag]; } } - flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)((TQ_UINT32)flag >> 1); } return TQString::null; } TQString DeviceTrayComponent::tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; - while (flag > 0) { + while (flag != 0) { if (state & flag) { if (m_tooltips.contains(flag)) { return m_tooltips[flag]; } } - flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)((TQ_UINT32)flag >> 1); } return TQString::null; } @@ -136,7 +136,13 @@ TQStringList DeviceTrayComponent::getToolTipText() TQPixmap DeviceTrayComponent::pixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { if (pixmapForConnState(state) != "") { - return KSystemTray::loadIcon(pixmapForConnState(state)); + TQString pixmapPath = pixmapForConnState(state); + if (pixmapPath != "") { + return KSystemTray::loadIcon(pixmapPath); + } + else { + return TQPixmap(); + } } else { return TQPixmap(); @@ -146,7 +152,13 @@ TQPixmap DeviceTrayComponent::pixmapForState(TDENetworkConnectionStatus::TDENetw TQMovie DeviceTrayComponent::movieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { if (movieForConnState(state) != "") { - return TQMovie( KGlobal::iconLoader()->moviePath(movieForConnState(state), KIcon::Panel)); + TQString moviePath = movieForConnState(state); + if (moviePath != "") { + return TQMovie(KGlobal::iconLoader()->moviePath(moviePath, KIcon::Panel)); + } + else { + return TQMovie(); + } } else { return TQMovie(); @@ -166,31 +178,31 @@ void DeviceTrayComponent::setPixmapForState(TDENetworkConnectionStatus::TDENetwo void DeviceTrayComponent::deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus prevState, TQString hwAddress) { TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); TDENetworkDevice* dev = dynamic_cast(hwdevices->findByUniqueID(m_device)); if (dev->macAddress() != hwAddress) { printf("[WARNING] Got networkDeviceStateChanged signal for HW address '%s', but my HW address is '%s'! Ignoring...\n\r", hwAddress.ascii(), dev->macAddress().ascii()); + return; } + printf("Device tray state: %d\n\r", newState); + //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? - switch (newState) { - case TDENetworkConnectionStatus::EstablishingLink: + if (newState & TDENetworkConnectionStatus::EstablishingLink) { + emit needsCenterStage(this, true); + } + else if (newState & TDENetworkConnectionStatus::Connected) { + if (nm->defaultNetworkDevices().contains(m_device)) { emit needsCenterStage(this, true); - break; - case TDENetworkConnectionStatus::Connected: -// if ( m_device == nm->getDefaultDevice() ) { - emit needsCenterStage(this, true); -// } - break; - case TDENetworkConnectionStatus::LinkUnavailable: - case TDENetworkConnectionStatus::Disconnected: - case TDENetworkConnectionStatus::Failed: - emit needsCenterStage(this, false); - break; - default: - break; + } + } + else if ((newState & TDENetworkConnectionStatus::LinkUnavailable) + || (newState & TDENetworkConnectionStatus::Disconnected) + || (newState & TDENetworkConnectionStatus::Failed)) { + emit needsCenterStage(this, false); } } #include "devicetraycomponent.moc" diff --git a/tdenetworkmanager/src/main.cpp b/tdenetworkmanager/src/main.cpp index f8c86cb..02cd662 100644 --- a/tdenetworkmanager/src/main.cpp +++ b/tdenetworkmanager/src/main.cpp @@ -23,6 +23,7 @@ **************************************************************************/ // TDE includes +#include #include #include #include @@ -56,10 +57,20 @@ kdemain (int argc, char* argv[]) KCmdLineArgs::init (argc, argv, &aboutData); - if (TDENetworkManager::start ()) { + if (TDENetworkManager::start()) { TDENetworkManager app; - app.disableSessionManagement (); - return app.exec (); + app.disableSessionManagement(); + + if (!KGlobal::hardwareDevices()) { + printf("[ERROR] Unable to load tdenetworkmanager due to invalid KGlobal::hardwareDevices() object\n\r"); fflush(stdout); + return -1; + } + if (!KGlobal::networkManager()) { + printf("[ERROR] Unable to load tdenetworkmanager due to invalid KGlobal::hardwareDevices() object\n\r"); fflush(stdout); + return -1; + } + + return app.exec(); } return 0; } diff --git a/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp index e43275b..86ce9ee 100644 --- a/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp @@ -112,8 +112,9 @@ void CellularDeviceTray::addMenuItems(KPopupMenu* menu) // bring the device down KAction* deactivate = tray()->actionCollection()->action("deactivate_device"); - if (deactivate) + if (deactivate) { deactivate->plug(menu); + } menu->insertSeparator(); } diff --git a/tdenetworkmanager/src/tdenetman-device_tray.cpp b/tdenetworkmanager/src/tdenetman-device_tray.cpp index 798b707..6b2d3aa 100644 --- a/tdenetworkmanager/src/tdenetman-device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-device_tray.cpp @@ -95,39 +95,39 @@ class DeviceTrayPrivate TQPixmap DeviceTrayPrivate::pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; - while (flag > 0) { + while (flag != 0) { if (state & flag) { if (pixmaps.contains(flag)) { return pixmaps[flag]; } } - flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)((TQ_UINT32)flag >> 1); } return TQPixmap(); } TQMovie DeviceTrayPrivate::movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; - while (flag > 0) { + while (flag != 0) { if (state & flag) { if (movies.contains(flag)) { return movies[flag]; } } - flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)((TQ_UINT32)flag >> 1); } return TQMovie(); } TQString DeviceTrayPrivate::tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; - while (flag > 0) { + while (flag != 0) { if (state & flag) { if (tooltips.contains(flag)) { return tooltips[flag]; } } - flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)(flag >> 1); + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)((TQ_UINT32)flag >> 1); } return TQString::null; } diff --git a/tdenetworkmanager/src/tdenetman-tray.cpp b/tdenetworkmanager/src/tdenetman-tray.cpp index 19af694..371260c 100644 --- a/tdenetworkmanager/src/tdenetman-tray.cpp +++ b/tdenetworkmanager/src/tdenetman-tray.cpp @@ -191,7 +191,6 @@ void Tray::slotOnlineMode() void Tray::contextMenuAboutToShow (KPopupMenu* menu) { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); TDEGlobalNetworkManager* nm = KGlobal::networkManager(); nm->loadConnectionInformation(); @@ -388,8 +387,6 @@ void Tray::slotAddDeviceTrayComponent(TQString dev) void Tray::slotRemoveDeviceTrayComponent(TQString dev) { - TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); - for (TQValueList::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) { DeviceTrayComponent* dev_comp = dynamic_cast(*it); @@ -430,8 +427,6 @@ void Tray::createDeviceTrayComponent(TQString dev) { bool trayExists = false; - TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); - // check if we have already a trayicon for this device for (TQValueList::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) { @@ -467,8 +462,8 @@ void Tray::createDeviceTrayComponent(TQString dev) } if(devTray) { - connect( devTray, TQT_SIGNAL(needsCenterStage(TrayComponent*,bool)), TQT_SLOT(trayComponentNeedsCenterStage(TrayComponent*,bool))); - connect( devTray, TQT_SIGNAL(uiUpdated()), TQT_SLOT(trayUiChanged())); + 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 } @@ -477,9 +472,6 @@ void Tray::createDeviceTrayComponent(TQString dev) void Tray::updateDeviceTrays() { - TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); - if (!hwdevices) return; - // create one tray-icon for each device TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network); @@ -523,10 +515,48 @@ void Tray::slotDeactivateConnection(int index) } } +void Tray::connectTrayDeviceManager() { + if (d->foregroundTrayComponent) { + TDENetworkDevice* foreground_tray_dev = dynamic_cast(hwdevices->findByUniqueID(d->foregroundTrayComponent->device())); + if (foreground_tray_dev) { + TDENetworkConnectionManager* deviceConnMan = foreground_tray_dev->connectionManager(); + if (deviceConnMan) { + slotUpdateDeviceState(deviceConnMan->deviceInformation().statusFlags, TDENetworkConnectionStatus::Invalid, TQString()); + connect(deviceConnMan, TQT_SIGNAL(networkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString)), this, TQT_SLOT(slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString))); + } + } + } +} + +void Tray::disconnectTrayDeviceManager() { + if (d->foregroundTrayComponent) { + TDENetworkDevice* foreground_tray_dev = dynamic_cast(hwdevices->findByUniqueID(d->foregroundTrayComponent->device())); + if (foreground_tray_dev) { + TDENetworkConnectionManager* deviceConnMan = foreground_tray_dev->connectionManager(); + if (deviceConnMan) { + slotUpdateDeviceState(deviceConnMan->deviceInformation().statusFlags, TDENetworkConnectionStatus::Invalid, TQString()); + disconnect(deviceConnMan, TQT_SIGNAL(networkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString)), this, 0); + } + } + } +} + +void Tray::updateTrayDeviceManagerState() { + if (d->foregroundTrayComponent) { + TDENetworkDevice* foreground_tray_dev = dynamic_cast(hwdevices->findByUniqueID(d->foregroundTrayComponent->device())); + if (foreground_tray_dev) { + TDENetworkConnectionManager* deviceConnMan = foreground_tray_dev->connectionManager(); + if (deviceConnMan) { + slotUpdateDeviceState(deviceConnMan->deviceInformation().statusFlags, TDENetworkConnectionStatus::Invalid, TQString()); + slotUpdateDeviceState(deviceConnMan->deviceInformation().statusFlags, TDENetworkConnectionStatus::Invalid, TQString()); + } + } + } +} + void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt) { - TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); - if (!hwdevices) return; + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); DeviceTrayComponent * dtc = dynamic_cast(component); if (dtc) { @@ -535,35 +565,29 @@ void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt) TDENetworkDevice * device = dtc_comp_dev; if (needsIt) { if (d->foregroundTrayComponent) { - TDENetworkDevice* foreground_tray_dev = dynamic_cast(hwdevices->findByUniqueID(d->foregroundTrayComponent->device())); - disconnect(foreground_tray_dev, TQT_SIGNAL(StateChanged(NMDeviceState)), this, 0 ); + disconnectTrayDeviceManager(); } d->foregroundTrayComponent = dtc; - connect(device, TQT_SIGNAL(StateChanged(NMDeviceState)), TQT_SLOT(slotUpdateDeviceState(NMDeviceState))); - } else { - disconnect(device, TQT_SIGNAL(StateChanged(NMDeviceState)), this, 0 ); + connectTrayDeviceManager(); + } + else { + disconnectTrayDeviceManager(); + // use active default -#if 0 - // FIXME - // The TDE network backend has no concept of a default device - // Should it? - device = nm->getDefaultDevice(); - if ( device ) { + TQStringList defaultDevices = nm->defaultNetworkDevices(); + if (defaultDevices.count() > 0) { // identify the new foreground - for (TQValueList::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) - { + for (TQValueList::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) { DeviceTrayComponent* newDtc = dynamic_cast (*it); - if ( newDtc && newDtc->device() == device ) { + if ( newDtc && newDtc->device() == defaultDevices[0] ) { d->foregroundTrayComponent = newDtc; break; } } kdDebug() << " Device " << dtc_comp_dev->deviceNode() << " background, new foreground device: " << device->deviceNode() << endl; - connect(device, TQT_SIGNAL(StateChanged(NMDeviceState)), - TQT_SLOT(slotUpdateDeviceState(NMDeviceState))); - slotUpdateDeviceState(device->getState()); + connectTrayDeviceManager(); + updateTrayDeviceManagerState(); } -#endif } } } @@ -573,17 +597,16 @@ void Tray::slotUpdateDeviceState() // FIXME } -void Tray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) +void Tray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus prevState, TQString hwAddress) { - updateTrayIcon(state); - updateActiveConnection(state); + printf("Device state: %d\n\r", newState); + + updateTrayIcon(newState); + updateActiveConnection(newState); } void Tray::trayUiChanged() { - TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); - if (!hwdevices) return; - DeviceTrayComponent * dtc = d->foregroundTrayComponent; if (dtc) { TDENetworkDevice* dtc_comp_dev = dynamic_cast(hwdevices->findByUniqueID(dtc->device())); @@ -591,6 +614,7 @@ void Tray::trayUiChanged() updateTrayIcon(deviceConnMan->deviceInformation().statusFlags); } } + void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { // Get all active connections @@ -624,32 +648,36 @@ void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus // stop the old movie to avoid unnecessary wakups DeviceTrayComponent * dtc = d->foregroundTrayComponent; - if (movie()) + if (movie()) { movie()->pause(); + } if ((dtc) && (found_any_active_connection == 1)) { - if (!dtc->movieForState(state).isNull()) { // animation desired int frame = -1; - if (movie()) + if (movie()) { frame = movie()->frameNumber(); + } // set the movie setMovie(dtc->movieForState(state)); // start at the same frame as the movie before - if (frame > 0) + if (frame > 0) { movie()->step(frame); + } // start the animation movie()->unpause(); } - else if (!dtc->pixmapForState(state).isNull()) + else if (!dtc->pixmapForState(state).isNull()) { setPixmap(dtc->pixmapForState(state)); - else + } + else { setPixmap(loadIcon("tdenetworkmanager")); + } } else { setPixmap(loadIcon("tdenetworkmanager")); @@ -705,8 +733,36 @@ void Tray::slotEditNotifications() KNotifyDialog::configure(this); } -Tray::Tray () : KSystemTray () +void Tray::slotGenericDeviceAdded(TDEGenericDevice *dev) { + TDENetworkDevice* netdev = dynamic_cast(dev); + if (netdev) { + slotAddDeviceTrayComponent(netdev->uniqueID()); + slotDeviceAddedNotify(netdev); + } +} + +void Tray::slotGenericDeviceRemoved(TDEGenericDevice *dev) +{ + TDENetworkDevice* netdev = dynamic_cast(dev); + if (netdev) { + slotRemoveDeviceTrayComponent(netdev->uniqueID()); + slotDeviceRemovedNotify(netdev); + } +} + +void Tray::slotGenericHardwareEvent(TDEHardwareEvent::TDEHardwareEvent event, TQString) +{ + if (event == TDEHardwareEvent::HardwareListModified) { + updateDeviceTrays(); + connectTrayDeviceManager(); + } +} + +Tray::Tray() : KSystemTray() +{ + hwdevices = KGlobal::hardwareDevices(); + d = new TrayPrivate(TQT_TQOBJECT(this)); connect(&d->signalMapper, TQT_SIGNAL(mapped(int)), this, TQT_SLOT(slotDeactivateConnection(int))); @@ -716,56 +772,52 @@ Tray::Tray () : KSystemTray () // 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + SmallIcon ("filenew", TQIconSet::Automatic), + actionCollection(), "new_connection_menu"); new KActionMenu (i18n ("Deactivate connection..."), - SmallIcon ("no", TQIconSet::Automatic), - actionCollection (), "deactivate_menu"); + SmallIcon ("no", TQIconSet::Automatic), + actionCollection (), "deactivate_menu"); // get notified when NM's state changes connect(KGlobal::networkManager(), TQT_SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, TQT_SLOT(slotStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags))); // get notified about new/removed devices - // FIXME -// DeviceStore* store = DeviceStore::getInstance(); -// connect(store, TQT_SIGNAL(DeviceStoreChanged()), this, TQT_SLOT(updateDeviceTrays())); -// connect(store, TQT_SIGNAL(DeviceAdded(TDENetworkDevice*)), this, TQT_SLOT(slotAddDeviceTrayComponent(TDENetworkDevice*))); -// connect(store, TQT_SIGNAL(DeviceRemoved(TDENetworkDevice*)), this, TQT_SLOT(slotRemoveDeviceTrayComponent(TDENetworkDevice*))); + connect(hwdevices, TQT_SIGNAL(hardwareAdded(TDEGenericDevice*)), this, TQT_SLOT(slotGenericDeviceAdded(TDEGenericDevice*))); + connect(hwdevices, TQT_SIGNAL(hardwareRemoved(TDEGenericDevice*)), this, TQT_SLOT(slotGenericDeviceRemoved(TDEGenericDevice*))); + connect(hwdevices, TQT_SIGNAL(hardwareEvent(TDEHardwareEvent::TDEHardwareEvent, TQString)), this, TQT_SLOT(slotGenericHardwareEvent(TDEHardwareEvent::TDEHardwareEvent, TQString))); // Notifications connect(KGlobal::networkManager(), TQT_SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, TQT_SLOT(slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags))); -// connect(store, TQT_SIGNAL(DeviceAdded(TDENetworkDevice*)), this, TQT_SLOT(slotDeviceAddedNotify(TDENetworkDevice*))); -// connect(store, TQT_SIGNAL(DeviceRemoved(TDENetworkDevice*)), this, TQT_SLOT(slotDeviceRemovedNotify(TDENetworkDevice*))); // initial setup of the device-trays diff --git a/tdenetworkmanager/src/tdenetman-tray.h b/tdenetworkmanager/src/tdenetman-tray.h index 10744eb..75075a8 100644 --- a/tdenetworkmanager/src/tdenetman-tray.h +++ b/tdenetworkmanager/src/tdenetman-tray.h @@ -92,9 +92,9 @@ class Tray : public KSystemTray void slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState); void slotUpdateDeviceState(); - void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus prevState, TQString hwAddress); - protected slots: + protected slots: void updateDeviceTrays(); void slotAddDeviceTrayComponent(TQString); void slotRemoveDeviceTrayComponent(TQString); @@ -103,15 +103,23 @@ class Tray : public KSystemTray void trayUiChanged(); void slotEditNotifications(); + private slots: + void slotGenericDeviceAdded(TDEGenericDevice*); + void slotGenericDeviceRemoved(TDEGenericDevice*); + void slotGenericHardwareEvent(TDEHardwareEvent::TDEHardwareEvent, TQString); + private: void updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus); void updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus); void mousePressEvent(TQMouseEvent *e); void createDeviceTrayComponent(TQString); void enterEvent(TQEvent*); + void connectTrayDeviceManager(); + void disconnectTrayDeviceManager(); + void updateTrayDeviceManagerState(); TrayPrivate* d; - + TDEHardwareDevices* hwdevices; }; class NewSecretsDialog : public TQDialog diff --git a/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp index 8855cd2..8a91142 100644 --- a/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp @@ -129,10 +129,12 @@ void WiredDeviceTray::addMenuItems(KPopupMenu* menu) // menu->insertSeparator(); 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) + if (deactivate) { deactivate->plug(menu); + } } } diff --git a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp index b9a4623..337df5f 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp @@ -169,10 +169,10 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) } wirelessNetworkItem = new WirelessNetworkItem (menu, - d->dev, - net, - (*it)->UUID, - false); + d->dev, + net, + (*it)->UUID, + false); int id = menu->insertItem (wirelessNetworkItem, -1, -1); menu->setItemChecked(id, ((TDENetworkConnection*)(*it) == active_conn)); menu->connectItem(id, wirelessNetworkItem, TQT_SLOT(slotActivate())); @@ -198,10 +198,10 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) } wirelessNetworkItem = new WirelessNetworkItem (menu, - d->dev, - net, - (*it)->UUID, - false); + d->dev, + net, + (*it)->UUID, + false); int id = popup->insertItem (wirelessNetworkItem, -1, -1); popup->connectItem(id, wirelessNetworkItem, TQT_SLOT(slotActivate())); @@ -213,25 +213,25 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) menu->insertItem(i18n("Connect to saved network"), popup); } -// // List available unsaved networks - TQPopupMenu* newpopup = new TQPopupMenu(menu); - uint newnetworkItemsAdded = 0; - TQValueList newnets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID); + // List available unsaved networks + TQPopupMenu* newpopup = new TQPopupMenu(menu); + uint newnetworkItemsAdded = 0; + TQValueList newnets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID); newWirelessPopupSSIDMap.clear(); - for (TQValueList::Iterator it = newnets.begin(); it != newnets.end(); ++it) - { + for (TQValueList::Iterator it = newnets.begin(); it != newnets.end(); ++it) + { // Only display networks with no existing connnection if ( findMatchingConnection(*it, conns) != NULL) continue; - WirelessNetworkItem* wirelessNetworkItem; + WirelessNetworkItem* wirelessNetworkItem; wirelessNetworkItem = new WirelessNetworkItem (menu, - d->dev, - *it, - NULL, - false); - + d->dev, + *it, + NULL, + false); + int id = newpopup->insertItem (wirelessNetworkItem, -1, -1); newWirelessPopupSSIDMap[id] = (*it).getSsid(); newpopup->connectItem(id, this, TQT_SLOT(newConnection(int))); @@ -258,7 +258,7 @@ void WirelessDeviceTray::addMenuItems(KPopupMenu* menu) Subhead* subhead = new Subhead (menu, "subhead", TQString("Wireless Connection (%1)").arg(dev->deviceNode()), SmallIcon("wireless", TQIconSet::Automatic)); menu->insertItem (subhead, -1, -1); - // bolding subhead instead + // bolding subhead instead //menu->insertSeparator(); if (!nm->wiFiEnabled()) @@ -303,8 +303,11 @@ void WirelessDeviceTray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENe if (dev->macAddress() != hwAddress) { printf("[WARNING] Got networkDeviceStateChanged signal for HW address '%s', but my HW address is '%s'! Ignoring...\n\r", hwAddress.ascii(), dev->macAddress().ascii()); + return; } + printf("Wireless state: %d\n\r", newState); + slotCheckActiveAccessPoint(); if (newState == TDENetworkConnectionStatus::Connected) { @@ -457,6 +460,7 @@ WirelessDeviceTray::WirelessDeviceTray (TQString dev, KSystemTray * parent, cons // Listen for hardware change events connect(hwdevices, TQT_SIGNAL(hardwareEvent(TDEHardwareEvent::TDEHardwareEvent, TQString)), this, TQT_SLOT(tdeHardwareEventHandler(TDEHardwareEvent::TDEHardwareEvent, TQString))); + // Trigger an initial hardware information update tdeHardwareEventHandler(TDEHardwareEvent::HardwareListModified, TQString::null); } diff --git a/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp b/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp index f41483a..2b02796 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp @@ -147,6 +147,8 @@ WirelessNetworkItem::sizeHint () WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, TQString dev, WirelessNetwork& net, TQString conn, bool adhoc) : NetworkMenuItem(dev, conn, 0, 0 ), TQCustomMenuItem () { + hwdevices = KGlobal::hardwareDevices(); + parent = p; _adhoc = adhoc; _net = net; diff --git a/tdenetworkmanager/src/tdenetman.cpp b/tdenetworkmanager/src/tdenetman.cpp index 19238b3..d9f2ad1 100644 --- a/tdenetworkmanager/src/tdenetman.cpp +++ b/tdenetworkmanager/src/tdenetman.cpp @@ -28,7 +28,7 @@ #include #include -// TDENM includes +// KNM includes #include "tdenetman.h" #include "tdenetman-tray.h" @@ -49,7 +49,8 @@ class TDENetworkManagerPrivate public: TDENetworkManagerPrivate() {} ~TDENetworkManagerPrivate() {} - static TDENetworkManager* _ctx; + + static TDENetworkManager* _ctx; }; TDENetworkManager* TDENetworkManagerPrivate::_ctx = NULL; @@ -68,10 +69,10 @@ TDENetworkManager::slotShutDown() void TDENetworkManager::timerEvent( TQTimerEvent *e ) { Tray* tray = Tray::getInstance(); - tray->slotUpdateDeviceState(nm_device_state_global); + tray->slotUpdateDeviceState(nm_device_state_global, TDENetworkConnectionStatus::Invalid, TQString()); } -TDENetworkManager::TDENetworkManager () : KUniqueApplication () +TDENetworkManager::TDENetworkManager() : KUniqueApplication() { d = new TDENetworkManagerPrivate(); d->_ctx = this; -- cgit v1.2.1 From 627465cf8c1f15806ad73a0c84b0ff40293085c2 Mon Sep 17 00:00:00 2001 From: Automated System Date: Mon, 10 Sep 2012 02:53:05 -0500 Subject: Reset submodule main/applications/knetworkmanager9/cmake to latest HEAD --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index cd6c861..f1cea7f 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit cd6c8614e972ea4ffbd7316d473b7b6e48ea67ff +Subproject commit f1cea7f894713183e061fa6d2b69b05889a90a03 -- cgit v1.2.1 From 4be2fb85946d100e41466d477a9e82aefa377b5a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 10 Sep 2012 09:50:53 -0500 Subject: Add various movie sizes --- .../pics/hi16-action-nm_stage01_connecting.mng | Bin 0 -> 8283 bytes .../pics/hi16-action-nm_stage02_connecting.mng | Bin 0 -> 7835 bytes .../pics/hi16-action-nm_stage02_connecting_vpn.mng | Bin 0 -> 9339 bytes .../pics/hi16-action-nm_stage03_connecting.mng | Bin 0 -> 7466 bytes .../pics/hi16-action-nm_stage03_connecting_vpn.mng | Bin 0 -> 9049 bytes .../pics/hi32-action-nm_stage01_connecting.mng | Bin 0 -> 20419 bytes .../pics/hi32-action-nm_stage02_connecting.mng | Bin 0 -> 19731 bytes .../pics/hi32-action-nm_stage02_connecting_vpn.mng | Bin 0 -> 25564 bytes .../pics/hi32-action-nm_stage03_connecting.mng | Bin 0 -> 18480 bytes .../pics/hi32-action-nm_stage03_connecting_vpn.mng | Bin 0 -> 24380 bytes .../pics/hi48-action-nm_stage01_connecting.mng | Bin 0 -> 36612 bytes .../pics/hi48-action-nm_stage02_connecting.mng | Bin 0 -> 35740 bytes .../pics/hi48-action-nm_stage02_connecting_vpn.mng | Bin 0 -> 47711 bytes .../pics/hi48-action-nm_stage03_connecting.mng | Bin 0 -> 33314 bytes .../pics/hi48-action-nm_stage03_connecting_vpn.mng | Bin 0 -> 45432 bytes .../pics/hi64-action-nm_stage01_connecting.mng | Bin 0 -> 55712 bytes .../pics/hi64-action-nm_stage02_connecting.mng | Bin 0 -> 54386 bytes .../pics/hi64-action-nm_stage02_connecting_vpn.mng | Bin 0 -> 74238 bytes .../pics/hi64-action-nm_stage03_connecting.mng | Bin 0 -> 50471 bytes .../pics/hi64-action-nm_stage03_connecting_vpn.mng | Bin 0 -> 70470 bytes tdenetworkmanager/pics/updatemovies.sh | 22 +++++++++++++++++++++ 21 files changed, 22 insertions(+) create mode 100644 tdenetworkmanager/pics/hi16-action-nm_stage01_connecting.mng create mode 100644 tdenetworkmanager/pics/hi16-action-nm_stage02_connecting.mng create mode 100644 tdenetworkmanager/pics/hi16-action-nm_stage02_connecting_vpn.mng create mode 100644 tdenetworkmanager/pics/hi16-action-nm_stage03_connecting.mng create mode 100644 tdenetworkmanager/pics/hi16-action-nm_stage03_connecting_vpn.mng create mode 100644 tdenetworkmanager/pics/hi32-action-nm_stage01_connecting.mng create mode 100644 tdenetworkmanager/pics/hi32-action-nm_stage02_connecting.mng create mode 100644 tdenetworkmanager/pics/hi32-action-nm_stage02_connecting_vpn.mng create mode 100644 tdenetworkmanager/pics/hi32-action-nm_stage03_connecting.mng create mode 100644 tdenetworkmanager/pics/hi32-action-nm_stage03_connecting_vpn.mng create mode 100644 tdenetworkmanager/pics/hi48-action-nm_stage01_connecting.mng create mode 100644 tdenetworkmanager/pics/hi48-action-nm_stage02_connecting.mng create mode 100644 tdenetworkmanager/pics/hi48-action-nm_stage02_connecting_vpn.mng create mode 100644 tdenetworkmanager/pics/hi48-action-nm_stage03_connecting.mng create mode 100644 tdenetworkmanager/pics/hi48-action-nm_stage03_connecting_vpn.mng create mode 100644 tdenetworkmanager/pics/hi64-action-nm_stage01_connecting.mng create mode 100644 tdenetworkmanager/pics/hi64-action-nm_stage02_connecting.mng create mode 100644 tdenetworkmanager/pics/hi64-action-nm_stage02_connecting_vpn.mng create mode 100644 tdenetworkmanager/pics/hi64-action-nm_stage03_connecting.mng create mode 100644 tdenetworkmanager/pics/hi64-action-nm_stage03_connecting_vpn.mng create mode 100755 tdenetworkmanager/pics/updatemovies.sh diff --git a/tdenetworkmanager/pics/hi16-action-nm_stage01_connecting.mng b/tdenetworkmanager/pics/hi16-action-nm_stage01_connecting.mng new file mode 100644 index 0000000..2605a88 Binary files /dev/null and b/tdenetworkmanager/pics/hi16-action-nm_stage01_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting.mng b/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting.mng new file mode 100644 index 0000000..8e25a71 Binary files /dev/null and b/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting_vpn.mng b/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting_vpn.mng new file mode 100644 index 0000000..951b284 Binary files /dev/null and b/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting_vpn.mng differ diff --git a/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting.mng b/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting.mng new file mode 100644 index 0000000..b39ffe6 Binary files /dev/null and b/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting_vpn.mng b/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting_vpn.mng new file mode 100644 index 0000000..6c6ebd4 Binary files /dev/null and b/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting_vpn.mng differ diff --git a/tdenetworkmanager/pics/hi32-action-nm_stage01_connecting.mng b/tdenetworkmanager/pics/hi32-action-nm_stage01_connecting.mng new file mode 100644 index 0000000..d0979e7 Binary files /dev/null and b/tdenetworkmanager/pics/hi32-action-nm_stage01_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting.mng b/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting.mng new file mode 100644 index 0000000..c05519e Binary files /dev/null and b/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting_vpn.mng b/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting_vpn.mng new file mode 100644 index 0000000..1d97851 Binary files /dev/null and b/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting_vpn.mng differ diff --git a/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting.mng b/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting.mng new file mode 100644 index 0000000..ab08fc3 Binary files /dev/null and b/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting_vpn.mng b/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting_vpn.mng new file mode 100644 index 0000000..0469b43 Binary files /dev/null and b/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting_vpn.mng differ diff --git a/tdenetworkmanager/pics/hi48-action-nm_stage01_connecting.mng b/tdenetworkmanager/pics/hi48-action-nm_stage01_connecting.mng new file mode 100644 index 0000000..f0b8332 Binary files /dev/null and b/tdenetworkmanager/pics/hi48-action-nm_stage01_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting.mng b/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting.mng new file mode 100644 index 0000000..e616d5c Binary files /dev/null and b/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting_vpn.mng b/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting_vpn.mng new file mode 100644 index 0000000..fc6f635 Binary files /dev/null and b/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting_vpn.mng differ diff --git a/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting.mng b/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting.mng new file mode 100644 index 0000000..e5f32d2 Binary files /dev/null and b/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting_vpn.mng b/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting_vpn.mng new file mode 100644 index 0000000..4d4aa90 Binary files /dev/null and b/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting_vpn.mng differ diff --git a/tdenetworkmanager/pics/hi64-action-nm_stage01_connecting.mng b/tdenetworkmanager/pics/hi64-action-nm_stage01_connecting.mng new file mode 100644 index 0000000..77bae45 Binary files /dev/null and b/tdenetworkmanager/pics/hi64-action-nm_stage01_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting.mng b/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting.mng new file mode 100644 index 0000000..0732be6 Binary files /dev/null and b/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting_vpn.mng b/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting_vpn.mng new file mode 100644 index 0000000..1d33054 Binary files /dev/null and b/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting_vpn.mng differ diff --git a/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting.mng b/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting.mng new file mode 100644 index 0000000..261c198 Binary files /dev/null and b/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting_vpn.mng b/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting_vpn.mng new file mode 100644 index 0000000..881745b Binary files /dev/null and b/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting_vpn.mng differ diff --git a/tdenetworkmanager/pics/updatemovies.sh b/tdenetworkmanager/pics/updatemovies.sh new file mode 100755 index 0000000..3bd7d39 --- /dev/null +++ b/tdenetworkmanager/pics/updatemovies.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +convert -dispose Background hi22-action-nm_stage01_connecting.mng -resize 16x16 hi16-action-nm_stage01_connecting.mng +convert -dispose Background hi22-action-nm_stage02_connecting.mng -resize 16x16 hi16-action-nm_stage02_connecting.mng +convert -dispose Background hi22-action-nm_stage02_connecting_vpn.mng -resize 16x16 hi16-action-nm_stage02_connecting_vpn.mng +convert -dispose Background hi22-action-nm_stage03_connecting.mng -resize 16x16 hi16-action-nm_stage03_connecting.mng +convert -dispose Background hi22-action-nm_stage03_connecting_vpn.mng -resize 16x16 hi16-action-nm_stage03_connecting_vpn.mng +convert -dispose Background hi22-action-nm_stage01_connecting.mng -resize 32x32 hi32-action-nm_stage01_connecting.mng +convert -dispose Background hi22-action-nm_stage02_connecting.mng -resize 32x32 hi32-action-nm_stage02_connecting.mng +convert -dispose Background hi22-action-nm_stage02_connecting_vpn.mng -resize 32x32 hi32-action-nm_stage02_connecting_vpn.mng +convert -dispose Background hi22-action-nm_stage03_connecting.mng -resize 32x32 hi32-action-nm_stage03_connecting.mng +convert -dispose Background hi22-action-nm_stage03_connecting_vpn.mng -resize 32x32 hi32-action-nm_stage03_connecting_vpn.mng +convert -dispose Background hi22-action-nm_stage01_connecting.mng -resize 48x48 hi48-action-nm_stage01_connecting.mng +convert -dispose Background hi22-action-nm_stage02_connecting.mng -resize 48x48 hi48-action-nm_stage02_connecting.mng +convert -dispose Background hi22-action-nm_stage02_connecting_vpn.mng -resize 48x48 hi48-action-nm_stage02_connecting_vpn.mng +convert -dispose Background hi22-action-nm_stage03_connecting.mng -resize 48x48 hi48-action-nm_stage03_connecting.mng +convert -dispose Background hi22-action-nm_stage03_connecting_vpn.mng -resize 48x48 hi48-action-nm_stage03_connecting_vpn.mng +convert -dispose Background hi22-action-nm_stage01_connecting.mng -resize 64x64 hi64-action-nm_stage01_connecting.mng +convert -dispose Background hi22-action-nm_stage02_connecting.mng -resize 64x64 hi64-action-nm_stage02_connecting.mng +convert -dispose Background hi22-action-nm_stage02_connecting_vpn.mng -resize 64x64 hi64-action-nm_stage02_connecting_vpn.mng +convert -dispose Background hi22-action-nm_stage03_connecting.mng -resize 64x64 hi64-action-nm_stage03_connecting.mng +convert -dispose Background hi22-action-nm_stage03_connecting_vpn.mng -resize 64x64 hi64-action-nm_stage03_connecting_vpn.mng -- cgit v1.2.1 From 2b5b314cfd27f4e5b123b5c7d5aa7282d41efce1 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 10 Sep 2012 10:28:16 -0500 Subject: Fix movie loading --- .../pics/hi16-action-nm_stage01_connecting.mng | Bin 8283 -> 8270 bytes .../pics/hi16-action-nm_stage02_connecting.mng | Bin 7835 -> 7822 bytes .../pics/hi16-action-nm_stage02_connecting_vpn.mng | Bin 9339 -> 9326 bytes .../pics/hi16-action-nm_stage03_connecting.mng | Bin 7466 -> 7453 bytes .../pics/hi16-action-nm_stage03_connecting_vpn.mng | Bin 9049 -> 9036 bytes .../pics/hi32-action-nm_stage01_connecting.mng | Bin 20419 -> 20406 bytes .../pics/hi32-action-nm_stage02_connecting.mng | Bin 19731 -> 19718 bytes .../pics/hi32-action-nm_stage02_connecting_vpn.mng | Bin 25564 -> 25551 bytes .../pics/hi32-action-nm_stage03_connecting.mng | Bin 18480 -> 18467 bytes .../pics/hi32-action-nm_stage03_connecting_vpn.mng | Bin 24380 -> 24367 bytes .../pics/hi48-action-nm_stage01_connecting.mng | Bin 36612 -> 36599 bytes .../pics/hi48-action-nm_stage02_connecting.mng | Bin 35740 -> 35727 bytes .../pics/hi48-action-nm_stage02_connecting_vpn.mng | Bin 47711 -> 47698 bytes .../pics/hi48-action-nm_stage03_connecting.mng | Bin 33314 -> 33301 bytes .../pics/hi48-action-nm_stage03_connecting_vpn.mng | Bin 45432 -> 45419 bytes .../pics/hi64-action-nm_stage01_connecting.mng | Bin 55712 -> 55699 bytes .../pics/hi64-action-nm_stage02_connecting.mng | Bin 54386 -> 54373 bytes .../pics/hi64-action-nm_stage02_connecting_vpn.mng | Bin 74238 -> 74225 bytes .../pics/hi64-action-nm_stage03_connecting.mng | Bin 50471 -> 50458 bytes .../pics/hi64-action-nm_stage03_connecting_vpn.mng | Bin 70470 -> 70457 bytes tdenetworkmanager/pics/updatemovies.sh | 40 +-- tdenetworkmanager/src/CMakeLists.txt | 2 +- ...n-connection_setting_wireless_security_widget.h | 5 +- ...denetman-connection_setting_wireless_widget.cpp | 2 + tdenetworkmanager/src/devicetraycomponent.cpp | 9 +- tdenetworkmanager/src/devicetraycomponent.h | 4 + tdenetworkmanager/src/tdenetman-device_tray.cpp | 379 --------------------- tdenetworkmanager/src/tdenetman-device_tray.h | 88 ----- tdenetworkmanager/src/tdenetman-wireless_manager.h | 1 - 29 files changed, 38 insertions(+), 492 deletions(-) delete mode 100644 tdenetworkmanager/src/tdenetman-device_tray.cpp delete mode 100644 tdenetworkmanager/src/tdenetman-device_tray.h diff --git a/tdenetworkmanager/pics/hi16-action-nm_stage01_connecting.mng b/tdenetworkmanager/pics/hi16-action-nm_stage01_connecting.mng index 2605a88..6414aa4 100644 Binary files a/tdenetworkmanager/pics/hi16-action-nm_stage01_connecting.mng and b/tdenetworkmanager/pics/hi16-action-nm_stage01_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting.mng b/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting.mng index 8e25a71..270e946 100644 Binary files a/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting.mng and b/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting_vpn.mng b/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting_vpn.mng index 951b284..103ca43 100644 Binary files a/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting_vpn.mng and b/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting_vpn.mng differ diff --git a/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting.mng b/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting.mng index b39ffe6..cf8c0d0 100644 Binary files a/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting.mng and b/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting_vpn.mng b/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting_vpn.mng index 6c6ebd4..07b37a3 100644 Binary files a/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting_vpn.mng and b/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting_vpn.mng differ diff --git a/tdenetworkmanager/pics/hi32-action-nm_stage01_connecting.mng b/tdenetworkmanager/pics/hi32-action-nm_stage01_connecting.mng index d0979e7..75a27cd 100644 Binary files a/tdenetworkmanager/pics/hi32-action-nm_stage01_connecting.mng and b/tdenetworkmanager/pics/hi32-action-nm_stage01_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting.mng b/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting.mng index c05519e..4effbdb 100644 Binary files a/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting.mng and b/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting_vpn.mng b/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting_vpn.mng index 1d97851..aa305c8 100644 Binary files a/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting_vpn.mng and b/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting_vpn.mng differ diff --git a/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting.mng b/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting.mng index ab08fc3..cb92447 100644 Binary files a/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting.mng and b/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting_vpn.mng b/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting_vpn.mng index 0469b43..4eaaa57 100644 Binary files a/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting_vpn.mng and b/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting_vpn.mng differ diff --git a/tdenetworkmanager/pics/hi48-action-nm_stage01_connecting.mng b/tdenetworkmanager/pics/hi48-action-nm_stage01_connecting.mng index f0b8332..eca51d7 100644 Binary files a/tdenetworkmanager/pics/hi48-action-nm_stage01_connecting.mng and b/tdenetworkmanager/pics/hi48-action-nm_stage01_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting.mng b/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting.mng index e616d5c..1260aff 100644 Binary files a/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting.mng and b/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting_vpn.mng b/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting_vpn.mng index fc6f635..fd50353 100644 Binary files a/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting_vpn.mng and b/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting_vpn.mng differ diff --git a/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting.mng b/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting.mng index e5f32d2..0f1964f 100644 Binary files a/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting.mng and b/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting_vpn.mng b/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting_vpn.mng index 4d4aa90..a9873e9 100644 Binary files a/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting_vpn.mng and b/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting_vpn.mng differ diff --git a/tdenetworkmanager/pics/hi64-action-nm_stage01_connecting.mng b/tdenetworkmanager/pics/hi64-action-nm_stage01_connecting.mng index 77bae45..4bd4608 100644 Binary files a/tdenetworkmanager/pics/hi64-action-nm_stage01_connecting.mng and b/tdenetworkmanager/pics/hi64-action-nm_stage01_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting.mng b/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting.mng index 0732be6..addba20 100644 Binary files a/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting.mng and b/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting_vpn.mng b/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting_vpn.mng index 1d33054..c70dc0e 100644 Binary files a/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting_vpn.mng and b/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting_vpn.mng differ diff --git a/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting.mng b/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting.mng index 261c198..6be0854 100644 Binary files a/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting.mng and b/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting.mng differ diff --git a/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting_vpn.mng b/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting_vpn.mng index 881745b..d208ab3 100644 Binary files a/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting_vpn.mng and b/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting_vpn.mng differ diff --git a/tdenetworkmanager/pics/updatemovies.sh b/tdenetworkmanager/pics/updatemovies.sh index 3bd7d39..3078714 100755 --- a/tdenetworkmanager/pics/updatemovies.sh +++ b/tdenetworkmanager/pics/updatemovies.sh @@ -1,22 +1,22 @@ #!/bin/bash -convert -dispose Background hi22-action-nm_stage01_connecting.mng -resize 16x16 hi16-action-nm_stage01_connecting.mng -convert -dispose Background hi22-action-nm_stage02_connecting.mng -resize 16x16 hi16-action-nm_stage02_connecting.mng -convert -dispose Background hi22-action-nm_stage02_connecting_vpn.mng -resize 16x16 hi16-action-nm_stage02_connecting_vpn.mng -convert -dispose Background hi22-action-nm_stage03_connecting.mng -resize 16x16 hi16-action-nm_stage03_connecting.mng -convert -dispose Background hi22-action-nm_stage03_connecting_vpn.mng -resize 16x16 hi16-action-nm_stage03_connecting_vpn.mng -convert -dispose Background hi22-action-nm_stage01_connecting.mng -resize 32x32 hi32-action-nm_stage01_connecting.mng -convert -dispose Background hi22-action-nm_stage02_connecting.mng -resize 32x32 hi32-action-nm_stage02_connecting.mng -convert -dispose Background hi22-action-nm_stage02_connecting_vpn.mng -resize 32x32 hi32-action-nm_stage02_connecting_vpn.mng -convert -dispose Background hi22-action-nm_stage03_connecting.mng -resize 32x32 hi32-action-nm_stage03_connecting.mng -convert -dispose Background hi22-action-nm_stage03_connecting_vpn.mng -resize 32x32 hi32-action-nm_stage03_connecting_vpn.mng -convert -dispose Background hi22-action-nm_stage01_connecting.mng -resize 48x48 hi48-action-nm_stage01_connecting.mng -convert -dispose Background hi22-action-nm_stage02_connecting.mng -resize 48x48 hi48-action-nm_stage02_connecting.mng -convert -dispose Background hi22-action-nm_stage02_connecting_vpn.mng -resize 48x48 hi48-action-nm_stage02_connecting_vpn.mng -convert -dispose Background hi22-action-nm_stage03_connecting.mng -resize 48x48 hi48-action-nm_stage03_connecting.mng -convert -dispose Background hi22-action-nm_stage03_connecting_vpn.mng -resize 48x48 hi48-action-nm_stage03_connecting_vpn.mng -convert -dispose Background hi22-action-nm_stage01_connecting.mng -resize 64x64 hi64-action-nm_stage01_connecting.mng -convert -dispose Background hi22-action-nm_stage02_connecting.mng -resize 64x64 hi64-action-nm_stage02_connecting.mng -convert -dispose Background hi22-action-nm_stage02_connecting_vpn.mng -resize 64x64 hi64-action-nm_stage02_connecting_vpn.mng -convert -dispose Background hi22-action-nm_stage03_connecting.mng -resize 64x64 hi64-action-nm_stage03_connecting.mng -convert -dispose Background hi22-action-nm_stage03_connecting_vpn.mng -resize 64x64 hi64-action-nm_stage03_connecting_vpn.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage01_connecting.mng -resize 16x16 hi16-action-nm_stage01_connecting.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage02_connecting.mng -resize 16x16 hi16-action-nm_stage02_connecting.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage02_connecting_vpn.mng -resize 16x16 hi16-action-nm_stage02_connecting_vpn.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage03_connecting.mng -resize 16x16 hi16-action-nm_stage03_connecting.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage03_connecting_vpn.mng -resize 16x16 hi16-action-nm_stage03_connecting_vpn.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage01_connecting.mng -resize 32x32 hi32-action-nm_stage01_connecting.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage02_connecting.mng -resize 32x32 hi32-action-nm_stage02_connecting.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage02_connecting_vpn.mng -resize 32x32 hi32-action-nm_stage02_connecting_vpn.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage03_connecting.mng -resize 32x32 hi32-action-nm_stage03_connecting.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage03_connecting_vpn.mng -resize 32x32 hi32-action-nm_stage03_connecting_vpn.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage01_connecting.mng -resize 48x48 hi48-action-nm_stage01_connecting.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage02_connecting.mng -resize 48x48 hi48-action-nm_stage02_connecting.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage02_connecting_vpn.mng -resize 48x48 hi48-action-nm_stage02_connecting_vpn.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage03_connecting.mng -resize 48x48 hi48-action-nm_stage03_connecting.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage03_connecting_vpn.mng -resize 48x48 hi48-action-nm_stage03_connecting_vpn.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage01_connecting.mng -resize 64x64 hi64-action-nm_stage01_connecting.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage02_connecting.mng -resize 64x64 hi64-action-nm_stage02_connecting.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage02_connecting_vpn.mng -resize 64x64 hi64-action-nm_stage02_connecting_vpn.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage03_connecting.mng -resize 64x64 hi64-action-nm_stage03_connecting.mng +convert -dispose Previous -delay 10 hi22-action-nm_stage03_connecting_vpn.mng -resize 64x64 hi64-action-nm_stage03_connecting_vpn.mng diff --git a/tdenetworkmanager/src/CMakeLists.txt b/tdenetworkmanager/src/CMakeLists.txt index ac862e2..3d82ad4 100644 --- a/tdenetworkmanager/src/CMakeLists.txt +++ b/tdenetworkmanager/src/CMakeLists.txt @@ -51,7 +51,7 @@ tde_add_tdeinit_executable( tdenetworkmanager AUTOMOC connection_editor.ui vpnauthentication.ui main.cpp tdenetman.cpp tdenetman-tray.cpp #tdenetman-vpn_plugin.cpp - tdenetman-cellular_device_tray.cpp tdenetman-device_tray.cpp + tdenetman-cellular_device_tray.cpp #tdenetman-device_tray.cpp tdenetman-wired_device_tray.cpp tdenetman-wireless_device_tray.cpp tdenetman-wireless_menuitem.cpp tdenetman-menuitem.cpp tdenetman-menu_subhead.cpp diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h index 8f5a857..1c2e6ef 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h @@ -25,7 +25,10 @@ #ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H #define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H -/* ui autogenerated headers */ +// tqt headers +#include + +// ui autogenerated headers #include "connection_setting_wireless_security.h" #include "connection_setting_wireless_security_eap.h" #include "connection_setting_wireless_security_phase2.h" diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp index 80f4f5b..536b4ef 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include diff --git a/tdenetworkmanager/src/devicetraycomponent.cpp b/tdenetworkmanager/src/devicetraycomponent.cpp index ede0e9f..5c4cdb4 100644 --- a/tdenetworkmanager/src/devicetraycomponent.cpp +++ b/tdenetworkmanager/src/devicetraycomponent.cpp @@ -64,7 +64,7 @@ TQString DeviceTrayComponent::tooltipForConnState(TDENetworkConnectionStatus::TD } DeviceTrayComponent::DeviceTrayComponent(TQString device, KSystemTray * parent, const char * name ) - : TrayComponent(parent, name), m_device(device) + : TrayComponent(parent, name), m_tray(dynamic_cast(parent)), m_device(device) { TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); @@ -154,7 +154,12 @@ TQMovie DeviceTrayComponent::movieForState(TDENetworkConnectionStatus::TDENetwor if (movieForConnState(state) != "") { TQString moviePath = movieForConnState(state); if (moviePath != "") { - return TQMovie(KGlobal::iconLoader()->moviePath(moviePath, KIcon::Panel)); + if (m_tray) { + return TQMovie(KGlobal::iconLoader()->moviePath(moviePath, KIcon::Panel, m_tray->width())); + } + else { + return TQMovie(KGlobal::iconLoader()->moviePath(moviePath, KIcon::Panel)); + } } else { return TQMovie(); diff --git a/tdenetworkmanager/src/devicetraycomponent.h b/tdenetworkmanager/src/devicetraycomponent.h index 316790c..3ee4a13 100644 --- a/tdenetworkmanager/src/devicetraycomponent.h +++ b/tdenetworkmanager/src/devicetraycomponent.h @@ -29,6 +29,7 @@ along with this program. If not, see . #include #include +#include "tdenetman-tray.h" #include "traycomponent.h" class TDENetworkDevice; @@ -68,6 +69,9 @@ class DeviceTrayComponent : public TrayComponent TQString movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); TQString tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); + protected: + Tray* m_tray; + private: TQString m_device; TQMap m_movies; diff --git a/tdenetworkmanager/src/tdenetman-device_tray.cpp b/tdenetworkmanager/src/tdenetman-device_tray.cpp deleted file mode 100644 index 6b2d3aa..0000000 --- a/tdenetworkmanager/src/tdenetman-device_tray.cpp +++ /dev/null @@ -1,379 +0,0 @@ -/*************************************************************************** - * - * tdenetman-device_tray.cpp - A NetworkManager frontend for TDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// TDE includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// TDENM includes -#include "tdenetman-device_tray.h" -#include "tdenetman-menu_subhead.h" -#include "tdenetman-connection_settings_dialog.h" - -using namespace ConnectionSettings; - -class DeviceTrayPrivate -{ - public: - - DeviceTrayPrivate() - : dev(NULL) - { - tooltips[TDENetworkConnectionStatus::Invalid] = i18n("Unknown"); - tooltips[TDENetworkConnectionStatus::LinkUnavailable] = i18n("Down"); - tooltips[TDENetworkConnectionStatus::UnManaged] = i18n("Unmanaged"); - tooltips[TDENetworkConnectionStatus::Disconnected] = i18n("Disconnected"); - tooltips[TDENetworkConnectionStatus::EstablishingLink] = i18n("Preparing"); - tooltips[TDENetworkConnectionStatus::ConfiguringProtocols] = i18n("Configuration"); - tooltips[TDENetworkConnectionStatus::NeedAuthorization] = i18n("Awaiting authentication"); - tooltips[TDENetworkConnectionStatus::VerifyingProtocols] = i18n("IP configuration"); - tooltips[TDENetworkConnectionStatus::Connected] = i18n("Activated"); - tooltips[TDENetworkConnectionStatus::Failed] = i18n("Failed"); - } - - ~DeviceTrayPrivate() {} - - TDENetworkDevice* dev; - TQMap movies; - TQMap pixmaps; - TQMap tooltips; - - TQPixmap pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); - TQMovie movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); - TQString tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); -}; - -TQPixmap DeviceTrayPrivate::pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { - TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; - while (flag != 0) { - if (state & flag) { - if (pixmaps.contains(flag)) { - return pixmaps[flag]; - } - } - flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)((TQ_UINT32)flag >> 1); - } - return TQPixmap(); -} - -TQMovie DeviceTrayPrivate::movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { - TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; - while (flag != 0) { - if (state & flag) { - if (movies.contains(flag)) { - return movies[flag]; - } - } - flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)((TQ_UINT32)flag >> 1); - } - return TQMovie(); -} - -TQString DeviceTrayPrivate::tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { - TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; - while (flag != 0) { - if (state & flag) { - if (tooltips.contains(flag)) { - return tooltips[flag]; - } - } - flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)((TQ_UINT32)flag >> 1); - } - return TQString::null; -} - -TDENetworkDevice* DeviceTray::getDevice() const -{ - return d->dev; -} - -TQString DeviceTray::getTooltipText() -{ - - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); - TDENetworkConnectionStatus::TDENetworkConnectionStatus state = deviceConnMan->deviceInformation().statusFlags; - TQString tooltip = TQString(); - - if (!d->tooltipForConnState(state).isEmpty()) { - tooltip += i18n("State: %1").arg(d->tooltipForConnState(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 ("tdenetworkmanager", TQIconSet::Automatic), "TDENetworkManager", -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(TDENetworkConnectionStatus::TDENetworkConnectionStatus state, TQMovie movie) -{ - d->movies[state] = movie; - slotUpdateDeviceState(); -} - -void DeviceTray::setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state, TQPixmap pixmap) -{ - d->pixmaps[state] = pixmap; - slotUpdateDeviceState(); -} - -void DeviceTray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) -{ - // stop the old movie to avoid unnecessary wakups - if (movie()) { - movie()->pause(); - } - - if (!d->movieForConnState(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->movieForConnState(state)); - - // start at the same frame as the movie before - if (frame > 0) - movie()->step(frame); - - // start the animation - movie()->unpause(); - } - else if (!d->pixmapForConnState(state).isNull()) { - setPixmap(d->pixmapForConnState(state)); - } - else { - setPixmap(loadSizedIcon("TDENetworkManager", width())); - } - - m_currentIconState = state; -} - -void DeviceTray::updateActions(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) -{ - // allow device deactivation only when device is activated - KAction* deactivate = actionCollection()->action("deactivate_device"); - if (deactivate) - deactivate->setEnabled( (state & TDENetworkConnectionStatus::Connected || - state & TDENetworkConnectionStatus::VerifyingProtocols || - state & TDENetworkConnectionStatus::EstablishingLink || - state & TDENetworkConnectionStatus::ConfiguringProtocols || - state & TDENetworkConnectionStatus::NeedAuthorization) ); -} - -void DeviceTray::updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) -{ - if (!(state & TDENetworkConnectionStatus::Connected)) { - return; - } -} - -void DeviceTray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) -{ - updateTrayIcon(state); - updateActions(state); - updateActiveConnection(state); -} - -void DeviceTray::slotUpdateDeviceState() -{ - TDENetworkConnectionManager* deviceConnMan = d->dev->connectionManager(); - slotUpdateDeviceState(deviceConnMan->deviceInformation().statusFlags); -} - -void DeviceTray::loadIcons() { - d->pixmaps[TDENetworkConnectionStatus::Invalid] = loadSizedIcon("nm_no_connection", width()); - d->pixmaps[TDENetworkConnectionStatus::UnManaged] = loadSizedIcon("nm_no_connection", width()); - d->pixmaps[TDENetworkConnectionStatus::LinkUnavailable] = loadSizedIcon("nm_no_connection", width()); - d->pixmaps[TDENetworkConnectionStatus::Disconnected] = loadSizedIcon("nm_no_connection", width()); - - d->movies[TDENetworkConnectionStatus::EstablishingLink] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage01_connecting", KIcon::Panel)); - d->movies[TDENetworkConnectionStatus::EstablishingLink].pause(); - - d->movies[TDENetworkConnectionStatus::ConfiguringProtocols] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage02_connecting", KIcon::Panel)); - d->movies[TDENetworkConnectionStatus::ConfiguringProtocols].pause(); - - d->movies[TDENetworkConnectionStatus::VerifyingProtocols] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage03_connecting", KIcon::Panel)); - d->movies[TDENetworkConnectionStatus::VerifyingProtocols].pause(); - - d->movies[TDENetworkConnectionStatus::NeedAuthorization] = d->movies[TDENetworkConnectionStatus::ConfiguringProtocols]; - d->movies[TDENetworkConnectionStatus::NeedAuthorization].pause(); - - d->pixmaps[TDENetworkConnectionStatus::Connected] = loadSizedIcon("ok", width()); - - d->pixmaps[TDENetworkConnectionStatus::Failed] = loadSizedIcon("nm_no_connection", width()); -} - -DeviceTray::DeviceTray (TDENetworkDevice* dev) : KSystemTray () -{ - d = new DeviceTrayPrivate(); - d->dev = dev; - - m_currentIconState = TDENetworkConnectionStatus::Invalid; - loadIcons(); - - // get notified when the device state changes - connect(dev, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), this, TQT_SLOT(slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus))); - - setMouseTracking (true); - - // defer the initial call to slotUpdateDeviceState as it will crash tdenm 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 "tdenetman-device_tray.moc" diff --git a/tdenetworkmanager/src/tdenetman-device_tray.h b/tdenetworkmanager/src/tdenetman-device_tray.h deleted file mode 100644 index 809174b..0000000 --- a/tdenetworkmanager/src/tdenetman-device_tray.h +++ /dev/null @@ -1,88 +0,0 @@ -/*************************************************************************** - * - * tdenetman-device_tray.h - A NetworkManager frontend for TDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include "tdenetman.h" - -class DeviceTrayPrivate; - -class DeviceTray : public KSystemTray -{ - Q_OBJECT - - - public: - DeviceTray (TDENetworkDevice*); - ~DeviceTray (); - - void contextMenuAboutToShow (KPopupMenu* menu); - virtual void addMenuItems(KPopupMenu* menu) = 0; - TDENetworkDevice* getDevice() const; - - protected: - void setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQMovie); - void setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQPixmap); - void resizeEvent ( TQResizeEvent * ); - - virtual TQString getTooltipText(); - - public slots: - void setPixmap(const TQPixmap &); - void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus); - void slotUpdateDeviceState(); - - private: - void updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus); - void updateActions(TDENetworkConnectionStatus::TDENetworkConnectionStatus); - void updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus); - void enterEvent (TQEvent*); - void loadIcons(); - - DeviceTrayPrivate* d; - TDENetworkConnectionStatus::TDENetworkConnectionStatus m_currentIconState; -}; - -#endif /* KNETWORKMANAGER_DEVICE_TRAY_H */ diff --git a/tdenetworkmanager/src/tdenetman-wireless_manager.h b/tdenetworkmanager/src/tdenetman-wireless_manager.h index 3eacd6c..8baf68e 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_manager.h +++ b/tdenetworkmanager/src/tdenetman-wireless_manager.h @@ -31,7 +31,6 @@ // TDENM includes #include "tdenetman.h" -#include "tdenetman-device_tray.h" #include "tdenetman-wireless_network.h" namespace ConnectionSettings -- cgit v1.2.1 From 2df5ea4aaf2340b29a70ea4447ee0f9e3788a204 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 10 Sep 2012 11:32:58 -0500 Subject: Fix wireless bargraph menu layout problems --- tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp b/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp index 2b02796..38021e0 100644 --- a/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -112,7 +113,7 @@ WirelessNetworkItem::paint (TQPainter *p, const TQColorGroup &/*cg*/, bool highl int spacer = 0; pbarStrength->setTotalSteps (100); pbarStrength->setSizePolicy (TQSizePolicy ((TQSizePolicy::SizeType) 0, (TQSizePolicy::SizeType) 0, 0, 0, pbarStrength->sizePolicy ().hasHeightForWidth ())); - pbarStrength->setFixedHeight (_height - 2); + pbarStrength->setFixedHeight (h - (_border*2)); pbarStrength->setProgress (_net.getStrength()); pbarStrength->setPercentageVisible (false); @@ -125,13 +126,23 @@ WirelessNetworkItem::paint (TQPainter *p, const TQColorGroup &/*cg*/, bool highl p->drawText (x, y, w, h, AlignLeft | AlignVCenter | DontClip | ShowPrefix, getDisplayText()); if (_net.isEncrypted()) { - TQPixmap pmLock = SmallIcon ("lock", TQIconSet::Automatic); + TQPixmap pmLock = SmallIcon ("lock", h - (_border*2)); + if (pmLock.size().height() != (h - (_border*2))) { + TQImage pmLockImg = pmLock.convertToImage(); + pmLockImg = pmLockImg.smoothScale(65535, (h - (_border*2)), TQImage::ScaleMin); + pmLock.convertFromImage(pmLockImg); + } p->drawPixmap (parent->sizeHint ().width () - pbarStrength->width () - _space - pmLock.size ().width () - 6, y + _border, pmLock); spacer = pmLock.size ().width () + 4; } if (_adhoc) { - TQPixmap pmAdHoc = SmallIcon ("system", TQIconSet::Automatic); + TQPixmap pmAdHoc = SmallIcon ("system", h - (_border*2)); + if (pmAdHoc.size().height() != (h - (_border*2))) { + TQImage pmAdHocImg = pmAdHoc.convertToImage(); + pmAdHocImg = pmAdHocImg.smoothScale(65535, (h - (_border*2)), TQImage::ScaleMin); + pmAdHoc.convertFromImage(pmAdHocImg); + } p->drawPixmap (parent->sizeHint ().width () - pbarStrength->width () - _space - pmAdHoc.size ().width () - spacer - 6, y + _border, pmAdHoc); } @@ -166,8 +177,10 @@ WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, TQString dev, WirelessNet _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->style ().pixelMetric (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; -- cgit v1.2.1 From 475d08942faffe521f631e149b05e39825736cb6 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 10 Sep 2012 13:36:13 -0500 Subject: Reactivate basic VPN support --- tdenetworkmanager/src/CMakeLists.txt | 11 +- tdenetworkmanager/src/tdenetman-tray.cpp | 172 ++++++++++++++++++--- tdenetworkmanager/src/tdenetman-tray.h | 4 + tdenetworkmanager/src/tdenetman-vpn_plugin.cpp | 132 ---------------- tdenetworkmanager/src/tdenetman-vpn_plugin.h | 62 -------- .../src/tdenetman-vpnauthenticationdialog.cpp | 51 +----- .../src/tdenetman-vpnauthenticationdialog.h | 12 +- tdenetworkmanager/src/tdenetman-vpnmanager.cpp | 10 +- tdenetworkmanager/src/tdenetman-vpnmanager.h | 3 - tdenetworkmanager/src/tdenetman-vpnplugin.cpp | 4 +- tdenetworkmanager/src/tdenetman-vpnplugin.h | 10 +- tdenetworkmanager/src/tdenetman-vpnservice.h | 3 - tdenetworkmanager/src/vpn_tray_component.cpp | 120 +++++++------- 13 files changed, 243 insertions(+), 351 deletions(-) delete mode 100644 tdenetworkmanager/src/tdenetman-vpn_plugin.cpp delete mode 100644 tdenetworkmanager/src/tdenetman-vpn_plugin.h diff --git a/tdenetworkmanager/src/CMakeLists.txt b/tdenetworkmanager/src/CMakeLists.txt index 3d82ad4..10dd396 100644 --- a/tdenetworkmanager/src/CMakeLists.txt +++ b/tdenetworkmanager/src/CMakeLists.txt @@ -50,8 +50,7 @@ tde_add_tdeinit_executable( tdenetworkmanager AUTOMOC SOURCES connection_editor.ui vpnauthentication.ui main.cpp tdenetman.cpp tdenetman-tray.cpp - #tdenetman-vpn_plugin.cpp - tdenetman-cellular_device_tray.cpp #tdenetman-device_tray.cpp + tdenetman-cellular_device_tray.cpp tdenetman-wired_device_tray.cpp tdenetman-wireless_device_tray.cpp tdenetman-wireless_menuitem.cpp tdenetman-menuitem.cpp tdenetman-menu_subhead.cpp @@ -59,10 +58,10 @@ tde_add_tdeinit_executable( tdenetworkmanager AUTOMOC tdenetman-wireless_network.cpp tdenetman-wireless_manager.cpp tdenetman-connection_editor.cpp devicetraycomponent.cpp traycomponent.cpp - #tdenetman-plugin.cpp tdenetman-vpnplugin.cpp - #tdenetman-pluginmanager.cpp tdenetman-vpnservice.cpp tdenetman-vpnmanager.cpp - #tdenetman-vpnauthenticationdialog.cpp - #vpn_tray_component.cpp + tdenetman-plugin.cpp tdenetman-vpnplugin.cpp + tdenetman-pluginmanager.cpp tdenetman-vpnservice.cpp tdenetman-vpnmanager.cpp + tdenetman-vpnauthenticationdialog.cpp + vpn_tray_component.cpp EMBED tdenetwork-connection-configwidgets-static #tdenetwork-connection-settings-static LINK tdecore-shared tdeui-shared kutils-shared ${DBUS_TQT_LIBRARIES} ) diff --git a/tdenetworkmanager/src/tdenetman-tray.cpp b/tdenetworkmanager/src/tdenetman-tray.cpp index 371260c..f6b4d9e 100644 --- a/tdenetworkmanager/src/tdenetman-tray.cpp +++ b/tdenetworkmanager/src/tdenetman-tray.cpp @@ -66,10 +66,12 @@ #include "tdenetman-wired_device_tray.h" #include "tdenetman-wireless_device_tray.h" #include "tdenetman-cellular_device_tray.h" +#include "vpn_tray_component.h" #include -TDENetworkConnectionStatus::TDENetworkConnectionStatus nm_device_state_global; +TDENetworkConnectionStatus::TDENetworkConnectionStatus nm_device_state_global = TDENetworkConnectionStatus::Invalid; +TDENetworkConnectionStatus::TDENetworkConnectionStatus current_vpn_state = TDENetworkConnectionStatus::Invalid; NewSecretsDialog::NewSecretsDialog(TDENetworkConnection *connection, TQWidget * parent, const char * name, bool modal, TQt::WFlags f) : TQDialog(parent, name, modal, f) @@ -189,6 +191,23 @@ void Tray::slotOnlineMode() nm->enableNetworking(true); } +void Tray::slotNewVPNConnection() +{ + printf("Creating new VPN connection\n\r"); + // create a new VPN connection + TDEVPNConnection* conn = new TDEVPNConnection(); + + // edit the new connection + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, TQByteArray(), this, "connect_something", false, TQt::WDestructiveClose); + dlg->show(); +} + +void Tray::slotVPNBannerShow(const TQString& vpnbanner) +{ + printf("VPN banner: %s\n\r", vpnbanner.ascii()); + KNotifyClient::event(winId(), "knm-nm-vpn-banner", vpnbanner); +} + void Tray::contextMenuAboutToShow (KPopupMenu* menu) { TDEGlobalNetworkManager* nm = KGlobal::networkManager(); @@ -243,6 +262,13 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu) newConnActionMenu->insert(deviceNewConnAction); } } + // New VPN connection option + ++it; + KAction * deviceNewConnAction = 0; + TQString menuCaption = "VPN Connection"; + TQString actionName = TQString("new_connection_%1").arg("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"); @@ -470,6 +496,33 @@ void Tray::createDeviceTrayComponent(TQString dev) } } +void Tray::createVPNTrayComponent() +{ + bool trayExists = false; + + // check if we have already a trayicon for this device + for (TQValueList::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) + { + VPNTrayComponent* vpn_comp = dynamic_cast (*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 @@ -486,6 +539,9 @@ void Tray::updateDeviceTrays() 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 ) @@ -618,13 +674,37 @@ void Tray::trayUiChanged() void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { // Get all active connections + char active_vpn=0; char found_any_active_connection=0; TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkConnectionList* allconmap; + + // get all available VPN Connections + active_vpn = 0; + allconmap = nm->connections(); + for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) { + TDEVPNConnection* conn = dynamic_cast(*it); + if (!conn) { + continue; + } + + TDENetworkConnectionStatus::TDENetworkConnectionStatus connStatus = nm->checkConnectionStatus(conn->UUID); + if ((connStatus & TDENetworkConnectionStatus::Connected) + || (connStatus & TDENetworkConnectionStatus::EstablishingLink) + || (connStatus & TDENetworkConnectionStatus::ConfiguringProtocols) + || (connStatus & TDENetworkConnectionStatus::Reconnecting) + || (connStatus & TDENetworkConnectionStatus::VerifyingProtocols) + || (connStatus & TDENetworkConnectionStatus::NeedAuthorization) + || (connStatus & TDENetworkConnectionStatus::DependencyWait)) { + // This VPN connection is active! + active_vpn = 1; + } + } found_any_active_connection = 0; // Get all active connections - TDENetworkConnectionList* allconmap = nm->connections(); + allconmap = nm->connections(); for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) { TDENetworkConnection* conn = (*it); @@ -645,6 +725,10 @@ void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus // printf("Active connection found\n\r"); // } + if ((current_vpn_state & TDENetworkConnectionStatus::Failed) || (current_vpn_state & TDENetworkConnectionStatus::Disconnected)) { + active_vpn = 0; + } + // stop the old movie to avoid unnecessary wakups DeviceTrayComponent * dtc = d->foregroundTrayComponent; @@ -652,35 +736,77 @@ void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus movie()->pause(); } - if ((dtc) && (found_any_active_connection == 1)) { - if (!dtc->movieForState(state).isNull()) - { - // animation desired - int frame = -1; - if (movie()) { - frame = movie()->frameNumber(); + if (active_vpn == 0) { + 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(); } - - // set the movie - setMovie(dtc->movieForState(state)); - - // start at the same frame as the movie before - if (frame > 0) { - movie()->step(frame); + else if (!dtc->pixmapForState(state).isNull()) { + setPixmap(dtc->pixmapForState(state)); + } + else { + setPixmap(loadIcon("tdenetworkmanager")); } - - // start the animation - movie()->unpause(); - } - else if (!dtc->pixmapForState(state).isNull()) { - setPixmap(dtc->pixmapForState(state)); } else { setPixmap(loadIcon("tdenetworkmanager")); } } else { - setPixmap(loadIcon("tdenetworkmanager")); + printf("VPN state: %d\n\r", current_vpn_state); + //printf("Activated is: %d\n\r", TDENetworkConnectionStatus::Connected); + // stop the old movie to avoid unnecessary wakups + DeviceTrayComponent * dtc = d->foregroundTrayComponent; + + if (movie()) + movie()->pause(); + + if (dtc) { + if (current_vpn_state & TDENetworkConnectionStatus::Connected) { + setPixmap(loadIcon("nm_device_vpn")); + } + if ((current_vpn_state & TDENetworkConnectionStatus::EstablishingLink) + || (current_vpn_state & TDENetworkConnectionStatus::NeedAuthorization) + || (current_vpn_state & TDENetworkConnectionStatus::ConfiguringProtocols) + || (current_vpn_state & TDENetworkConnectionStatus::VerifyingProtocols)) { + int frame = -1; + if (movie()) + frame = movie()->frameNumber(); + + // set the movie + if ((current_vpn_state & TDENetworkConnectionStatus::EstablishingLink) + || (current_vpn_state & TDENetworkConnectionStatus::NeedAuthorization)) { + setMovie(TQMovie(KGlobal::iconLoader()->moviePath("nm_stage02_connecting_vpn", KIcon::Panel))); + } + if ((current_vpn_state & TDENetworkConnectionStatus::ConfiguringProtocols) + || (current_vpn_state & TDENetworkConnectionStatus::VerifyingProtocols)) { + 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; diff --git a/tdenetworkmanager/src/tdenetman-tray.h b/tdenetworkmanager/src/tdenetman-tray.h index 75075a8..1daf455 100644 --- a/tdenetworkmanager/src/tdenetman-tray.h +++ b/tdenetworkmanager/src/tdenetman-tray.h @@ -94,6 +94,9 @@ class Tray : public KSystemTray void slotUpdateDeviceState(); void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus prevState, TQString hwAddress); + void slotNewVPNConnection(); + void slotVPNBannerShow(const TQString& vpnbanner); + protected slots: void updateDeviceTrays(); void slotAddDeviceTrayComponent(TQString); @@ -112,6 +115,7 @@ class Tray : public KSystemTray void updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus); void updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus); void mousePressEvent(TQMouseEvent *e); + void createVPNTrayComponent(); void createDeviceTrayComponent(TQString); void enterEvent(TQEvent*); void connectTrayDeviceManager(); diff --git a/tdenetworkmanager/src/tdenetman-vpn_plugin.cpp b/tdenetworkmanager/src/tdenetman-vpn_plugin.cpp deleted file mode 100644 index 94f20b4..0000000 --- a/tdenetworkmanager/src/tdenetman-vpn_plugin.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/*************************************************************************** - * - * tdenetman-vpn_plugin.cpp - A NetworkManager frontend for TDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * Author: Timothy Pearson - * - * 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 - * - **************************************************************************/ - -// TDE includes -#include - -// TQt includes -#include - -// TQT_DBus includes -#include -#include -#include - -// NM includes -#include -#include - -// TDENM includes -#include "tdenetman.h" -#include "tdenetman-tray.h" -#include "tdenetman-vpn_plugin.h" -#include "dbus/vpnpluginproxy.h" -#include "tdenetman-hal_device_proxy.h" -#include "tdenetman-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 "tdenetman-vpn_plugin.moc" diff --git a/tdenetworkmanager/src/tdenetman-vpn_plugin.h b/tdenetworkmanager/src/tdenetman-vpn_plugin.h deleted file mode 100644 index 674a402..0000000 --- a/tdenetworkmanager/src/tdenetman-vpn_plugin.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************** - * - * tdenetman-wired_device.h - A NetworkManager frontend for TDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * Author: Timothy Pearson - * - * 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 - -// TDENM includes -#include "tdenetman.h" - -class TDENetworkManager; - -class VPNDBUSPluginPrivate; - -class VPNDBUSPlugin : public TQObject -{ - Q_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/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp index ae4c047..db078df 100644 --- a/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp +++ b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp @@ -38,32 +38,20 @@ #include #include -#include -#include - #include "tdenetman-vpnservice.h" #include "tdenetman-vpnmanager.h" #include "tdenetman-vpnauthenticationdialog.h" -#include "tdenetman-vpn_connection.h" -#include "tdenetman-nm_proxy.h" -#include "tdenetman-connection_setting_vpn.h" -#include "tdenetman-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) +VPNAuthenticationDialog::VPNAuthenticationDialog(TDEVPNConnection* 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").arg(conn->getInfoSetting()->getName())); + this->setCaption(i18n("VPN Authentication for %1").arg(conn->friendlyName)); labelPixmap->setPixmap(KGlobal::instance()->iconLoader()->loadIcon("encrypted", KIcon::Small, 32)); // nice icons @@ -74,8 +62,8 @@ VPNAuthenticationDialog::VPNAuthenticationDialog(VPNConnection* conn, TQWidget* TQFocusData* foc = focusData(); TQWidget* lastFocusWidget = foc->last(); - VPN* vpn = conn->getVPNSetting(); - VPNService* vpnservice = VPNManager::getVPNService(vpn->getServiceType()); + TDEVPNConnection* vpn = conn; + VPNService* vpnservice = VPNManager::getVPNService(vpn->vpnPluginID); // get the appropriate plugin and create the authentication widget VPNPlugin* vpnPlugin = vpnservice->getVPNPlugin(); @@ -84,7 +72,7 @@ VPNAuthenticationDialog::VPNAuthenticationDialog(VPNConnection* conn, TQWidget* _vpnAuthWidget = vpnPlugin->CreateAuthenticationWidget(widgetStack); if (_vpnAuthWidget) { - _vpnAuthWidget->setVPNData(conn->getVPNSetting()->getRoutes(), conn->getVPNSetting()->getData()); + _vpnAuthWidget->setVPNData(conn->ipConfig.routeConfigurations, conn->pluginData, conn->pluginSecrets); widgetStack->raiseWidget(_vpnAuthWidget); } } @@ -119,37 +107,11 @@ 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 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(propcore); - prop->setSecrets(mypwds); - _conn->slotSecretsProvided(prop); TQDialog::done(0); } @@ -169,9 +131,6 @@ void VPNAuthenticationDialog::cancel() printf("Attempting to deactivate VPN connection...\n\r"); - // Disconnect the attempted connection - _conn->slotSecretsError(); - // Quit the dialog TQDialog::done(1); } diff --git a/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h index 5602518..af50908 100644 --- a/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h +++ b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h @@ -30,6 +30,9 @@ #include #include +#include +#include + #include "tdenetman.h" #include "vpnauthentication.h" #include "tdenetman-vpnplugin.h" @@ -39,17 +42,12 @@ class TDENetworkManager; class ManageConnectionsDialog; class VPNService; -namespace ConnectionSettings -{ - class VPNConnection; -} - class VPNAuthenticationDialog : public AuthenticationDialog { Q_OBJECT public: - VPNAuthenticationDialog(ConnectionSettings::VPNConnection* conn = NULL, TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); + VPNAuthenticationDialog(TDEVPNConnection* 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); @@ -60,7 +58,7 @@ class VPNAuthenticationDialog : public AuthenticationDialog private: VPNAuthenticationWidget* _vpnAuthWidget; - ConnectionSettings::VPNConnection* _conn; + TDEVPNConnection* _conn; signals: void done(bool, TQStringList &, bool, bool); diff --git a/tdenetworkmanager/src/tdenetman-vpnmanager.cpp b/tdenetworkmanager/src/tdenetman-vpnmanager.cpp index d3472c3..1113562 100644 --- a/tdenetworkmanager/src/tdenetman-vpnmanager.cpp +++ b/tdenetworkmanager/src/tdenetman-vpnmanager.cpp @@ -41,22 +41,20 @@ 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; + 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(TDENetworkManager::getInstance())); @@ -74,15 +72,13 @@ kdDebug() << "VPN Service " << kconfig->readEntry ("name", TQString()).ascii() < 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; diff --git a/tdenetworkmanager/src/tdenetman-vpnmanager.h b/tdenetworkmanager/src/tdenetman-vpnmanager.h index d6e6002..d80e7c5 100644 --- a/tdenetworkmanager/src/tdenetman-vpnmanager.h +++ b/tdenetworkmanager/src/tdenetman-vpnmanager.h @@ -26,9 +26,6 @@ #ifndef KNETWORKMANAGER_VPNMANAGER_H #define KNETWORKMANAGER_VPNMANAGER_H -#include -#include - #include #include diff --git a/tdenetworkmanager/src/tdenetman-vpnplugin.cpp b/tdenetworkmanager/src/tdenetman-vpnplugin.cpp index e06ea39..f21fa6b 100644 --- a/tdenetworkmanager/src/tdenetman-vpnplugin.cpp +++ b/tdenetworkmanager/src/tdenetman-vpnplugin.cpp @@ -41,7 +41,7 @@ VPNConfigWidget::VPNConfigWidget(TQWidget* parent, const char* name) } -void VPNConfigWidget::setVPNData(const TQStringList& /*routes*/, const TQMap& /*properties*/) +void VPNConfigWidget::setVPNData(TDENetworkSingleRouteConfigurationList& /*routes*/, TDENetworkSettingsMap& /*properties*/, TDENetworkSettingsMap& /*secrets*/) { } @@ -91,7 +91,7 @@ void VPNAuthenticationWidget::setPasswords(TQString name, TQString value) } -void VPNAuthenticationWidget::setVPNData(const TQStringList& /*routes*/, const TQMap& /*properties*/) +void VPNAuthenticationWidget::setVPNData(TDENetworkSingleRouteConfigurationList& /*routes*/, TDENetworkSettingsMap& /*properties*/, TDENetworkSettingsMap& /*secrets*/) { } diff --git a/tdenetworkmanager/src/tdenetman-vpnplugin.h b/tdenetworkmanager/src/tdenetman-vpnplugin.h index d98db7e..a24749a 100644 --- a/tdenetworkmanager/src/tdenetman-vpnplugin.h +++ b/tdenetworkmanager/src/tdenetman-vpnplugin.h @@ -27,8 +27,10 @@ #include #include -#include -#include + +#include +#include + #include "tdenetman-plugin.h" #define KNETWORKMANAGER_VPNPLUGIN "TDENetworkManager/VPNPlugin" @@ -41,7 +43,7 @@ class VPNConfigWidget : public TQWidget virtual ~VPNConfigWidget(); VPNConfigWidget(TQWidget* parent = NULL, const char* name = NULL); - virtual void setVPNData(const TQStringList&, const TQMap&); + virtual void setVPNData(TDENetworkSingleRouteConfigurationList&, TDENetworkSettingsMap&, TDENetworkSettingsMap&); virtual TQMap getVPNProperties(); virtual TQStringList getVPNRoutes(); virtual bool hasChanged(); @@ -56,7 +58,7 @@ class VPNAuthenticationWidget : public TQWidget virtual ~VPNAuthenticationWidget(); VPNAuthenticationWidget(TQWidget* parent = NULL, const char* name = NULL); - virtual void setVPNData(const TQStringList&, const TQMap&); + virtual void setVPNData(TDENetworkSingleRouteConfigurationList&, TDENetworkSettingsMap&, TDENetworkSettingsMap&); virtual TQMap getPasswords(); virtual void setPasswords(TQString value, TQString data); virtual bool needsUserInteraction(); diff --git a/tdenetworkmanager/src/tdenetman-vpnservice.h b/tdenetworkmanager/src/tdenetman-vpnservice.h index d95fafa..ed6004f 100644 --- a/tdenetworkmanager/src/tdenetman-vpnservice.h +++ b/tdenetworkmanager/src/tdenetman-vpnservice.h @@ -26,9 +26,6 @@ #ifndef KNETWORKMANAGER_VPN_SERVICE_H #define KNETWORKMANAGER_VPN_SERVICE_H -#include -#include - #include #include diff --git a/tdenetworkmanager/src/vpn_tray_component.cpp b/tdenetworkmanager/src/vpn_tray_component.cpp index 49474b2..019e6c3 100644 --- a/tdenetworkmanager/src/vpn_tray_component.cpp +++ b/tdenetworkmanager/src/vpn_tray_component.cpp @@ -35,12 +35,7 @@ #include "vpn_tray_component.h" #include "tdenetman-menuitem.h" #include "tdenetman-menu_subhead.h" -#include "tdenetman-connection_store.h" -#include "tdenetman-vpn_connection.h" -#include "tdenetman-nm_proxy.h" -#include "tdenetman-connection_setting_info.h" -#include "tdenetman-connection_setting_vpn.h" #include "tdenetman-connection_settings_dialog.h" #include @@ -48,11 +43,14 @@ using namespace ConnectionSettings; void VPNTrayComponent::slotShowNewConnectionDialog() { + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + // create a new VPN connection - Connection* conn = new VPNConnection(); + TDEVPNConnection* conn = new TDEVPNConnection(); + nm->loadConnectionAllowedValues(conn); // edit the new connection - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, tray(), "connect_something", false, TQt::WDestructiveClose); + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, TQByteArray(), tray(), "connect_something", false, TQt::WDestructiveClose); dlg->show(); } @@ -60,70 +58,80 @@ void VPNTrayComponent::slotShowNewConnectionDialog() void VPNTrayComponent::addMenuItems(KPopupMenu* menu) { int inactive_vpn_connections = 0; - char vpn_found; + char vpn_found = 0; char any_vpn_found = 0; - ConnectionStore* connectionStore = ConnectionStore::getInstance(); // Get all active connections - NMProxy* nm = NMProxy::getInstance(); - TQValueList > map = nm->getActiveConnectionsMap(); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); // get all available VPN Connections - TQValueList connections = connectionStore->getConnections(NM_SETTING_VPN_SETTING_NAME); - if (!connections.empty()) - { - TQPopupMenu* popup = new TQPopupMenu(menu); - for (TQValueList::iterator it = connections.begin(); it != connections.end(); ++it) - { - VPNConnection* vpnconn = dynamic_cast(*it); - if (vpnconn) - { - // VPN connection found :) - Info* info = vpnconn->getInfoSetting(); - - // lets create a nice name for this connection - if (info) - { - TQString title = info->getName(); + TQPopupMenu* popup = NULL; + TDENetworkConnectionList* allconmap = nm->connections(); + for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) { + TDEVPNConnection* conn = dynamic_cast(*it); + if (!conn) { + continue; + } + + if (!popup) { + popup = new TQPopupMenu(menu); + } + + TQString title = conn->friendlyName; - NetworkMenuItem* item = new NetworkMenuItem(NULL, vpnconn, TQT_TQOBJECT(menu)); - - vpn_found = 0; - for (TQValueList >::Iterator it = map.begin(); it != map.end(); ++it) - { - ConnectionSettings::GenericConnection* conn = dynamic_cast((*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)); - } - } + NetworkMenuItem* item = new NetworkMenuItem(NULL, conn->UUID, TQT_TQOBJECT(menu)); + + vpn_found = 0; + TDENetworkConnectionStatus::TDENetworkConnectionStatus connStatus = nm->checkConnectionStatus(conn->UUID); + if ((connStatus & TDENetworkConnectionStatus::Connected) + || (connStatus & TDENetworkConnectionStatus::EstablishingLink) + || (connStatus & TDENetworkConnectionStatus::ConfiguringProtocols) + || (connStatus & TDENetworkConnectionStatus::Reconnecting) + || (connStatus & TDENetworkConnectionStatus::VerifyingProtocols) + || (connStatus & TDENetworkConnectionStatus::NeedAuthorization) + || (connStatus & TDENetworkConnectionStatus::DependencyWait)) { + // This VPN connection is active! + vpn_found = 1; + any_vpn_found = 1; + } + + if (vpn_found == 1) { + printf("Active VPN connection found\n\r"); + } + else { + popup->insertItem(SmallIcon ("encrypted", TQIconSet::Automatic), title, item, TQT_SLOT(slotActivate())); + inactive_vpn_connections++; } - TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection(); - TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn); + //menu->setItemChecked(id, ((*it) == active_conn)); + } + if (popup) { + // At least one VPN connection is defined on this system if (any_vpn_found == 1) { inactive_vpn_connections = 0; } - if (device.isNull()) { +#if 0 + // FIXME + // NetworkManager is rather stupid and won't let us activate a VPN connection if it doesn't manage the backend connection (!?!?!?) + // When/if this limitation is removed, uncomment the following code block! + TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags backendStatus = nm->backendStatus(); + if ((backendStatus & TDENetworkGlobalManagerFlags::Connected) + || (backendStatus & TDENetworkGlobalManagerFlags::LinkLocalAccess) + || (backendStatus & TDENetworkGlobalManagerFlags::SiteLocalAccess) + || (backendStatus & TDENetworkGlobalManagerFlags::GlobalAccess)) { + // We have network access of some kind + } + else { + inactive_vpn_connections = 0; + } +#else + TQStringList defaultNetworkDevices = nm->defaultNetworkDevices(); + if (defaultNetworkDevices.count() <= 0) { inactive_vpn_connections = 0; } +#endif if (inactive_vpn_connections > 0) { menu->insertItem(SmallIcon ("encrypted", TQIconSet::Automatic), i18n("Start VPN connection"), popup); -- cgit v1.2.1 From 330644c862a6d1ece1b151eac94306cc06f1c1e5 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 10 Sep 2012 13:55:03 -0500 Subject: Fix VPN plugin API --- .../src/tdenetman-vpnauthenticationdialog.cpp | 6 +++--- .../src/tdenetman-vpnauthenticationdialog.h | 2 +- tdenetworkmanager/src/tdenetman-vpnplugin.cpp | 19 ++++++++++++------- tdenetworkmanager/src/tdenetman-vpnplugin.h | 11 ++++++----- .../vpn-plugins/vpnc/src/knetworkmanager-vpnc.h | 15 ++++++++------- 5 files changed, 30 insertions(+), 23 deletions(-) diff --git a/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp index db078df..4b100ed 100644 --- a/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp +++ b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp @@ -115,10 +115,10 @@ void VPNAuthenticationDialog::ok() TQDialog::done(0); } -void VPNAuthenticationDialog::setPasswords(TQString name, TQString value) { - if (value.length() > 0) { +void VPNAuthenticationDialog::setPasswords(TDENetworkSettingsMap secrets) { + if (secrets.count() > 0) { chkStorePasswordsPermanent->setChecked(true); - _vpnAuthWidget->setPasswords(name, value); + _vpnAuthWidget->setPasswords(secrets); } } diff --git a/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h index af50908..750526d 100644 --- a/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h +++ b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h @@ -49,7 +49,7 @@ class VPNAuthenticationDialog : public AuthenticationDialog public: VPNAuthenticationDialog(TDEVPNConnection* conn = NULL, TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~VPNAuthenticationDialog(); - void setPasswords(TQString name, TQString value); + void setPasswords(TDENetworkSettingsMap secrets); virtual bool close(bool); protected slots: diff --git a/tdenetworkmanager/src/tdenetman-vpnplugin.cpp b/tdenetworkmanager/src/tdenetman-vpnplugin.cpp index f21fa6b..f95eb57 100644 --- a/tdenetworkmanager/src/tdenetman-vpnplugin.cpp +++ b/tdenetworkmanager/src/tdenetman-vpnplugin.cpp @@ -46,14 +46,19 @@ void VPNConfigWidget::setVPNData(TDENetworkSingleRouteConfigurationList& /*route } -TQMap VPNConfigWidget::getVPNProperties() +TDENetworkSettingsMap VPNConfigWidget::getVPNProperties() { - return TQMap(); + return TDENetworkSettingsMap(); } -TQStringList VPNConfigWidget::getVPNRoutes() +TDENetworkSettingsMap VPNConfigWidget::getVPNSecrets() { - return TQStringList(); + return TDENetworkSettingsMap(); +} + +TDENetworkSingleRouteConfigurationList VPNConfigWidget::getVPNRoutes() +{ + return TDENetworkSingleRouteConfigurationList(); } bool VPNConfigWidget::hasChanged() @@ -81,12 +86,12 @@ VPNAuthenticationWidget::~VPNAuthenticationWidget() } -TQMap VPNAuthenticationWidget::getPasswords() +TDENetworkSettingsMap VPNAuthenticationWidget::getPasswords() { - return TQMap(); + return TDENetworkSettingsMap(); } -void VPNAuthenticationWidget::setPasswords(TQString name, TQString value) +void VPNAuthenticationWidget::setPasswords(TDENetworkSettingsMap secrets) { } diff --git a/tdenetworkmanager/src/tdenetman-vpnplugin.h b/tdenetworkmanager/src/tdenetman-vpnplugin.h index a24749a..0ec909c 100644 --- a/tdenetworkmanager/src/tdenetman-vpnplugin.h +++ b/tdenetworkmanager/src/tdenetman-vpnplugin.h @@ -43,9 +43,10 @@ class VPNConfigWidget : public TQWidget virtual ~VPNConfigWidget(); VPNConfigWidget(TQWidget* parent = NULL, const char* name = NULL); - virtual void setVPNData(TDENetworkSingleRouteConfigurationList&, TDENetworkSettingsMap&, TDENetworkSettingsMap&); - virtual TQMap getVPNProperties(); - virtual TQStringList getVPNRoutes(); + virtual void setVPNData(TDENetworkSingleRouteConfigurationList&, TDENetworkSettingsMap&, TDENetworkSettingsMap&); + virtual TDENetworkSettingsMap getVPNProperties(); + virtual TDENetworkSettingsMap getVPNSecrets(); + virtual TDENetworkSingleRouteConfigurationList getVPNRoutes(); virtual bool hasChanged(); virtual bool isValid(TQStringList&); }; @@ -59,8 +60,8 @@ class VPNAuthenticationWidget : public TQWidget VPNAuthenticationWidget(TQWidget* parent = NULL, const char* name = NULL); virtual void setVPNData(TDENetworkSingleRouteConfigurationList&, TDENetworkSettingsMap&, TDENetworkSettingsMap&); - virtual TQMap getPasswords(); - virtual void setPasswords(TQString value, TQString data); + virtual TDENetworkSettingsMap getPasswords(); + virtual void setPasswords(TDENetworkSettingsMap secrets); virtual bool needsUserInteraction(); }; diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h b/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h index 2a45ca0..0b3b23c 100644 --- a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h +++ b/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h @@ -50,13 +50,14 @@ class VPNCPlugin : public VPNPlugin class VPNCConfig : public VPNConfigWidget { Q_OBJECT - + public: - void setVPNData(const TQStringList& routes, const TQMap& properties); - TQMap getVPNProperties(); + void setVPNData(TDENetworkSingleRouteConfigurationList&, TDENetworkSettingsMap&, TDENetworkSettingsMap&); + TDENetworkSettingsMap getVPNProperties(); + TDENetworkSettingsMap getVPNSecrets(); TQStringList getVPNRoutes(); bool hasChanged(); - bool isValid(TQStringList& ); + bool isValid(TQStringList&); VPNCConfig(TQWidget* parent); ~VPNCConfig(); @@ -75,12 +76,12 @@ class VPNCConfig : public VPNConfigWidget class VPNCAuthentication : public VPNAuthenticationWidget { Q_OBJECT - + public: VPNCAuthentication(TQWidget* parent = NULL, char* name = NULL); ~VPNCAuthentication(); - TQMap getPasswords(); - void setPasswords(TQString name, TQString value); + TDENetworkSettingsMap getPasswords(); + void setPasswords(TDENetworkSettingsMap secrets); private: VPNCAuthenticationWidget* _vpncAuth; -- cgit v1.2.1 From 441c9f0207681f071e353357511255bc16b4ded0 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 10 Sep 2012 14:32:34 -0500 Subject: Start work on vpnc plugin --- tdenetworkmanager/CMakeLists.txt | 2 +- tdenetworkmanager/vpn-plugins/CMakeLists.txt | 15 + tdenetworkmanager/vpn-plugins/vpnc/AUTHORS | 1 + tdenetworkmanager/vpn-plugins/vpnc/CMakeLists.txt | 14 + .../vpn-plugins/vpnc/knetworkmanager_vpnc.desktop | 23 -- .../vpn-plugins/vpnc/src/CMakeLists.txt | 43 +++ .../vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp | 402 -------------------- .../vpn-plugins/vpnc/src/knetworkmanager-vpnc.h | 90 ----- .../vpn-plugins/vpnc/src/tdenetman-vpnc.cpp | 403 +++++++++++++++++++++ .../vpn-plugins/vpnc/src/tdenetman-vpnc.h | 90 +++++ .../vpn-plugins/vpnc/tdenetman_vpnc.desktop | 23 ++ 11 files changed, 590 insertions(+), 516 deletions(-) create mode 100644 tdenetworkmanager/vpn-plugins/CMakeLists.txt create mode 100644 tdenetworkmanager/vpn-plugins/vpnc/CMakeLists.txt delete mode 100644 tdenetworkmanager/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop create mode 100644 tdenetworkmanager/vpn-plugins/vpnc/src/CMakeLists.txt delete mode 100644 tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp delete mode 100644 tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h create mode 100644 tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp create mode 100644 tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h create mode 100644 tdenetworkmanager/vpn-plugins/vpnc/tdenetman_vpnc.desktop diff --git a/tdenetworkmanager/CMakeLists.txt b/tdenetworkmanager/CMakeLists.txt index 1938a55..af12c8d 100644 --- a/tdenetworkmanager/CMakeLists.txt +++ b/tdenetworkmanager/CMakeLists.txt @@ -11,7 +11,7 @@ add_subdirectory( pics ) add_subdirectory( src ) -# add_subdirectory( vpn-plugins ) +add_subdirectory( vpn-plugins ) # add_subdirectory( po ) install( FILES tdenetworkmanager.conf DESTINATION ${DBUS_SYS_DIR} ) diff --git a/tdenetworkmanager/vpn-plugins/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/CMakeLists.txt new file mode 100644 index 0000000..aa31dbf --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/CMakeLists.txt @@ -0,0 +1,15 @@ +################################################# +# +# (C) 2012 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +# add_subdirectory( openvpn ) +# add_subdirectory( pptp ) +# add_subdirectory( strongswan ) +add_subdirectory( vpnc ) diff --git a/tdenetworkmanager/vpn-plugins/vpnc/AUTHORS b/tdenetworkmanager/vpn-plugins/vpnc/AUTHORS index e0ecfce..676305e 100644 --- a/tdenetworkmanager/vpn-plugins/vpnc/AUTHORS +++ b/tdenetworkmanager/vpn-plugins/vpnc/AUTHORS @@ -1,2 +1,3 @@ +Timothy Pearson Helmut Schaa , Thomas Kallenberg diff --git a/tdenetworkmanager/vpn-plugins/vpnc/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/vpnc/CMakeLists.txt new file mode 100644 index 0000000..d865ba9 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/vpnc/CMakeLists.txt @@ -0,0 +1,14 @@ +################################################# +# +# (C) 2012 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( src ) + +install( FILES tdenetman_vpnc.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) diff --git a/tdenetworkmanager/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop b/tdenetworkmanager/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop deleted file mode 100644 index fd7d07c..0000000 --- a/tdenetworkmanager/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop +++ /dev/null @@ -1,23 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Type=Service -Icon= -ServiceTypes=TDENetworkManager/VPNPlugin -X-TDE-Library=knetworkmanager_vpnc -X-NetworkManager-Services=vpnc -X-TDE-PluginInfo-Author=Helmut Schaa -X-TDE-PluginInfo-Email=hschaa@suse.de -X-TDE-PluginInfo-Name=knetworkmanager_vpnc -X-TDE-PluginInfo-Version=0.1 -X-TDE-PluginInfo-Website= -X-TDE-PluginInfo-Category=VPNService -X-TDE-PluginInfo-Depends= -X-TDE-PluginInfo-License=GPL -X-TDE-PluginInfo-EnabledByDefault=false -Name=VPNC -Name[bn]=ভিপিএনসি -Name[xx]=xxVPNCxx -Comment=VPNC -Comment[bn]=ভিপিএনসি -Comment[xx]=xxVPNCxx - diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/vpnc/src/CMakeLists.txt new file mode 100644 index 0000000..25bd8ea --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/vpnc/src/CMakeLists.txt @@ -0,0 +1,43 @@ +################################################# +# +# (C) 2012 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_definitions( -UQT_NO_ASCII_CAST ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/tdenetworkmanager/src/settings + ${CMAKE_SOURCE_DIR}/tdenetworkmanager/src/configwidgets + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${DBUS_TQT_INCLUDE_DIRS} + ${NM_UTIL_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + +##### tdenetman_vpnc (module) ################### + +set( target tdenetman_vpnc ) + +set( ${target}_SRCS + tdenetman-vpnc.cpp + vpncprop.ui + vpncauth.ui +) + +tde_add_kpart( ${target} AUTOMOC + SOURCES ${${target}_SRCS} + LINK tdeinit_kded-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp b/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp deleted file mode 100644 index 9804256..0000000 --- a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp +++ /dev/null @@ -1,402 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-vpnc.cpp - A NetworkManager frontend for TDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * Author: Timothy Pearson - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "knetworkmanager-vpnc.h" -using namespace std; - -typedef KGenericFactory VPNCPluginFactory; -K_EXPORT_COMPONENT_FACTORY( knetworkmanager_vpnc, VPNCPluginFactory("knetworkmanager_vpnc")); - -#define NAT_MODE_CISCO 0 -#define NAT_MODE_NATT 1 -#define NAT_MODE_DISABLED 2 - -char linedata [2048]; - -VPNCPlugin::VPNCPlugin(TQObject* parent, const char* name, const TQStringList& args) - : VPNPlugin(parent, name, args) -{ - KLocale* loc = KGlobal::locale(); - loc->insertCatalogue("NetworkManager-vpnc"); -} - -VPNCPlugin::~VPNCPlugin() -{ - -} - -VPNConfigWidget* VPNCPlugin::CreateConfigWidget(TQWidget* parent) -{ - return new VPNCConfig(parent); -} - -VPNAuthenticationWidget* VPNCPlugin::CreateAuthenticationWidget(TQWidget* parent) -{ - return new VPNCAuthentication(parent); -} - - -VPNCConfig::VPNCConfig(TQWidget* parent) - : VPNConfigWidget(parent) -{ - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _vpncWidget = new VPNCConfigWidget(this); - layout->addWidget(_vpncWidget); - - connect(_vpncWidget->pcfImport, TQT_SIGNAL(clicked()), this, TQT_SLOT( pcfImport()) ); - - //connect(_vpncWidget->chkOverrideUsername, TQT_SIGNAL(toggled(bool)), _vpncWidget->Xauth_username, TQT_SLOT(setEnabled(bool))); - //connect(_vpncWidget->chkOverrideUsername, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblUsername, TQT_SLOT(setEnabled(bool))); - - connect(_vpncWidget->chkUseDomain, TQT_SIGNAL(toggled(bool)), _vpncWidget->Domain, TQT_SLOT(setEnabled(bool))); - connect(_vpncWidget->chkUseDomain, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblDomain, TQT_SLOT(setEnabled(bool))); - - connect(_vpncWidget->chkIPAdresses, TQT_SIGNAL(toggled(bool)), _vpncWidget->routes, TQT_SLOT(setEnabled(bool))); - - connect(_vpncWidget->chkUseKeepAlive, TQT_SIGNAL(toggled(bool)), _vpncWidget->nat_keep_alive_interval, TQT_SLOT(setEnabled(bool))); - connect(_vpncWidget->chkUseKeepAlive, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblKeepAliveInterval, TQT_SLOT(setEnabled(bool))); - - _vpncWidget->cboNAT->insertItem(i18n("Cisco UDP (default)"), NAT_MODE_CISCO); - _vpncWidget->cboNAT->insertItem(i18n("NAT-T"), NAT_MODE_NATT); - _vpncWidget->cboNAT->insertItem(i18n("Disabled"), NAT_MODE_DISABLED); - - this->languageChange(); -} - -VPNCConfig::~VPNCConfig() -{ - -} - -void VPNCConfig::languageChange() -{ - -} - -int VPNCConfig::getFileConfig(char *parameter, char *line) { - int i; - - if (strstr(line, parameter) != NULL) { - if ((strstr(line, parameter) - line) == 0) { - for (i=0; i<(strlen(line)-strlen(parameter));i++) { - linedata[i] = line[i+strlen(parameter)]; - if ((linedata[i] == 10) || (linedata[i] == 13)) { - linedata[i] = 0; - } - } - linedata[i-1]=0; - - return 0; - } - else { - return 1; - } - } - else { - return 1; - } -} - -void VPNCConfig::pcfImport() -{ - const TQString& pcf_file = TQString(_vpncWidget->editPCF->url()); - printf("Asked for PCF import from file %s\n\r", pcf_file.ascii()); - int i; - - FILE *file = fopen ( pcf_file.ascii(), "r" ); - if ( file != NULL ) { - char line [2048]; // or other suitable maximum line size - // read a line - while ( fgets ( line, sizeof line, file ) != NULL ) { - // Parse the line and update global variables (current line in variable "line") - if (getFileConfig("Host=", line) == 0) { - //strdup(linedata) - printf("Got configuration parameter Host with data %s\n\r", linedata); - _vpncWidget->IPSec_gateway->setText(linedata); - } - if (getFileConfig("GroupName=", line) == 0) { - printf("Got configuration parameter GroupName with data %s\n\r", linedata); - _vpncWidget->IPSec_ID->setText(linedata); - } -// if (getFileConfig("TcpTunnelingPort=", line) == 0) { -// printf("Got configuration parameter TcpTunnelingPort with data %s\n\r", linedata); -// _vpncWidget->IPSec_ID->setText(linedata); -// } - if (getFileConfig("NTDomain=", line) == 0) { - if (strlen(linedata) > 0) { - printf("Got configuration parameter NTDomain with data %s\n\r", linedata); - _vpncWidget->Domain->setText(linedata); - _vpncWidget->chkUseDomain->setChecked(true); - } - } - if (getFileConfig("GroupPwd=", line) == 0) { - if (strlen(linedata) > 0) { - printf("Got configuration parameter GroupPwd with data %s\n\r", linedata); - KMessageBox::information(this, TQString("Your group password is: %1\n\r\n\rYou will need this information when you log on").arg(linedata)); - } - } - if (getFileConfig("enc_GroupPwd=", line) == 0) { - if (strlen(linedata) > 0) { - printf("Got configuration parameter enc_GroupPwd with data %s\n\r", linedata); - - // Decrypt the obfusticated password with /usr/lib/vpnc/cisco-decrypt - string decryptcommand="/usr/lib/vpnc/cisco-decrypt "; - FILE *pipe_decrypt; - char decrypted_result[2048]; - int i; - - decryptcommand.append(linedata); - printf("Group password decrypt command: %s\n\r", decryptcommand.c_str()); - if ((pipe_decrypt = popen(decryptcommand.c_str(), "r")) == NULL) - { - printf("Group password decrypt error\n\r"); - } - else { - fgets(decrypted_result, 2048, pipe_decrypt); - pclose(pipe_decrypt); - for (i=0;i<2048;i++) { - if (decrypted_result[i] == 0) { - decrypted_result[i-1]=0; - i=2048; - } - } - printf("Group password decrypt result: '%s'\n\r", decrypted_result); - } - KMessageBox::information(this, TQString("Your group password is: %1\n\r\n\rYou will need this information when you log on").arg(decrypted_result)); - } - } - } - fclose ( file ); - } - else - { - //printf("[WARN] Unable to open configuration file %s\n\r", pcf_file.ascii()); - KMessageBox::error(this, i18n("That configuration file does not exist!")); - } -} - -void VPNCConfig::setVPNData(const TQStringList& routes, const TQMap& properties) -{ - // fill up our inputfields (only textfields atm) - for(TQMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) - { - TQString entry = it.key(); - TQString value = it.data(); - - if (entry == "IPSec gateway") - { - _vpncWidget->IPSec_gateway->setText(value); - } - else if (entry == "IPSec ID") - { - _vpncWidget->IPSec_ID->setText(value); - } - else if (entry == "Xauth username") - { - _vpncWidget->Xauth_username->setText(value); - //_vpncWidget->chkOverrideUsername->setChecked(true); - } - else if (entry == "Domain") - { - _vpncWidget->Domain->setText(value); - _vpncWidget->chkUseDomain->setChecked(true); - } - else if (entry == "NAT-Keepalive packet interval") - { - _vpncWidget->nat_keep_alive_interval->setText(value); - _vpncWidget->chkUseKeepAlive->setChecked(true); - } - // backwards compatibility - else if (entry == "Disable NAT Traversal") - { - _vpncWidget->cboNAT->setCurrentItem(NAT_MODE_DISABLED); - } - else if (entry == "NAT Traversal Mode") - { - if (value == "natt") - _vpncWidget->cboNAT->setCurrentItem(NAT_MODE_NATT); - else if (value == "cisco-udp") - _vpncWidget->cboNAT->setCurrentItem(NAT_MODE_CISCO); - else if (value == "none") - _vpncWidget->cboNAT->setCurrentItem(NAT_MODE_DISABLED); - else - { - // FIXME: unknown NAT mode - } - } - else if (entry == "Enable Single DES") - { - _vpncWidget->chkSingleDES->setChecked(value == "yes" || value == "true"); - } - } - - // set routes - if (!routes.empty()) - { - _vpncWidget->chkIPAdresses->setChecked(true); - _vpncWidget->routes->setText(routes.join(" ")); - } -} - -TQMap VPNCConfig::getVPNProperties() -{ - // build a StingList of properties - TQMap strlist; - strlist.insert("IPSec gateway", TQString(_vpncWidget->IPSec_gateway->text())); - strlist.insert("IPSec ID", TQString(_vpncWidget->IPSec_ID->text())); - - //if (_vpncWidget->chkOverrideUsername->isChecked()) - strlist.insert("Xauth username", TQString(_vpncWidget->Xauth_username->text())); - - if (_vpncWidget->chkUseDomain->isChecked()) - strlist.insert("Domain", TQString(_vpncWidget->Domain->text())); - - if (_vpncWidget->chkUseKeepAlive->isChecked()) - strlist.insert("NAT-Keepalive packet interval", TQString(_vpncWidget->nat_keep_alive_interval->text())); - - switch (_vpncWidget->cboNAT->currentItem()) - { - case NAT_MODE_CISCO: - strlist.insert("NAT Traversal Mode", "cisco-udp"); - break; - case NAT_MODE_NATT: - strlist.insert("NAT Traversal Mode", "natt"); - break; - case NAT_MODE_DISABLED: - default: - strlist.insert("NAT Traversal Mode", "none"); - break; - } - - if (_vpncWidget->chkSingleDES->isChecked()) - strlist.insert("Enable Single DES", "yes"); - else - strlist.insert("Enable Single DES", "no"); - - return strlist; -} - -TQStringList VPNCConfig::getVPNRoutes() -{ - TQStringList strlist; - if(_vpncWidget->chkIPAdresses->isChecked()) - { - strlist = TQStringList::split(" ", _vpncWidget->routes->text()); - } - return strlist; - -} - -bool VPNCConfig::hasChanged() -{ - return true; -} - -bool VPNCConfig::isValid(TQStringList& err_msg) -{ - bool retval = true; - if(_vpncWidget->IPSec_gateway->text() == "" || _vpncWidget->IPSec_ID->text() == "") - { - err_msg.append(i18n("At least the gateway and group has to be supplied.")); - retval = false; - } - return retval; -} - -VPNCAuthentication::VPNCAuthentication(TQWidget* parent, char* name) - : VPNAuthenticationWidget(parent, name) -{ - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _vpncAuth = new VPNCAuthenticationWidget(this); - layout->addWidget(_vpncAuth); -} - -VPNCAuthentication::~VPNCAuthentication() -{ - -} - -TQMap VPNCAuthentication::getPasswords() -{ - TQMap pwds; - pwds.insert("Xauth password", TQString(_vpncAuth->editUserPassword->password())); - if (_vpncAuth->chkObfusticated->isChecked()) { - // Decrypt the obfusticated password with /usr/lib/vpnc/cisco-decrypt - string decryptcommand="/usr/lib/vpnc/cisco-decrypt "; - FILE *pipe_decrypt; - char decrypted_result[2048]; - int i; - - decryptcommand.append(_vpncAuth->editGroupPassword->password()); - printf("Group password decrypt command: %s\n\r", decryptcommand.c_str()); - if ((pipe_decrypt = popen(decryptcommand.c_str(), "r")) == NULL) - { - printf("Group password decrypt error\n\r"); - } - else { - fgets(decrypted_result, 2048, pipe_decrypt); - pclose(pipe_decrypt); - for (i=0;i<2048;i++) { - if (decrypted_result[i] == 0) { - decrypted_result[i-1]=0; - i=2048; - } - } - printf("Group password decrypt result: '%s'\n\r", decrypted_result); - pwds.insert("IPSec secret", TQString(decrypted_result)); - } - } - else { - pwds.insert("IPSec secret", TQString(_vpncAuth->editGroupPassword->password())); - } - return pwds; -} - -void VPNCAuthentication::setPasswords(TQString name, TQString value) { - if (name == TQString("Xauth password")) { - _vpncAuth->editUserPassword->erase(); - _vpncAuth->editUserPassword->insert(value); - } - else if (name == TQString("IPSec secret")) { - _vpncAuth->editGroupPassword->erase(); - _vpncAuth->editGroupPassword->insert(value); - } -} \ No newline at end of file diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h b/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h deleted file mode 100644 index 0b3b23c..0000000 --- a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-vpnc.h - A NetworkManager frontend for TDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * Author: Timothy Pearson - * - * 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_VPNC_H -#define KNETWORKMANAGER_VPNC_H - -#include -#include -#include -#include - -#include "knetworkmanager-vpnplugin.h" -#include "vpncprop.h" -#include "vpncauth.h" - -class VPNCPlugin : public VPNPlugin -{ - Q_OBJECT - - public: - VPNCPlugin(TQObject*, const char*, const TQStringList&); - ~VPNCPlugin(); - - VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0); - VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0); -}; - -class VPNCConfig : public VPNConfigWidget -{ - Q_OBJECT - - public: - void setVPNData(TDENetworkSingleRouteConfigurationList&, TDENetworkSettingsMap&, TDENetworkSettingsMap&); - TDENetworkSettingsMap getVPNProperties(); - TDENetworkSettingsMap getVPNSecrets(); - TQStringList getVPNRoutes(); - bool hasChanged(); - bool isValid(TQStringList&); - - VPNCConfig(TQWidget* parent); - ~VPNCConfig(); - - public slots: - void pcfImport(); - - private: - VPNCConfigWidget* _vpncWidget; - int getFileConfig(char *parameter, char *line); - - protected slots: - void languageChange(); -}; - -class VPNCAuthentication : public VPNAuthenticationWidget -{ - Q_OBJECT - - public: - VPNCAuthentication(TQWidget* parent = NULL, char* name = NULL); - ~VPNCAuthentication(); - TDENetworkSettingsMap getPasswords(); - void setPasswords(TDENetworkSettingsMap secrets); - - private: - VPNCAuthenticationWidget* _vpncAuth; -}; - -#endif /* KNETWORKMANAGER_VPNC_H */ diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp new file mode 100644 index 0000000..aff389b --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp @@ -0,0 +1,403 @@ +/*************************************************************************** + * + * tdenetman-vpnc.cpp - A NetworkManager frontend for TDE + * + * Copyright (C) 2006 Novell, Inc. + * Copyright (C) 2012 Timothy Pearson + * + * Author: Helmut Schaa , + * Author: Timothy Pearson + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tdenetman-vpnc.h" +using namespace std; + +typedef KGenericFactory VPNCPluginFactory; +K_EXPORT_COMPONENT_FACTORY( knetworkmanager_vpnc, VPNCPluginFactory("knetworkmanager_vpnc")); + +#define NAT_MODE_CISCO 0 +#define NAT_MODE_NATT 1 +#define NAT_MODE_DISABLED 2 + +char linedata [2048]; + +VPNCPlugin::VPNCPlugin(TQObject* parent, const char* name, const TQStringList& args) + : VPNPlugin(parent, name, args) +{ + KLocale* loc = KGlobal::locale(); + loc->insertCatalogue("NetworkManager-vpnc"); +} + +VPNCPlugin::~VPNCPlugin() +{ + +} + +VPNConfigWidget* VPNCPlugin::CreateConfigWidget(TQWidget* parent) +{ + return new VPNCConfig(parent); +} + +VPNAuthenticationWidget* VPNCPlugin::CreateAuthenticationWidget(TQWidget* parent) +{ + return new VPNCAuthentication(parent); +} + + +VPNCConfig::VPNCConfig(TQWidget* parent) + : VPNConfigWidget(parent) +{ + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _vpncWidget = new VPNCConfigWidget(this); + layout->addWidget(_vpncWidget); + + connect(_vpncWidget->pcfImport, TQT_SIGNAL(clicked()), this, TQT_SLOT( pcfImport()) ); + + //connect(_vpncWidget->chkOverrideUsername, TQT_SIGNAL(toggled(bool)), _vpncWidget->Xauth_username, TQT_SLOT(setEnabled(bool))); + //connect(_vpncWidget->chkOverrideUsername, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblUsername, TQT_SLOT(setEnabled(bool))); + + connect(_vpncWidget->chkUseDomain, TQT_SIGNAL(toggled(bool)), _vpncWidget->Domain, TQT_SLOT(setEnabled(bool))); + connect(_vpncWidget->chkUseDomain, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblDomain, TQT_SLOT(setEnabled(bool))); + + connect(_vpncWidget->chkIPAdresses, TQT_SIGNAL(toggled(bool)), _vpncWidget->routes, TQT_SLOT(setEnabled(bool))); + + connect(_vpncWidget->chkUseKeepAlive, TQT_SIGNAL(toggled(bool)), _vpncWidget->nat_keep_alive_interval, TQT_SLOT(setEnabled(bool))); + connect(_vpncWidget->chkUseKeepAlive, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblKeepAliveInterval, TQT_SLOT(setEnabled(bool))); + + _vpncWidget->cboNAT->insertItem(i18n("Cisco UDP (default)"), NAT_MODE_CISCO); + _vpncWidget->cboNAT->insertItem(i18n("NAT-T"), NAT_MODE_NATT); + _vpncWidget->cboNAT->insertItem(i18n("Disabled"), NAT_MODE_DISABLED); + + this->languageChange(); +} + +VPNCConfig::~VPNCConfig() +{ + +} + +void VPNCConfig::languageChange() +{ + +} + +int VPNCConfig::getFileConfig(char *parameter, char *line) { + int i; + + if (strstr(line, parameter) != NULL) { + if ((strstr(line, parameter) - line) == 0) { + for (i=0; i<(strlen(line)-strlen(parameter));i++) { + linedata[i] = line[i+strlen(parameter)]; + if ((linedata[i] == 10) || (linedata[i] == 13)) { + linedata[i] = 0; + } + } + linedata[i-1]=0; + + return 0; + } + else { + return 1; + } + } + else { + return 1; + } +} + +void VPNCConfig::pcfImport() +{ + const TQString& pcf_file = TQString(_vpncWidget->editPCF->url()); + printf("Asked for PCF import from file %s\n\r", pcf_file.ascii()); + int i; + + FILE *file = fopen ( pcf_file.ascii(), "r" ); + if ( file != NULL ) { + char line [2048]; // or other suitable maximum line size + // read a line + while ( fgets ( line, sizeof line, file ) != NULL ) { + // Parse the line and update global variables (current line in variable "line") + if (getFileConfig("Host=", line) == 0) { + //strdup(linedata) + printf("Got configuration parameter Host with data %s\n\r", linedata); + _vpncWidget->IPSec_gateway->setText(linedata); + } + if (getFileConfig("GroupName=", line) == 0) { + printf("Got configuration parameter GroupName with data %s\n\r", linedata); + _vpncWidget->IPSec_ID->setText(linedata); + } +// if (getFileConfig("TcpTunnelingPort=", line) == 0) { +// printf("Got configuration parameter TcpTunnelingPort with data %s\n\r", linedata); +// _vpncWidget->IPSec_ID->setText(linedata); +// } + if (getFileConfig("NTDomain=", line) == 0) { + if (strlen(linedata) > 0) { + printf("Got configuration parameter NTDomain with data %s\n\r", linedata); + _vpncWidget->Domain->setText(linedata); + _vpncWidget->chkUseDomain->setChecked(true); + } + } + if (getFileConfig("GroupPwd=", line) == 0) { + if (strlen(linedata) > 0) { + printf("Got configuration parameter GroupPwd with data %s\n\r", linedata); + KMessageBox::information(this, TQString("Your group password is: %1\n\r\n\rYou will need this information when you log on").arg(linedata)); + } + } + if (getFileConfig("enc_GroupPwd=", line) == 0) { + if (strlen(linedata) > 0) { + printf("Got configuration parameter enc_GroupPwd with data %s\n\r", linedata); + + // Decrypt the obfusticated password with /usr/lib/vpnc/cisco-decrypt + string decryptcommand="/usr/lib/vpnc/cisco-decrypt "; + FILE *pipe_decrypt; + char decrypted_result[2048]; + int i; + + decryptcommand.append(linedata); + printf("Group password decrypt command: %s\n\r", decryptcommand.c_str()); + if ((pipe_decrypt = popen(decryptcommand.c_str(), "r")) == NULL) + { + printf("Group password decrypt error\n\r"); + } + else { + fgets(decrypted_result, 2048, pipe_decrypt); + pclose(pipe_decrypt); + for (i=0;i<2048;i++) { + if (decrypted_result[i] == 0) { + decrypted_result[i-1]=0; + i=2048; + } + } + printf("Group password decrypt result: '%s'\n\r", decrypted_result); + } + KMessageBox::information(this, TQString("Your group password is: %1\n\r\n\rYou will need this information when you log on").arg(decrypted_result)); + } + } + } + fclose ( file ); + } + else + { + //printf("[WARN] Unable to open configuration file %s\n\r", pcf_file.ascii()); + KMessageBox::error(this, i18n("That configuration file does not exist!")); + } +} + +void VPNCConfig::setVPNData(const TQStringList& routes, const TQMap& properties) +{ + // fill up our inputfields (only textfields atm) + for(TQMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) + { + TQString entry = it.key(); + TQString value = it.data(); + + if (entry == "IPSec gateway") + { + _vpncWidget->IPSec_gateway->setText(value); + } + else if (entry == "IPSec ID") + { + _vpncWidget->IPSec_ID->setText(value); + } + else if (entry == "Xauth username") + { + _vpncWidget->Xauth_username->setText(value); + //_vpncWidget->chkOverrideUsername->setChecked(true); + } + else if (entry == "Domain") + { + _vpncWidget->Domain->setText(value); + _vpncWidget->chkUseDomain->setChecked(true); + } + else if (entry == "NAT-Keepalive packet interval") + { + _vpncWidget->nat_keep_alive_interval->setText(value); + _vpncWidget->chkUseKeepAlive->setChecked(true); + } + // backwards compatibility + else if (entry == "Disable NAT Traversal") + { + _vpncWidget->cboNAT->setCurrentItem(NAT_MODE_DISABLED); + } + else if (entry == "NAT Traversal Mode") + { + if (value == "natt") + _vpncWidget->cboNAT->setCurrentItem(NAT_MODE_NATT); + else if (value == "cisco-udp") + _vpncWidget->cboNAT->setCurrentItem(NAT_MODE_CISCO); + else if (value == "none") + _vpncWidget->cboNAT->setCurrentItem(NAT_MODE_DISABLED); + else + { + // FIXME: unknown NAT mode + } + } + else if (entry == "Enable Single DES") + { + _vpncWidget->chkSingleDES->setChecked(value == "yes" || value == "true"); + } + } + + // set routes + if (!routes.empty()) + { + _vpncWidget->chkIPAdresses->setChecked(true); + _vpncWidget->routes->setText(routes.join(" ")); + } +} + +TQMap VPNCConfig::getVPNProperties() +{ + // build a StingList of properties + TQMap strlist; + strlist.insert("IPSec gateway", TQString(_vpncWidget->IPSec_gateway->text())); + strlist.insert("IPSec ID", TQString(_vpncWidget->IPSec_ID->text())); + + //if (_vpncWidget->chkOverrideUsername->isChecked()) + strlist.insert("Xauth username", TQString(_vpncWidget->Xauth_username->text())); + + if (_vpncWidget->chkUseDomain->isChecked()) + strlist.insert("Domain", TQString(_vpncWidget->Domain->text())); + + if (_vpncWidget->chkUseKeepAlive->isChecked()) + strlist.insert("NAT-Keepalive packet interval", TQString(_vpncWidget->nat_keep_alive_interval->text())); + + switch (_vpncWidget->cboNAT->currentItem()) + { + case NAT_MODE_CISCO: + strlist.insert("NAT Traversal Mode", "cisco-udp"); + break; + case NAT_MODE_NATT: + strlist.insert("NAT Traversal Mode", "natt"); + break; + case NAT_MODE_DISABLED: + default: + strlist.insert("NAT Traversal Mode", "none"); + break; + } + + if (_vpncWidget->chkSingleDES->isChecked()) + strlist.insert("Enable Single DES", "yes"); + else + strlist.insert("Enable Single DES", "no"); + + return strlist; +} + +TQStringList VPNCConfig::getVPNRoutes() +{ + TQStringList strlist; + if(_vpncWidget->chkIPAdresses->isChecked()) + { + strlist = TQStringList::split(" ", _vpncWidget->routes->text()); + } + return strlist; + +} + +bool VPNCConfig::hasChanged() +{ + return true; +} + +bool VPNCConfig::isValid(TQStringList& err_msg) +{ + bool retval = true; + if(_vpncWidget->IPSec_gateway->text() == "" || _vpncWidget->IPSec_ID->text() == "") + { + err_msg.append(i18n("At least the gateway and group has to be supplied.")); + retval = false; + } + return retval; +} + +VPNCAuthentication::VPNCAuthentication(TQWidget* parent, char* name) + : VPNAuthenticationWidget(parent, name) +{ + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _vpncAuth = new VPNCAuthenticationWidget(this); + layout->addWidget(_vpncAuth); +} + +VPNCAuthentication::~VPNCAuthentication() +{ + +} + +TQMap VPNCAuthentication::getPasswords() +{ + TQMap pwds; + pwds.insert("Xauth password", TQString(_vpncAuth->editUserPassword->password())); + if (_vpncAuth->chkObfusticated->isChecked()) { + // Decrypt the obfusticated password with /usr/lib/vpnc/cisco-decrypt + string decryptcommand="/usr/lib/vpnc/cisco-decrypt "; + FILE *pipe_decrypt; + char decrypted_result[2048]; + int i; + + decryptcommand.append(_vpncAuth->editGroupPassword->password()); + printf("Group password decrypt command: %s\n\r", decryptcommand.c_str()); + if ((pipe_decrypt = popen(decryptcommand.c_str(), "r")) == NULL) + { + printf("Group password decrypt error\n\r"); + } + else { + fgets(decrypted_result, 2048, pipe_decrypt); + pclose(pipe_decrypt); + for (i=0;i<2048;i++) { + if (decrypted_result[i] == 0) { + decrypted_result[i-1]=0; + i=2048; + } + } + printf("Group password decrypt result: '%s'\n\r", decrypted_result); + pwds.insert("IPSec secret", TQString(decrypted_result)); + } + } + else { + pwds.insert("IPSec secret", TQString(_vpncAuth->editGroupPassword->password())); + } + return pwds; +} + +void VPNCAuthentication::setPasswords(TQString name, TQString value) { + if (name == TQString("Xauth password")) { + _vpncAuth->editUserPassword->erase(); + _vpncAuth->editUserPassword->insert(value); + } + else if (name == TQString("IPSec secret")) { + _vpncAuth->editGroupPassword->erase(); + _vpncAuth->editGroupPassword->insert(value); + } +} diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h new file mode 100644 index 0000000..0b3b23c --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h @@ -0,0 +1,90 @@ +/*************************************************************************** + * + * knetworkmanager-vpnc.h - A NetworkManager frontend for TDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * Author: Timothy Pearson + * + * 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_VPNC_H +#define KNETWORKMANAGER_VPNC_H + +#include +#include +#include +#include + +#include "knetworkmanager-vpnplugin.h" +#include "vpncprop.h" +#include "vpncauth.h" + +class VPNCPlugin : public VPNPlugin +{ + Q_OBJECT + + public: + VPNCPlugin(TQObject*, const char*, const TQStringList&); + ~VPNCPlugin(); + + VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0); + VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0); +}; + +class VPNCConfig : public VPNConfigWidget +{ + Q_OBJECT + + public: + void setVPNData(TDENetworkSingleRouteConfigurationList&, TDENetworkSettingsMap&, TDENetworkSettingsMap&); + TDENetworkSettingsMap getVPNProperties(); + TDENetworkSettingsMap getVPNSecrets(); + TQStringList getVPNRoutes(); + bool hasChanged(); + bool isValid(TQStringList&); + + VPNCConfig(TQWidget* parent); + ~VPNCConfig(); + + public slots: + void pcfImport(); + + private: + VPNCConfigWidget* _vpncWidget; + int getFileConfig(char *parameter, char *line); + + protected slots: + void languageChange(); +}; + +class VPNCAuthentication : public VPNAuthenticationWidget +{ + Q_OBJECT + + public: + VPNCAuthentication(TQWidget* parent = NULL, char* name = NULL); + ~VPNCAuthentication(); + TDENetworkSettingsMap getPasswords(); + void setPasswords(TDENetworkSettingsMap secrets); + + private: + VPNCAuthenticationWidget* _vpncAuth; +}; + +#endif /* KNETWORKMANAGER_VPNC_H */ diff --git a/tdenetworkmanager/vpn-plugins/vpnc/tdenetman_vpnc.desktop b/tdenetworkmanager/vpn-plugins/vpnc/tdenetman_vpnc.desktop new file mode 100644 index 0000000..64ad398 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/vpnc/tdenetman_vpnc.desktop @@ -0,0 +1,23 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +Icon= +ServiceTypes=TDENetworkManager/VPNPlugin +X-TDE-Library=tdenetman_vpnc +X-NetworkManager-Services=vpnc +X-TDE-PluginInfo-Author=Timothy Pearson +X-TDE-PluginInfo-Email=kb9vqf@pearsoncomputing.net +X-TDE-PluginInfo-Name=tdenetman_vpnc +X-TDE-PluginInfo-Version=0.1 +X-TDE-PluginInfo-Website= +X-TDE-PluginInfo-Category=VPNService +X-TDE-PluginInfo-Depends= +X-TDE-PluginInfo-License=GPL +X-TDE-PluginInfo-EnabledByDefault=false +Name=VPNC +Name[bn]=ভিপিএনসি +Name[xx]=xxVPNCxx +Comment=VPNC +Comment[bn]=ভিপিএনসি +Comment[xx]=xxVPNCxx + -- cgit v1.2.1 From 2027fb3d61d6d825b0f824a4f76e745ff3bb82b8 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 10 Sep 2012 15:14:13 -0500 Subject: Reactivate VPNC plugin --- tdenetworkmanager/src/tdenetman-vpnplugin.cpp | 2 +- tdenetworkmanager/src/vpn_tray_component.h | 4 + .../vpn-plugins/vpnc/src/CMakeLists.txt | 2 +- .../vpn-plugins/vpnc/src/tdenetman-vpnc.cpp | 121 ++++++++++++++------- .../vpn-plugins/vpnc/src/tdenetman-vpnc.h | 9 +- 5 files changed, 91 insertions(+), 47 deletions(-) diff --git a/tdenetworkmanager/src/tdenetman-vpnplugin.cpp b/tdenetworkmanager/src/tdenetman-vpnplugin.cpp index f95eb57..65e1b96 100644 --- a/tdenetworkmanager/src/tdenetman-vpnplugin.cpp +++ b/tdenetworkmanager/src/tdenetman-vpnplugin.cpp @@ -72,7 +72,7 @@ bool VPNConfigWidget::isValid(TQStringList& /*err_msg*/) } /****************************** -* class VPNAuthentiactionWidget +* class VPNAuthenticationWidget ******************************/ VPNAuthenticationWidget::VPNAuthenticationWidget(TQWidget* parent, const char* name) diff --git a/tdenetworkmanager/src/vpn_tray_component.h b/tdenetworkmanager/src/vpn_tray_component.h index 11107c4..3f1af35 100644 --- a/tdenetworkmanager/src/vpn_tray_component.h +++ b/tdenetworkmanager/src/vpn_tray_component.h @@ -25,6 +25,10 @@ #ifndef VPN_TRAY_COMPONENT_H #define VPN_TRAY_COMPONENT_H +// TDE includes +#include +#include + // TDENM includes #include "traycomponent.h" diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/vpnc/src/CMakeLists.txt index 25bd8ea..9c7a5d1 100644 --- a/tdenetworkmanager/vpn-plugins/vpnc/src/CMakeLists.txt +++ b/tdenetworkmanager/vpn-plugins/vpnc/src/CMakeLists.txt @@ -38,6 +38,6 @@ set( ${target}_SRCS tde_add_kpart( ${target} AUTOMOC SOURCES ${${target}_SRCS} - LINK tdeinit_kded-shared + LINK tdeinit_kded-shared tdeinit_tdenetworkmanager-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp index aff389b..d060a55 100644 --- a/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp +++ b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp @@ -44,7 +44,7 @@ using namespace std; typedef KGenericFactory VPNCPluginFactory; -K_EXPORT_COMPONENT_FACTORY( knetworkmanager_vpnc, VPNCPluginFactory("knetworkmanager_vpnc")); +K_EXPORT_COMPONENT_FACTORY( tdenetman_vpnc, VPNCPluginFactory("tdenetman_vpnc")); #define NAT_MODE_CISCO 0 #define NAT_MODE_NATT 1 @@ -112,7 +112,7 @@ void VPNCConfig::languageChange() } -int VPNCConfig::getFileConfig(char *parameter, char *line) { +int VPNCConfig::getFileConfig(const char *parameter, char *line) { int i; if (strstr(line, parameter) != NULL) { @@ -140,7 +140,6 @@ void VPNCConfig::pcfImport() { const TQString& pcf_file = TQString(_vpncWidget->editPCF->url()); printf("Asked for PCF import from file %s\n\r", pcf_file.ascii()); - int i; FILE *file = fopen ( pcf_file.ascii(), "r" ); if ( file != NULL ) { @@ -191,7 +190,9 @@ void VPNCConfig::pcfImport() printf("Group password decrypt error\n\r"); } else { - fgets(decrypted_result, 2048, pipe_decrypt); + if (fgets(decrypted_result, 2048, pipe_decrypt) == NULL) { + printf("Error reading from decryption program\n\r"); + } pclose(pipe_decrypt); for (i=0;i<2048;i++) { if (decrypted_result[i] == 0) { @@ -214,11 +215,13 @@ void VPNCConfig::pcfImport() } } -void VPNCConfig::setVPNData(const TQStringList& routes, const TQMap& properties) +void VPNCConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets) { + m_vpnProperties = properties; + m_vpnSecrets = secrets; + // fill up our inputfields (only textfields atm) - for(TQMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) - { + for (TDENetworkSettingsMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) { TQString entry = it.key(); TQString value = it.data(); @@ -273,56 +276,86 @@ void VPNCConfig::setVPNData(const TQStringList& routes, const TQMapchkIPAdresses->setChecked(true); - _vpncWidget->routes->setText(routes.join(" ")); + TQStringList routesText; + for (TDENetworkSingleRouteConfigurationList::Iterator it = routes.begin(); it != routes.end(); ++it) { + routesText.append(TQString("%1/%2").arg((*it).ipAddress.toString()).arg((*it).networkMask.toCIDRMask())); + } + _vpncWidget->routes->setText(routesText.join(" ")); } } -TQMap VPNCConfig::getVPNProperties() -{ - // build a StingList of properties - TQMap strlist; - strlist.insert("IPSec gateway", TQString(_vpncWidget->IPSec_gateway->text())); - strlist.insert("IPSec ID", TQString(_vpncWidget->IPSec_ID->text())); +TDENetworkSettingsMap VPNCConfig::getVPNProperties() { + // Build a list of properties + m_vpnProperties.insert("IPSec gateway", TQString(_vpncWidget->IPSec_gateway->text())); + m_vpnProperties.insert("IPSec ID", TQString(_vpncWidget->IPSec_ID->text())); - //if (_vpncWidget->chkOverrideUsername->isChecked()) - strlist.insert("Xauth username", TQString(_vpncWidget->Xauth_username->text())); + // if (_vpncWidget->chkOverrideUsername->isChecked()) { + m_vpnProperties.insert("Xauth username", TQString(_vpncWidget->Xauth_username->text())); + // } - if (_vpncWidget->chkUseDomain->isChecked()) - strlist.insert("Domain", TQString(_vpncWidget->Domain->text())); + if (_vpncWidget->chkUseDomain->isChecked()) { + m_vpnProperties.insert("Domain", TQString(_vpncWidget->Domain->text())); + } + else { + m_vpnProperties.remove("Domain"); + } - if (_vpncWidget->chkUseKeepAlive->isChecked()) - strlist.insert("NAT-Keepalive packet interval", TQString(_vpncWidget->nat_keep_alive_interval->text())); + if (_vpncWidget->chkUseKeepAlive->isChecked()) { + m_vpnProperties.insert("NAT-Keepalive packet interval", TQString(_vpncWidget->nat_keep_alive_interval->text())); + } + else { + m_vpnProperties.remove("NAT-Keepalive packet interval"); + } - switch (_vpncWidget->cboNAT->currentItem()) - { + switch (_vpncWidget->cboNAT->currentItem()) { case NAT_MODE_CISCO: - strlist.insert("NAT Traversal Mode", "cisco-udp"); + m_vpnProperties.insert("NAT Traversal Mode", "cisco-udp"); break; case NAT_MODE_NATT: - strlist.insert("NAT Traversal Mode", "natt"); + m_vpnProperties.insert("NAT Traversal Mode", "natt"); break; case NAT_MODE_DISABLED: default: - strlist.insert("NAT Traversal Mode", "none"); + m_vpnProperties.insert("NAT Traversal Mode", "none"); break; } - if (_vpncWidget->chkSingleDES->isChecked()) - strlist.insert("Enable Single DES", "yes"); - else - strlist.insert("Enable Single DES", "no"); + if (_vpncWidget->chkSingleDES->isChecked()) { + m_vpnProperties.insert("Enable Single DES", "yes"); + } + else { + m_vpnProperties.insert("Enable Single DES", "no"); + } - return strlist; + return m_vpnProperties; } -TQStringList VPNCConfig::getVPNRoutes() +TDENetworkSettingsMap VPNCConfig::getVPNSecrets() { + // Build a list of secrets + // FIXME + + return m_vpnSecrets; +} + +TDENetworkSingleRouteConfigurationList VPNCConfig::getVPNRoutes() { + TDENetworkSingleRouteConfigurationList ret; TQStringList strlist; - if(_vpncWidget->chkIPAdresses->isChecked()) - { + if(_vpncWidget->chkIPAdresses->isChecked()) { strlist = TQStringList::split(" ", _vpncWidget->routes->text()); } - return strlist; + + for (TQStringList::Iterator it = strlist.begin(); it != strlist.end(); ++it) { + TQStringList pieces = TQStringList::split("/", (*it)); + TDENetworkSingleRouteConfiguration routeconfig; + routeconfig.ipAddress.setAddress(pieces[0]); + if (pieces.count() > 1) { + routeconfig.networkMask.fromCIDRMask(pieces[1].toUInt()); + } + ret.append(routeconfig); + } + + return ret; } @@ -355,9 +388,9 @@ VPNCAuthentication::~VPNCAuthentication() } -TQMap VPNCAuthentication::getPasswords() +TDENetworkSettingsMap VPNCAuthentication::getPasswords() { - TQMap pwds; + TDENetworkSettingsMap pwds; pwds.insert("Xauth password", TQString(_vpncAuth->editUserPassword->password())); if (_vpncAuth->chkObfusticated->isChecked()) { // Decrypt the obfusticated password with /usr/lib/vpnc/cisco-decrypt @@ -373,7 +406,9 @@ TQMap VPNCAuthentication::getPasswords() printf("Group password decrypt error\n\r"); } else { - fgets(decrypted_result, 2048, pipe_decrypt); + if (fgets(decrypted_result, 2048, pipe_decrypt) == NULL) { + printf("Error reading from decryption program\n\r"); + } pclose(pipe_decrypt); for (i=0;i<2048;i++) { if (decrypted_result[i] == 0) { @@ -391,13 +426,15 @@ TQMap VPNCAuthentication::getPasswords() return pwds; } -void VPNCAuthentication::setPasswords(TQString name, TQString value) { - if (name == TQString("Xauth password")) { +void VPNCAuthentication::setPasswords(TDENetworkSettingsMap secrets) { + if (secrets.contains("Xauth password")) { _vpncAuth->editUserPassword->erase(); - _vpncAuth->editUserPassword->insert(value); + _vpncAuth->editUserPassword->insert(secrets["Xauth password"]); } - else if (name == TQString("IPSec secret")) { + else if (secrets.contains("IPSec secret")) { _vpncAuth->editGroupPassword->erase(); - _vpncAuth->editGroupPassword->insert(value); + _vpncAuth->editGroupPassword->insert(secrets["IPSec secret"]); } } + +#include "tdenetman-vpnc.moc" \ No newline at end of file diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h index 0b3b23c..9d5e6e1 100644 --- a/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h +++ b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h @@ -31,7 +31,7 @@ #include #include -#include "knetworkmanager-vpnplugin.h" +#include "tdenetman-vpnplugin.h" #include "vpncprop.h" #include "vpncauth.h" @@ -55,7 +55,7 @@ class VPNCConfig : public VPNConfigWidget void setVPNData(TDENetworkSingleRouteConfigurationList&, TDENetworkSettingsMap&, TDENetworkSettingsMap&); TDENetworkSettingsMap getVPNProperties(); TDENetworkSettingsMap getVPNSecrets(); - TQStringList getVPNRoutes(); + TDENetworkSingleRouteConfigurationList getVPNRoutes(); bool hasChanged(); bool isValid(TQStringList&); @@ -67,7 +67,10 @@ class VPNCConfig : public VPNConfigWidget private: VPNCConfigWidget* _vpncWidget; - int getFileConfig(char *parameter, char *line); + int getFileConfig(const char *parameter, char *line); + + TDENetworkSettingsMap m_vpnProperties; + TDENetworkSettingsMap m_vpnSecrets; protected slots: void languageChange(); -- cgit v1.2.1 From 0fa003ad691b60fbcca85726f1f3651a89347044 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 10 Sep 2012 15:41:05 -0500 Subject: Fix VPN settings dialog --- tdenetworkmanager/src/configwidgets/CMakeLists.txt | 4 +- .../tdenetman-connection_setting_vpn_widget.cpp | 24 +++--- .../tdenetman-connection_setting_vpn_widget.h | 6 +- .../tdenetman-connection_settings_dialog.cpp | 11 +-- tdenetworkmanager/src/tdenetman-vpnmanager.cpp | 89 ++++++++++++++-------- 5 files changed, 78 insertions(+), 56 deletions(-) diff --git a/tdenetworkmanager/src/configwidgets/CMakeLists.txt b/tdenetworkmanager/src/configwidgets/CMakeLists.txt index 6233f98..8c9c32e 100644 --- a/tdenetworkmanager/src/configwidgets/CMakeLists.txt +++ b/tdenetworkmanager/src/configwidgets/CMakeLists.txt @@ -44,7 +44,7 @@ set( ${target}_SRCS connection_setting_wireless_security_wepencryption.ui connection_settings.ui connection_setting_wireless_security_auth.ui -# connection_setting_vpn.ui + connection_setting_vpn.ui tdenetman-connection_setting_cdma_widget.cpp tdenetman-connection_setting_gsm_widget.cpp tdenetman-connection_setting_info_widget.cpp @@ -53,7 +53,7 @@ set( ${target}_SRCS tdenetman-connection_setting_serial_widget.cpp tdenetman-connection_setting_wireless_security_widget.cpp tdenetman-connection_setting_wireless_widget.cpp -# tdenetman-connection_setting_vpn_widget.cpp + tdenetman-connection_setting_vpn_widget.cpp tdenetman-connection_setting_widget_interface.cpp tdenetman-connection_settings_dialog.cpp ) diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp index 06509ec..c4f488b 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp @@ -35,20 +35,17 @@ #include // tdenm headers -#include "tdenetman-connection.h" -#include "tdenetman-connection_setting_vpn.h" #include "tdenetman-connection_setting_vpn_widget.h" -#include "tdenetman-device.h" #include "tdenetman-vpnmanager.h" #include "tdenetman-vpnservice.h" using namespace ConnectionSettings; -VPNWidgetImpl::VPNWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl) +VPNWidgetImpl::VPNWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) , _new_conn(new_conn) { - _vpnsetting = dynamic_cast (conn->getSetting(NM_SETTING_VPN_SETTING_NAME)); + _vpnsetting = dynamic_cast(conn); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingVPNWidget(this); @@ -96,9 +93,10 @@ VPNWidgetImpl::Init() disp_name = "StrongSwan VPN"; } - // the service should not get changed when editing a connection - if (service->getService() != _vpnsetting->getServiceType() && !_new_conn) + // the service should not be changed when editing a connection + if (service->getService() != _vpnsetting->vpnPluginID && !_new_conn) { continue; + } // no special icon for this service, use default if (icon.isEmpty()) @@ -107,7 +105,7 @@ VPNWidgetImpl::Init() _mainWid->cboServices->insertItem(SmallIcon(icon, TQIconSet::Automatic), disp_name, index); _mapServiceCombo.insert(index++, *it); - if (service->getService() == _vpnsetting->getServiceType()) + if (service->getService() == _vpnsetting->vpnPluginID) { // preselect the correct service _mainWid->cboServices->setCurrentItem(index - 1); @@ -128,7 +126,7 @@ VPNWidgetImpl::Init() // update the username to the current one KUser user; - _vpnsetting->setUserName(user.loginName()); + _vpnsetting->lockedUserName = user.loginName(); // notification if VPN service is selected connect(_mainWid->cboServices, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotServiceComboActivated(int))); @@ -169,7 +167,7 @@ VPNWidgetImpl::slotServiceComboActivated(int index) VPNConfigWidget* config = getVPNConfigWidget(service); _mainWid->widgetStack->raiseWidget(config); - config->setVPNData(_vpnsetting->getRoutes(), _vpnsetting->getData()); + config->setVPNData(_vpnsetting->ipConfig.routeConfigurations, _vpnsetting->pluginData, _vpnsetting->pluginSecrets); } } else @@ -186,13 +184,15 @@ VPNWidgetImpl::Deactivate() if (service) { // set the correct service type - _vpnsetting->setServiceType(service->getService()); + _vpnsetting->vpnPluginID = service->getService(); VPNConfigWidget* config = *_mapServiceWidget.find(service); if (config) { // update the vpn properties - _vpnsetting->setData(config->getVPNProperties()); + _vpnsetting->pluginData = config->getVPNProperties(); + // update the vpn secrets + _vpnsetting->pluginSecrets = config->getVPNSecrets(); } } } diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h index ad9cfde..09efd05 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h @@ -41,14 +41,12 @@ class VPNConfigWidget; namespace ConnectionSettings { -class Connection; - class VPNWidgetImpl : public WidgetInterface { Q_OBJECT public: - VPNWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); + VPNWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); void Activate(); void Deactivate(); public slots: @@ -59,7 +57,7 @@ class VPNWidgetImpl : public WidgetInterface VPNConfigWidget* getVPNConfigWidget(VPNService* service); bool _new_conn; - VPN* _vpnsetting; + TDEVPNConnection* _vpnsetting; ConnectionSettingVPNWidget* _mainWid; TQMap _mapServiceCombo; TQMap _mapServiceWidget; diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp index 7b98819..50ac293 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp @@ -50,6 +50,7 @@ #include "tdenetman-connection_setting_wireless_security_widget.h" #include "tdenetman-connection_setting_ipv4_widget.h" #include "tdenetman-connection_setting_info_widget.h" +#include "tdenetman-connection_setting_vpn_widget.h" #include "tdenetman-wireless_network.h" #include "tdenetman-wireless_manager.h" @@ -143,8 +144,8 @@ ConnectionSettingsDialogImpl::createWidgetsForVPN(TDENetworkConnection* conn, bo { TQValueList ret; - // widgetlist for wired connection -// ret.append(new ConnectionSettings::VPNWidgetImpl(conn, new_conn, this)); + // widgetlist for virtual private connection + ret.append(new ConnectionSettings::VPNWidgetImpl(conn, new_conn, this)); ret.append(new ConnectionSettings::InfoWidgetImpl(conn, this)); return ret; @@ -221,9 +222,9 @@ ConnectionSettingsDialogImpl::createWidgetsForConnection(TDENetworkConnection* c } } } -// else if (conn->getType() == NM_SETTING_VPN_SETTING_NAME) { -// widgets = createWidgetsForVPN(conn, new_conn); -// } + else if (conn->type() == TDENetworkConnectionType::VPN) { + widgets = createWidgetsForVPN(conn, new_conn); + } else { kdWarning() << k_funcinfo << "Not handled yet" << endl; } diff --git a/tdenetworkmanager/src/tdenetman-vpnmanager.cpp b/tdenetworkmanager/src/tdenetman-vpnmanager.cpp index 1113562..aa777f1 100644 --- a/tdenetworkmanager/src/tdenetman-vpnmanager.cpp +++ b/tdenetworkmanager/src/tdenetman-vpnmanager.cpp @@ -23,8 +23,6 @@ * **************************************************************************/ -#define SERVICE_DIR "/etc/NetworkManager/VPN" - #include #include #include @@ -42,27 +40,40 @@ VPNServiceList VPNManager::getVPNServices () { VPNServiceList list; - - TQDir serviceDir(SERVICE_DIR, TQString(), TQDir::Name|TQDir::IgnoreCase, TQDir::Files); - TQStringList services = serviceDir.entryList ().grep (".name", true); - if (services.count () > 0) - { - // 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"); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkVPNTypeList availablePlugins = nm->availableVPNTypes(); - kdDebug() << "VPN Service " << kconfig->readEntry ("name", TQString()).ascii() << endl; + if (availablePlugins.count() > 0) { + // find all available services + for (TDENetworkVPNTypeList::Iterator it = availablePlugins.begin (); it != availablePlugins.end (); ++it) { + TQString serviceString; + if ((*it) == TDENetworkVPNType::OpenVPN) { + serviceString = "openvpn"; + } + else if ((*it) == TDENetworkVPNType::PPTP) { + serviceString = "pptp"; + } + else if ((*it) == TDENetworkVPNType::StrongSwan) { + serviceString = "strongswan"; + } + else if ((*it) == TDENetworkVPNType::VPNC) { + serviceString = "vpnc"; + } + if (serviceString == "") { + continue; + } + + kdDebug() << "VPN Service " << serviceString.ascii() << endl; // create new VPNService Object - VPNService* vpnservice = new VPNService(kconfig->readEntry ("name", TQString()), kconfig->readEntry ("service", TQString()), TQT_TQOBJECT(TDENetworkManager::getInstance())); - if (!vpnservice->getVPNPlugin()) + VPNService* vpnservice = new VPNService(serviceString, serviceString, TQT_TQOBJECT(TDENetworkManager::getInstance())); + if (!vpnservice->getVPNPlugin()) { delete vpnservice; - else + } + else { list.push_back(vpnservice); - delete kconfig; + } } } @@ -73,31 +84,43 @@ VPNService* VPNManager::getVPNService(TQString service_type) { VPNServiceList list; - - TQDir serviceDir(SERVICE_DIR, TQString(), TQDir::Name|TQDir::IgnoreCase, TQDir::Files); - TQStringList services = serviceDir.entryList ().grep (".name", true); - if (services.count () > 0) - { - // 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"); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkVPNTypeList availablePlugins = nm->availableVPNTypes(); - if (kconfig->readEntry ("service", TQString()) == service_type) - { + if (availablePlugins.count() > 0) { + for (TDENetworkVPNTypeList::Iterator it = availablePlugins.begin (); it != availablePlugins.end (); ++it) { + TQString serviceString; + if ((*it) == TDENetworkVPNType::OpenVPN) { + serviceString = "openvpn"; + } + else if ((*it) == TDENetworkVPNType::PPTP) { + serviceString = "pptp"; + } + else if ((*it) == TDENetworkVPNType::StrongSwan) { + serviceString = "strongswan"; + } + else if ((*it) == TDENetworkVPNType::VPNC) { + serviceString = "vpnc"; + } + if (serviceString == "") { + continue; + } + + if (serviceString == service_type) { // create new VPNService Object - VPNService* vpnservice = new VPNService(kconfig->readEntry ("name", TQString()), kconfig->readEntry ("service", TQString()), TQT_TQOBJECT(TDENetworkManager::getInstance())); - if (!vpnservice->getVPNPlugin()) + VPNService* vpnservice = new VPNService(service_type, service_type, TQT_TQOBJECT(TDENetworkManager::getInstance())); + if (!vpnservice->getVPNPlugin()) { delete vpnservice; - else + } + else { return vpnservice; + } } } } - return NULL; + return NULL; } #include "tdenetman-vpnmanager.moc" -- cgit v1.2.1 From 3c57e87e071472d32b70090f8a11a9df08c1c461 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 10 Sep 2012 16:03:14 -0500 Subject: Reactivate PPTP plugin --- tdenetworkmanager/vpn-plugins/CMakeLists.txt | 2 +- tdenetworkmanager/vpn-plugins/pptp/AUTHORS | 1 + tdenetworkmanager/vpn-plugins/pptp/CMakeLists.txt | 14 ++ .../vpn-plugins/pptp/knetworkmanager_pptp.desktop | 23 -- .../vpn-plugins/pptp/src/CMakeLists.txt | 43 ++++ .../vpn-plugins/pptp/src/knetworkmanager-pptp.cpp | 231 ------------------- .../vpn-plugins/pptp/src/knetworkmanager-pptp.h | 84 ------- .../vpn-plugins/pptp/src/tdenetman-pptp.cpp | 254 +++++++++++++++++++++ .../vpn-plugins/pptp/src/tdenetman-pptp.h | 88 +++++++ .../vpn-plugins/pptp/tdenetman_pptp.desktop | 23 ++ .../vpn-plugins/vpnc/src/tdenetman-vpnc.cpp | 3 +- .../vpn-plugins/vpnc/src/tdenetman-vpnc.h | 2 +- 12 files changed, 426 insertions(+), 342 deletions(-) create mode 100644 tdenetworkmanager/vpn-plugins/pptp/CMakeLists.txt delete mode 100644 tdenetworkmanager/vpn-plugins/pptp/knetworkmanager_pptp.desktop create mode 100644 tdenetworkmanager/vpn-plugins/pptp/src/CMakeLists.txt delete mode 100644 tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp delete mode 100644 tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.h create mode 100644 tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-pptp.cpp create mode 100644 tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-pptp.h create mode 100644 tdenetworkmanager/vpn-plugins/pptp/tdenetman_pptp.desktop diff --git a/tdenetworkmanager/vpn-plugins/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/CMakeLists.txt index aa31dbf..6e10d60 100644 --- a/tdenetworkmanager/vpn-plugins/CMakeLists.txt +++ b/tdenetworkmanager/vpn-plugins/CMakeLists.txt @@ -10,6 +10,6 @@ ################################################# # add_subdirectory( openvpn ) -# add_subdirectory( pptp ) +add_subdirectory( pptp ) # add_subdirectory( strongswan ) add_subdirectory( vpnc ) diff --git a/tdenetworkmanager/vpn-plugins/pptp/AUTHORS b/tdenetworkmanager/vpn-plugins/pptp/AUTHORS index 17bdf96..93dbeb8 100644 --- a/tdenetworkmanager/vpn-plugins/pptp/AUTHORS +++ b/tdenetworkmanager/vpn-plugins/pptp/AUTHORS @@ -1 +1,2 @@ +Timothy Pearson Helmut Schaa , diff --git a/tdenetworkmanager/vpn-plugins/pptp/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/pptp/CMakeLists.txt new file mode 100644 index 0000000..323bc89 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/pptp/CMakeLists.txt @@ -0,0 +1,14 @@ +################################################# +# +# (C) 2012 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( src ) + +install( FILES tdenetman_pptp.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) diff --git a/tdenetworkmanager/vpn-plugins/pptp/knetworkmanager_pptp.desktop b/tdenetworkmanager/vpn-plugins/pptp/knetworkmanager_pptp.desktop deleted file mode 100644 index bbc0b4b..0000000 --- a/tdenetworkmanager/vpn-plugins/pptp/knetworkmanager_pptp.desktop +++ /dev/null @@ -1,23 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Type=Service -Icon= -ServiceTypes=TDENetworkManager/VPNPlugin -X-TDE-Library=knetworkmanager_pptp -X-NetworkManager-Services=pptp -X-TDE-PluginInfo-Author=Helmut Schaa -X-TDE-PluginInfo-Email=hschaa@suse.de -X-TDE-PluginInfo-Name=knetworkmanager_pptp -X-TDE-PluginInfo-Version=0.1 -X-TDE-PluginInfo-Website= -X-TDE-PluginInfo-Category=VPNService -X-TDE-PluginInfo-Depends= -X-TDE-PluginInfo-License=GPL -X-TDE-PluginInfo-EnabledByDefault=false -Name=PPTP -Name[bn]=পিপিটিপি -Name[xx]=xxPPTPxx -Comment=PPTP -Comment[bn]=পিপিটিপি -Comment[xx]=xxPPTPxx - diff --git a/tdenetworkmanager/vpn-plugins/pptp/src/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/pptp/src/CMakeLists.txt new file mode 100644 index 0000000..fa1c6e0 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/pptp/src/CMakeLists.txt @@ -0,0 +1,43 @@ +################################################# +# +# (C) 2012 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_definitions( -UQT_NO_ASCII_CAST ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/tdenetworkmanager/src/settings + ${CMAKE_SOURCE_DIR}/tdenetworkmanager/src/configwidgets + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${DBUS_TQT_INCLUDE_DIRS} + ${NM_UTIL_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + +##### tdenetman_pptp (module) ################### + +set( target tdenetman_pptp ) + +set( ${target}_SRCS + tdenetman-pptp.cpp + pptpprop.ui + pptpauth.ui +) + +tde_add_kpart( ${target} AUTOMOC + SOURCES ${${target}_SRCS} + LINK tdeinit_kded-shared tdeinit_tdenetworkmanager-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp b/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp deleted file mode 100644 index e8180d1..0000000 --- a/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-pptp.cpp - A NetworkManager frontend for TDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "knetworkmanager-pptp.h" - -typedef KGenericFactory PPTPPluginFactory; -K_EXPORT_COMPONENT_FACTORY( knetworkmanager_pptp, PPTPPluginFactory("knetworkmanager_pptp")); - - -PPTPPlugin::PPTPPlugin(TQObject* parent, const char* name, const TQStringList& args) - : VPNPlugin(parent, name, args) -{ - KLocale* loc = KGlobal::locale(); - loc->insertCatalogue("NetworkManager-pptp"); -} - -PPTPPlugin::~PPTPPlugin() -{ - -} - -VPNConfigWidget* PPTPPlugin::CreateConfigWidget(TQWidget* parent) -{ - return new PPTPConfig(parent); -} - -VPNAuthenticationWidget* PPTPPlugin::CreateAuthenticationWidget(TQWidget* parent) -{ - return new PPTPAuthentication(parent); -} - - -PPTPConfig::PPTPConfig(TQWidget* parent) - : VPNConfigWidget(parent) -{ - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _pptpWidget = new PPTPConfigWidget(this); - layout->addWidget(_pptpWidget); - - connect(_pptpWidget->chkIPAdresses, TQT_SIGNAL(toggled(bool)), _pptpWidget->routes, TQT_SLOT(setEnabled(bool))); - - this->languageChange(); -} - -PPTPConfig::~PPTPConfig() -{ - -} - -void PPTPConfig::languageChange() -{ - -} - -void PPTPConfig::setVPNData(const TQStringList& routes, const TQMap& properties) -{ - // fill up our inputfields (only textfields atm) - for(TQMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) - { - TQString entry = it.key(); - TQString value = it.data(); - - if (entry == "gateway") - { - _pptpWidget->gateway->setText(value); - } - else if (entry == "refuse-eap") - { - _pptpWidget->chk_refuseeap->setChecked(value == "yes" || value == "true"); - } - else if (entry == "refuse-pap") - { - _pptpWidget->chk_refusepap->setChecked(value == "yes" || value == "true"); - } - else if (entry == "refuse-chap") - { - _pptpWidget->chk_refusechap->setChecked(value == "yes" || value == "true"); - } - else if (entry == "refuse-mschap") - { - _pptpWidget->chk_refusemschap->setChecked(value == "yes" || value == "true"); - } - else if (entry == "refuse-mschapv2") - { - _pptpWidget->chk_refusemschapv2->setChecked(value == "yes" || value == "true"); - } - else if (entry == "require-mppe") - { - _pptpWidget->chk_requiremppe->setChecked(value == "yes" || value == "true"); - } - else if (entry == "require-mppe-40") - { - _pptpWidget->chk_requiremppe40->setChecked(value == "yes" || value == "true"); - } - else if (entry == "require-mppe-128") - { - _pptpWidget->chk_requiremppe128->setChecked(value == "yes" || value == "true"); - } - else if (entry == "mppe-stateful") - { - _pptpWidget->chk_mppestateful->setChecked(value == "yes" || value == "true"); - } - else if (entry == "nodeflate") - { - _pptpWidget->chk_nodeflate->setChecked(value == "yes" || value == "true"); - } - } - - // set routes - if (!routes.empty()) - { - _pptpWidget->chkIPAdresses->setChecked(true); - _pptpWidget->routes->setText(routes.join(" ")); - } -} - -TQMap PPTPConfig::getVPNProperties() -{ - // build a StingList of properties - TQMap strlist; - strlist.insert("gateway", TQString(_pptpWidget->gateway->text())); - strlist.insert("refuse-eap", TQString(_pptpWidget->chk_refuseeap->isChecked() ? "yes" : "no")); - strlist.insert("refuse-pap", TQString(_pptpWidget->chk_refusepap->isChecked() ? "yes" : "no")); - strlist.insert("refuse-chap", TQString(_pptpWidget->chk_refusechap->isChecked() ? "yes" : "no")); - strlist.insert("refuse-mschap", TQString(_pptpWidget->chk_refusemschap->isChecked() ? "yes" : "no")); - strlist.insert("refuse-mschapv2", TQString(_pptpWidget->chk_refusemschapv2->isChecked() ? "yes" : "no")); - strlist.insert("require-mppe", TQString(_pptpWidget->chk_requiremppe->isChecked() ? "yes" : "no")); - strlist.insert("require-mppe-40", TQString(_pptpWidget->chk_requiremppe40->isChecked() ? "yes" : "no")); - strlist.insert("require-mppe-128", TQString(_pptpWidget->chk_requiremppe128->isChecked() ? "yes" : "no")); - strlist.insert("mppe-stateful", TQString(_pptpWidget->chk_mppestateful->isChecked() ? "yes" : "no")); - strlist.insert("nodeflate", TQString(_pptpWidget->chk_nodeflate->isChecked() ? "yes" : "no")); - - // Current network-manager-pptp plugin supports bluetooth-gprs,dialup and pptp. - // We want a pptp connection. - //strlist.insert("ppp-connection-type", "pptp"); - - return strlist; -} - -TQStringList PPTPConfig::getVPNRoutes() -{ - TQStringList strlist; - if(_pptpWidget->chkIPAdresses->isChecked()) - { - strlist = TQStringList::split(" ", _pptpWidget->routes->text()); - } - return strlist; - -} - -bool PPTPConfig::hasChanged() -{ - return true; -} - -bool PPTPConfig::isValid(TQStringList& err_msg) -{ - bool retval = true; - if(_pptpWidget->gateway->text() == "") - { - err_msg.append(i18n("At least the gateway has to be supplied.")); - retval = false; - } - return retval; -} - -PPTPAuthentication::PPTPAuthentication(TQWidget* parent, char* name) - : VPNAuthenticationWidget(parent, name) -{ - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _pptpAuth = new PPTPAuthenticationWidget(this); - layout->addWidget(_pptpAuth); -} - -PPTPAuthentication::~PPTPAuthentication() -{ - -} - -TQMap PPTPAuthentication::getPasswords() -{ - // network-manager-pptp will fail hard if "CHAP" is not the - // first element in the username&password list. - TQMap pwds; - //pwds.insert("CHAP", "CHAP"); - pwds.insert("user", TQString(_pptpAuth->username->text())); - pwds.insert("password", TQString(_pptpAuth->password->password())); - pwds.insert("domain", TQString(_pptpAuth->domain->text())); - return pwds; -} - -void PPTPAuthentication::setPasswords(TQString name, TQString value) { - if (name == TQString("password")) { - _pptpAuth->password->erase(); - _pptpAuth->password->insert(value); - } -} \ No newline at end of file diff --git a/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.h b/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.h deleted file mode 100644 index c286e16..0000000 --- a/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.h +++ /dev/null @@ -1,84 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-vpnc.h - A NetworkManager frontend for TDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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_PPTP_H -#define KNETWORKMANAGER_PPTP_H - -#include -#include -#include -#include - -#include "knetworkmanager-vpnplugin.h" -#include "pptpprop.h" -#include "pptpauth.h" - -class PPTPPlugin : public VPNPlugin -{ - Q_OBJECT - - public: - PPTPPlugin(TQObject*, const char*, const TQStringList&); - ~PPTPPlugin(); - - VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0); - VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0); -}; - -class PPTPConfig : public VPNConfigWidget -{ - Q_OBJECT - - public: - void setVPNData(const TQStringList& routes, const TQMap& properties); - TQMap getVPNProperties(); - TQStringList getVPNRoutes(); - bool hasChanged(); - bool isValid(TQStringList& ); - - PPTPConfig(TQWidget* parent); - ~PPTPConfig(); - - private: - PPTPConfigWidget* _pptpWidget; - - protected slots: - void languageChange(); -}; - -class PPTPAuthentication : public VPNAuthenticationWidget -{ - Q_OBJECT - - public: - PPTPAuthentication(TQWidget* parent = NULL, char* name = NULL); - ~PPTPAuthentication(); - TQMap getPasswords(); - void setPasswords(TQString name, TQString value); - - private: - PPTPAuthenticationWidget* _pptpAuth; -}; - -#endif /* KNETWORKMANAGER_PPTP_H */ diff --git a/tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-pptp.cpp b/tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-pptp.cpp new file mode 100644 index 0000000..3475dd5 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-pptp.cpp @@ -0,0 +1,254 @@ +/*************************************************************************** + * + * knetworkmanager-pptp.cpp - A NetworkManager frontend for TDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tdenetman-pptp.h" + +typedef KGenericFactory PPTPPluginFactory; +K_EXPORT_COMPONENT_FACTORY(tdenetman_pptp, PPTPPluginFactory("tdenetman_pptp")); + + +PPTPPlugin::PPTPPlugin(TQObject* parent, const char* name, const TQStringList& args) + : VPNPlugin(parent, name, args) +{ + KLocale* loc = KGlobal::locale(); + loc->insertCatalogue("NetworkManager-pptp"); +} + +PPTPPlugin::~PPTPPlugin() +{ + +} + +VPNConfigWidget* PPTPPlugin::CreateConfigWidget(TQWidget* parent) +{ + return new PPTPConfig(parent); +} + +VPNAuthenticationWidget* PPTPPlugin::CreateAuthenticationWidget(TQWidget* parent) +{ + return new PPTPAuthentication(parent); +} + + +PPTPConfig::PPTPConfig(TQWidget* parent) + : VPNConfigWidget(parent) +{ + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _pptpWidget = new PPTPConfigWidget(this); + layout->addWidget(_pptpWidget); + + connect(_pptpWidget->chkIPAdresses, TQT_SIGNAL(toggled(bool)), _pptpWidget->routes, TQT_SLOT(setEnabled(bool))); + + this->languageChange(); +} + +PPTPConfig::~PPTPConfig() +{ + +} + +void PPTPConfig::languageChange() +{ + +} + +void PPTPConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets) { + m_vpnProperties = properties; + m_vpnSecrets = secrets; + + // fill up our inputfields (only textfields atm) + for(TQMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) + { + TQString entry = it.key(); + TQString value = it.data(); + + if (entry == "gateway") + { + _pptpWidget->gateway->setText(value); + } + else if (entry == "refuse-eap") + { + _pptpWidget->chk_refuseeap->setChecked(value == "yes" || value == "true"); + } + else if (entry == "refuse-pap") + { + _pptpWidget->chk_refusepap->setChecked(value == "yes" || value == "true"); + } + else if (entry == "refuse-chap") + { + _pptpWidget->chk_refusechap->setChecked(value == "yes" || value == "true"); + } + else if (entry == "refuse-mschap") + { + _pptpWidget->chk_refusemschap->setChecked(value == "yes" || value == "true"); + } + else if (entry == "refuse-mschapv2") + { + _pptpWidget->chk_refusemschapv2->setChecked(value == "yes" || value == "true"); + } + else if (entry == "require-mppe") + { + _pptpWidget->chk_requiremppe->setChecked(value == "yes" || value == "true"); + } + else if (entry == "require-mppe-40") + { + _pptpWidget->chk_requiremppe40->setChecked(value == "yes" || value == "true"); + } + else if (entry == "require-mppe-128") + { + _pptpWidget->chk_requiremppe128->setChecked(value == "yes" || value == "true"); + } + else if (entry == "mppe-stateful") + { + _pptpWidget->chk_mppestateful->setChecked(value == "yes" || value == "true"); + } + else if (entry == "nodeflate") + { + _pptpWidget->chk_nodeflate->setChecked(value == "yes" || value == "true"); + } + } + + // set routes + if (!routes.empty()) + { + _pptpWidget->chkIPAdresses->setChecked(true); + TQStringList routesText; + for (TDENetworkSingleRouteConfigurationList::Iterator it = routes.begin(); it != routes.end(); ++it) { + routesText.append(TQString("%1/%2").arg((*it).ipAddress.toString()).arg((*it).networkMask.toCIDRMask())); + } + _pptpWidget->routes->setText(routesText.join(" ")); + } +} + +TDENetworkSettingsMap PPTPConfig::getVPNProperties() { + // Build a list of properties + m_vpnProperties.insert("gateway", TQString(_pptpWidget->gateway->text())); + m_vpnProperties.insert("refuse-eap", TQString(_pptpWidget->chk_refuseeap->isChecked() ? "yes" : "no")); + m_vpnProperties.insert("refuse-pap", TQString(_pptpWidget->chk_refusepap->isChecked() ? "yes" : "no")); + m_vpnProperties.insert("refuse-chap", TQString(_pptpWidget->chk_refusechap->isChecked() ? "yes" : "no")); + m_vpnProperties.insert("refuse-mschap", TQString(_pptpWidget->chk_refusemschap->isChecked() ? "yes" : "no")); + m_vpnProperties.insert("refuse-mschapv2", TQString(_pptpWidget->chk_refusemschapv2->isChecked() ? "yes" : "no")); + m_vpnProperties.insert("require-mppe", TQString(_pptpWidget->chk_requiremppe->isChecked() ? "yes" : "no")); + m_vpnProperties.insert("require-mppe-40", TQString(_pptpWidget->chk_requiremppe40->isChecked() ? "yes" : "no")); + m_vpnProperties.insert("require-mppe-128", TQString(_pptpWidget->chk_requiremppe128->isChecked() ? "yes" : "no")); + m_vpnProperties.insert("mppe-stateful", TQString(_pptpWidget->chk_mppestateful->isChecked() ? "yes" : "no")); + m_vpnProperties.insert("nodeflate", TQString(_pptpWidget->chk_nodeflate->isChecked() ? "yes" : "no")); + + // Current network-manager-pptp plugin supports bluetooth-gprs,dialup and pptp. + // We want a pptp connection. + //m_vpnProperties.insert("ppp-connection-type", "pptp"); + + return m_vpnProperties; +} + +TDENetworkSettingsMap PPTPConfig::getVPNSecrets() { + // Build a list of secrets + // FIXME + + return m_vpnSecrets; +} + +TDENetworkSingleRouteConfigurationList PPTPConfig::getVPNRoutes() +{ + TDENetworkSingleRouteConfigurationList ret; + TQStringList strlist; + if(_pptpWidget->chkIPAdresses->isChecked()) { + strlist = TQStringList::split(" ", _pptpWidget->routes->text()); + } + + for (TQStringList::Iterator it = strlist.begin(); it != strlist.end(); ++it) { + TQStringList pieces = TQStringList::split("/", (*it)); + TDENetworkSingleRouteConfiguration routeconfig; + routeconfig.ipAddress.setAddress(pieces[0]); + if (pieces.count() > 1) { + routeconfig.networkMask.fromCIDRMask(pieces[1].toUInt()); + } + ret.append(routeconfig); + } + + return ret; +} + +bool PPTPConfig::hasChanged() +{ + return true; +} + +bool PPTPConfig::isValid(TQStringList& err_msg) +{ + bool retval = true; + if(_pptpWidget->gateway->text() == "") + { + err_msg.append(i18n("At least the gateway has to be supplied.")); + retval = false; + } + return retval; +} + +PPTPAuthentication::PPTPAuthentication(TQWidget* parent, char* name) + : VPNAuthenticationWidget(parent, name) +{ + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _pptpAuth = new PPTPAuthenticationWidget(this); + layout->addWidget(_pptpAuth); +} + +PPTPAuthentication::~PPTPAuthentication() +{ + +} + +TDENetworkSettingsMap PPTPAuthentication::getPasswords() +{ + // network-manager-pptp will fail hard if "CHAP" is not the + // first element in the username&password list. + TDENetworkSettingsMap pwds; + //pwds.insert("CHAP", "CHAP"); + pwds.insert("user", TQString(_pptpAuth->username->text())); + pwds.insert("password", TQString(_pptpAuth->password->password())); + pwds.insert("domain", TQString(_pptpAuth->domain->text())); + return pwds; +} + +void PPTPAuthentication::setPasswords(TDENetworkSettingsMap secrets) { + if (secrets.contains("password")) { + _pptpAuth->password->erase(); + _pptpAuth->password->insert(secrets["password"]); + } +} + +#include "tdenetman-pptp.moc" \ No newline at end of file diff --git a/tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-pptp.h b/tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-pptp.h new file mode 100644 index 0000000..6f80300 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-pptp.h @@ -0,0 +1,88 @@ +/*************************************************************************** + * + * knetworkmanager-vpnc.h - A NetworkManager frontend for TDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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_PPTP_H +#define KNETWORKMANAGER_PPTP_H + +#include +#include +#include +#include + +#include "tdenetman-vpnplugin.h" +#include "pptpprop.h" +#include "pptpauth.h" + +class PPTPPlugin : public VPNPlugin +{ + Q_OBJECT + + public: + PPTPPlugin(TQObject*, const char*, const TQStringList&); + ~PPTPPlugin(); + + VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0); + VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0); +}; + +class PPTPConfig : public VPNConfigWidget +{ + Q_OBJECT + + public: + void setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets); + TDENetworkSettingsMap getVPNProperties(); + TDENetworkSettingsMap getVPNSecrets(); + TDENetworkSingleRouteConfigurationList getVPNRoutes(); + bool hasChanged(); + bool isValid(TQStringList& ); + + PPTPConfig(TQWidget* parent); + ~PPTPConfig(); + + private: + PPTPConfigWidget* _pptpWidget; + + TDENetworkSettingsMap m_vpnProperties; + TDENetworkSettingsMap m_vpnSecrets; + + protected slots: + void languageChange(); +}; + +class PPTPAuthentication : public VPNAuthenticationWidget +{ + Q_OBJECT + + public: + PPTPAuthentication(TQWidget* parent = NULL, char* name = NULL); + ~PPTPAuthentication(); + TDENetworkSettingsMap getPasswords(); + void setPasswords(TDENetworkSettingsMap secrets); + + private: + PPTPAuthenticationWidget* _pptpAuth; +}; + +#endif /* KNETWORKMANAGER_PPTP_H */ diff --git a/tdenetworkmanager/vpn-plugins/pptp/tdenetman_pptp.desktop b/tdenetworkmanager/vpn-plugins/pptp/tdenetman_pptp.desktop new file mode 100644 index 0000000..d5d626c --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/pptp/tdenetman_pptp.desktop @@ -0,0 +1,23 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +Icon= +ServiceTypes=TDENetworkManager/VPNPlugin +X-TDE-Library=tdenetman_pptp +X-NetworkManager-Services=pptp +X-TDE-PluginInfo-Author=Timothy Pearson +X-TDE-PluginInfo-Email=kb9vqf@pearsoncomputing.net +X-TDE-PluginInfo-Name=tdenetman_pptp +X-TDE-PluginInfo-Version=0.1 +X-TDE-PluginInfo-Website= +X-TDE-PluginInfo-Category=VPNService +X-TDE-PluginInfo-Depends= +X-TDE-PluginInfo-License=GPL +X-TDE-PluginInfo-EnabledByDefault=false +Name=PPTP +Name[bn]=পিপিটিপি +Name[xx]=xxPPTPxx +Comment=PPTP +Comment[bn]=পিপিটিপি +Comment[xx]=xxPPTPxx + diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp index d060a55..272e05f 100644 --- a/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp +++ b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp @@ -44,7 +44,7 @@ using namespace std; typedef KGenericFactory VPNCPluginFactory; -K_EXPORT_COMPONENT_FACTORY( tdenetman_vpnc, VPNCPluginFactory("tdenetman_vpnc")); +K_EXPORT_COMPONENT_FACTORY(tdenetman_vpnc, VPNCPluginFactory("tdenetman_vpnc")); #define NAT_MODE_CISCO 0 #define NAT_MODE_NATT 1 @@ -356,7 +356,6 @@ TDENetworkSingleRouteConfigurationList VPNCConfig::getVPNRoutes() } return ret; - } bool VPNCConfig::hasChanged() diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h index 9d5e6e1..9999140 100644 --- a/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h +++ b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h @@ -52,7 +52,7 @@ class VPNCConfig : public VPNConfigWidget Q_OBJECT public: - void setVPNData(TDENetworkSingleRouteConfigurationList&, TDENetworkSettingsMap&, TDENetworkSettingsMap&); + void setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets); TDENetworkSettingsMap getVPNProperties(); TDENetworkSettingsMap getVPNSecrets(); TDENetworkSingleRouteConfigurationList getVPNRoutes(); -- cgit v1.2.1 From 60bf9a139fd8cc0948bcf11d4fbcfab5cd9e0641 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 10 Sep 2012 17:08:29 -0500 Subject: Reactivate openvpn plugin --- tdenetworkmanager/src/tdenetman-pluginmanager.cpp | 45 +- tdenetworkmanager/src/tdenetman-vpnservice.cpp | 8 +- tdenetworkmanager/vpn-plugins/CMakeLists.txt | 2 +- tdenetworkmanager/vpn-plugins/openvpn/AUTHORS | 1 + .../vpn-plugins/openvpn/CMakeLists.txt | 14 + .../openvpn/knetworkmanager_openvpn.desktop | 25 - .../vpn-plugins/openvpn/src/CMakeLists.txt | 43 ++ .../openvpn/src/knetworkmanager-openvpn.cpp | 566 ------------------- .../openvpn/src/knetworkmanager-openvpn.h | 110 ---- .../vpn-plugins/openvpn/src/tdenetman-openvpn.cpp | 603 +++++++++++++++++++++ .../vpn-plugins/openvpn/src/tdenetman-openvpn.h | 114 ++++ .../vpn-plugins/openvpn/tdenetman_openvpn.desktop | 25 + 12 files changed, 824 insertions(+), 732 deletions(-) create mode 100644 tdenetworkmanager/vpn-plugins/openvpn/CMakeLists.txt delete mode 100644 tdenetworkmanager/vpn-plugins/openvpn/knetworkmanager_openvpn.desktop create mode 100644 tdenetworkmanager/vpn-plugins/openvpn/src/CMakeLists.txt delete mode 100644 tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.cpp delete mode 100644 tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.h create mode 100644 tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-openvpn.cpp create mode 100644 tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-openvpn.h create mode 100644 tdenetworkmanager/vpn-plugins/openvpn/tdenetman_openvpn.desktop diff --git a/tdenetworkmanager/src/tdenetman-pluginmanager.cpp b/tdenetworkmanager/src/tdenetman-pluginmanager.cpp index a5dfce9..0dad6ad 100644 --- a/tdenetworkmanager/src/tdenetman-pluginmanager.cpp +++ b/tdenetworkmanager/src/tdenetman-pluginmanager.cpp @@ -33,8 +33,9 @@ PluginManager* PluginManager::_instance; PluginManager* PluginManager::getInstance() { - if (_instance) + if (_instance) { return _instance; + } return new PluginManager(TQT_TQOBJECT(TDENetworkManager::getInstance()), "pluginmanager"); } @@ -45,22 +46,21 @@ PluginManager::PluginManager(TQObject* parent, const char* name) this->_plugins = KPluginInfo::fromServices( KTrader::self()->query( TQString::fromLatin1( "TDENetworkManager/Plugin" ))); // a bit debug output - for(TQValueList::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it) + for(TQValueList::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it) { kdDebug() << k_funcinfo << TQString("Found Plugin '%1'").arg((*it)->pluginName()) << endl; + } } PluginManager::~PluginManager() { // delete all loaded plugins - while(!_loadedPlugins.empty()) - { + while(!_loadedPlugins.empty()) { PluginMap::Iterator it = _loadedPlugins.begin(); _loadedPlugins.remove(it); } // delete all available plugininfos - while(!_plugins.empty()) - { + while(!_plugins.empty()) { TQValueList::Iterator it = _plugins.begin(); delete *it; _plugins.remove(it); @@ -71,11 +71,12 @@ TQStringList PluginManager::getPluginList(const TQString& serviceType, const TQS { TQStringList ret; // find a suitable plugin - for(TQValueList::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it) - { - if ((*it)->service()->serviceTypes().contains(serviceType) > 0) - if ((*it)->property(property).toString().contains(value)) + for(TQValueList::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; } @@ -83,12 +84,10 @@ TQStringList PluginManager::getPluginList(const TQString& serviceType, const TQS Plugin* PluginManager::getPlugin(const TQString& pluginID) { KPluginInfo* info = infoForPluginID(pluginID); - if (_loadedPlugins.contains(info)) - { + if (_loadedPlugins.contains(info)) { return _loadedPlugins[info]; } - else - { + else { return loadPlugin(pluginID); } return NULL; @@ -101,8 +100,7 @@ const KPluginInfo* PluginManager::getPluginInfo(const TQString& pluginID) const KPluginInfo* PluginManager::getPluginInfo(const Plugin* plugin) { - for(PluginMap::ConstIterator it = _loadedPlugins.begin(); it != _loadedPlugins.end(); ++it) - { + for(PluginMap::ConstIterator it = _loadedPlugins.begin(); it != _loadedPlugins.end(); ++it) { if (it.data() == plugin) return it.key(); } @@ -112,8 +110,7 @@ const KPluginInfo* PluginManager::getPluginInfo(const Plugin* plugin) void PluginManager::loadAllPlugins() { // iterate over all plugins - for(TQValueList::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it) - { + for(TQValueList::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it) { // load Plugin loadPlugin((*it)->pluginName()); } @@ -129,13 +126,11 @@ Plugin* PluginManager::loadPlugin(const TQString& pluginID) TQString::fromLatin1( "[X-TDE-PluginInfo-Name]=='%1'" ).arg( pluginID ), this, 0, TQStringList(), &error ); // plugin loaded? - if (plugin) - { + if (plugin) { kdDebug() << k_funcinfo << TQString(i18n("successfully loaded plugin '%1'")).arg(info->pluginName()) << endl; _loadedPlugins.insert(info, plugin); } - else - { + else { // error switch( error ) { @@ -172,10 +167,10 @@ Plugin* PluginManager::loadPlugin(const TQString& pluginID) KPluginInfo * PluginManager::infoForPluginID( const TQString& pluginID ) const { TQValueList::ConstIterator it; - for ( it = this->_plugins.begin(); it != this->_plugins.end(); ++it ) - { - if ( ( *it )->pluginName() == pluginID ) + for ( it = this->_plugins.begin(); it != this->_plugins.end(); ++it ) { + if ( ( *it )->pluginName() == pluginID ) { return *it; + } } return 0L; diff --git a/tdenetworkmanager/src/tdenetman-vpnservice.cpp b/tdenetworkmanager/src/tdenetman-vpnservice.cpp index b2643cf..d97cf82 100644 --- a/tdenetworkmanager/src/tdenetman-vpnservice.cpp +++ b/tdenetworkmanager/src/tdenetman-vpnservice.cpp @@ -54,12 +54,10 @@ VPNService::VPNService(const TQString& serviceName, const TQString& service, TQO // query if a plugin for this vpn service is available PluginManager* plugMan = PluginManager::getInstance(); - if (plugMan) - { + if (plugMan) { TQStringList list = plugMan->getPluginList("TDENetworkManager/VPNPlugin", "X-NetworkManager-Services", serviceName); - if (list.size() > 0) - { - // get the first VPN Plugin handling our VPNService + if (list.size() > 0) { + // get the first VPN Plugin handling our VPNService VPNPlugin* vpnPlugin = dynamic_cast( plugMan->getPlugin(list.first()) ); if (vpnPlugin) { diff --git a/tdenetworkmanager/vpn-plugins/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/CMakeLists.txt index 6e10d60..2643aad 100644 --- a/tdenetworkmanager/vpn-plugins/CMakeLists.txt +++ b/tdenetworkmanager/vpn-plugins/CMakeLists.txt @@ -9,7 +9,7 @@ # ################################################# -# add_subdirectory( openvpn ) +add_subdirectory( openvpn ) add_subdirectory( pptp ) # add_subdirectory( strongswan ) add_subdirectory( vpnc ) diff --git a/tdenetworkmanager/vpn-plugins/openvpn/AUTHORS b/tdenetworkmanager/vpn-plugins/openvpn/AUTHORS index f4340ea..d61cb52 100644 --- a/tdenetworkmanager/vpn-plugins/openvpn/AUTHORS +++ b/tdenetworkmanager/vpn-plugins/openvpn/AUTHORS @@ -1,2 +1,3 @@ +Timothy Pearson Helmut Schaa , Thomas Kallenberg diff --git a/tdenetworkmanager/vpn-plugins/openvpn/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/openvpn/CMakeLists.txt new file mode 100644 index 0000000..2646dbb --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/openvpn/CMakeLists.txt @@ -0,0 +1,14 @@ +################################################# +# +# (C) 2012 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( src ) + +install( FILES tdenetman_openvpn.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) diff --git a/tdenetworkmanager/vpn-plugins/openvpn/knetworkmanager_openvpn.desktop b/tdenetworkmanager/vpn-plugins/openvpn/knetworkmanager_openvpn.desktop deleted file mode 100644 index 2f8d837..0000000 --- a/tdenetworkmanager/vpn-plugins/openvpn/knetworkmanager_openvpn.desktop +++ /dev/null @@ -1,25 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Type=Service -Icon= -ServiceTypes=TDENetworkManager/VPNPlugin -X-TDE-Library=knetworkmanager_openvpn -X-NetworkManager-Services=openvpn -X-TDE-PluginInfo-Author=Helmut Schaa -X-TDE-PluginInfo-Email=hschaa@suse.de -X-TDE-PluginInfo-Name=knetworkmanager_openvpn -X-TDE-PluginInfo-Version=0.1 -X-TDE-PluginInfo-Website= -X-TDE-PluginInfo-Category=VPNService -X-TDE-PluginInfo-Depends= -X-TDE-PluginInfo-License=GPL -X-TDE-PluginInfo-EnabledByDefault=false -Name=OpenVPN -Name[bn]=ওপেন-ভিপিএন -Name[ca]=VPN oberta -Name[xx]=xxOpenVPNxx -Comment=OpenVPN -Comment[bn]=ওপেন-ভিপিএন -Comment[ca]=VPN oberta -Comment[xx]=xxOpenVPNxx - diff --git a/tdenetworkmanager/vpn-plugins/openvpn/src/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/openvpn/src/CMakeLists.txt new file mode 100644 index 0000000..a565251 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/openvpn/src/CMakeLists.txt @@ -0,0 +1,43 @@ +################################################# +# +# (C) 2012 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_definitions( -UQT_NO_ASCII_CAST ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/tdenetworkmanager/src/settings + ${CMAKE_SOURCE_DIR}/tdenetworkmanager/src/configwidgets + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${DBUS_TQT_INCLUDE_DIRS} + ${NM_UTIL_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + +##### tdenetman_openvpn (module) ################ + +set( target tdenetman_openvpn ) + +set( ${target}_SRCS + tdenetman-openvpn.cpp + openvpnprop.ui + openvpnauth.ui +) + +tde_add_kpart( ${target} AUTOMOC + SOURCES ${${target}_SRCS} + LINK tdeinit_kded-shared tdeinit_tdenetworkmanager-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.cpp b/tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.cpp deleted file mode 100644 index ad27368..0000000 --- a/tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.cpp +++ /dev/null @@ -1,566 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-openvpn.cpp - A NetworkManager frontend for TDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "knetworkmanager-openvpn.h" - -typedef KGenericFactory OpenVPNPluginFactory; -K_EXPORT_COMPONENT_FACTORY( knetworkmanager_openvpn, OpenVPNPluginFactory("knetworkmanager_openvpn")); - -/************************************ -* OpenVPNPlugin -************************************/ -OpenVPNPlugin::OpenVPNPlugin(TQObject* parent, const char* name, const TQStringList& args) - : VPNPlugin(parent, name, args) -{ - -} - -OpenVPNPlugin::~OpenVPNPlugin() -{ - -} - -VPNConfigWidget* OpenVPNPlugin::CreateConfigWidget(TQWidget* parent) -{ - return new OpenVPNConfig(parent); -} - -VPNAuthenticationWidget* OpenVPNPlugin::CreateAuthenticationWidget(TQWidget* parent) -{ - return new OpenVPNAuthentication(parent); -} - -/************************************ -* OpenVPNConnectionType -************************************/ -OpenVPNConnectionType::CONNECTIONTYPE OpenVPNConnectionType::mapString2ConnectionType(int prop) -{ - if (prop == 0) - return X509; - else if (prop == 1) - return SHARED_KEY; - else if (prop == 2) - return PASSWORD; - else if (prop == 3) - return X509USERPASS; - return UNKNOWN; -} - -int OpenVPNConnectionType::mapConnectionType2String(CONNECTIONTYPE connType) -{ - switch(connType) - { - case X509: - return 0; - case SHARED_KEY: - return 1; - case PASSWORD: - return 2; - case X509USERPASS: - return 3; - default: - return -1; - } - return -1; -} - -/************************************ -* OpenVPNConfig -************************************/ - -OpenVPNConfig::OpenVPNConfig(TQWidget* parent) - : VPNConfigWidget(parent) -{ - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _openvpnWidget = new OpenVPNConfigWidget(this); - layout->addWidget(_openvpnWidget); - - connect(_openvpnWidget->chkUseCipher, TQT_SIGNAL(toggled(bool)), _openvpnWidget->cboCipher, TQT_SLOT(setEnabled(bool))); - connect(_openvpnWidget->chkUseTLS, TQT_SIGNAL(toggled(bool)), _openvpnWidget->cboDirection, TQT_SLOT(setEnabled(bool))); - connect(_openvpnWidget->chkUseTLS, TQT_SIGNAL(toggled(bool)), _openvpnWidget->editTLSAuth, TQT_SLOT(setEnabled(bool))); - connect(_openvpnWidget->chkIPAdresses, TQT_SIGNAL(toggled(bool)), _openvpnWidget->routes, TQT_SLOT(setEnabled(bool))); - - // add all Cipher modes to the Combobox - getCipherModes(); - - // switch to the right configuration interface when selecting the connection type - connect(_openvpnWidget->cboConnectionType, TQT_SIGNAL( activated(int)), _openvpnWidget->widgetStack, TQT_SLOT(raiseWidget(int))); - this->languageChange(); -} - -OpenVPNConfig::~OpenVPNConfig() -{ - -} - -void OpenVPNConfig::languageChange() -{ - _openvpnWidget->cboConnectionType->insertItem(i18n("X.509 Certificates"), OpenVPNConnectionType::X509 ); - _openvpnWidget->cboConnectionType->insertItem(i18n("Pre-shared key") , OpenVPNConnectionType::SHARED_KEY ); - _openvpnWidget->cboConnectionType->insertItem(i18n("Password Authentication") , OpenVPNConnectionType::PASSWORD ); - _openvpnWidget->cboConnectionType->insertItem(i18n("X.509 with Password Authentication") , OpenVPNConnectionType::X509USERPASS ); - - _openvpnWidget->cboDirection->insertItem(i18n("none")); - _openvpnWidget->cboDirection->insertItem(i18n("0")); - _openvpnWidget->cboDirection->insertItem(i18n("1")); -} - -TQString OpenVPNConfig::findOpenVPNBinary() -{ - static const char *openvpn_binary_paths[] = - { - "/usr/sbin/openvpn", - "/sbin/openvpn", - NULL - }; - - const char **openvpn_binary = openvpn_binary_paths; - - while (*openvpn_binary != NULL) { - if ( TQFileInfo(*openvpn_binary).exists()) - break; - openvpn_binary++; - } - - return *openvpn_binary; -} - - -void OpenVPNConfig::receiveCipherData(KProcess*, char* buffer, int len) -{ - // add possible cipher modes to the combobox - TQStringList cipherModes = TQStringList::split("\n", TQString::fromLatin1(buffer, len), false ); - for (TQStringList::ConstIterator it = cipherModes.begin(); it != cipherModes.end(); ++it) - { - _openvpnWidget->cboCipher->insertItem((*it)); - } -} - -void OpenVPNConfig::getCipherModes() -{ - // get all possible cipher modes - TQString openvpn = findOpenVPNBinary(); - if (!openvpn.isNull()) - { - KProcess* cipherHelper = new KProcess(); - cipherHelper->setUseShell(true, "/bin/sh"); - *cipherHelper << TQString::fromLatin1("%1 --show-ciphers | awk '/^[A-Z][A-Z0-9]+-/ { print $1 }'").arg(openvpn); - connect (cipherHelper, TQT_SIGNAL(receivedStdout(KProcess*, char*, int)), this, TQT_SLOT(receiveCipherData(KProcess*, char*, int))); - kdDebug() << "starting openvpn to get cipher modes" << endl; - if (!cipherHelper->start(KProcess::Block, KProcess::Stdout)) - kdDebug() << "error starting openvpn" << endl; - } - -} - -void OpenVPNConfig::setVPNData(const TQStringList& routes, const TQMap& properties) -{ - // fill up our inputfields - for(TQMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) - { - TQString entry = it.key(); - TQString value = it.data(); - - if (entry == "connection-type") - { - OpenVPNConnectionType::CONNECTIONTYPE type = OpenVPNConnectionType::mapString2ConnectionType(value.toInt()); - _openvpnWidget->cboConnectionType->setCurrentItem(type); - _openvpnWidget->widgetStack->raiseWidget(type); - } - else if (entry == "remote") - { - _openvpnWidget->gateway->setText(value); - } - else if (entry == "port") - { - if (value.toInt() > 0) - { - _openvpnWidget->port->setText(value); - _openvpnWidget->chkDefaultPort->setChecked(false); - } - else - { - _openvpnWidget->chkDefaultPort->setChecked(true); - } - } - else if (entry == "proto" || entry == "proto-tcp") - { - _openvpnWidget->chkUseTCP->setChecked( value == "yes"); - } - else if (entry == "ca") - { - _openvpnWidget->editCA->setURL(value); - } - else if (entry == "cert") - { - _openvpnWidget->editCert->setURL(value); - } - else if (entry == "key") - { - _openvpnWidget->editKey->setURL(value); - } - else if (entry == "cipher") - { - _openvpnWidget->chkUseCipher->setChecked(true); - _openvpnWidget->cboCipher->setCurrentItem(value); - } - else if (entry == "comp-lzo") - { - _openvpnWidget->chkUseLZO->setChecked(value == "true"); - } - else if (entry == "shared-key" || entry == "static-key") - { - _openvpnWidget->editSharedKey->setURL(value); - } - else if (entry == "username") - { - _openvpnWidget->editUsername->setText(value); - } - else if (entry == "local-ip") - { - _openvpnWidget->editLocalIP->setText(value); - } - else if (entry == "remote-ip") - { - _openvpnWidget->editRemoteIP->setText(value); - } - else if (entry == "dev" || entry == "tap-dev") { - _openvpnWidget->chkUseTAP->setChecked(value == "true"); - } - else if (entry == "ta") - { - _openvpnWidget->chkUseTLS->setChecked(true); - _openvpnWidget->editTLSAuth->setURL(value); - } - else if (entry == "ta-dir") - { - _openvpnWidget->cboDirection->setCurrentItem(value); - } - else - { - kdDebug() << TQString("OpenVPN: Property '%1' not handled").arg(entry) << endl; - } - } - - // set routes - if (!routes.empty()) - { - _openvpnWidget->chkIPAdresses->setChecked(true); - _openvpnWidget->routes->setText(routes.join(" ")); - } -} - -TQMapOpenVPNConfig::getVPNProperties() -{ - // build a StingList of properties - TQMap strlist; - - strlist.insert("connection-type", TQString::number(OpenVPNConnectionType::mapConnectionType2String((OpenVPNConnectionType::CONNECTIONTYPE)_openvpnWidget->cboConnectionType->currentItem()))); - strlist.insert("remote", TQString(_openvpnWidget->gateway->text())); - - // port is not necessary - if (!_openvpnWidget->port->text().isEmpty() && !_openvpnWidget->chkDefaultPort->isChecked()) - strlist.insert("port", _openvpnWidget->port->text()); - - strlist.insert("ca", TQString(_openvpnWidget->editCA->url())); - strlist.insert("cert",TQString(_openvpnWidget->editCert->url() )); - strlist.insert("key", TQString(_openvpnWidget->editKey->url())); - - if (_openvpnWidget->chkUseCipher->isChecked()) - strlist.insert("cipher", TQString(_openvpnWidget->cboCipher->currentText())); - - if (_openvpnWidget->chkUseLZO->isChecked()) - strlist.insert("comp-lzo", TQString("true")); - else - strlist.insert("comp-lzo", TQString("false")); - - strlist.insert("static-key", TQString(_openvpnWidget->editSharedKey->url())); - strlist.insert("username", TQString(_openvpnWidget->editUsername->text())); - strlist.insert("local-ip", TQString(_openvpnWidget->editLocalIP->text())); - strlist.insert("remote-ip", TQString(_openvpnWidget->editRemoteIP->text())); - - if (_openvpnWidget->chkUseTAP->isChecked()) { - strlist.insert("tap-dev", "true"); - strlist.insert("proto-tcp", "true"); - } else { - strlist.insert("tap-dev", "false"); - strlist.insert("proto-tcp", "false"); - } - - if (_openvpnWidget->chkUseTLS->isChecked()) - strlist.insert("ta", TQString(_openvpnWidget->editTLSAuth->url())); - - strlist.insert("ta-dir", TQString(_openvpnWidget->cboDirection->currentText())); - - return strlist; -} - -TQStringList OpenVPNConfig::getVPNRoutes() -{ - TQStringList strlist; - if(_openvpnWidget->chkIPAdresses->isChecked()) - { - strlist = TQStringList::split(" ", _openvpnWidget->routes->text()); - } - return strlist; -} - -bool OpenVPNConfig::hasChanged() -{ - return true; -} - -bool OpenVPNConfig::isValid(TQStringList& err_msg) -{ - bool retval = true; - - // check gateway - if (_openvpnWidget->gateway->text().isEmpty()) - { - err_msg.append(i18n("You have to specify a gateway")); - retval = false; - } - - bool ok = false; - _openvpnWidget->port->text().toULong(&ok); - if (!ok && !_openvpnWidget->port->text().isEmpty() ) - { - err_msg.append(i18n("The port number has to be numeric")); - retval = false; - } - - switch(_openvpnWidget->cboConnectionType->currentItem()) - { - case OpenVPNConnectionType::X509: - // check if ca file is correct - if (_openvpnWidget->editCA->url().isEmpty()) - { - retval = false; - err_msg.append(i18n("no CA file provided")); - } - else if (!TQFileInfo(_openvpnWidget->editCA->url()).isFile()) - { - retval = false; - err_msg.append(i18n("CA file not valid")); - } - - // check if cert file is correct - if (_openvpnWidget->editCert->url().isEmpty()) - { - retval = false; - err_msg.append(i18n("no CERT file provided")); - } - else if (!TQFileInfo(_openvpnWidget->editCert->url()).isFile()) - { - retval = false; - err_msg.append(i18n("CERT file not valid")); - } - - // check if key file is correct - if (_openvpnWidget->editKey->url().isEmpty()) - { - retval = false; - err_msg.append(i18n("no Key file provided")); - } - else if (!TQFileInfo(_openvpnWidget->editKey->url()).isFile()) - { - retval = false; - err_msg.append(i18n("Key file not valid")); - } - - break; - - - case OpenVPNConnectionType::SHARED_KEY: - // check if a shared key is selected - if (_openvpnWidget->editSharedKey->url().isEmpty()) - { - retval = false; - err_msg.append(i18n("Please provide a valid shared key")); - } - // check if the shared key file exists - else if (!TQFileInfo(_openvpnWidget->editSharedKey->url()).exists()) - { - retval = false; - err_msg.append(i18n("Please provide a valid shared key")); - } - - // check if local ip is valid - if (!TQHostAddress().setAddress(_openvpnWidget->editLocalIP->text())) - { - retval = false; - err_msg.append(i18n("local IP is invalid")); - } - // check if remote ip is valid - if (!TQHostAddress().setAddress(_openvpnWidget->editRemoteIP->text())) - { - retval = false; - err_msg.append(i18n("remote IP is invalid")); - } - - break; - case OpenVPNConnectionType::PASSWORD: - // check if username is suplied - if (_openvpnWidget->editUsername->text().isEmpty()) - { - retval = false; - err_msg.append(i18n("no username provided")); - } - - // check if ca file is correct - if (_openvpnWidget->editCA->url().isEmpty()) - { - retval = false; - err_msg.append(i18n("no CA file provided")); - } - else if (!TQFileInfo(_openvpnWidget->editCA->url()).isFile()) - { - retval = false; - err_msg.append(i18n("CA file not valid")); - } - - break; - - - case OpenVPNConnectionType::X509USERPASS: - // check if username is suplied - if (_openvpnWidget->editUsername->text().isEmpty()) - { - retval = false; - err_msg.append(i18n("no username provided")); - } - - // check if ca file is correct - if (_openvpnWidget->editCA->url().isEmpty()) - { - retval = false; - err_msg.append(i18n("no CA file provided")); - } - else if (!TQFileInfo(_openvpnWidget->editCA->url()).isFile()) - { - retval = false; - err_msg.append(i18n("CA file not valid")); - } - - // check if cert file is correct - if (_openvpnWidget->editCert->url().isEmpty()) - { - retval = false; - err_msg.append(i18n("no CERT file provided")); - } - else if (!TQFileInfo(_openvpnWidget->editCert->url()).isFile()) - { - retval = false; - err_msg.append(i18n("CERT file not valid")); - } - - // check if key file is correct - if (_openvpnWidget->editKey->url().isEmpty()) - { - retval = false; - err_msg.append(i18n("no Key file provided")); - } - else if (!TQFileInfo(_openvpnWidget->editKey->url()).isFile()) - { - retval = false; - err_msg.append(i18n("Key file not valid")); - } - break; - } - - - return retval; -} - -/************************************ -* OpenVPNAuthentication -************************************/ - -OpenVPNAuthentication::OpenVPNAuthentication(TQWidget* parent, char* name) - : VPNAuthenticationWidget(parent, name) -{ - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _openvpnAuth = new OpenVPNAuthenticationWidget(this); - layout->addWidget(_openvpnAuth); -} - -OpenVPNAuthentication::~OpenVPNAuthentication() -{ - -} - -void OpenVPNAuthentication::setVPNData(const TQStringList& /*routes*/, const TQMap& properties) -{ - // find the connection type property - for(TQMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) - { - if (it.key() == "connection-type") - { - _connectionType = OpenVPNConnectionType::mapString2ConnectionType(it.data().toInt()); - break; - } - } -} - -TQMap OpenVPNAuthentication::getPasswords() -{ - TQMap pwds; - if ((_connectionType == OpenVPNConnectionType::PASSWORD) || (_connectionType == OpenVPNConnectionType::X509USERPASS)) - pwds.insert("password", TQString(_openvpnAuth->editUserPassword->password())); - else - pwds.insert("no-secret", TQString("true")); - - return pwds; -} - -void OpenVPNAuthentication::setPasswords(TQString name, TQString value) { - if (name == TQString("password")) { - _openvpnAuth->editUserPassword->erase(); - _openvpnAuth->editUserPassword->insert(value); - } -} - -bool OpenVPNAuthentication::needsUserInteraction() -{ - if ((_connectionType == OpenVPNConnectionType::PASSWORD) || (_connectionType == OpenVPNConnectionType::X509USERPASS)) - return true; - return false; -} - diff --git a/tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.h b/tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.h deleted file mode 100644 index 02c328f..0000000 --- a/tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.h +++ /dev/null @@ -1,110 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-openvpn.h - A NetworkManager frontend for TDE - * - * Copyright (C) 2006 Novell, Inc. - * - * Author: Helmut Schaa , - * - * 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_OPENVPN_H -#define KNETWORKMANAGER_OPENVPN_H - -#include -#include -#include -#include -#include - -#include "knetworkmanager-vpnplugin.h" -#include "openvpnprop.h" -#include "openvpnauth.h" - -class OpenVPNPlugin : public VPNPlugin -{ - Q_OBJECT - - public: - OpenVPNPlugin(TQObject*, const char*, const TQStringList&); - ~OpenVPNPlugin(); - - VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0); - VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0); -}; - -class OpenVPNConnectionType -{ - public: - enum CONNECTIONTYPE - { - UNKNOWN = -1 - , X509 = 0 - , SHARED_KEY - , PASSWORD - , X509USERPASS - }; - - static CONNECTIONTYPE mapString2ConnectionType(int string); - static int mapConnectionType2String(CONNECTIONTYPE connectionType); -}; - -class OpenVPNConfig : public VPNConfigWidget -{ - Q_OBJECT - - public: - void setVPNData(const TQStringList& routes, const TQMap& properties); - TQMap getVPNProperties(); - TQStringList getVPNRoutes(); - bool hasChanged(); - bool isValid(TQStringList& ); - - OpenVPNConfig(TQWidget* parent); - ~OpenVPNConfig(); - - public slots: - void receiveCipherData(KProcess*, char*, int); - - private: - OpenVPNConfigWidget* _openvpnWidget; - - void getCipherModes(); - TQString findOpenVPNBinary(); - - protected slots: - void languageChange(); -}; - -class OpenVPNAuthentication : public VPNAuthenticationWidget -{ - Q_OBJECT - - public: - OpenVPNAuthentication(TQWidget* parent = NULL, char* name = NULL); - ~OpenVPNAuthentication(); - void setVPNData(const TQStringList&, const TQMap&); - TQMap getPasswords(); - void setPasswords(TQString name, TQString value); - bool needsUserInteraction(); - - private: - OpenVPNAuthenticationWidget* _openvpnAuth; - OpenVPNConnectionType::CONNECTIONTYPE _connectionType; -}; - -#endif /* KNETWORKMANAGER_OPENVPN_H */ diff --git a/tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-openvpn.cpp b/tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-openvpn.cpp new file mode 100644 index 0000000..7cee87a --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-openvpn.cpp @@ -0,0 +1,603 @@ +/*************************************************************************** + * + * knetworkmanager-openvpn.cpp - A NetworkManager frontend for TDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tdenetman-openvpn.h" + +typedef KGenericFactory OpenVPNPluginFactory; +K_EXPORT_COMPONENT_FACTORY( tdenetman_openvpn, OpenVPNPluginFactory("tdenetman_openvpn")); + +/************************************ +* OpenVPNPlugin +************************************/ +OpenVPNPlugin::OpenVPNPlugin(TQObject* parent, const char* name, const TQStringList& args) + : VPNPlugin(parent, name, args) +{ + +} + +OpenVPNPlugin::~OpenVPNPlugin() +{ + +} + +VPNConfigWidget* OpenVPNPlugin::CreateConfigWidget(TQWidget* parent) +{ + return new OpenVPNConfig(parent); +} + +VPNAuthenticationWidget* OpenVPNPlugin::CreateAuthenticationWidget(TQWidget* parent) +{ + return new OpenVPNAuthentication(parent); +} + +/************************************ +* OpenVPNConnectionType +************************************/ +OpenVPNConnectionType::CONNECTIONTYPE OpenVPNConnectionType::mapString2ConnectionType(int prop) +{ + if (prop == 0) + return X509; + else if (prop == 1) + return SHARED_KEY; + else if (prop == 2) + return PASSWORD; + else if (prop == 3) + return X509USERPASS; + return UNKNOWN; +} + +int OpenVPNConnectionType::mapConnectionType2String(CONNECTIONTYPE connType) +{ + switch(connType) + { + case X509: + return 0; + case SHARED_KEY: + return 1; + case PASSWORD: + return 2; + case X509USERPASS: + return 3; + default: + return -1; + } + return -1; +} + +/************************************ +* OpenVPNConfig +************************************/ + +OpenVPNConfig::OpenVPNConfig(TQWidget* parent) + : VPNConfigWidget(parent) +{ + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _openvpnWidget = new OpenVPNConfigWidget(this); + layout->addWidget(_openvpnWidget); + + connect(_openvpnWidget->chkUseCipher, TQT_SIGNAL(toggled(bool)), _openvpnWidget->cboCipher, TQT_SLOT(setEnabled(bool))); + connect(_openvpnWidget->chkUseTLS, TQT_SIGNAL(toggled(bool)), _openvpnWidget->cboDirection, TQT_SLOT(setEnabled(bool))); + connect(_openvpnWidget->chkUseTLS, TQT_SIGNAL(toggled(bool)), _openvpnWidget->editTLSAuth, TQT_SLOT(setEnabled(bool))); + connect(_openvpnWidget->chkIPAdresses, TQT_SIGNAL(toggled(bool)), _openvpnWidget->routes, TQT_SLOT(setEnabled(bool))); + + // add all Cipher modes to the Combobox + getCipherModes(); + + // switch to the right configuration interface when selecting the connection type + connect(_openvpnWidget->cboConnectionType, TQT_SIGNAL( activated(int)), _openvpnWidget->widgetStack, TQT_SLOT(raiseWidget(int))); + this->languageChange(); +} + +OpenVPNConfig::~OpenVPNConfig() +{ + +} + +void OpenVPNConfig::languageChange() +{ + _openvpnWidget->cboConnectionType->insertItem(i18n("X.509 Certificates"), OpenVPNConnectionType::X509 ); + _openvpnWidget->cboConnectionType->insertItem(i18n("Pre-shared key") , OpenVPNConnectionType::SHARED_KEY ); + _openvpnWidget->cboConnectionType->insertItem(i18n("Password Authentication") , OpenVPNConnectionType::PASSWORD ); + _openvpnWidget->cboConnectionType->insertItem(i18n("X.509 with Password Authentication") , OpenVPNConnectionType::X509USERPASS ); + + _openvpnWidget->cboDirection->insertItem(i18n("none")); + _openvpnWidget->cboDirection->insertItem(i18n("0")); + _openvpnWidget->cboDirection->insertItem(i18n("1")); +} + +TQString OpenVPNConfig::findOpenVPNBinary() +{ + static const char *openvpn_binary_paths[] = + { + "/usr/sbin/openvpn", + "/sbin/openvpn", + NULL + }; + + const char **openvpn_binary = openvpn_binary_paths; + + while (*openvpn_binary != NULL) { + if ( TQFileInfo(*openvpn_binary).exists()) + break; + openvpn_binary++; + } + + return *openvpn_binary; +} + + +void OpenVPNConfig::receiveCipherData(KProcess*, char* buffer, int len) +{ + // add possible cipher modes to the combobox + TQStringList cipherModes = TQStringList::split("\n", TQString::fromLatin1(buffer, len), false ); + for (TQStringList::ConstIterator it = cipherModes.begin(); it != cipherModes.end(); ++it) + { + _openvpnWidget->cboCipher->insertItem((*it)); + } +} + +void OpenVPNConfig::getCipherModes() +{ + // get all possible cipher modes + TQString openvpn = findOpenVPNBinary(); + if (!openvpn.isNull()) { + KProcess* cipherHelper = new KProcess(); + cipherHelper->setUseShell(true, "/bin/sh"); + *cipherHelper << TQString::fromLatin1("%1 --show-ciphers | awk '/^[A-Z][A-Z0-9]+-/ { print $1 }'").arg(openvpn); + connect (cipherHelper, TQT_SIGNAL(receivedStdout(KProcess*, char*, int)), this, TQT_SLOT(receiveCipherData(KProcess*, char*, int))); + kdDebug() << "starting openvpn to get cipher modes" << endl; + if (!cipherHelper->start(KProcess::Block, KProcess::Stdout)) { + kdDebug() << "error starting openvpn" << endl; + } + } +} + +void OpenVPNConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets) +{ + m_vpnProperties = properties; + m_vpnSecrets = secrets; + + // fill up our inputfields + for(TQMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) + { + TQString entry = it.key(); + TQString value = it.data(); + + if (entry == "connection-type") + { + OpenVPNConnectionType::CONNECTIONTYPE type = OpenVPNConnectionType::mapString2ConnectionType(value.toInt()); + _openvpnWidget->cboConnectionType->setCurrentItem(type); + _openvpnWidget->widgetStack->raiseWidget(type); + } + else if (entry == "remote") + { + _openvpnWidget->gateway->setText(value); + } + else if (entry == "port") + { + if (value.toInt() > 0) + { + _openvpnWidget->port->setText(value); + _openvpnWidget->chkDefaultPort->setChecked(false); + } + else + { + _openvpnWidget->chkDefaultPort->setChecked(true); + } + } + else if (entry == "proto" || entry == "proto-tcp") + { + _openvpnWidget->chkUseTCP->setChecked( value == "yes"); + } + else if (entry == "ca") + { + _openvpnWidget->editCA->setURL(value); + } + else if (entry == "cert") + { + _openvpnWidget->editCert->setURL(value); + } + else if (entry == "key") + { + _openvpnWidget->editKey->setURL(value); + } + else if (entry == "cipher") + { + _openvpnWidget->chkUseCipher->setChecked(true); + _openvpnWidget->cboCipher->setCurrentItem(value); + } + else if (entry == "comp-lzo") + { + _openvpnWidget->chkUseLZO->setChecked(value == "true"); + } + else if (entry == "shared-key" || entry == "static-key") + { + _openvpnWidget->editSharedKey->setURL(value); + } + else if (entry == "username") + { + _openvpnWidget->editUsername->setText(value); + } + else if (entry == "local-ip") + { + _openvpnWidget->editLocalIP->setText(value); + } + else if (entry == "remote-ip") + { + _openvpnWidget->editRemoteIP->setText(value); + } + else if (entry == "dev" || entry == "tap-dev") { + _openvpnWidget->chkUseTAP->setChecked(value == "true"); + } + else if (entry == "ta") + { + _openvpnWidget->chkUseTLS->setChecked(true); + _openvpnWidget->editTLSAuth->setURL(value); + } + else if (entry == "ta-dir") + { + _openvpnWidget->cboDirection->setCurrentItem(value); + } + else + { + kdDebug() << TQString("OpenVPN: Property '%1' not handled").arg(entry) << endl; + } + } + + // set routes + if (!routes.empty()) + { + _openvpnWidget->chkIPAdresses->setChecked(true); + TQStringList routesText; + for (TDENetworkSingleRouteConfigurationList::Iterator it = routes.begin(); it != routes.end(); ++it) { + routesText.append(TQString("%1/%2").arg((*it).ipAddress.toString()).arg((*it).networkMask.toCIDRMask())); + } + _openvpnWidget->routes->setText(routesText.join(" ")); + } +} + +TDENetworkSettingsMap OpenVPNConfig::getVPNProperties() +{ + // Build a list of properties + m_vpnProperties.insert("connection-type", TQString::number(OpenVPNConnectionType::mapConnectionType2String((OpenVPNConnectionType::CONNECTIONTYPE)_openvpnWidget->cboConnectionType->currentItem()))); + m_vpnProperties.insert("remote", TQString(_openvpnWidget->gateway->text())); + + // port is not necessary + if (!_openvpnWidget->port->text().isEmpty() && !_openvpnWidget->chkDefaultPort->isChecked()) { + m_vpnProperties.insert("port", _openvpnWidget->port->text()); + } + else { + m_vpnProperties.remove("port"); + } + + m_vpnProperties.insert("ca", TQString(_openvpnWidget->editCA->url())); + m_vpnProperties.insert("cert",TQString(_openvpnWidget->editCert->url() )); + m_vpnProperties.insert("key", TQString(_openvpnWidget->editKey->url())); + + if (_openvpnWidget->chkUseCipher->isChecked()) { + m_vpnProperties.insert("cipher", TQString(_openvpnWidget->cboCipher->currentText())); + } + else { + m_vpnProperties.remove("cipher"); + } + + if (_openvpnWidget->chkUseLZO->isChecked()) { + m_vpnProperties.insert("comp-lzo", TQString("true")); + } + else { + m_vpnProperties.insert("comp-lzo", TQString("false")); + } + + m_vpnProperties.insert("static-key", TQString(_openvpnWidget->editSharedKey->url())); + m_vpnProperties.insert("username", TQString(_openvpnWidget->editUsername->text())); + m_vpnProperties.insert("local-ip", TQString(_openvpnWidget->editLocalIP->text())); + m_vpnProperties.insert("remote-ip", TQString(_openvpnWidget->editRemoteIP->text())); + + if (_openvpnWidget->chkUseTAP->isChecked()) { + m_vpnProperties.insert("tap-dev", "true"); + m_vpnProperties.insert("proto-tcp", "true"); + } + else { + m_vpnProperties.insert("tap-dev", "false"); + m_vpnProperties.insert("proto-tcp", "false"); + } + + if (_openvpnWidget->chkUseTLS->isChecked()) { + m_vpnProperties.insert("ta", TQString(_openvpnWidget->editTLSAuth->url())); + } + else { + m_vpnProperties.remove("ta"); + } + + m_vpnProperties.insert("ta-dir", TQString(_openvpnWidget->cboDirection->currentText())); + + return m_vpnProperties; +} + +TDENetworkSettingsMap OpenVPNConfig::getVPNSecrets() { + // Build a list of secrets + // FIXME + + return m_vpnSecrets; +} + +TDENetworkSingleRouteConfigurationList OpenVPNConfig::getVPNRoutes() +{ + TDENetworkSingleRouteConfigurationList ret; + TQStringList strlist; + if(_openvpnWidget->chkIPAdresses->isChecked()) { + strlist = TQStringList::split(" ", _openvpnWidget->routes->text()); + } + + for (TQStringList::Iterator it = strlist.begin(); it != strlist.end(); ++it) { + TQStringList pieces = TQStringList::split("/", (*it)); + TDENetworkSingleRouteConfiguration routeconfig; + routeconfig.ipAddress.setAddress(pieces[0]); + if (pieces.count() > 1) { + routeconfig.networkMask.fromCIDRMask(pieces[1].toUInt()); + } + ret.append(routeconfig); + } + + return ret; +} + +bool OpenVPNConfig::hasChanged() +{ + return true; +} + +bool OpenVPNConfig::isValid(TQStringList& err_msg) +{ + bool retval = true; + + // check gateway + if (_openvpnWidget->gateway->text().isEmpty()) + { + err_msg.append(i18n("You have to specify a gateway")); + retval = false; + } + + bool ok = false; + _openvpnWidget->port->text().toULong(&ok); + if (!ok && !_openvpnWidget->port->text().isEmpty() ) + { + err_msg.append(i18n("The port number has to be numeric")); + retval = false; + } + + switch(_openvpnWidget->cboConnectionType->currentItem()) + { + case OpenVPNConnectionType::X509: + // check if ca file is correct + if (_openvpnWidget->editCA->url().isEmpty()) + { + retval = false; + err_msg.append(i18n("no CA file provided")); + } + else if (!TQFileInfo(_openvpnWidget->editCA->url()).isFile()) + { + retval = false; + err_msg.append(i18n("CA file not valid")); + } + + // check if cert file is correct + if (_openvpnWidget->editCert->url().isEmpty()) + { + retval = false; + err_msg.append(i18n("no CERT file provided")); + } + else if (!TQFileInfo(_openvpnWidget->editCert->url()).isFile()) + { + retval = false; + err_msg.append(i18n("CERT file not valid")); + } + + // check if key file is correct + if (_openvpnWidget->editKey->url().isEmpty()) + { + retval = false; + err_msg.append(i18n("no Key file provided")); + } + else if (!TQFileInfo(_openvpnWidget->editKey->url()).isFile()) + { + retval = false; + err_msg.append(i18n("Key file not valid")); + } + + break; + + + case OpenVPNConnectionType::SHARED_KEY: + // check if a shared key is selected + if (_openvpnWidget->editSharedKey->url().isEmpty()) + { + retval = false; + err_msg.append(i18n("Please provide a valid shared key")); + } + // check if the shared key file exists + else if (!TQFileInfo(_openvpnWidget->editSharedKey->url()).exists()) + { + retval = false; + err_msg.append(i18n("Please provide a valid shared key")); + } + + // check if local ip is valid + if (!TQHostAddress().setAddress(_openvpnWidget->editLocalIP->text())) + { + retval = false; + err_msg.append(i18n("local IP is invalid")); + } + // check if remote ip is valid + if (!TQHostAddress().setAddress(_openvpnWidget->editRemoteIP->text())) + { + retval = false; + err_msg.append(i18n("remote IP is invalid")); + } + + break; + case OpenVPNConnectionType::PASSWORD: + // check if username is suplied + if (_openvpnWidget->editUsername->text().isEmpty()) + { + retval = false; + err_msg.append(i18n("no username provided")); + } + + // check if ca file is correct + if (_openvpnWidget->editCA->url().isEmpty()) + { + retval = false; + err_msg.append(i18n("no CA file provided")); + } + else if (!TQFileInfo(_openvpnWidget->editCA->url()).isFile()) + { + retval = false; + err_msg.append(i18n("CA file not valid")); + } + + break; + + + case OpenVPNConnectionType::X509USERPASS: + // check if username is suplied + if (_openvpnWidget->editUsername->text().isEmpty()) + { + retval = false; + err_msg.append(i18n("no username provided")); + } + + // check if ca file is correct + if (_openvpnWidget->editCA->url().isEmpty()) + { + retval = false; + err_msg.append(i18n("no CA file provided")); + } + else if (!TQFileInfo(_openvpnWidget->editCA->url()).isFile()) + { + retval = false; + err_msg.append(i18n("CA file not valid")); + } + + // check if cert file is correct + if (_openvpnWidget->editCert->url().isEmpty()) + { + retval = false; + err_msg.append(i18n("no CERT file provided")); + } + else if (!TQFileInfo(_openvpnWidget->editCert->url()).isFile()) + { + retval = false; + err_msg.append(i18n("CERT file not valid")); + } + + // check if key file is correct + if (_openvpnWidget->editKey->url().isEmpty()) + { + retval = false; + err_msg.append(i18n("no Key file provided")); + } + else if (!TQFileInfo(_openvpnWidget->editKey->url()).isFile()) + { + retval = false; + err_msg.append(i18n("Key file not valid")); + } + break; + } + + + return retval; +} + +/************************************ +* OpenVPNAuthentication +************************************/ + +OpenVPNAuthentication::OpenVPNAuthentication(TQWidget* parent, char* name) + : VPNAuthenticationWidget(parent, name) +{ + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _openvpnAuth = new OpenVPNAuthenticationWidget(this); + layout->addWidget(_openvpnAuth); +} + +OpenVPNAuthentication::~OpenVPNAuthentication() +{ + +} + +void OpenVPNAuthentication::setVPNData(TDENetworkSingleRouteConfigurationList& /*routes*/, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets) +{ + // find the connection type property + for(TQMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) + { + if (it.key() == "connection-type") + { + _connectionType = OpenVPNConnectionType::mapString2ConnectionType(it.data().toInt()); + break; + } + } +} + +TDENetworkSettingsMap OpenVPNAuthentication::getPasswords() +{ + TQMap pwds; + if ((_connectionType == OpenVPNConnectionType::PASSWORD) || (_connectionType == OpenVPNConnectionType::X509USERPASS)) + pwds.insert("password", TQString(_openvpnAuth->editUserPassword->password())); + else + pwds.insert("no-secret", TQString("true")); + + return pwds; +} + +void OpenVPNAuthentication::setPasswords(TDENetworkSettingsMap secrets) { + if (secrets.contains("password")) { + _openvpnAuth->editUserPassword->erase(); + _openvpnAuth->editUserPassword->insert(secrets["password"]); + } +} + +bool OpenVPNAuthentication::needsUserInteraction() +{ + if ((_connectionType == OpenVPNConnectionType::PASSWORD) || (_connectionType == OpenVPNConnectionType::X509USERPASS)) + return true; + return false; +} + +#include "tdenetman-openvpn.moc" \ No newline at end of file diff --git a/tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-openvpn.h b/tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-openvpn.h new file mode 100644 index 0000000..2f8889d --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-openvpn.h @@ -0,0 +1,114 @@ +/*************************************************************************** + * + * knetworkmanager-openvpn.h - A NetworkManager frontend for TDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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_OPENVPN_H +#define KNETWORKMANAGER_OPENVPN_H + +#include +#include +#include +#include +#include + +#include "tdenetman-vpnplugin.h" +#include "openvpnprop.h" +#include "openvpnauth.h" + +class OpenVPNPlugin : public VPNPlugin +{ + Q_OBJECT + + public: + OpenVPNPlugin(TQObject*, const char*, const TQStringList&); + ~OpenVPNPlugin(); + + VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0); + VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0); +}; + +class OpenVPNConnectionType +{ + public: + enum CONNECTIONTYPE + { + UNKNOWN = -1 + , X509 = 0 + , SHARED_KEY + , PASSWORD + , X509USERPASS + }; + + static CONNECTIONTYPE mapString2ConnectionType(int string); + static int mapConnectionType2String(CONNECTIONTYPE connectionType); +}; + +class OpenVPNConfig : public VPNConfigWidget +{ + Q_OBJECT + + public: + void setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets); + TDENetworkSettingsMap getVPNProperties(); + TDENetworkSettingsMap getVPNSecrets(); + TDENetworkSingleRouteConfigurationList getVPNRoutes(); + bool hasChanged(); + bool isValid(TQStringList&); + + OpenVPNConfig(TQWidget* parent); + ~OpenVPNConfig(); + + public slots: + void receiveCipherData(KProcess*, char*, int); + + private: + OpenVPNConfigWidget* _openvpnWidget; + + void getCipherModes(); + TQString findOpenVPNBinary(); + + TDENetworkSettingsMap m_vpnProperties; + TDENetworkSettingsMap m_vpnSecrets; + + protected slots: + void languageChange(); +}; + +class OpenVPNAuthentication : public VPNAuthenticationWidget +{ + Q_OBJECT + + public: + OpenVPNAuthentication(TQWidget* parent = NULL, char* name = NULL); + ~OpenVPNAuthentication(); + void setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets); + TDENetworkSettingsMap getPasswords(); + void setPasswords(TDENetworkSettingsMap secrets); + bool needsUserInteraction(); + + private: + OpenVPNAuthenticationWidget* _openvpnAuth; + OpenVPNConnectionType::CONNECTIONTYPE _connectionType; +}; + +#endif /* KNETWORKMANAGER_OPENVPN_H */ diff --git a/tdenetworkmanager/vpn-plugins/openvpn/tdenetman_openvpn.desktop b/tdenetworkmanager/vpn-plugins/openvpn/tdenetman_openvpn.desktop new file mode 100644 index 0000000..dad55c0 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/openvpn/tdenetman_openvpn.desktop @@ -0,0 +1,25 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +Icon= +ServiceTypes=TDENetworkManager/VPNPlugin +X-TDE-Library=tdenetman_openvpn +X-NetworkManager-Services=openvpn +X-TDE-PluginInfo-Author=Timothy Pearson +X-TDE-PluginInfo-Email=kb9vqf@pearsoncomputing.net +X-TDE-PluginInfo-Name=tdenetman_openvpn +X-TDE-PluginInfo-Version=0.1 +X-TDE-PluginInfo-Website= +X-TDE-PluginInfo-Category=VPNService +X-TDE-PluginInfo-Depends= +X-TDE-PluginInfo-License=GPL +X-TDE-PluginInfo-EnabledByDefault=false +Name=OpenVPN +Name[bn]=ওপেন-ভিপিএন +Name[ca]=VPN oberta +Name[xx]=xxOpenVPNxx +Comment=OpenVPN +Comment[bn]=ওপেন-ভিপিএন +Comment[ca]=VPN oberta +Comment[xx]=xxOpenVPNxx + -- cgit v1.2.1 From b99db6aa82bcdba086ec51c292415b1a2bdb8cf7 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 10 Sep 2012 17:44:39 -0500 Subject: Reactivate strongswan VPN plugin --- tdenetworkmanager/vpn-plugins/CMakeLists.txt | 2 +- tdenetworkmanager/vpn-plugins/strongswan/AUTHORS | 2 + .../vpn-plugins/strongswan/CMakeLists.txt | 14 ++ tdenetworkmanager/vpn-plugins/strongswan/authors | 1 - .../strongswan/knetworkmanager_strongswan.desktop | 21 -- .../strongswan/src/knetworkmanager-strongswan.cpp | 234 ------------------ .../strongswan/src/knetworkmanager-strongswan.h | 99 -------- .../strongswan/src/tdenetman-strongswan.cpp | 267 +++++++++++++++++++++ .../strongswan/src/tdenetman-strongswan.h | 103 ++++++++ .../strongswan/tdenetman_strongswan.desktop | 21 ++ 10 files changed, 408 insertions(+), 356 deletions(-) create mode 100644 tdenetworkmanager/vpn-plugins/strongswan/AUTHORS create mode 100644 tdenetworkmanager/vpn-plugins/strongswan/CMakeLists.txt delete mode 100644 tdenetworkmanager/vpn-plugins/strongswan/authors delete mode 100644 tdenetworkmanager/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop delete mode 100644 tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp delete mode 100644 tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h create mode 100644 tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp create mode 100644 tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.h create mode 100644 tdenetworkmanager/vpn-plugins/strongswan/tdenetman_strongswan.desktop diff --git a/tdenetworkmanager/vpn-plugins/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/CMakeLists.txt index 2643aad..d5f6e8e 100644 --- a/tdenetworkmanager/vpn-plugins/CMakeLists.txt +++ b/tdenetworkmanager/vpn-plugins/CMakeLists.txt @@ -11,5 +11,5 @@ add_subdirectory( openvpn ) add_subdirectory( pptp ) -# add_subdirectory( strongswan ) +add_subdirectory( strongswan ) add_subdirectory( vpnc ) diff --git a/tdenetworkmanager/vpn-plugins/strongswan/AUTHORS b/tdenetworkmanager/vpn-plugins/strongswan/AUTHORS new file mode 100644 index 0000000..242ed99 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/strongswan/AUTHORS @@ -0,0 +1,2 @@ +Timothy Pearson +Thomas Kallenberg , diff --git a/tdenetworkmanager/vpn-plugins/strongswan/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/strongswan/CMakeLists.txt new file mode 100644 index 0000000..05b45b3 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/strongswan/CMakeLists.txt @@ -0,0 +1,14 @@ +################################################# +# +# (C) 2012 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( src ) + +install( FILES tdenetman_strongswan.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) diff --git a/tdenetworkmanager/vpn-plugins/strongswan/authors b/tdenetworkmanager/vpn-plugins/strongswan/authors deleted file mode 100644 index 06c50d3..0000000 --- a/tdenetworkmanager/vpn-plugins/strongswan/authors +++ /dev/null @@ -1 +0,0 @@ -Thomas Kallenberg , diff --git a/tdenetworkmanager/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop b/tdenetworkmanager/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop deleted file mode 100644 index 2ea51d3..0000000 --- a/tdenetworkmanager/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop +++ /dev/null @@ -1,21 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Type=Service -Icon= -ServiceTypes=TDENetworkManager/VPNPlugin -X-TDE-Library=knetworkmanager_strongswan -X-NetworkManager-Services=strongswan -X-TDE-PluginInfo-Author=Thomas Kallenberg -X-TDE-PluginInfo-Email=tkallenb@hsr.ch -X-TDE-PluginInfo-Name=knetworkmanager_strongswan -X-TDE-PluginInfo-Version=0.1 -X-TDE-PluginInfo-Website= -X-TDE-PluginInfo-Category=VPNService -X-TDE-PluginInfo-Depends= -X-TDE-PluginInfo-License=GPL -X-TDE-PluginInfo-EnabledByDefault=false -Name=StrongSwan -Name[xx]=xxStrongSwanxx -Comment=StrongSwan -Comment[xx]=xxStrongSwanxx - diff --git a/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp b/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp deleted file mode 100644 index 7abe62d..0000000 --- a/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-strongswan.cpp - A NetworkManager frontend for TDE - * - * Author: Thomas Kallenberg , - * - * Strongly based on the Code of Helmut Schaa - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "knetworkmanager-strongswan.h" - -typedef KGenericFactory StrongswanPluginFactory; -K_EXPORT_COMPONENT_FACTORY( knetworkmanager_strongswan, StrongswanPluginFactory("knetworkmanager_strongswan")); - - -StrongswanPlugin::StrongswanPlugin(TQObject* parent, const char* name, const TQStringList& args) - : VPNPlugin(parent, name, args) -{ - KLocale* loc = KGlobal::locale(); - loc->insertCatalogue("NetworkManager-strongswan"); -} - -StrongswanPlugin::~StrongswanPlugin() -{ - -} - -VPNConfigWidget* StrongswanPlugin::CreateConfigWidget(TQWidget* parent) -{ - return new StrongswanConfig(parent); -} - -VPNAuthenticationWidget* StrongswanPlugin::CreateAuthenticationWidget(TQWidget* parent) -{ - return new StrongswanAuthentication(parent); -} - - -StrongswanConfig::StrongswanConfig(TQWidget* parent) - : VPNConfigWidget(parent) -{ - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _strongswanWidget = new StrongswanConfigWidget(this); - layout->addWidget(_strongswanWidget); - - /* TODO not sure if we need this here */ - this->languageChange(); -} - -StrongswanConfig::~StrongswanConfig() -{ - -} - -void StrongswanConfig::languageChange() -{ - -} - - // usercert agent password userkey -StrongswanConnectionType::CONNECTIONTYPE StrongswanConnectionType::mapString2ConnectionType(int prop) -{ - if (prop == 0) - return psk; - else if (prop == 1) - return key; - else if (prop == 2) - return agent; - return UNKNOWN; -} - -int StrongswanConnectionType::mapConnectionType2String(CONNECTIONTYPE connType) -{ - switch(connType) - { - case psk: - return 0; - case key: - return 1; - case agent: - return 2; - default: - return -1; - } - return -1; -} - -void StrongswanConfig::setVPNData(const TQStringList& routes, const TQMap& properties) -{ - // fill up our inputfields (only textfields atm) - for(TQMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) - { - TQString entry = it.key(); - TQString value = it.data(); - - if (entry == "gateway") - { - _strongswanWidget->gateway->setText(value); - } - else if (entry == "certificate") - { - _strongswanWidget->certificate->setURL(value); - } - else if (entry == "username") - { - _strongswanWidget->username->setText(value); - } - else if (entry == "method") - { - StrongswanConnectionType::CONNECTIONTYPE type = StrongswanConnectionType::mapString2ConnectionType(value.toInt()); - _strongswanWidget->authtype->setCurrentItem(type); - } - // Options - else if (entry == "chkUDPenc") - { - _strongswanWidget->chkUDPenc->setChecked(value == "true"); - } - else if (entry == "chkIPcomp") - { - _strongswanWidget->chkIPcomp->setChecked(value == "true"); - } - else if (entry == "chkIPinner") - { - _strongswanWidget->chkIPinner->setChecked(value == "true"); - } - } -} - -TQMap StrongswanConfig::getVPNProperties() -{ - // build a StingList of properties - TQMap strlist; - - strlist.insert("gateway", TQString(_strongswanWidget->gateway->text())); - strlist.insert("certificate", TQString(_strongswanWidget->certificate->url())); - strlist.insert("username", TQString(_strongswanWidget->username->text())); - strlist.insert("method", - TQString::number(StrongswanConnectionType::mapConnectionType2String((StrongswanConnectionType::CONNECTIONTYPE)_strongswanWidget->authtype->currentItem()))); - - if (_strongswanWidget->chkUDPenc->isChecked()) - strlist.insert("encap", TQString("yes")); - - if (_strongswanWidget->chkIPcomp->isChecked()) - strlist.insert("ipcomp", TQString("yes")); - - if (_strongswanWidget->chkIPinner->isChecked()) - strlist.insert("virtual", TQString("yes")); - - return strlist; -} - -TQStringList StrongswanConfig::getVPNRoutes() -{ - TQStringList strlist; - /*if(_strongswanWidget->chkIPAdresses->isChecked()) - { - strlist = TQStringList::split(" ", _strongswanWidget->routes->text()); - } - */ - return strlist; - -} - -bool StrongswanConfig::hasChanged() -{ - return true; -} - -bool StrongswanConfig::isValid(TQStringList& err_msg) -{ - bool retval = true; - if(_strongswanWidget->gateway->text() == "" || _strongswanWidget->username->text() == "") - { - err_msg.append(i18n("At least the gateway and group has to be supplied.")); - retval = false; - } - return retval; -} - -StrongswanAuthentication::StrongswanAuthentication(TQWidget* parent, char* name) - : VPNAuthenticationWidget(parent, name) -{ - TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); - _strongswanAuth = new StrongswanAuthenticationWidget(this); - layout->addWidget(_strongswanAuth); -} - -StrongswanAuthentication::~StrongswanAuthentication() -{ - -} - -TQMap StrongswanAuthentication::getPasswords() -{ - TQMap pwds; - pwds.insert("user", TQString(_strongswanAuth->username->text())); - pwds.insert("password", TQString(_strongswanAuth->password->password())); - return pwds; -} - -void StrongswanAuthentication::setPasswords(TQString name, TQString value) { - if (name == TQString("password")) { - _strongswanAuth->password->erase(); - _strongswanAuth->password->insert(value); - } -} \ No newline at end of file diff --git a/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h b/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h deleted file mode 100644 index 341d25d..0000000 --- a/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h +++ /dev/null @@ -1,99 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-strongswan.h - A NetworkManager frontend for TDE - * - * Author: Thomas Kallenberg , - * - * Strongly based on the Code of Helmut Schaa - * - * 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_STRONGSWAN_H -#define KNETWORKMANAGER_STRONGSWAN_H - -#include -#include -#include -#include - -#include "knetworkmanager-vpnplugin.h" -#include "strongswanprop.h" -#include "strongswanauth.h" - -class StrongswanPlugin : public VPNPlugin -{ - Q_OBJECT - - public: - StrongswanPlugin(TQObject*, const char*, const TQStringList&); - ~StrongswanPlugin(); - - VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0); - VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0); -}; - -class StrongswanConnectionType -{ - public: - enum CONNECTIONTYPE - { - UNKNOWN = -1 - , psk = 0 - , key - , agent - }; - - static CONNECTIONTYPE mapString2ConnectionType(int string); - static int mapConnectionType2String(CONNECTIONTYPE connectionType); -}; - -class StrongswanConfig : public VPNConfigWidget -{ - Q_OBJECT - - public: - void setVPNData(const TQStringList& routes, const TQMap& properties); - TQMap getVPNProperties(); - TQStringList getVPNRoutes(); - bool hasChanged(); - bool isValid(TQStringList& ); - - StrongswanConfig(TQWidget* parent); - ~StrongswanConfig(); - - private: - StrongswanConfigWidget* _strongswanWidget; - - protected slots: - void languageChange(); -}; - -class StrongswanAuthentication : public VPNAuthenticationWidget -{ - Q_OBJECT - - public: - StrongswanAuthentication(TQWidget* parent = NULL, char* name = NULL); - ~StrongswanAuthentication(); - TQMap getPasswords(); - void setPasswords(TQString name, TQString value); - - private: - StrongswanAuthenticationWidget* _strongswanAuth; -}; - -#endif /* KNETWORKMANAGER_STRONGSWAN_H */ diff --git a/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp b/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp new file mode 100644 index 0000000..a0826bd --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp @@ -0,0 +1,267 @@ +/*************************************************************************** + * + * knetworkmanager-strongswan.cpp - A NetworkManager frontend for TDE + * + * Author: Thomas Kallenberg , + * + * Strongly based on the Code of Helmut Schaa + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tdenetman-strongswan.h" + +typedef KGenericFactory StrongswanPluginFactory; +K_EXPORT_COMPONENT_FACTORY( tdenetman_strongswan, StrongswanPluginFactory("tdenetman_strongswan")); + + +StrongswanPlugin::StrongswanPlugin(TQObject* parent, const char* name, const TQStringList& args) + : VPNPlugin(parent, name, args) +{ + KLocale* loc = KGlobal::locale(); + loc->insertCatalogue("NetworkManager-strongswan"); +} + +StrongswanPlugin::~StrongswanPlugin() +{ + +} + +VPNConfigWidget* StrongswanPlugin::CreateConfigWidget(TQWidget* parent) +{ + return new StrongswanConfig(parent); +} + +VPNAuthenticationWidget* StrongswanPlugin::CreateAuthenticationWidget(TQWidget* parent) +{ + return new StrongswanAuthentication(parent); +} + + +StrongswanConfig::StrongswanConfig(TQWidget* parent) + : VPNConfigWidget(parent) +{ + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _strongswanWidget = new StrongswanConfigWidget(this); + layout->addWidget(_strongswanWidget); + + /* TODO not sure if we need this here */ + this->languageChange(); +} + +StrongswanConfig::~StrongswanConfig() +{ + +} + +void StrongswanConfig::languageChange() +{ + +} + +// usercert agent password userkey +StrongswanConnectionType::CONNECTIONTYPE StrongswanConnectionType::mapString2ConnectionType(int prop) +{ + if (prop == 0) + return psk; + else if (prop == 1) + return key; + else if (prop == 2) + return agent; + return UNKNOWN; +} + +int StrongswanConnectionType::mapConnectionType2String(CONNECTIONTYPE connType) +{ + switch(connType) + { + case psk: + return 0; + case key: + return 1; + case agent: + return 2; + default: + return -1; + } + return -1; +} + +void StrongswanConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets) +{ + m_vpnProperties = properties; + m_vpnSecrets = secrets; + + // fill up our inputfields (only textfields atm) + for(TQMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) + { + TQString entry = it.key(); + TQString value = it.data(); + + if (entry == "gateway") + { + _strongswanWidget->gateway->setText(value); + } + else if (entry == "certificate") + { + _strongswanWidget->certificate->setURL(value); + } + else if (entry == "username") + { + _strongswanWidget->username->setText(value); + } + else if (entry == "method") + { + StrongswanConnectionType::CONNECTIONTYPE type = StrongswanConnectionType::mapString2ConnectionType(value.toInt()); + _strongswanWidget->authtype->setCurrentItem(type); + } + // Options + else if (entry == "chkUDPenc") + { + _strongswanWidget->chkUDPenc->setChecked(value == "true"); + } + else if (entry == "chkIPcomp") + { + _strongswanWidget->chkIPcomp->setChecked(value == "true"); + } + else if (entry == "chkIPinner") + { + _strongswanWidget->chkIPinner->setChecked(value == "true"); + } + } +} + +TDENetworkSettingsMap StrongswanConfig::getVPNProperties() +{ + // Build a list of properties + m_vpnProperties.insert("gateway", TQString(_strongswanWidget->gateway->text())); + m_vpnProperties.insert("certificate", TQString(_strongswanWidget->certificate->url())); + m_vpnProperties.insert("username", TQString(_strongswanWidget->username->text())); + m_vpnProperties.insert("method", TQString::number(StrongswanConnectionType::mapConnectionType2String((StrongswanConnectionType::CONNECTIONTYPE)_strongswanWidget->authtype->currentItem()))); + + if (_strongswanWidget->chkUDPenc->isChecked()) { + m_vpnProperties.insert("encap", TQString("yes")); + } + else { + m_vpnProperties.remove("encap"); + } + + if (_strongswanWidget->chkIPcomp->isChecked()) { + m_vpnProperties.insert("ipcomp", TQString("yes")); + } + else { + m_vpnProperties.remove("ipcomp"); + } + + if (_strongswanWidget->chkIPinner->isChecked()) { + m_vpnProperties.insert("virtual", TQString("yes")); + } + else { + m_vpnProperties.remove("virtual"); + } + + return m_vpnProperties; +} + +TDENetworkSettingsMap StrongswanConfig::getVPNSecrets() { + // Build a list of secrets + // FIXME + + return m_vpnSecrets; +} + +TDENetworkSingleRouteConfigurationList StrongswanConfig::getVPNRoutes() +{ + TDENetworkSingleRouteConfigurationList ret; +#if 0 + TQStringList strlist; + if(_strongswanWidget->chkIPAdresses->isChecked()) { + strlist = TQStringList::split(" ", _strongswanWidget->routes->text()); + } + + for (TQStringList::Iterator it = strlist.begin(); it != strlist.end(); ++it) { + TQStringList pieces = TQStringList::split("/", (*it)); + TDENetworkSingleRouteConfiguration routeconfig; + routeconfig.ipAddress.setAddress(pieces[0]); + if (pieces.count() > 1) { + routeconfig.networkMask.fromCIDRMask(pieces[1].toUInt()); + } + ret.append(routeconfig); + } +#endif + + return ret; + +} + +bool StrongswanConfig::hasChanged() +{ + return true; +} + +bool StrongswanConfig::isValid(TQStringList& err_msg) +{ + bool retval = true; + if(_strongswanWidget->gateway->text() == "" || _strongswanWidget->username->text() == "") + { + err_msg.append(i18n("At least the gateway and group has to be supplied.")); + retval = false; + } + return retval; +} + +StrongswanAuthentication::StrongswanAuthentication(TQWidget* parent, char* name) + : VPNAuthenticationWidget(parent, name) +{ + TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); + _strongswanAuth = new StrongswanAuthenticationWidget(this); + layout->addWidget(_strongswanAuth); +} + +StrongswanAuthentication::~StrongswanAuthentication() +{ + +} + +TDENetworkSettingsMap StrongswanAuthentication::getPasswords() +{ + TQMap pwds; + pwds.insert("user", TQString(_strongswanAuth->username->text())); + pwds.insert("password", TQString(_strongswanAuth->password->password())); + return pwds; +} + +void StrongswanAuthentication::setPasswords(TDENetworkSettingsMap secrets) { + if (secrets.contains("password")) { + _strongswanAuth->password->erase(); + _strongswanAuth->password->insert(secrets["password"]); + } +} + +#include "tdenetman-strongswan.moc" \ No newline at end of file diff --git a/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.h b/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.h new file mode 100644 index 0000000..c1229ab --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.h @@ -0,0 +1,103 @@ +/*************************************************************************** + * + * knetworkmanager-strongswan.h - A NetworkManager frontend for TDE + * + * Author: Thomas Kallenberg , + * + * Strongly based on the Code of Helmut Schaa + * + * 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_STRONGSWAN_H +#define KNETWORKMANAGER_STRONGSWAN_H + +#include +#include +#include +#include + +#include "tdenetman-vpnplugin.h" +#include "strongswanprop.h" +#include "strongswanauth.h" + +class StrongswanPlugin : public VPNPlugin +{ + Q_OBJECT + + public: + StrongswanPlugin(TQObject*, const char*, const TQStringList&); + ~StrongswanPlugin(); + + VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0); + VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0); +}; + +class StrongswanConnectionType +{ + public: + enum CONNECTIONTYPE + { + UNKNOWN = -1 + , psk = 0 + , key + , agent + }; + + static CONNECTIONTYPE mapString2ConnectionType(int string); + static int mapConnectionType2String(CONNECTIONTYPE connectionType); +}; + +class StrongswanConfig : public VPNConfigWidget +{ + Q_OBJECT + + public: + void setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets); + TDENetworkSettingsMap getVPNProperties(); + TDENetworkSettingsMap getVPNSecrets(); + TDENetworkSingleRouteConfigurationList getVPNRoutes(); + bool hasChanged(); + bool isValid(TQStringList& ); + + StrongswanConfig(TQWidget* parent); + ~StrongswanConfig(); + + private: + StrongswanConfigWidget* _strongswanWidget; + + TDENetworkSettingsMap m_vpnProperties; + TDENetworkSettingsMap m_vpnSecrets; + + protected slots: + void languageChange(); +}; + +class StrongswanAuthentication : public VPNAuthenticationWidget +{ + Q_OBJECT + + public: + StrongswanAuthentication(TQWidget* parent = NULL, char* name = NULL); + ~StrongswanAuthentication(); + TDENetworkSettingsMap getPasswords(); + void setPasswords(TDENetworkSettingsMap secrets); + + private: + StrongswanAuthenticationWidget* _strongswanAuth; +}; + +#endif /* KNETWORKMANAGER_STRONGSWAN_H */ diff --git a/tdenetworkmanager/vpn-plugins/strongswan/tdenetman_strongswan.desktop b/tdenetworkmanager/vpn-plugins/strongswan/tdenetman_strongswan.desktop new file mode 100644 index 0000000..7026d04 --- /dev/null +++ b/tdenetworkmanager/vpn-plugins/strongswan/tdenetman_strongswan.desktop @@ -0,0 +1,21 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +Icon= +ServiceTypes=TDENetworkManager/VPNPlugin +X-TDE-Library=tdenetman_strongswan +X-NetworkManager-Services=strongswan +X-TDE-PluginInfo-Author=Timothy Pearson +X-TDE-PluginInfo-Email=kb9vqf@pearsoncomputing.net +X-TDE-PluginInfo-Name=tdenetman_strongswan +X-TDE-PluginInfo-Version=0.1 +X-TDE-PluginInfo-Website= +X-TDE-PluginInfo-Category=VPNService +X-TDE-PluginInfo-Depends= +X-TDE-PluginInfo-License=GPL +X-TDE-PluginInfo-EnabledByDefault=false +Name=StrongSwan +Name[xx]=xxStrongSwanxx +Comment=StrongSwan +Comment[xx]=xxStrongSwanxx + -- cgit v1.2.1 From 94881634c452a182c71121771a3f576af60a3872 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 10 Sep 2012 21:18:39 -0500 Subject: Clean up the code slightly --- tdenetworkmanager/TODO | 4 +- .../tdenetman-connection_setting_vpn_widget.cpp | 48 ++++++++-------------- .../src/tdenetman-connection_editor.cpp | 6 +-- .../strongswan/src/tdenetman-strongswan.cpp | 27 +++++------- 4 files changed, 34 insertions(+), 51 deletions(-) diff --git a/tdenetworkmanager/TODO b/tdenetworkmanager/TODO index ea2e206..80660c2 100644 --- a/tdenetworkmanager/TODO +++ b/tdenetworkmanager/TODO @@ -1,2 +1,4 @@ -VPN support +Prompt user when connection fails +Tell the user when he/she enters an invalid setting +Better VPN support; there should be a visual indication of VPN status in the tray icon Translations diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp index c4f488b..ba4aa18 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp @@ -60,22 +60,18 @@ VPNWidgetImpl::Init() // fill in all possible VPN services VPNServiceList list = VPNManager::getVPNServices(); - if (list.isEmpty()) - { + if (list.isEmpty()) { // FIXME Do something useful here } - else - { + else { int index = 0; - for (VPNServiceList::Iterator it = list.begin(); it != list.end(); ++it) - { + 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) - { + if (service) { icon = service->getIcon(); disp_name = service->getDisplayName(); } @@ -99,14 +95,14 @@ VPNWidgetImpl::Init() } // no special icon for this service, use default - if (icon.isEmpty()) + if (icon.isEmpty()) { icon = "encrypted"; + } _mainWid->cboServices->insertItem(SmallIcon(icon, TQIconSet::Automatic), disp_name, index); _mapServiceCombo.insert(index++, *it); - if (service->getService() == _vpnsetting->vpnPluginID) - { + if (service->getService() == _vpnsetting->vpnPluginID) { // preselect the correct service _mainWid->cboServices->setCurrentItem(index - 1); slotServiceComboActivated(index - 1); @@ -115,10 +111,10 @@ VPNWidgetImpl::Init() } // lock the combo when editing an already existing connection - if (!_new_conn) + if (!_new_conn) { _mainWid->cboServices->setEnabled(false); - else - { + } + else { // preselect the correct service _mainWid->cboServices->setCurrentItem(0); slotServiceComboActivated(0); @@ -135,17 +131,14 @@ VPNWidgetImpl::Init() VPNConfigWidget* VPNWidgetImpl::getVPNConfigWidget(VPNService* service) { - if (_mapServiceWidget.find(service) != _mapServiceWidget.end()) - { + if (_mapServiceWidget.find(service) != _mapServiceWidget.end()) { // return the already available config widget return *_mapServiceWidget.find(service); } - else - { + else { // we have to create a new one VPNPlugin* plugin = service->getVPNPlugin(); - if (plugin) - { + if (plugin) { VPNConfigWidget* config = plugin->CreateConfigWidget(_mainWid->widgetStack); _mapServiceWidget.insert(service, config); return config; @@ -159,19 +152,16 @@ void VPNWidgetImpl::slotServiceComboActivated(int index) { VPNService* service; - if (_mapServiceCombo.find(index) != _mapServiceCombo.end()) - { + if (_mapServiceCombo.find(index) != _mapServiceCombo.end()) { service = *_mapServiceCombo.find(index); - if (service) - { + if (service) { VPNConfigWidget* config = getVPNConfigWidget(service); _mainWid->widgetStack->raiseWidget(config); config->setVPNData(_vpnsetting->ipConfig.routeConfigurations, _vpnsetting->pluginData, _vpnsetting->pluginSecrets); } } - else - { + else { //FIXME - do something useful here } } @@ -181,14 +171,12 @@ VPNWidgetImpl::Deactivate() { // update the setting from the currently selected vpn service VPNService* service = *_mapServiceCombo.find(_mainWid->cboServices->currentItem()); - if (service) - { + if (service) { // set the correct service type _vpnsetting->vpnPluginID = service->getService(); VPNConfigWidget* config = *_mapServiceWidget.find(service); - if (config) - { + if (config) { // update the vpn properties _vpnsetting->pluginData = config->getVPNProperties(); // update the vpn secrets diff --git a/tdenetworkmanager/src/tdenetman-connection_editor.cpp b/tdenetworkmanager/src/tdenetman-connection_editor.cpp index 906e158..5a00c30 100644 --- a/tdenetworkmanager/src/tdenetman-connection_editor.cpp +++ b/tdenetworkmanager/src/tdenetman-connection_editor.cpp @@ -68,9 +68,9 @@ class ConnectionListViewItem : public KListViewItem else if (_conn->type() == TDENetworkConnectionType::WiFi) { setPixmap(0, KGlobal::iconLoader()->loadIcon("wireless", KIcon::Small)); } -// else if (_conn->type() == TDENetworkConnectionType::VPN) { -// setPixmap(0, KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small)); -// } + else if (_conn->type() == TDENetworkConnectionType::VPN) { + setPixmap(0, KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small)); + } else { setPixmap(0, KGlobal::iconLoader()->loadIcon("help", KIcon::Small)); } diff --git a/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp b/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp index a0826bd..2d9e0d7 100644 --- a/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp +++ b/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp @@ -119,39 +119,32 @@ void StrongswanConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes m_vpnSecrets = secrets; // fill up our inputfields (only textfields atm) - for(TQMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) - { + for(TDENetworkSettingsMap::iterator it = properties.begin(); it != properties.end(); ++it) { TQString entry = it.key(); TQString value = it.data(); - if (entry == "gateway") - { + if (entry == "gateway") { _strongswanWidget->gateway->setText(value); } - else if (entry == "certificate") - { + else if (entry == "certificate") { _strongswanWidget->certificate->setURL(value); } - else if (entry == "username") - { + else if (entry == "username") { _strongswanWidget->username->setText(value); } - else if (entry == "method") - { - StrongswanConnectionType::CONNECTIONTYPE type = StrongswanConnectionType::mapString2ConnectionType(value.toInt()); + else if (entry == "method") { + StrongswanConnectionType::CONNECTIONTYPE type = StrongswanConnectionType::mapString2ConnectionType(value.toInt()); _strongswanWidget->authtype->setCurrentItem(type); } + // Options - else if (entry == "chkUDPenc") - { + else if (entry == "chkUDPenc") { _strongswanWidget->chkUDPenc->setChecked(value == "true"); } - else if (entry == "chkIPcomp") - { + else if (entry == "chkIPcomp") { _strongswanWidget->chkIPcomp->setChecked(value == "true"); } - else if (entry == "chkIPinner") - { + else if (entry == "chkIPinner") { _strongswanWidget->chkIPinner->setChecked(value == "true"); } } -- cgit v1.2.1 From 186ceec058095c3aa69ba988ea22e91f6859e20a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 11 Sep 2012 10:11:08 -0500 Subject: Show VPN status information --- tdenetworkmanager/src/tdenetman-tray.cpp | 33 ++++++++++++++++++++------------ tdenetworkmanager/src/tdenetman-tray.h | 1 + 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/tdenetworkmanager/src/tdenetman-tray.cpp b/tdenetworkmanager/src/tdenetman-tray.cpp index f6b4d9e..b8674b1 100644 --- a/tdenetworkmanager/src/tdenetman-tray.cpp +++ b/tdenetworkmanager/src/tdenetman-tray.cpp @@ -71,7 +71,6 @@ #include TDENetworkConnectionStatus::TDENetworkConnectionStatus nm_device_state_global = TDENetworkConnectionStatus::Invalid; -TDENetworkConnectionStatus::TDENetworkConnectionStatus current_vpn_state = TDENetworkConnectionStatus::Invalid; NewSecretsDialog::NewSecretsDialog(TDENetworkConnection *connection, TQWidget * parent, const char * name, bool modal, TQt::WFlags f) : TQDialog(parent, name, modal, f) @@ -324,7 +323,7 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu) // offline vs. online mode KAction* switch_mode = NULL; - if (nm->backendStatus() != TDENetworkGlobalManagerFlags::Sleeping) { + if (nm->backendStatus() & TDENetworkGlobalManagerFlags::Sleeping) { switch_mode = actionCollection ()->action ("offline_mode"); } else { @@ -725,7 +724,8 @@ void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus // printf("Active connection found\n\r"); // } - if ((current_vpn_state & TDENetworkConnectionStatus::Failed) || (current_vpn_state & TDENetworkConnectionStatus::Disconnected)) { + TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags current_vpn_state = (KGlobal::networkManager()->backendStatus() & TDENetworkGlobalManagerFlags::VPNMask); + if ((current_vpn_state & TDENetworkGlobalManagerFlags::VPNFailed) || (current_vpn_state & TDENetworkGlobalManagerFlags::VPNDisconnected)) { active_vpn = 0; } @@ -769,6 +769,7 @@ void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus } } else { + TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags current_vpn_state = (KGlobal::networkManager()->backendStatus() & TDENetworkGlobalManagerFlags::VPNMask); printf("VPN state: %d\n\r", current_vpn_state); //printf("Activated is: %d\n\r", TDENetworkConnectionStatus::Connected); // stop the old movie to avoid unnecessary wakups @@ -778,24 +779,24 @@ void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus movie()->pause(); if (dtc) { - if (current_vpn_state & TDENetworkConnectionStatus::Connected) { + if (current_vpn_state & TDENetworkGlobalManagerFlags::VPNConnected) { setPixmap(loadIcon("nm_device_vpn")); } - if ((current_vpn_state & TDENetworkConnectionStatus::EstablishingLink) - || (current_vpn_state & TDENetworkConnectionStatus::NeedAuthorization) - || (current_vpn_state & TDENetworkConnectionStatus::ConfiguringProtocols) - || (current_vpn_state & TDENetworkConnectionStatus::VerifyingProtocols)) { + if ((current_vpn_state & TDENetworkGlobalManagerFlags::VPNEstablishingLink) + || (current_vpn_state & TDENetworkGlobalManagerFlags::VPNNeedAuthorization) + || (current_vpn_state & TDENetworkGlobalManagerFlags::VPNConfiguringProtocols) + || (current_vpn_state & TDENetworkGlobalManagerFlags::VPNVerifyingProtocols)) { int frame = -1; if (movie()) frame = movie()->frameNumber(); // set the movie - if ((current_vpn_state & TDENetworkConnectionStatus::EstablishingLink) - || (current_vpn_state & TDENetworkConnectionStatus::NeedAuthorization)) { + if ((current_vpn_state & TDENetworkGlobalManagerFlags::VPNEstablishingLink) + || (current_vpn_state & TDENetworkGlobalManagerFlags::VPNNeedAuthorization)) { setMovie(TQMovie(KGlobal::iconLoader()->moviePath("nm_stage02_connecting_vpn", KIcon::Panel))); } - if ((current_vpn_state & TDENetworkConnectionStatus::ConfiguringProtocols) - || (current_vpn_state & TDENetworkConnectionStatus::VerifyingProtocols)) { + if ((current_vpn_state & TDENetworkGlobalManagerFlags::VPNConfiguringProtocols) + || (current_vpn_state & TDENetworkGlobalManagerFlags::VPNVerifyingProtocols)) { setMovie(TQMovie(KGlobal::iconLoader()->moviePath("nm_stage03_connecting_vpn", KIcon::Panel))); } @@ -885,6 +886,13 @@ void Tray::slotGenericHardwareEvent(TDEHardwareEvent::TDEHardwareEvent event, TQ } } +void Tray::slotVPNEventHandler(TDENetworkVPNEventType::TDENetworkVPNEventType event, TQString message) +{ + if (event == TDENetworkVPNEventType::LoginBanner) { + slotVPNBannerShow(message); + } +} + Tray::Tray() : KSystemTray() { hwdevices = KGlobal::hardwareDevices(); @@ -944,6 +952,7 @@ Tray::Tray() : KSystemTray() // Notifications connect(KGlobal::networkManager(), TQT_SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, TQT_SLOT(slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags))); + connect(KGlobal::networkManager(), TQT_SIGNAL(vpnEvent(TDENetworkVPNEventType::TDENetworkVPNEventType, TQString)), this, TQT_SLOT(slotVPNEventHandler(TDENetworkVPNEventType::TDENetworkVPNEventType, TQString))); // initial setup of the device-trays diff --git a/tdenetworkmanager/src/tdenetman-tray.h b/tdenetworkmanager/src/tdenetman-tray.h index 1daf455..fc02aa7 100644 --- a/tdenetworkmanager/src/tdenetman-tray.h +++ b/tdenetworkmanager/src/tdenetman-tray.h @@ -110,6 +110,7 @@ class Tray : public KSystemTray void slotGenericDeviceAdded(TDEGenericDevice*); void slotGenericDeviceRemoved(TDEGenericDevice*); void slotGenericHardwareEvent(TDEHardwareEvent::TDEHardwareEvent, TQString); + void slotVPNEventHandler(TDENetworkVPNEventType::TDENetworkVPNEventType event, TQString message); private: void updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus); -- cgit v1.2.1 From 75d5225a52e81e369e4bcef45bee258724573688 Mon Sep 17 00:00:00 2001 From: Automated System Date: Fri, 14 Sep 2012 20:26:20 -0500 Subject: Reset submodule main/applications/knetworkmanager9/admin to latest HEAD --- admin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin b/admin index ac762db..efdff81 160000 --- a/admin +++ b/admin @@ -1 +1 @@ -Subproject commit ac762db5a07d3ab5909e058f7051d82aef384224 +Subproject commit efdff81cd246d0737ecb1a82ef6fd588c0a6bc08 -- cgit v1.2.1