diff options
author | Darrell Anderson <[email protected]> | 2012-09-16 23:05:24 -0500 |
---|---|---|
committer | Darrell Anderson <[email protected]> | 2012-09-16 23:05:24 -0500 |
commit | 452198ac1214041750a4765846fd35469059017e (patch) | |
tree | 9d789b0f7ce4832a30d3754c0702fa8f455d0b3b | |
parent | 2b39cdb5c9b16a7d41c0488547b5cb0b95f613b6 (diff) | |
parent | 75d5225a52e81e369e4bcef45bee258724573688 (diff) | |
download | tdenetworkmanager-452198ac1214041750a4765846fd35469059017e.tar.gz tdenetworkmanager-452198ac1214041750a4765846fd35469059017e.zip |
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/knetworkmanager9
Conflicts:
tdenetworkmanager/src/tdenetman-pluginmanager.cpp
300 files changed, 6048 insertions, 12616 deletions
diff --git a/tdenetworkmanager/CMakeLists.txt b/tdenetworkmanager/CMakeLists.txt index 119a77e..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 knetworkmanager.conf DESTINATION ${DBUS_SYS_DIR} ) +install( FILES tdenetworkmanager.conf DESTINATION ${DBUS_SYS_DIR} ) 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/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/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-action-nm_stage01_connecting.mng b/tdenetworkmanager/pics/hi16-action-nm_stage01_connecting.mng Binary files differnew file mode 100644 index 0000000..6414aa4 --- /dev/null +++ b/tdenetworkmanager/pics/hi16-action-nm_stage01_connecting.mng diff --git a/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting.mng b/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting.mng Binary files differnew file mode 100644 index 0000000..270e946 --- /dev/null +++ b/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting.mng diff --git a/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting_vpn.mng b/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting_vpn.mng Binary files differnew file mode 100644 index 0000000..103ca43 --- /dev/null +++ b/tdenetworkmanager/pics/hi16-action-nm_stage02_connecting_vpn.mng diff --git a/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting.mng b/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting.mng Binary files differnew file mode 100644 index 0000000..cf8c0d0 --- /dev/null +++ b/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting.mng diff --git a/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting_vpn.mng b/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting_vpn.mng Binary files differnew file mode 100644 index 0000000..07b37a3 --- /dev/null +++ b/tdenetworkmanager/pics/hi16-action-nm_stage03_connecting_vpn.mng diff --git a/tdenetworkmanager/pics/hi16-app-knetworkmanager.png b/tdenetworkmanager/pics/hi16-app-tdenetworkmanager.png Binary files differindex db29bb8..db29bb8 100644 --- a/tdenetworkmanager/pics/hi16-app-knetworkmanager.png +++ b/tdenetworkmanager/pics/hi16-app-tdenetworkmanager.png diff --git a/tdenetworkmanager/pics/hi16-app-knetworkmanager_disabled.png b/tdenetworkmanager/pics/hi16-app-tdenetworkmanager_disabled.png Binary files differindex 971f7e3..971f7e3 100644 --- a/tdenetworkmanager/pics/hi16-app-knetworkmanager_disabled.png +++ b/tdenetworkmanager/pics/hi16-app-tdenetworkmanager_disabled.png diff --git a/tdenetworkmanager/pics/hi32-action-nm_stage01_connecting.mng b/tdenetworkmanager/pics/hi32-action-nm_stage01_connecting.mng Binary files differnew file mode 100644 index 0000000..75a27cd --- /dev/null +++ b/tdenetworkmanager/pics/hi32-action-nm_stage01_connecting.mng diff --git a/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting.mng b/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting.mng Binary files differnew file mode 100644 index 0000000..4effbdb --- /dev/null +++ b/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting.mng diff --git a/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting_vpn.mng b/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting_vpn.mng Binary files differnew file mode 100644 index 0000000..aa305c8 --- /dev/null +++ b/tdenetworkmanager/pics/hi32-action-nm_stage02_connecting_vpn.mng diff --git a/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting.mng b/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting.mng Binary files differnew file mode 100644 index 0000000..cb92447 --- /dev/null +++ b/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting.mng diff --git a/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting_vpn.mng b/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting_vpn.mng Binary files differnew file mode 100644 index 0000000..4eaaa57 --- /dev/null +++ b/tdenetworkmanager/pics/hi32-action-nm_stage03_connecting_vpn.mng diff --git a/tdenetworkmanager/pics/hi32-app-knetworkmanager.png b/tdenetworkmanager/pics/hi32-app-tdenetworkmanager.png Binary files differindex 5e98e9c..5e98e9c 100644 --- a/tdenetworkmanager/pics/hi32-app-knetworkmanager.png +++ b/tdenetworkmanager/pics/hi32-app-tdenetworkmanager.png diff --git a/tdenetworkmanager/pics/hi32-app-knetworkmanager_disabled.png b/tdenetworkmanager/pics/hi32-app-tdenetworkmanager_disabled.png Binary files differindex a9ed5f9..a9ed5f9 100644 --- a/tdenetworkmanager/pics/hi32-app-knetworkmanager_disabled.png +++ b/tdenetworkmanager/pics/hi32-app-tdenetworkmanager_disabled.png diff --git a/tdenetworkmanager/pics/hi48-action-nm_stage01_connecting.mng b/tdenetworkmanager/pics/hi48-action-nm_stage01_connecting.mng Binary files differnew file mode 100644 index 0000000..eca51d7 --- /dev/null +++ b/tdenetworkmanager/pics/hi48-action-nm_stage01_connecting.mng diff --git a/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting.mng b/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting.mng Binary files differnew file mode 100644 index 0000000..1260aff --- /dev/null +++ b/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting.mng diff --git a/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting_vpn.mng b/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting_vpn.mng Binary files differnew file mode 100644 index 0000000..fd50353 --- /dev/null +++ b/tdenetworkmanager/pics/hi48-action-nm_stage02_connecting_vpn.mng diff --git a/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting.mng b/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting.mng Binary files differnew file mode 100644 index 0000000..0f1964f --- /dev/null +++ b/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting.mng diff --git a/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting_vpn.mng b/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting_vpn.mng Binary files differnew file mode 100644 index 0000000..a9873e9 --- /dev/null +++ b/tdenetworkmanager/pics/hi48-action-nm_stage03_connecting_vpn.mng diff --git a/tdenetworkmanager/pics/hi48-app-knetworkmanager.png b/tdenetworkmanager/pics/hi48-app-tdenetworkmanager.png Binary files differindex 8306829..8306829 100644 --- a/tdenetworkmanager/pics/hi48-app-knetworkmanager.png +++ b/tdenetworkmanager/pics/hi48-app-tdenetworkmanager.png diff --git a/tdenetworkmanager/pics/hi48-app-knetworkmanager_disabled.png b/tdenetworkmanager/pics/hi48-app-tdenetworkmanager_disabled.png Binary files differindex 53eafb4..53eafb4 100644 --- a/tdenetworkmanager/pics/hi48-app-knetworkmanager_disabled.png +++ b/tdenetworkmanager/pics/hi48-app-tdenetworkmanager_disabled.png diff --git a/tdenetworkmanager/pics/hi64-action-nm_stage01_connecting.mng b/tdenetworkmanager/pics/hi64-action-nm_stage01_connecting.mng Binary files differnew file mode 100644 index 0000000..4bd4608 --- /dev/null +++ b/tdenetworkmanager/pics/hi64-action-nm_stage01_connecting.mng diff --git a/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting.mng b/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting.mng Binary files differnew file mode 100644 index 0000000..addba20 --- /dev/null +++ b/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting.mng diff --git a/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting_vpn.mng b/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting_vpn.mng Binary files differnew file mode 100644 index 0000000..c70dc0e --- /dev/null +++ b/tdenetworkmanager/pics/hi64-action-nm_stage02_connecting_vpn.mng diff --git a/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting.mng b/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting.mng Binary files differnew file mode 100644 index 0000000..6be0854 --- /dev/null +++ b/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting.mng diff --git a/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting_vpn.mng b/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting_vpn.mng Binary files differnew file mode 100644 index 0000000..d208ab3 --- /dev/null +++ b/tdenetworkmanager/pics/hi64-action-nm_stage03_connecting_vpn.mng diff --git a/tdenetworkmanager/pics/updatemovies.sh b/tdenetworkmanager/pics/updatemovies.sh new file mode 100755 index 0000000..3078714 --- /dev/null +++ b/tdenetworkmanager/pics/updatemovies.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +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/po/af.po b/tdenetworkmanager/po/af.po index 7dc7c3c..f61d0a7 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 @@ -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 dcefcb1..f063389 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 @@ -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 9a3a55e..59fcf92 100644 --- a/tdenetworkmanager/po/bg.po +++ b/tdenetworkmanager/po/bg.po @@ -286,20 +286,20 @@ 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." 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 880cbf4..4d6325a 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 @@ -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 ee0134d..f650e34 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 @@ -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 9f19b3e..42b5850 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 @@ -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 b75e2c7..f916751 100644 --- a/tdenetworkmanager/po/cs.po +++ b/tdenetworkmanager/po/cs.po @@ -283,20 +283,20 @@ 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." 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 d440c9f..2ac2b6f 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 @@ -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 caa683f..4eb56c6 100644 --- a/tdenetworkmanager/po/da.po +++ b/tdenetworkmanager/po/da.po @@ -288,20 +288,20 @@ 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." 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 10f0bb9..e3d0a12 100644 --- a/tdenetworkmanager/po/de.po +++ b/tdenetworkmanager/po/de.po @@ -288,20 +288,20 @@ 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." 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 0f67634..938aa55 100644 --- a/tdenetworkmanager/po/el.po +++ b/tdenetworkmanager/po/el.po @@ -319,20 +319,20 @@ 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." 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 d29d844..feccfa6 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 @@ -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 13aa270..d193bd1 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 @@ -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 043a67e..3829d0f 100644 --- a/tdenetworkmanager/po/es.po +++ b/tdenetworkmanager/po/es.po @@ -289,22 +289,22 @@ 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." 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 60fde3c..ae73607 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 @@ -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 df90383..2e173ed 100644 --- a/tdenetworkmanager/po/fi.po +++ b/tdenetworkmanager/po/fi.po @@ -286,19 +286,19 @@ 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." 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 44bc4df..22057c5 100644 --- a/tdenetworkmanager/po/fr.po +++ b/tdenetworkmanager/po/fr.po @@ -295,21 +295,21 @@ 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." 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 fae1e72..3d2a4fc 100644 --- a/tdenetworkmanager/po/gl.po +++ b/tdenetworkmanager/po/gl.po @@ -283,20 +283,20 @@ 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." 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 a05cefe..5196355 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 @@ -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 9ca4dfc..1b6b16d 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 @@ -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 0527e1a..4976d2c 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 @@ -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 e3ce240..2fae00a 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 @@ -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 b219636..34040ab 100644 --- a/tdenetworkmanager/po/hu.po +++ b/tdenetworkmanager/po/hu.po @@ -286,20 +286,20 @@ 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." 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 063a624..95764d3 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 @@ -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 4234ea4..59b4c5f 100644 --- a/tdenetworkmanager/po/it.po +++ b/tdenetworkmanager/po/it.po @@ -292,21 +292,21 @@ 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." 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 58bcb20..9e96e8c 100644 --- a/tdenetworkmanager/po/ja.po +++ b/tdenetworkmanager/po/ja.po @@ -286,19 +286,19 @@ 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." 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 14f2a68..d4a2833 100644 --- a/tdenetworkmanager/po/ka.po +++ b/tdenetworkmanager/po/ka.po @@ -280,20 +280,20 @@ 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." 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 834ebc5..a109d5e 100644 --- a/tdenetworkmanager/po/km.po +++ b/tdenetworkmanager/po/km.po @@ -284,20 +284,20 @@ 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." 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 4367a9b..3cc4a94 100644 --- a/tdenetworkmanager/po/ko.po +++ b/tdenetworkmanager/po/ko.po @@ -290,19 +290,19 @@ 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." 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 5b3b5c3..936004b 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 @@ -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 caacc6e..a1b6172 100644 --- a/tdenetworkmanager/po/lt.po +++ b/tdenetworkmanager/po/lt.po @@ -286,20 +286,20 @@ 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." 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 75566d5..0d19411 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 @@ -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 8f5aa68..92e7f0e 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 @@ -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 ca3a397..5cce1f4 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 @@ -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 a797b74..b964618 100644 --- a/tdenetworkmanager/po/nl.po +++ b/tdenetworkmanager/po/nl.po @@ -294,20 +294,20 @@ 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." 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 6cda331..7401649 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 @@ -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 0011667..b2a4c6a 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 @@ -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 48e8bcc..01c5175 100644 --- a/tdenetworkmanager/po/pt.po +++ b/tdenetworkmanager/po/pt.po @@ -296,20 +296,20 @@ 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." 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 a20b2c9..10ac9af 100644 --- a/tdenetworkmanager/po/pt_BR.po +++ b/tdenetworkmanager/po/pt_BR.po @@ -308,20 +308,20 @@ 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." 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 997c5c6..8407883 100644 --- a/tdenetworkmanager/po/ro.po +++ b/tdenetworkmanager/po/ro.po @@ -290,20 +290,20 @@ 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." 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 e195ed0..cd18392 100644 --- a/tdenetworkmanager/po/ru.po +++ b/tdenetworkmanager/po/ru.po @@ -295,20 +295,20 @@ 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." 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 f3bd366..993a6de 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 @@ -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 e7f06e6..ac1c8e8 100644 --- a/tdenetworkmanager/po/sk.po +++ b/tdenetworkmanager/po/sk.po @@ -298,20 +298,20 @@ 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." 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 2dcb14f..f25ec2b 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 @@ -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 d025ffd..0957c59 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 @@ -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 ae1b7f2..d0370a4 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 @@ -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 5fe0e60..22d3130 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 @@ -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 c6cc2e5..d18b7dd 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 @@ -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 ead37c3..db2a1a4 100644 --- a/tdenetworkmanager/po/tr.po +++ b/tdenetworkmanager/po/tr.po @@ -294,21 +294,21 @@ 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." 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 62678f9..6d3fdf5 100644 --- a/tdenetworkmanager/po/uk.po +++ b/tdenetworkmanager/po/uk.po @@ -287,20 +287,20 @@ 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." 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 006c6e0..16c6b59 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 @@ -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 a5ce8a6..9e29afc 100644 --- a/tdenetworkmanager/po/wa.po +++ b/tdenetworkmanager/po/wa.po @@ -285,19 +285,19 @@ 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." 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 dafb189..6a0c7ea 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 @@ -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 fee2ec7..91d5168 100644 --- a/tdenetworkmanager/po/zh_CN.po +++ b/tdenetworkmanager/po/zh_CN.po @@ -297,20 +297,20 @@ 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." 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 "KDE 网络管理器" +msgid "TDENetworkManager" +msgstr "TDE 网络管理器" #: main.cpp:50 #: main.cpp:51 diff --git a/tdenetworkmanager/po/zh_TW.po b/tdenetworkmanager/po/zh_TW.po index f53bd40..0623f17 100644 --- a/tdenetworkmanager/po/zh_TW.po +++ b/tdenetworkmanager/po/zh_TW.po @@ -292,19 +292,19 @@ 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." 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 a8a3999..49e4e73 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 @@ -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 320ec32..10dd396 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} @@ -28,64 +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( tdenetworkmanager AUTOMOC SOURCES - connection_setting_info.ui connection_setting_wireless_security_wep.ui connection_setting_gsm.ui - connection_setting_cdma.ui connection_setting_ipv4.ui connection_setting_ppp.ui - connection_setting_serial.ui connection_setting_wireless_security_wpacipher.ui - connection_setting_wireless_security_eap.ui connection_setting_wireless_security_wpapsk.ui - connection_setting_wireless_security_phase2.ui connection_setting_wireless_security_wpaversion.ui - connection_setting_wireless_security.ui connection_setting_wireless.ui - connection_setting_wireless_security_wepencryption.ui connection_settings.ui - connection_setting_wireless_security_auth.ui connection_setting_vpn.ui connection_editor.ui - vpnauthentication.ui main.cpp knetworkmanager.cpp knetworkmanager-tray.cpp - knetworkmanager-hal_device_proxy.cpp knetworkmanager-nm_proxy.cpp knetworkmanager-device.cpp - knetworkmanager-cdma_device.cpp knetworkmanager-cellular_device.cpp knetworkmanager-gsm_device.cpp - knetworkmanager-wired_device.cpp knetworkmanager-vpn_device.cpp knetworkmanager-vpn_plugin.cpp - knetworkmanager-wireless_device.cpp knetworkmanager-devicestore.cpp - knetworkmanager-cellular_device_tray.cpp knetworkmanager-device_tray.cpp - knetworkmanager-wired_device_tray.cpp knetworkmanager-wireless_device_tray.cpp - knetworkmanager-accesspoint.cpp knetworkmanager-wireless_menuitem.cpp knetworkmanager-menuitem.cpp - knetworkmanager-menu_subhead.cpp knetworkmanager-connection_setting.cpp - knetworkmanager-connection_setting_info.cpp knetworkmanager-connection_setting_ipv4.cpp - knetworkmanager-connection_setting_wired.cpp knetworkmanager-connection_setting_wireless.cpp - knetworkmanager-connection_setting_wireless_security.cpp - knetworkmanager-connection_setting_8021x.cpp knetworkmanager-connection_setting_vpn.cpp - knetworkmanager-connection_setting_serial.cpp knetworkmanager-connection_setting_cdma.cpp - knetworkmanager-connection_setting_gsm.cpp knetworkmanager-connection_setting_ppp.cpp - knetworkmanager-connection_dbus.cpp knetworkmanager-connection_secrets_dbus.cpp - knetworkmanager-connection.cpp knetworkmanager-generic_connection.cpp - knetworkmanager-cdma_connection.cpp knetworkmanager-gsm_connection.cpp - knetworkmanager-ppp_connection.cpp knetworkmanager-wireless_connection.cpp - knetworkmanager-wired_connection.cpp knetworkmanager-vpn_connection.cpp - knetworkmanager-connection_store.cpp knetworkmanager-connection_setting_cdma_widget.cpp - knetworkmanager-connection_setting_gsm_widget.cpp - knetworkmanager-connection_setting_info_widget.cpp - knetworkmanager-connection_setting_ipv4_widget.cpp - knetworkmanager-connection_setting_ppp_widget.cpp - knetworkmanager-connection_setting_serial_widget.cpp - knetworkmanager-connection_setting_wireless_security_widget.cpp - knetworkmanager-connection_setting_wireless_widget.cpp - knetworkmanager-connection_setting_vpn_widget.cpp knetworkmanager-connection_settings_dialog.cpp - knetworkmanager-connection_setting_widget_interface.cpp knetworkmanager-nmsettings.cpp - sha1.cpp md5.cpp xmlmarshaller.cpp knetworkmanager-storage.cpp - knetworkmanager-wireless_network.cpp knetworkmanager-wireless_manager.cpp - knetworkmanager-connection_editor.cpp knetworkmanager-plugin.cpp knetworkmanager-vpnplugin.cpp - knetworkmanager-pluginmanager.cpp knetworkmanager-vpnservice.cpp knetworkmanager-vpnmanager.cpp - knetworkmanager-vpnauthenticationdialog.cpp devicetraycomponent.cpp traycomponent.cpp - vpn_tray_component.cpp secret_storage_plugin.cpp + connection_editor.ui + vpnauthentication.ui main.cpp tdenetman.cpp tdenetman-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 + sha1.cpp md5.cpp + 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 + 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/CMakeLists.txt b/tdenetworkmanager/src/configwidgets/CMakeLists.txt new file mode 100644 index 0000000..8c9c32e --- /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/connection_setting_cdma.ui b/tdenetworkmanager/src/configwidgets/connection_setting_cdma.ui index 5674468..5674468 100644 --- a/tdenetworkmanager/src/connection_setting_cdma.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_cdma.ui diff --git a/tdenetworkmanager/src/connection_setting_gsm.ui b/tdenetworkmanager/src/configwidgets/connection_setting_gsm.ui index c89a749..0830da7 100644 --- a/tdenetworkmanager/src/connection_setting_gsm.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_gsm.ui @@ -41,17 +41,6 @@ <cstring>mNetworkId</cstring> </property> </widget> - <widget class="TQLabel" row="3" column="0"> - <property name="name"> - <cstring>textLabel2_2_2</cstring> - </property> - <property name="text"> - <string>PU&K:</string> - </property> - <property name="buddy" stdset="0"> - <cstring>mUsername</cstring> - </property> - </widget> <widget class="TQLabel" row="0" column="2"> <property name="name"> <cstring>textLabel1</cstring> @@ -79,22 +68,22 @@ </item> <item> <property name="text"> - <string>GPRS</string> + <string>Only 3G</string> </property> </item> <item> <property name="text"> - <string>GSM</string> + <string>Only GPRS/EDGE</string> </property> </item> <item> <property name="text"> - <string>Prefer GPRS</string> + <string>Prefer 3G</string> </property> </item> <item> <property name="text"> - <string>Prefer GSM</string> + <string>Prefer 2G</string> </property> </item> <property name="name"> @@ -151,17 +140,6 @@ <cstring>mBand</cstring> </property> </widget> - <widget class="TQLineEdit" row="3" column="1"> - <property name="name"> - <cstring>mPuk</cstring> - </property> - <property name="toolTip" stdset="0"> - <string>Personal Unblocking Code</string> - </property> - <property name="whatsThis" stdset="0"> - <string> A code used to unblock a blocked SIM card</string> - </property> - </widget> <widget class="TQSpinBox" row="4" column="3"> <property name="name"> <cstring>mBand</cstring> @@ -283,7 +261,6 @@ <tabstop>mUsername</tabstop> <tabstop>mPassword</tabstop> <tabstop>mPin</tabstop> - <tabstop>mPuk</tabstop> <tabstop>mNumber</tabstop> <tabstop>mApn</tabstop> <tabstop>mNetworkId</tabstop> diff --git a/tdenetworkmanager/src/connection_setting_info.ui b/tdenetworkmanager/src/configwidgets/connection_setting_info.ui index 72a6e87..72a6e87 100644 --- a/tdenetworkmanager/src/connection_setting_info.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_info.ui diff --git a/tdenetworkmanager/src/connection_setting_ipv4.ui b/tdenetworkmanager/src/configwidgets/connection_setting_ipv4.ui index 0f08a00..0f08a00 100644 --- a/tdenetworkmanager/src/connection_setting_ipv4.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_ipv4.ui diff --git a/tdenetworkmanager/src/connection_setting_ppp.ui b/tdenetworkmanager/src/configwidgets/connection_setting_ppp.ui index 7db6e5e..734fe78 100644 --- a/tdenetworkmanager/src/connection_setting_ppp.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_ppp.ui @@ -210,14 +210,6 @@ <string>Require MPPE</string> </property> </widget> - <widget class="TQCheckBox" row="5" column="1"> - <property name="name"> - <cstring>mRequireMppc</cstring> - </property> - <property name="text"> - <string>Require MPPC</string> - </property> - </widget> <widget class="TQCheckBox" row="5" column="0"> <property name="name"> <cstring>mRefuseMschapV2</cstring> @@ -308,7 +300,6 @@ <tabstop>mRequireMppe</tabstop> <tabstop>mRequireMppe128</tabstop> <tabstop>mStatefulMppe</tabstop> - <tabstop>mRequireMppc</tabstop> <tabstop>mCrtscts</tabstop> <tabstop>mBaudRate</tabstop> <tabstop>mMru</tabstop> diff --git a/tdenetworkmanager/src/connection_setting_serial.ui b/tdenetworkmanager/src/configwidgets/connection_setting_serial.ui index 2a3b9ad..2a3b9ad 100644 --- a/tdenetworkmanager/src/connection_setting_serial.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_serial.ui diff --git a/tdenetworkmanager/src/connection_setting_vpn.ui b/tdenetworkmanager/src/configwidgets/connection_setting_vpn.ui index 976fc25..976fc25 100644 --- a/tdenetworkmanager/src/connection_setting_vpn.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_vpn.ui diff --git a/tdenetworkmanager/src/connection_setting_wireless.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless.ui index 9415ce4..9415ce4 100644 --- a/tdenetworkmanager/src/connection_setting_wireless.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless.ui diff --git a/tdenetworkmanager/src/connection_setting_wireless_security.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security.ui index 5fce58f..5fce58f 100644 --- a/tdenetworkmanager/src/connection_setting_wireless_security.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security.ui diff --git a/tdenetworkmanager/src/connection_setting_wireless_security_auth.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_auth.ui index ce88e51..ce88e51 100644 --- a/tdenetworkmanager/src/connection_setting_wireless_security_auth.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_auth.ui diff --git a/tdenetworkmanager/src/connection_setting_wireless_security_eap.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_eap.ui index a851a93..a851a93 100644 --- a/tdenetworkmanager/src/connection_setting_wireless_security_eap.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_eap.ui diff --git a/tdenetworkmanager/src/connection_setting_wireless_security_phase2.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_phase2.ui index b3237d4..b3237d4 100644 --- a/tdenetworkmanager/src/connection_setting_wireless_security_phase2.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_phase2.ui diff --git a/tdenetworkmanager/src/connection_setting_wireless_security_wep.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wep.ui index c07033e..c07033e 100644 --- a/tdenetworkmanager/src/connection_setting_wireless_security_wep.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wep.ui diff --git a/tdenetworkmanager/src/connection_setting_wireless_security_wepencryption.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wepencryption.ui index 50c149d..50c149d 100644 --- a/tdenetworkmanager/src/connection_setting_wireless_security_wepencryption.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wepencryption.ui diff --git a/tdenetworkmanager/src/connection_setting_wireless_security_wpacipher.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpacipher.ui index a402e66..a402e66 100644 --- a/tdenetworkmanager/src/connection_setting_wireless_security_wpacipher.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpacipher.ui diff --git a/tdenetworkmanager/src/connection_setting_wireless_security_wpapsk.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpapsk.ui index 4df8eea..4df8eea 100644 --- a/tdenetworkmanager/src/connection_setting_wireless_security_wpapsk.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpapsk.ui diff --git a/tdenetworkmanager/src/connection_setting_wireless_security_wpaversion.ui b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpaversion.ui index 11b1655..11b1655 100644 --- a/tdenetworkmanager/src/connection_setting_wireless_security_wpaversion.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_wireless_security_wpaversion.ui diff --git a/tdenetworkmanager/src/connection_settings.ui b/tdenetworkmanager/src/configwidgets/connection_settings.ui index c7994de..c7994de 100644 --- a/tdenetworkmanager/src/connection_settings.ui +++ b/tdenetworkmanager/src/configwidgets/connection_settings.ui diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_cdma_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.cpp index b09fea9..7e95fd3 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_cdma_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-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. * @@ -33,20 +33,20 @@ #include <tqwidgetstack.h> #include <kuser.h> -// knm headers -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting_cdma.h" -#include "knetworkmanager-connection_setting_cdma_widget.h" -#include "knetworkmanager-device.h" +// tdenm headers +#include "tdenetman-connection_setting_cdma_widget.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<ConnectionSettings::CDMA*> (conn->getSetting(NM_SETTING_CDMA_SETTING_NAME)); + _parentdialog = dynamic_cast<ConnectionSettingsDialogImpl*>(parent); + + _cdmasetting = dynamic_cast<TDEModemConnection*>(conn); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingCdmaWidget(this); @@ -58,12 +58,16 @@ CDMAWidgetImpl::CDMAWidgetImpl(Connection* conn, TQWidget* parent, const char* n 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 @@ -80,10 +84,14 @@ 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; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } -#include "knetworkmanager-connection_setting_cdma_widget.moc" +#include "tdenetman-connection_setting_cdma_widget.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_cdma_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.h index 6ee8a37..110b079 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_cdma_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_cdma_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-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. * @@ -26,14 +26,17 @@ #define KNETWORKMANAGER_CONNECTION_SETTING_CDMA_WIDGET_H -// qt headers +// tqt headers #include <tqwidget.h> #include <tqlineedit.h> -// knm headers -#include "knetworkmanager-connection_setting_cdma.h" -#include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-device.h" +// tde headers +#include <tdehardwaredevices.h> +#include <tdenetworkconnections.h> + +// tdenm headers +#include "tdenetman-connection_settings_dialog.h" +#include "tdenetman-connection_setting_widget_interface.h" //class VPNService; class ConnectionSettingCdmaWidget; @@ -41,14 +44,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: @@ -58,9 +59,10 @@ class CDMAWidgetImpl : public WidgetInterface void Init(); //VPNConfigWidget* getVPNConfigWidget(VPNService* service); - - CDMA* _cdmasetting; + 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 new file mode 100644 index 0000000..f373b04 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.cpp @@ -0,0 +1,160 @@ +/*************************************************************************** + * + * tdenetman-connection_setting_gsm_widget.cpp - A NetworkManager frontend for TDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa <[email protected]>, <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + **************************************************************************/ + +// qt headers +#include <tqwidget.h> +#include <tqlineedit.h> +#include <tqcheckbox.h> +#include <tqlayout.h> +#include <tqcombobox.h> +#include <tqspinbox.h> +#include <tqiconset.h> +#include <kiconloader.h> +#include <tqwidgetstack.h> +#include <kuser.h> + +// tdenm 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) +{ + _parentdialog = dynamic_cast<ConnectionSettingsDialogImpl*>(parent); + + _gsmsetting = dynamic_cast<TDEModemConnection*>(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; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts +} + +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/knetworkmanager-connection_setting_gsm_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.h index df77606..221336e 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_gsm_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_gsm_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-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. * @@ -26,14 +26,17 @@ #define KNETWORKMANAGER_CONNECTION_SETTING_GSM_WIDGET_H -// qt headers +// tqt headers #include <tqwidget.h> #include <tqlineedit.h> -// knm headers -#include "knetworkmanager-connection_setting_gsm.h" -#include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-device.h" +// tde headers +#include <tdehardwaredevices.h> +#include <tdenetworkconnections.h> + +// tdenm headers +#include "tdenetman-connection_settings_dialog.h" +#include "tdenetman-connection_setting_widget_interface.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,9 +61,13 @@ class GSMWidgetImpl : public WidgetInterface void Init(); //VPNConfigWidget* getVPNConfigWidget(VPNService* service); + void setNetworkType(TDEGSMNetworkType::TDEGSMNetworkType); + TDEGSMNetworkType::TDEGSMNetworkType getNetworkType(); - GSM* _gsmsetting; + TDEModemConnection* _gsmsetting; ConnectionSettingGsmWidget* _mainWid; + + ConnectionSettingsDialogImpl* _parentdialog; }; } diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_info_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.cpp index e0982e8..e9962ee 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_info_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -29,19 +29,16 @@ #include <tqcheckbox.h> #include <tqlayout.h> -// knm headers -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-connection_setting_info_widget.h" -#include "knetworkmanager-device.h" +// tdenm headers +#include "tdenetman-connection_setting_info_widget.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<ConnectionSettings::Info*> (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME)); - + _infosetting = conn; + _parentdialog = dynamic_cast<ConnectionSettingsDialogImpl*>(parent); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingInfoWidget(this); @@ -60,20 +57,22 @@ 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; + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void InfoWidgetImpl::slotAutoconnectChanged(bool autoconnect) { - _infosetting->setAutoconnect(autoconnect); + _infosetting->autoConnect = autoconnect; + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } -#include "knetworkmanager-connection_setting_info_widget.moc" +#include "tdenetman-connection_setting_info_widget.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_info_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.h index 16a7ace..2ddb6e5 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_info_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_info_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -27,14 +27,18 @@ #define KNETWORKMANAGER_CONNECTION_SETTING_INFO_WIDGET_H -// qt headers +// tqt headers #include <tqwidget.h> #include <tqlineedit.h> -// knm headers +// tde headers +#include <tdehardwaredevices.h> +#include <tdenetworkconnections.h> + +// tdenm headers #include "connection_setting_info.h" -#include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-device.h" +#include "tdenetman-connection_settings_dialog.h" +#include "tdenetman-connection_setting_widget_interface.h" namespace ConnectionSettings { @@ -47,7 +51,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 +61,8 @@ class InfoWidgetImpl : public WidgetInterface private: void Init(); - Info* _infosetting; + TDENetworkConnection* _infosetting; + ConnectionSettingsDialogImpl* _parentdialog; ConnectionSettingInfoWidget* _mainWid; }; diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp index ca00a49..03db7b4 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -29,17 +29,17 @@ #include <tqlayout.h> #include <tqhostaddress.h> -#include "knetworkmanager-connection_setting_ipv4_widget.h" -#include "knetworkmanager-connection_setting_ipv4.h" +#include "tdenetman-connection_setting_ipv4_widget.h" 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<ConnectionSettings::IPv4*> (conn->getSetting(NM_SETTING_IP4_CONFIG_SETTING_NAME)); + _ipv4_setting = conn; + _parentdialog = dynamic_cast<ConnectionSettingsDialogImpl*>(parent); 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<TQHostAddress> hosts = _ipv4_setting->getDNS(); + TDENetworkAddressList hosts = _ipv4_setting->ipConfig.resolvers; TQStringList list; - for (TQValueList<TQHostAddress>::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,18 @@ IPv4WidgetImpl::slotDNSAddressesChanged(const TQString& adr) { // TODO: use , and ; for splitting too TQStringList list = TQStringList::split(" ", adr); - TQValueList<TQHostAddress> 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; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } @@ -114,13 +126,34 @@ 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; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } 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; + } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void @@ -129,47 +162,61 @@ IPv4WidgetImpl::slotIPAddressChanged(const TQString& ip) TQHostAddress ipadr(ip); if (!ipadr.isNull()) { - TQValueList<IPv4Address> 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; + adr.valid = true; 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 + } } } } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void IPv4WidgetImpl::slotNetmaskChanged(const TQString& ip) { - TQValueList<IPv4Address> 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; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void IPv4WidgetImpl::slotGatewayChanged(const TQString& ip) { - TQValueList<IPv4Address> addrs = _ipv4_setting->getAddresses(); + TDENetworkSingleIPConfigurationList addrs = _ipv4_setting->ipConfig.ipConfigurations; addrs[0].gateway = TQHostAddress(ip); - _ipv4_setting->setAddresses(addrs); + _ipv4_setting->ipConfig.ipConfigurations = addrs; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } -#include "knetworkmanager-connection_setting_ipv4_widget.moc" +#include "tdenetman-connection_setting_ipv4_widget.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.h index 4fabdce..0b2e48f 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ipv4_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -25,13 +25,16 @@ #ifndef KNETWORKMANAGER_CONNECTION_SETTING_IPV4_WIDGET_H #define KNETWORKMANAGER_CONNECTION_SETTING_IPV4_WIDGET_H -// qt autogenerated headers +// tde headers +#include <tdehardwaredevices.h> +#include <tdenetworkconnections.h> + +// 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" +// tdenetman headers +#include "tdenetman-connection_settings_dialog.h" +#include "tdenetman-connection_setting_widget_interface.h" namespace ConnectionSettings { @@ -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,8 @@ namespace ConnectionSettings private: void Init(); - IPv4* _ipv4_setting; + 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 new file mode 100644 index 0000000..3ab971e --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.cpp @@ -0,0 +1,147 @@ +/*************************************************************************** + * + * tdenetman-connection_setting_ppp_widget.cpp - A NetworkManager frontend for TDE + * + * Copyright (C) 2008 Novell, Inc. + * + * Author: Will Stephenson <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + **************************************************************************/ + +#include <nm-setting-ppp.h> + +// qt headers +#include <tqwidget.h> +#include <tqlineedit.h> +#include <tqcheckbox.h> +#include <tqlayout.h> +#include <tqcombobox.h> +#include <tqspinbox.h> +#include <tqiconset.h> +#include <kiconloader.h> +#include <tqwidgetstack.h> +#include <kuser.h> + +// tdenm 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) +{ + _parentdialog = dynamic_cast<ConnectionSettingsDialogImpl*>(parent); + + _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; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts +} + +#include "tdenetman-connection_setting_ppp_widget.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_ppp_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.h index acdc2a2..71ccc67 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_ppp_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_ppp_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-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. * @@ -26,14 +26,17 @@ #define KNETWORKMANAGER_CONNECTION_SETTING_PPP_WIDGET_H -// qt headers +// tqt headers #include <tqwidget.h> #include <tqlineedit.h> -// knm headers -#include "knetworkmanager-connection_setting_ppp.h" -#include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-device.h" +// tde headers +#include <tdehardwaredevices.h> +#include <tdenetworkconnections.h> + +// tdenm headers +#include "tdenetman-connection_settings_dialog.h" +#include "tdenetman-connection_setting_widget_interface.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,8 +60,10 @@ class PPPWidgetImpl : public WidgetInterface private: void Init(); - PPP* _pppsetting; + 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 new file mode 100644 index 0000000..0f9d7a6 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.cpp @@ -0,0 +1,137 @@ +/*************************************************************************** + * + * tdenetman-connection_setting_serial_widget.cpp - A NetworkManager frontend for TDE + * + * Copyright (C) 2008 Novell, Inc. + * + * Author: Will Stephenson <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + **************************************************************************/ + +#include <limits.h> +// qt headers +#include <tqwidget.h> +#include <tqlineedit.h> +#include <tqcheckbox.h> +#include <tqlayout.h> +#include <tqcombobox.h> +#include <tqspinbox.h> +#include <tqiconset.h> +#include <kiconloader.h> +#include <tqwidgetstack.h> +#include <kuser.h> + +// tdenm 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) +{ + _parentdialog = dynamic_cast<ConnectionSettingsDialogImpl*>(parent); + + _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; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts +} + +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/knetworkmanager-connection_setting_serial_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.h index 5b3bf28..93e23fd 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_serial_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_serial_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-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. * @@ -26,14 +26,17 @@ #define KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_WIDGET_H -// qt headers +// tqt headers #include <tqwidget.h> #include <tqlineedit.h> -// knm headers -#include "knetworkmanager-connection_setting_serial.h" -#include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-device.h" +// tde headers +#include <tdehardwaredevices.h> +#include <tdenetworkconnections.h> + +// tdenm headers +#include "tdenetman-connection_setting_widget_interface.h" +#include "tdenetman-connection_settings_dialog.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,8 +60,13 @@ class SerialWidgetImpl : public WidgetInterface private: void Init(); - Serial* _serialsetting; + void setParityType(TDENetworkParity::TDENetworkParity type); + TDENetworkParity::TDENetworkParity getParityType(); + + TDENetworkConnection* _serialsetting; ConnectionSettingSerialWidget* _mainWid; + + ConnectionSettingsDialogImpl* _parentdialog; }; } diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_vpn_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp index 0e9ac95..ba4aa18 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_vpn_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-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. * @@ -23,7 +23,7 @@ * **************************************************************************/ -// qt headers +// tqt headers #include <tqwidget.h> #include <tqlineedit.h> #include <tqcheckbox.h> @@ -34,21 +34,18 @@ #include <tqwidgetstack.h> #include <kuser.h> -// knm headers -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting_vpn.h" -#include "knetworkmanager-connection_setting_vpn_widget.h" -#include "knetworkmanager-device.h" -#include "knetworkmanager-vpnmanager.h" -#include "knetworkmanager-vpnservice.h" +// tdenm headers +#include "tdenetman-connection_setting_vpn_widget.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<ConnectionSettings::VPN*> (conn->getSetting(NM_SETTING_VPN_SETTING_NAME)); + _vpnsetting = dynamic_cast<TDEVPNConnection*>(conn); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingVPNWidget(this); @@ -63,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(); } @@ -96,19 +89,20 @@ 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()) + if (icon.isEmpty()) { icon = "encrypted"; + } _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); slotServiceComboActivated(index - 1); @@ -117,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); @@ -128,7 +122,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))); @@ -137,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; @@ -161,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->getRoutes(), _vpnsetting->getData()); + config->setVPNData(_vpnsetting->ipConfig.routeConfigurations, _vpnsetting->pluginData, _vpnsetting->pluginSecrets); } } - else - { + else { //FIXME - do something useful here } } @@ -183,16 +171,16 @@ 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->setServiceType(service->getService()); + _vpnsetting->vpnPluginID = service->getService(); VPNConfigWidget* config = *_mapServiceWidget.find(service); - if (config) - { + if (config) { // update the vpn properties - _vpnsetting->setData(config->getVPNProperties()); + _vpnsetting->pluginData = config->getVPNProperties(); + // update the vpn secrets + _vpnsetting->pluginSecrets = config->getVPNSecrets(); } } } @@ -203,4 +191,4 @@ VPNWidgetImpl::Activate() } -#include "knetworkmanager-connection_setting_vpn_widget.moc" +#include "tdenetman-connection_setting_vpn_widget.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_vpn_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h index f7c16cd..09efd05 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_vpn_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-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. * @@ -26,14 +26,14 @@ #define KNETWORKMANAGER_CONNECTION_SETTING_VPN_WIDGET_H -// qt headers +// tqt headers #include <tqwidget.h> #include <tqlineedit.h> -// knm headers +// tdenm headers #include "connection_setting_vpn.h" -#include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-device.h" +#include "tdenetman-connection_setting_widget_interface.h" +#include "tdenetman-connection_settings_dialog.h" class VPNService; class VPNConfigWidget; @@ -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,10 +57,12 @@ class VPNWidgetImpl : public WidgetInterface VPNConfigWidget* getVPNConfigWidget(VPNService* service); bool _new_conn; - VPN* _vpnsetting; + TDEVPNConnection* _vpnsetting; ConnectionSettingVPNWidget* _mainWid; TQMap<int, VPNService*> _mapServiceCombo; TQMap<VPNService*, VPNConfigWidget*> _mapServiceWidget; + + ConnectionSettingsDialogImpl* _parentdialog; }; } diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_widget_interface.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.cpp index 2c00288..08c264f 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_widget_interface.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-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. * @@ -24,7 +24,7 @@ // qt headers #include <tqwidget.h> -#include "knetworkmanager-connection_setting_widget_interface.h" +#include "tdenetman-connection_setting_widget_interface.h" using namespace ConnectionSettings; @@ -34,4 +34,4 @@ WidgetInterface::WidgetInterface(TQWidget* parent, const char* name, WFlags fl) } -#include "knetworkmanager-connection_setting_widget_interface.moc" +#include "tdenetman-connection_setting_widget_interface.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_widget_interface.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.h index 13ea65e..298e67e 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_widget_interface.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_widget_interface.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-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/knetworkmanager-connection_setting_wireless_security_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp index 1adea03..1e1500f 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * - * knetworkmanager-connection_setting_wireless_security_widget.cpp - * - A NetworkManager frontend for KDE + * tdenetman-connection_setting_wireless_security_widget.cpp + * - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -40,49 +40,66 @@ #include <kdebug.h> #include <kpassdlg.h> -/* knetworkmanager headers */ -#include "knetworkmanager-accesspoint.h" -#include "knetworkmanager-wireless_device.h" -#include "knetworkmanager-device.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting_wireless_security_widget.h" -#include "knetworkmanager-connection_setting_wireless_security.h" -#include "knetworkmanager-connection_setting_wireless.h" -#include "knetworkmanager-connection_setting_8021x.h" +/* tdenetman headers */ +#include "tdenetman-connection_setting_wireless_security_widget.h" #include "sha1.h" #include "md5.h" -#include "knetworkmanager-wireless_manager.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(WirelessSecurity* 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->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); + } + 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 ); - txtWEPKey0->setText(_security_setting->getWepKey(0)); - txtWEPKey1->setText(_security_setting->getWepKey(1)); - txtWEPKey2->setText(_security_setting->getWepKey(2)); - txtWEPKey3->setText(_security_setting->getWepKey(3)); + if (_security_setting->securitySettings.authType == TDENetworkWiFiAuthType::Other) { + // Set up defaults + _security_setting->securitySettings.wepKeyType = TDENetworkWepKeyType::Hexadecimal; + cbKeyType->setCurrentItem(WEPKEY_TYPE_HEX); + } - switch(_security_setting->getWepTxidx()) + 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); @@ -116,65 +133,106 @@ 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; + } + + 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->setWepKey(0, hashed); + _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->setWepKey(1, hashed); + _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->setWepKey(2, hashed); + _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->setWepKey(3, hashed); + _security_setting->securitySettings.wepKey3 = hashed; + _security_setting->securitySettings.secretsValid = true; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityWEPImpl::slotWepIdx0Checked(bool check) { - if (check) - _security_setting->setWepTxidx(0); + if (check) { + _security_setting->securitySettings.wepKeyIndex = 0; + } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityWEPImpl::slotWepIdx1Checked(bool check) { - if (check) - _security_setting->setWepTxidx(1); + if (check) { + _security_setting->securitySettings.wepKeyIndex = 1; + } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityWEPImpl::slotWepIdx2Checked(bool check) { - if (check) - _security_setting->setWepTxidx(2); + if (check) { + _security_setting->securitySettings.wepKeyIndex = 2; + } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityWEPImpl::slotWepIdx3Checked(bool check) { - if (check) - _security_setting->setWepTxidx(3); + if (check) { + _security_setting->securitySettings.wepKeyIndex = 3; + } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } TQCString @@ -191,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; @@ -243,10 +301,12 @@ 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, 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")); } @@ -255,12 +315,14 @@ WirelessSecurityWEPEncryptionImpl::WirelessSecurityWEPEncryptionImpl(WirelessSec /* class WirelessSecurityWPAVersionImpl */ -WirelessSecurityWPAVersionImpl::WirelessSecurityWPAVersionImpl(WirelessSecurity* 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) { - cbWPA->setChecked(_security_setting->getProto() & WirelessSecurity::PROTO_WPA); - cbRSN->setChecked(_security_setting->getProto() & WirelessSecurity::PROTO_RSN); + _parentdialog = connsettings; + + 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,48 +333,50 @@ 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; } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } 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); + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } 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); + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } /* class WirelessSecurityWPACipherImpl */ -WirelessSecurityWPACipherImpl::WirelessSecurityWPACipherImpl(WirelessSecurity* 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))); @@ -323,14 +387,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); - - 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); + 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 @@ -339,99 +402,136 @@ 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; } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } 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); + } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } 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); + } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } 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); + } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } 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); + } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } 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); + } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } 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); + } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } /* 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, ConnectionSettingsDialogImpl* connsettings, const char* name, WFlags fl) : ConnectionSettingWirelessSecurityWPAPSK(parent, name, fl) , _security_setting(security_setting) , _wireless_setting(wireless_setting) { - txtPSK->setText(_security_setting->getPSK()); + _parentdialog = connsettings; + + 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,8 +540,11 @@ WirelessSecurityWPAPSKImpl::slotPSKChanged(const TQString& psk) { if (_wireless_setting) { - _security_setting->setPSK(psk); + _security_setting->securitySettings.psk = psk; + _security_setting->securitySettings.secretsValid = true; } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } TQCString @@ -464,50 +567,54 @@ 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, 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); - _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<int, IEEE8021x::EAP_PHASE1>::Iterator it = _eapIndexMap.findData(_security_setting->getEAP()); + TQBiDirectionalMap<int, TDENetworkIEEE8021xType::TDENetworkIEEE8021xType>::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 +626,55 @@ WirelessSecurityEAPImpl::WirelessSecurityEAPImpl(IEEE8021x* security_setting, Wi void WirelessSecurityEAPImpl::slotUseSystemCaCertChanged(bool on) { - _security_setting->setUseSystemCaCert(on); + _security_setting->eapConfig.forceSystemCaCertificates = on; kURLCACert->setEnabled(!on); + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } 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->eapConfig.allowedPhase2EAPMethods); - _phase2_widget->setAllowedPhase2Methods(_security_setting->getAllowedPhase2Methods()); + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityEAPImpl::slotIdentityChanged(const TQString& identity) { - _security_setting->setIdentity(identity); + _security_setting->eapConfig.userName = identity; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityEAPImpl::slotAnonIdentityChanged(const TQString& identity) { - _security_setting->setAnonIdentity(identity); + _security_setting->eapConfig.anonymousUserName = identity; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void WirelessSecurityEAPImpl::slotPasswordChanged(const TQString& pwd) { - _security_setting->setPassword(TQString(txtPassword->password())); + _security_setting->eapConfig.password = TQString(txtPassword->password()); + _security_setting->eapConfig.secretsValid = true; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } /* class WirelessSecurityPhase2Impl */ -WirelessSecurityPhase2Impl::WirelessSecurityPhase2Impl(IEEE8021x* 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) { - _allowed_methods.append(IEEE8021x::EAP_PHASE2_AUTH_NONE); + _parentdialog = connsettings; + + _allowed_methods.append(TDENetworkIEEE8021xType::None); updateMethodComboBox(); connect(cboPhase2Method, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotPhase2MethodChanged(int))); @@ -567,79 +687,79 @@ void WirelessSecurityPhase2Impl::updateMethodComboBox() cboPhase2Method->clear(); _eapIndexMap.clear(); - for (TQValueList<IEEE8021x::EAP_PHASE2>::Iterator it = _allowed_methods.begin(); it != _allowed_methods.end(); ++it) + for (TQValueList<TDENetworkIEEE8021xType::TDENetworkIEEE8021xType>::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<int, IEEE8021x::EAP_PHASE2>::Iterator it = _eapIndexMap.findData(_security_setting->getPhase2EAP()); + TQBiDirectionalMap<int, TDENetworkIEEE8021xType::TDENetworkIEEE8021xType>::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<IEEE8021x::EAP_PHASE2>& list) +void WirelessSecurityPhase2Impl::setAllowedPhase2Methods(const TQValueList<TDENetworkIEEE8021xType::TDENetworkIEEE8021xType>& list) { _allowed_methods = list; updateMethodComboBox(); @@ -648,20 +768,23 @@ void WirelessSecurityPhase2Impl::setAllowedPhase2Methods(const TQValueList<IEEE8 void WirelessSecurityPhase2Impl::slotPhase2MethodChanged(int index) { // new method choosen - IEEE8021x::EAP_PHASE2 eap = _eapIndexMap[index]; - _security_setting->setPhase2EAP(eap); + TDENetworkIEEE8021xType::TDENetworkIEEE8021xType eap = _eapIndexMap[index]; + _security_setting->eapConfig.phase2EAPAuthMethod = eap; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } /* 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<WirelessSecurity*> (conn->getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)); - _wireless_setting = dynamic_cast<Wireless*> (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); - _ieee8021x_setting = dynamic_cast<IEEE8021x*> (conn->getSetting(NM_SETTING_802_1X_SETTING_NAME)); + _parentdialog = dynamic_cast<ConnectionSettingsDialogImpl*>(parent); + _security_setting = dynamic_cast<TDEWiFiConnection*> (conn); + _wireless_setting = dynamic_cast<TDEWiFiConnection*> (conn); + _ieee8021x_setting = dynamic_cast<TDEWiFiConnection*> (conn); _new_conn = new_conn; TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); @@ -675,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); @@ -737,41 +860,41 @@ WirelessSecurityWidgetImpl::comboSecurityInit() // TODO: Preselect the right security method // We should have an Essid already, fetch all possible APs - TQValueList<AccessPoint *> aps; - if (_new_conn && !_wireless_setting->getEssid().isEmpty()) - { - aps = WirelessManager::getAccessPointsForEssid(_wireless_setting->getEssid()); + TQValueList<TDENetworkWiFiAPInfo*> 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<AccessPoint*>::Iterator it = aps.begin(); it != aps.end(); ++it) - { - if((*it)->isEncrypted()) - { - kdDebug() << "AP " << (*it)->getDisplaySsid().ascii() << " is encrypted" << endl; - if ((*it)->getRsnFlags() != NM_802_11_AP_SEC_NONE || (*it)->getWpaFlags() != NM_802_11_AP_SEC_NONE) - { + for (TQValueList<TDENetworkWiFiAPInfo*>::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 +938,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 +954,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 +995,9 @@ WirelessSecurityWidgetImpl::comboSecurityInit() void WirelessSecurityWidgetImpl::slotUseEncryptionToggled(bool on) { - _wireless_setting->setSecurity(on ? _security_setting->getType() : NULL); + _wireless_setting->securityRequired = on; + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void @@ -903,6 +1028,8 @@ WirelessSecurityWidgetImpl::slotComboSecurityActivated(int index) // should not happen, something is broken... break; } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } void @@ -963,37 +1090,39 @@ WirelessSecurityWidgetImpl::slotExtraSettingsToggled(bool on) _mainWid->groupUseEncryption->layout()->remove(*it); (*it)->hide(); } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } 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); } -#include "knetworkmanager-connection_setting_wireless_security_widget.moc" +#include "tdenetman-connection_setting_wireless_security_widget.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h index 7e90694..1c2e6ef 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_security_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -25,7 +25,10 @@ #ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H #define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H -/* qt autogenerated headers */ +// tqt headers +#include <tqtimer.h> + +// ui autogenerated headers #include "connection_setting_wireless_security.h" #include "connection_setting_wireless_security_eap.h" #include "connection_setting_wireless_security_phase2.h" @@ -35,17 +38,20 @@ #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" +// tde headers +#include <tdehardwaredevices.h> +#include <tdenetworkconnections.h> + +/* tdenetman headers */ +#include "qbidirectionalmap.h" +#include "tdenetman-connection_settings_dialog.h" +#include "tdenetman-connection_setting_widget_interface.h" namespace ConnectionSettings { /* class declarations */ class WirelessSecurity; class Wireless; - class IEEE8021x; class WirelessSecurityPhase2Impl; class WirelessSecurityWEPImpl : public ConnectionSettingWirelessSecurityWEP @@ -60,7 +66,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, 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; @@ -76,9 +82,12 @@ namespace ConnectionSettings void slotWepIdx1Checked(bool); void slotWepIdx2Checked(bool); void slotWepIdx3Checked(bool); + private: - WirelessSecurity* _security_setting; + TDEWiFiConnection* _security_setting; WEPKEY_TYPE _wepKeyType; + + ConnectionSettingsDialogImpl* _parentdialog; }; class WirelessSecurityWEPEncryptionImpl : public ConnectionSettingWirelessSecurityWEPEncryption @@ -86,9 +95,12 @@ 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, ConnectionSettingsDialogImpl* connsettings = 0, const char* name = 0, WFlags fl = 0); + private: - WirelessSecurity* _security_setting; + TDEWiFiConnection* _security_setting; + + ConnectionSettingsDialogImpl* _parentdialog; }; class WirelessSecurityWPAVersionImpl : public ConnectionSettingWirelessSecurityWPAVersion @@ -96,7 +108,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, ConnectionSettingsDialogImpl* connsettings = 0, const char* name = 0, WFlags fl = 0); public slots: void slotAuto(bool); @@ -104,7 +116,9 @@ namespace ConnectionSettings void slotWPA2(bool); private: - WirelessSecurity* _security_setting; + TDEWiFiConnection* _security_setting; + + ConnectionSettingsDialogImpl* _parentdialog; }; @@ -121,7 +135,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, ConnectionSettingsDialogImpl* connsettings = 0, const char* name = 0, WFlags fl = 0); public slots: void slotCipherChangedAuto(bool); @@ -133,7 +147,9 @@ namespace ConnectionSettings void slotPairwiseCipherChangedCCMP(bool); private: - WirelessSecurity* _security_setting; + TDEWiFiConnection* _security_setting; + + ConnectionSettingsDialogImpl* _parentdialog; }; class WirelessSecurityWPAPSKImpl : public ConnectionSettingWirelessSecurityWPAPSK @@ -141,15 +157,17 @@ 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, ConnectionSettingsDialogImpl* connsettings = 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; + + ConnectionSettingsDialogImpl* _parentdialog; }; class WirelessSecurityEAPImpl : public ConnectionSettingWirelessSecurityEAP @@ -157,7 +175,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, ConnectionSettingsDialogImpl* connsettings = 0, const char* name = 0, WFlags fl = 0); public slots: void slotMethodChanged(int index); @@ -167,9 +185,11 @@ namespace ConnectionSettings void slotUseSystemCaCertChanged(bool on); private: - IEEE8021x* _security_setting; - TQBiDirectionalMap<int, IEEE8021x::EAP_PHASE1> _eapIndexMap; + TDEWiFiConnection* _security_setting; + TQBiDirectionalMap<int, TDENetworkIEEE8021xType::TDENetworkIEEE8021xType> _eapIndexMap; WirelessSecurityPhase2Impl* _phase2_widget; + + ConnectionSettingsDialogImpl* _parentdialog; }; class WirelessSecurityPhase2Impl : public ConnectionSettingWirelessSecurityPhase2 @@ -177,16 +197,18 @@ 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, ConnectionSettingsDialogImpl* connsettings = 0, const char* name = 0, WFlags fl = 0); public slots: - void setAllowedPhase2Methods(const TQValueList<IEEE8021x::EAP_PHASE2>&); + void setAllowedPhase2Methods(const TQValueList<TDENetworkIEEE8021xType::TDENetworkIEEE8021xType>&); void slotPhase2MethodChanged(int index); private: void updateMethodComboBox(); - IEEE8021x* _security_setting; - TQBiDirectionalMap<int, IEEE8021x::EAP_PHASE2> _eapIndexMap; - TQValueList<IEEE8021x::EAP_PHASE2> _allowed_methods; + TDEWiFiConnection* _security_setting; + TQBiDirectionalMap<int, TDENetworkIEEE8021xType::TDENetworkIEEE8021xType> _eapIndexMap; + TQValueList<TDENetworkIEEE8021xType::TDENetworkIEEE8021xType> _allowed_methods; + + ConnectionSettingsDialogImpl* _parentdialog; }; class WirelessSecurityWidgetImpl : public WidgetInterface @@ -204,7 +226,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,12 +248,14 @@ namespace ConnectionSettings SecurityMethods _currentMethod; TQValueList<TQWidget*> _widgets[SECURITY_COUNT]; TQValueList<TQWidget*> _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<int, SecurityMethods> _securityComboMap; + + ConnectionSettingsDialogImpl* _parentdialog; }; } diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp index e6bd9c2..536b4ef 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -27,6 +27,8 @@ #include <tqlineedit.h> #include <tqlayout.h> #include <tqlistview.h> +#include <tqtimer.h> +#include <tqcheckbox.h> #include <klistview.h> #include <klineedit.h> @@ -34,15 +36,11 @@ #include <kiconloader.h> #include <kglobal.h> #include <kpushbutton.h> +#include <klocale.h> -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-connection_setting_wireless_widget.h" -#include "knetworkmanager-connection_setting_wireless.h" -#include "knetworkmanager-connection_setting_wireless_security.h" -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-wireless_network.h" -#include "knetworkmanager-wireless_manager.h" +#include "tdenetman-connection_setting_widget_interface.h" +#include "tdenetman-connection_setting_wireless_widget.h" +#include "tdenetman-wireless_manager.h" using namespace ConnectionSettings; @@ -73,14 +71,17 @@ 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, TQByteArray preselect_ssid, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { - _wireless_setting = dynamic_cast<Wireless*> (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); - _info_setting = dynamic_cast<Info*> (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME)); - _security_setting = dynamic_cast<WirelessSecurity*> (conn->getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)); - _hasName = !_info_setting->getName().isEmpty(); + _parentdialog = dynamic_cast<ConnectionSettingsDialogImpl*>(parent); + + _wireless_setting = dynamic_cast<TDEWiFiConnection*>(conn); + _info_setting = dynamic_cast<TDEWiFiConnection*>(conn); + _security_setting = dynamic_cast<TDEWiFiConnection*>(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); @@ -128,7 +129,21 @@ 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); + + if (!_preselect_ssid.isNull()) { + TQListViewItemIterator it(_mainWid->lvEssids); + while (it.current()) { + NetworkListViewItem* item = dynamic_cast<NetworkListViewItem*>(it.current()); + if (item) { + if (item->_net.getSsid() == _preselect_ssid) { + _mainWid->lvEssids->setSelected(item, true); + slotEssidChanged(item); + } + } + ++it; + } + } } void WirelessWidgetImpl::slotEssidChanged(TQListViewItem* item) @@ -142,6 +157,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 @@ -154,6 +171,8 @@ WirelessWidgetImpl::slotEssidDoubleClicked(TQListViewItem* item, const TQPoint& // essid selected with double click -> goto the next setting emit next(); } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } @@ -171,18 +190,25 @@ WirelessWidgetImpl::slotEssidChanged(const TQString& new_essid) essid.resize(essid.size() - 1); updateEssid(essid); + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } 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") + ">"; + } } + + if (_parentdialog) _parentdialog->slotEnableButtons(); // Update lockouts } TQByteArray WirelessWidgetImpl::byteArrayFromHexString(const TQCString& str) @@ -228,4 +254,4 @@ TQString WirelessWidgetImpl::hexStringFromByteArray(const TQByteArray& bytes) return tmp; } -#include "knetworkmanager-connection_setting_wireless_widget.moc" +#include "tdenetman-connection_setting_wireless_widget.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_widget.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h index 0baba65..b0b8ff0 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_widget.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_wireless_widget.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -26,9 +26,13 @@ #ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H #define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H -#include "knetworkmanager-connection_setting_widget_interface.h" +// tde headers +#include <tdehardwaredevices.h> +#include <tdenetworkconnections.h> + +#include "tdenetman-connection_setting_widget_interface.h" +#include "tdenetman-connection_settings_dialog.h" #include "connection_setting_wireless.h" -#include "knetworkmanager-connection_setting.h" class KListViewSearchLineWidget; @@ -44,7 +48,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, TQByteArray preselect_ssid = TQByteArray(), TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); void Activate(); @@ -60,12 +64,15 @@ 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; + 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 new file mode 100644 index 0000000..50ac293 --- /dev/null +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp @@ -0,0 +1,461 @@ +/*************************************************************************** + * + * tdenetman-devicestore_dbus.cpp - A NetworkManager frontend for TDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa <[email protected]>, <[email protected]> + * Author: Timothy Pearson <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + **************************************************************************/ + +// qt headers +#include <tqwidget.h> +#include <tqcombobox.h> +#include <tqtabwidget.h> +#include <tqpushbutton.h> +#include <tqwidgetstack.h> +#include <tqapplication.h> +#include <tqlabel.h> + +// tde headers +#include <kiconloader.h> +#include <kdebug.h> +#include <kpushbutton.h> +#include <klocale.h> +#include <kmessagebox.h> + +// tdenm 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-connection_setting_vpn_widget.h" +#include "tdenetman-wireless_network.h" +#include "tdenetman-wireless_manager.h" + +using namespace ConnectionSettings; + +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(); + + // get notified if device combo changes + connect(btnConnect, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotConnect()) ); + connect(pbNext, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotNext()) ); + connect(pbBack, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotBack()) ); + connect(pbCancel, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotCancel()) ); + connect(pbSave, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSave()) ); + + // nice images for the buttons + btnConnect->setIconSet(SmallIcon ("connect_creating", TQIconSet::Automatic)); + pbNext->setIconSet(SmallIcon ("1rightarrow", TQIconSet::Automatic)); + pbBack->setIconSet(SmallIcon ("1leftarrow", TQIconSet::Automatic)); + pbCancel->setIconSet(SmallIcon("cancel", TQIconSet::Automatic)); + pbSave->setIconSet(SmallIcon("ok", TQIconSet::Automatic)); + + // enable or disable buttons accroding to the current state + slotEnableButtons(); +} + +ConnectionSettingsDialogImpl::~ConnectionSettingsDialogImpl() +{ + kdDebug() << "ConnectionSettingsDialogImpl::~ConnectionSettingsDialogImpl" << endl; +} + +TQValueList<WidgetInterface*> +ConnectionSettingsDialogImpl::createWidgetsForWireless(TDENetworkConnection* conn, bool new_conn) +{ + TQValueList<WidgetInterface*> ret; + + // widgetlist for wireless connection + 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()) + { + // we have a problem here, NetworkManager asked for a setting we do not have + kdError() << k_funcinfo << "Unexpected setting requested" << endl; + } + + return ret; +} + +TQValueList<WidgetInterface*> +ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(TDENetworkConnection* conn, bool new_conn, const TQByteArray& essid) +{ + TQValueList<WidgetInterface*> ret; + + // widgetlist for wireless connection + 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()) + { + // we have a problem here, NetworkManager asked for a setting we do not have + kdError() << k_funcinfo << "Unexpected setting requested" << endl; + } + + return ret; +} + +TQValueList<WidgetInterface*> +ConnectionSettingsDialogImpl::createWidgetsForWired(TDENetworkConnection* conn, bool new_conn) +{ + TQValueList<WidgetInterface*> ret; + + // widgetlist for wired connection + ret.append(new ConnectionSettings::IPv4WidgetImpl(conn, this)); + ret.append(new ConnectionSettings::InfoWidgetImpl(conn, this)); + + return ret; +} + +TQValueList<WidgetInterface*> +ConnectionSettingsDialogImpl::createWidgetsForVPN(TDENetworkConnection* conn, bool new_conn) +{ + TQValueList<WidgetInterface*> ret; + + // widgetlist for virtual private connection + ret.append(new ConnectionSettings::VPNWidgetImpl(conn, new_conn, this)); + ret.append(new ConnectionSettings::InfoWidgetImpl(conn, this)); + + return ret; +} + +TQValueList<WidgetInterface*> +ConnectionSettingsDialogImpl::createWidgetsForCDMA(TDENetworkConnection* conn, bool new_conn) +{ + TQValueList<WidgetInterface*> ret; + + // widgetlist for wired connection + 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; +} + +TQValueList<WidgetInterface*> +ConnectionSettingsDialogImpl::createWidgetsForGSM(TDENetworkConnection* conn, bool new_conn) +{ + TQValueList<WidgetInterface*> ret; + + // widgetlist for wired connection + 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; +} + +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<WidgetInterface*> widgets; + // TODO: move to a factory class + if (conn->type() == TDENetworkConnectionType::WiFi) { + if (_networkextid.isNull()) { + widgets = createWidgetsForWireless(conn, new_conn); + } + else { + widgets = createWidgetsForWirelessKnownESSID(conn, new_conn, _networkextid); + } + } + else if (conn->type() == TDENetworkConnectionType::WiredEthernet) { + widgets = createWidgetsForWired(conn, new_conn); + } + else if (conn->type() == TDENetworkConnectionType::Modem) { + TDEModemConnection* modemconn = dynamic_cast<TDEModemConnection*>(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->type() == TDENetworkConnectionType::VPN) { + widgets = createWidgetsForVPN(conn, new_conn); + } + else { + kdWarning() << k_funcinfo << "Not handled yet" << endl; + } + + int id; + for (TQValueList<WidgetInterface*>::Iterator it = widgets.begin(); it != widgets.end(); ++it) { + id = wstackSettings->addWidget(*it); + _widgetIds.append(id); + } + + if (widgets.begin() != widgets.end()) { + activateWidget(*widgets.begin()); + } + } +} + +void +ConnectionSettingsDialogImpl::updateDialogForDeviceType() +{ + // clear our tabview first + TQWidget *page = NULL; + while ( (page = wstackSettings->visibleWidget()) != NULL) + { + wstackSettings->removeWidget(page); + delete page; + } + + if (_conn) { + 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<int>::Iterator current = _widgetIds.find(wstackSettings->id(wstackSettings->visibleWidget())); + if (current != _widgetIds.fromLast()) + { + WidgetInterface* widget = NULL; + + // let the widget know about it being the active one + widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current)); + if (widget) { + deactivateWidget(widget); + } + } + + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + // save the connection + nm->saveConnection(_conn); + + emit connectionSaved(); + this->close(true); +} + +void +ConnectionSettingsDialogImpl::slotCancel() +{ + close(); +} + +void +ConnectionSettingsDialogImpl::slotNext() +{ + TQValueList<int>::Iterator current = _widgetIds.find(wstackSettings->id(wstackSettings->visibleWidget())); + if (current != _widgetIds.fromLast()) + { + WidgetInterface* widget = NULL; + + // let the widget know about it being the active one + widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current)); + if (widget) { + deactivateWidget(widget); + } + + // next widget + current++; + + // let the widget know about it being the active one + widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current)); + if (widget) { + activateWidget(widget); + } + } + slotEnableButtons(); +} + +void +ConnectionSettingsDialogImpl::slotBack() +{ + TQValueList<int>::Iterator current = _widgetIds.find(wstackSettings->id(wstackSettings->visibleWidget())); + if (current != _widgetIds.begin()) + { + WidgetInterface* widget = NULL; + + // let the widget know about it being the active one + widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current)); + if (widget) { + deactivateWidget(widget); + } + + // one back + current--; + + // let the widget know about it being the active one + widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current)); + if (widget) { + activateWidget(widget); + } + } + slotEnableButtons(); +} + +void +ConnectionSettingsDialogImpl::activateWidget(WidgetInterface* widget) +{ + // allow the widget to press next + connect(widget, TQT_SIGNAL(next()), this, TQT_SLOT(slotNext())); + + // allow the widget to do some initialization + widget->Activate(); + + // show the widget + wstackSettings->raiseWidget(widget); + +} + +void +ConnectionSettingsDialogImpl::deactivateWidget(WidgetInterface* widget) +{ + // allow the widget to press next + disconnect(widget, TQT_SIGNAL(next()), this, TQT_SLOT(slotNext())); + + // allow the widget to do some initialization + widget->Deactivate(); +} + +void +ConnectionSettingsDialogImpl::slotEnableButtons() +{ + // enable the buttons according to the current state + + TQValueList<int>::Iterator current = _widgetIds.find(wstackSettings->id(wstackSettings->visibleWidget())); + bool enabled; + + /* + Next: enabled if another widget is available + */ + enabled = true; + if (current == _widgetIds.fromLast()) { + enabled = false; + } + pbNext->setEnabled(enabled); + + /* + Back: enabled if the current widget has a predecessor + */ + enabled = true; + if (current == _widgetIds.begin()) { + enabled = false; + } + pbBack->setEnabled(enabled); + + /* + Connect: only show connect if the connection is valid + */ + if (_conn) { + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + 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)); + } +} + +#include "tdenetman-connection_settings_dialog.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-connection_settings_dialog.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h index 9cedc69..b9f54f1 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_settings_dialog.h +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE + * tdenetman-devicestore_dbus.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -25,14 +25,16 @@ #ifndef KNETWORKMANAGER_CONNECTION_SETTINGS_DIALOG_H #define KNETWORKMANAGER_CONNECTION_SETTINGS_DIALOG_H -// qt headers +// tqt headers #include <tqvaluelist.h> +#include <tqlistview.h> -// qt autogenerated headers -#include "connection_settings.h" +// tde headers +#include <tdehardwaredevices.h> +#include <tdenetworkconnections.h> -// knm headers -#include "knetworkmanager-connection_setting.h" +// ui autogenerated headers +#include "connection_settings.h" class TQWidget; class Device; @@ -48,7 +50,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, TQByteArray networkextid = TQByteArray(), TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~ConnectionSettingsDialogImpl(); public slots: @@ -64,23 +66,23 @@ 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<ConnectionSettings::WidgetInterface*> createWidgetsForWired(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); - TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForWireless(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); - TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForWirelessKnownESSID(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting, const TQByteArray& essid); - TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForVPN(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); - TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForCDMA(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); - TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForGSM(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting); + TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForWired(TDENetworkConnection* conn, bool new_conn); + TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForWireless(TDENetworkConnection* conn, bool new_conn); + TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForWirelessKnownESSID(TDENetworkConnection* conn, bool new_conn, const TQByteArray& essid); + TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForVPN(TDENetworkConnection* conn, bool new_conn); + TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForCDMA(TDENetworkConnection* conn, bool new_conn); + TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForGSM(TDENetworkConnection* conn, bool new_conn); - ConnectionSettings::Connection* _conn; - ConnectionSettings::ConnectionSetting* _setting; + TDENetworkConnection* _conn; TQValueList<int> _widgetIds; bool _new_conn; + TQByteArray _networkextid; }; #endif /* KNETWORKMANAGER_CONNECTION_SETTINGS_DIALOG_H*/ diff --git a/tdenetworkmanager/src/devicetraycomponent.cpp b/tdenetworkmanager/src/devicetraycomponent.cpp index d42db60..5c4cdb4 100644 --- a/tdenetworkmanager/src/devicetraycomponent.cpp +++ b/tdenetworkmanager/src/devicetraycomponent.cpp @@ -24,110 +24,190 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <klocale.h> #include <ksystemtray.h> -#include "knetworkmanager-device.h" -#include "knetworkmanager-nm_proxy.h" +TQString DeviceTrayComponent::pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { + TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; + while (flag != 0) { + if (state & flag) { + if (m_pixmaps.contains(flag)) { + return m_pixmaps[flag]; + } + } + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)((TQ_UINT32)flag >> 1); + } + return TQString::null; +} -DeviceTrayComponent::DeviceTrayComponent(Device * device, KSystemTray * parent, const char * name ) - : TrayComponent(parent, name), m_device(device) +TQString DeviceTrayComponent::movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) { + TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000; + while (flag != 0) { + if (state & flag) { + if (m_movies.contains(flag)) { + return m_movies[flag]; + } + } + 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) { + if (state & flag) { + if (m_tooltips.contains(flag)) { + return m_tooltips[flag]; + } + } + flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)((TQ_UINT32)flag >> 1); + } + return TQString::null; +} + +DeviceTrayComponent::DeviceTrayComponent(TQString device, KSystemTray * parent, const char * name ) + : TrayComponent(parent, name), m_tray(dynamic_cast<Tray*>(parent)), 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"); + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + + // 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"; + 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 +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<TDENetworkDevice*>(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(); + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(m_device)); + TQStringList list; - NMDeviceState state = m_device->getState(); - if (m_tooltips.contains(state)) { - list.append(i18n("Device: %1").arg(m_device->getInterface())); - list.append(i18n("State: %1").arg(m_tooltips[state])); + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + TDENetworkConnectionStatus::TDENetworkConnectionStatus state = deviceConnMan->deviceInformation().statusFlags; + if (tooltipForConnState(state) != "") { + list.append(i18n("Device: %1").arg(dev->deviceNode())); + 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]); - } else { - return TQPixmap(); - } + if (pixmapForConnState(state) != "") { + TQString pixmapPath = pixmapForConnState(state); + if (pixmapPath != "") { + return KSystemTray::loadIcon(pixmapPath); + } + else { + return TQPixmap(); + } + } + 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)); - } else { - return TQMovie(); - } + if (movieForConnState(state) != "") { + TQString moviePath = movieForConnState(state); + if (moviePath != "") { + 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(); + } + } + else { + return TQMovie(); + } } -void DeviceTrayComponent::setMovieForState(NMDeviceState state, TQString movie) +void DeviceTrayComponent::setMovieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state, TQString movie) { - m_movies[state] = movie; + m_movies[state] = movie; } -void DeviceTrayComponent::setPixmapForState(NMDeviceState state, TQString pixmap) +void DeviceTrayComponent::setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state, TQString pixmap) { - m_pixmaps[state] = pixmap; + m_pixmaps[state] = pixmap; } -void DeviceTrayComponent::deviceStateChanged(NMDeviceState state) +void DeviceTrayComponent::deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus prevState, TQString hwAddress) { - //check if our device now holds the default active connection - // if it is the default active connection - // or if it is activating. what if 2 devices are activating simultaneously? - NMProxy * nm = 0; - switch (state) { - case NM_DEVICE_STATE_PREPARE: - emit needsCenterStage(this, true); - break; - case NM_DEVICE_STATE_ACTIVATED: - nm = NMProxy::getInstance(); - if ( m_device == nm->getDefaultDevice() ) { - emit needsCenterStage(this, true); - } - break; - case NM_DEVICE_STATE_UNAVAILABLE: - case NM_DEVICE_STATE_DISCONNECTED: - case NM_DEVICE_STATE_FAILED: - emit needsCenterStage(this, false); - break; - default: - break; - } + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(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? + if (newState & TDENetworkConnectionStatus::EstablishingLink) { + emit needsCenterStage(this, true); + } + else if (newState & TDENetworkConnectionStatus::Connected) { + if (nm->defaultNetworkDevices().contains(m_device)) { + emit needsCenterStage(this, true); + } + } + else if ((newState & TDENetworkConnectionStatus::LinkUnavailable) + || (newState & TDENetworkConnectionStatus::Disconnected) + || (newState & TDENetworkConnectionStatus::Failed)) { + emit needsCenterStage(this, false); + } } #include "devicetraycomponent.moc" diff --git a/tdenetworkmanager/src/devicetraycomponent.h b/tdenetworkmanager/src/devicetraycomponent.h index 729076f..3ee4a13 100644 --- a/tdenetworkmanager/src/devicetraycomponent.h +++ b/tdenetworkmanager/src/devicetraycomponent.h @@ -21,43 +21,61 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef DEVICE_TRAY_COMPONENT_H #define DEVICE_TRAY_COMPONENT_H -#include <NetworkManager.h> - #include <tqmap.h> #include <tqmovie.h> #include <tqobject.h> #include <tqpixmap.h> +#include <tdehardwaredevices.h> +#include <tdenetworkconnections.h> + +#include "tdenetman-tray.h" #include "traycomponent.h" -class Device; +class TDENetworkDevice; class KPopupMenu; class KSystemTray; class DeviceTrayComponent : public TrayComponent { -Q_OBJECT - -public: - DeviceTrayComponent(Device * device, KSystemTray * parent, const char * name ); - virtual ~DeviceTrayComponent(); - TQPixmap pixmapForState(NMDeviceState state); - TQMovie movieForState(NMDeviceState state); - virtual TQStringList getToolTipText(); - Device* device() const; -signals: - void needsCenterStage(TrayComponent *, bool); -public slots: - virtual void newConnection() = 0; -protected slots: - void deviceStateChanged(NMDeviceState); -protected: - void setMovieForState(NMDeviceState, TQString); - void setPixmapForState(NMDeviceState, TQString); -private: - Device * m_device; - TQMap<NMDeviceState, TQString> m_movies; - TQMap<NMDeviceState, TQString> m_pixmaps; - TQMap<NMDeviceState, TQString> m_tooltips; + Q_OBJECT + + public: + DeviceTrayComponent(TQString device, KSystemTray * parent, const char * name ); + virtual ~DeviceTrayComponent(); + TQPixmap pixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); + TQMovie movieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state); + virtual TQStringList getToolTipText(); + TQString device() const; + + signals: + void needsCenterStage(TrayComponent *, bool); + + public slots: + virtual void newConnection() = 0; + + protected slots: + void deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString); + + private slots: + void tdeHardwareEventHandler(TDEHardwareEvent::TDEHardwareEvent, TQString); + + 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); + + protected: + Tray* m_tray; + + private: + TQString m_device; + TQMap<TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString> m_movies; + TQMap<TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString> m_pixmaps; + TQMap<TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString> m_tooltips; }; #endif // DEVICE_TRAY_COMPONENT_H diff --git a/tdenetworkmanager/src/eventsrc b/tdenetworkmanager/src/eventsrc index 47723af..16438de 100644 --- a/tdenetworkmanager/src/eventsrc +++ b/tdenetworkmanager/src/eventsrc @@ -1,32 +1,32 @@ [!Global!] IconName=network -Comment=KNetworkManager +Comment=TDENetworkManager 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] -Name=KNetworkManager Offline -Name[bg]=KNetworkManager - изключен от Интернет +[tdenm-nm-sleeping] +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]=অফলাইন মোড চালু করা হয়েছে @@ -47,26 +47,26 @@ Comment[sv]=Bytte till nerkopplat läge Comment[tr]=Çevrimdışı kipe geçildi default_presentation=0 -[knm-nm-connected] -Name=KNetworkManager Connected -Name[bg]=KNetworkManager - свързан +[tdenm-nm-connected] +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]=এখন নেটওয়ার্ক-ম্যানেজার সংযুক্ত @@ -87,31 +87,31 @@ Comment[sv]=Networkmanager är nu ansluten Comment[tr]=NetworkManager şimdi bağlı default_presentation=0 -[knm-nm-connecting] -Name=KNetworkManager Connecting -Name[bg]=KNetworkManager се свързва +[tdenm-nm-connecting] +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 @@ -124,25 +124,25 @@ Comment[sv]=Networkmanager kopplar upp Comment[tr]=NetworkManager bağlanıyor default_presentation=0 -[knm-nm-disconnected] -Name=KNetworkManager Disconnected -Name[bg]=KNetworkManager - изключен от Интернет +[tdenm-nm-disconnected] +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]=এখন নেটওয়ার্ক-ম্যানেজার সংযোগ বিহীন @@ -162,24 +162,24 @@ Comment[sv]=Networkmanager är nu nerkopplad Comment[tr]=NetworkManager artık bağlı değil default_presentation=0 -[knm-nm-device-added] -Name=KNetworkManager Device Added -Name[bg]=KNetworkManager - добавено е устройство +[tdenm-nm-device-added] +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]=নতুন নেটওয়ার্ক ডিভাইস খুঁজে পেয়েছে @@ -200,24 +200,24 @@ Comment[sv]=Ny nätverksenhet hittades Comment[tr]=Yeni ağ aygıtı bulundu default_presentation=0 -[knm-nm-device-removed] -Name=KNetworkManager Device Removed -Name[bg]=KNetworkManager - устройството е премахнато +[tdenm-nm-device-removed] +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]=নেটওয়ার্ক ডিভাইস অপসারিত করা হয়েছে @@ -238,24 +238,24 @@ Comment[sv]=Nätverksenhet borttagen Comment[tr]=Ağ aygıtı kaldırıldı default_presentation=0 -[knm-nm-network-found] -Name=KNetworkManager New Wireless Network Found -Name[bg]=KNetworkManager - намерена е нова безжична мрежа +[tdenm-nm-network-found] +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]=নতুন ওয়্যারলেস নেটওয়ার্ক খুঁজে পেয়েছে @@ -275,24 +275,24 @@ Comment[sv]=Nytt trådlöst nätverk hittades Comment[tr]=Yeni kablosuz ağ bulundu default_presentation=0 -[knm-nm-network-gone] -Name=KNetworkManager Wireless Network Disappeared -Name[bg]=KNetworkManager - безжичната мрежа се изгуби +[tdenm-nm-network-gone] +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/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -// TQt -#include <tqguardedptr.h> - -// TQT_DBus includes -#include <tqdbuserror.h> -#include <tqdbusconnection.h> -#include <tqdbuserror.h> - -// NM includes -#include <NetworkManager.h> - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-accesspoint.h" -#include "dbus/accesspointproxy.h" - -class AccessPointPrivate -{ -public: - AccessPointPrivate(TQString objpath = TQString(), const DBus::AccessPointProxy* proxy = NULL) - : nmAccessPoint(proxy) - , objPath(objpath) - { - } - - ~AccessPointPrivate() { } - - // pointer to the shared DBus proxy - TQGuardedPtr<const DBus::AccessPointProxy> nmAccessPoint; - // DBus object path - TQString objPath; - - // Properties - TQ_UINT32 flags; - TQ_UINT32 wpaFlags; - TQ_UINT32 rsnFlags; - TQValueList<TQ_UINT8> ssid; - TQ_UINT32 freq; - TQString hwAddress; - TQ_INT32 mode; - TQ_UINT32 rate; - TQ_UINT8 strength; -}; - -TQ_UINT32 AccessPoint::getFlags() const -{ - return d->flags; -} - -TQ_UINT32 AccessPoint::getWpaFlags() const -{ - return d->wpaFlags; -} - -TQ_UINT32 AccessPoint::getRsnFlags() const -{ - return d->rsnFlags; -} - -TQValueList<TQ_UINT8> AccessPoint::getSsid() const -{ - return d->ssid; -} - -TQ_UINT32 AccessPoint::getFrequency() const -{ - return d->freq; -} - -TQString AccessPoint::getHwAddress() const -{ - return d->hwAddress; -} - -TQ_INT32 AccessPoint::getMode() const -{ - return d->mode; -} - -TQ_UINT32 AccessPoint::getRate() const -{ - return d->rate; -} - -TQ_UINT8 AccessPoint::getStrength() const -{ - return d->strength; -} - -const TQByteArray AccessPoint::getSsidByteArray() const -{ - // FIXME: Wow, thats ugly - TQValueList<TQ_UINT8> ssid = d->ssid; - TQByteArray ret_ssid(ssid.count()); - TQByteArray::Iterator byteit = ret_ssid.begin(); - for (TQValueList<TQ_UINT8>::iterator it = ssid.begin(); it != ssid.end(); ++it) - { - (*byteit) = (*it); - ++byteit; - } - return ret_ssid; -} - -TQString AccessPoint::getDisplaySsid() const -{ - return TQString(getSsidByteArray()); -} - -bool AccessPoint::isEncrypted() const -{ - return (getFlags() && NM_802_11_AP_FLAGS_PRIVACY); -} - -void AccessPoint::slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>& properties) -{ - updateProperties(); -} - -void AccessPoint::updateProperties() -{ - //TODO do this proper-like - TQT_DBusError err; - if (d->nmAccessPoint.isNull()) - return; - - d->flags = d->nmAccessPoint->getFlags(err); - d->wpaFlags = d->nmAccessPoint->getWpaFlags(err); - d->rsnFlags = d->nmAccessPoint->getRsnFlags(err); - d->ssid = d->nmAccessPoint->getSsid(err); - d->freq = d->nmAccessPoint->getFrequency(err); - d->hwAddress = d->nmAccessPoint->getHwAddress(err); - d->mode = d->nmAccessPoint->getMode(err); - d->rate = d->nmAccessPoint->getMaxBitrate(err); - d->strength = d->nmAccessPoint->getStrength(err); - emit strengthChanged(d->strength); -} - -TQString AccessPoint::getObjectPath() const -{ - return d->objPath; -} - -bool AccessPoint::isValid() const -{ - return !(d->objPath.isEmpty()); -} - -bool AccessPoint::operator== (const AccessPoint& other) const -{ - return (other.getObjectPath() == getObjectPath()); -} -#if 0 -AccessPoint& AccessPoint::operator= (const AccessPoint& other) -{ - kdDebug() << "AccessPoint::operator=\n" << endl; - d->objPath = other.d->objPath; - d->nmAccessPoint = other.d->nmAccessPoint; - connect(d->nmAccessPoint, TQT_SIGNAL(PropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)), this, TQT_SLOT(slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&))); - - updateProperties(); - - return *this; -} -#endif -AccessPoint::AccessPoint(TQString obj_path, TQObject * parent, const char * name) -: TQObject(parent, name) -{ - DBus::AccessPointProxy * proxy = new DBus::AccessPointProxy(NM_DBUS_SERVICE, obj_path); - proxy->setConnection(TQT_DBusConnection::systemBus()); - d = new AccessPointPrivate(obj_path, proxy); - - if (!d->nmAccessPoint.isNull()) - connect(d->nmAccessPoint, TQT_SIGNAL(PropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)), this, TQT_SLOT(slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&))); - - updateProperties(); -} -#if 0 -// copy constructor -AccessPoint::AccessPoint(const AccessPoint& other) - : TQObject() -{ - // just copy the private data from other - d = new AccessPointPrivate(*other.d); - - if (!d->nmAccessPoint.isNull()) - connect(d->nmAccessPoint, TQT_SIGNAL(PropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)), this, TQT_SLOT(slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&))); - - updateProperties(); -} -#endif -AccessPoint::~AccessPoint() -{ - delete d->nmAccessPoint; - delete d; -} - - -#include "knetworkmanager-accesspoint.moc" diff --git a/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 <[email protected]>, <[email protected]> - * Will Stephenson <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_ACCESSPOINT_H -#define KNETWORKMANAGER_ACCESSPOINT_H - -#include "knetworkmanager.h" -#include <tqdbusvariant.h> - -class AccessPointPrivate; -namespace DBus -{ - class AccessPointProxy; -}; - -class AccessPoint : public TQObject -{ - Q_OBJECT - - public: - AccessPoint (const AccessPoint&); - AccessPoint (TQString objpath = TQString(), TQObject * parent = 0, const char * name = 0); - ~AccessPoint (); - - AccessPoint& operator= (const AccessPoint& other); - bool operator== (const AccessPoint& other) const; - - TQ_UINT32 getFlags() const; - TQ_UINT32 getWpaFlags() const; - TQ_UINT32 getRsnFlags() const; - TQValueList<TQ_UINT8> getSsid() const; - TQ_UINT32 getFrequency() const; - TQString getHwAddress() const; - TQ_INT32 getMode() const; - TQ_UINT32 getRate() const; - TQ_UINT8 getStrength() const; - TQString getDisplaySsid() const; - const TQByteArray getSsidByteArray() const; - bool isEncrypted() const; - TQString getObjectPath() const; - bool isValid() const; - signals: - void strengthChanged(TQ_UINT8); - private slots: - void slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>& properties); - void updateProperties(); - - private: - - AccessPointPrivate * d; -}; - -#endif /* KNETWORKMANAGER_DEVICE_H */ diff --git a/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 <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#include "knetworkmanager-cdma_connection.h" - -#include <nm-setting-cdma.h> -#include "knetworkmanager-connection_setting_serial.h" - -ConnectionSettings::CDMAConnection::CDMAConnection() - : PPPConnection(NM_SETTING_CDMA_SETTING_NAME) -{ - appendSetting(new CDMA(this)); - appendSetting(new Serial(this)); -} - -ConnectionSettings::CDMAConnection::~CDMAConnection() -{ - -} - -ConnectionSettings::CDMA* ConnectionSettings::CDMAConnection::getCDMASetting() const -{ - return dynamic_cast<CDMA*>(getSetting(NM_SETTING_CDMA_SETTING_NAME)); -} - -ConnectionSettings::Serial* ConnectionSettings::CDMAConnection::getSerialSetting() const -{ - return dynamic_cast<Serial*>(getSetting(NM_SETTING_SERIAL_SETTING_NAME)); -} - -ConnectionSettings::Connection* ConnectionSettings::CDMAConnection::duplicate() -{ - CDMAConnection* conn = new CDMAConnection(); - conn->updateSettings(this); - return conn; -} - -#include "knetworkmanager-cdma_connection.moc" - -// vim: sw=4 sts=4 noet tw=100 diff --git a/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 <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_CDMA_CONNECTION_H -#define KNETWORKMANAGER_CDMA_CONNECTION_H - -#include "knetworkmanager-ppp_connection.h" -#include "knetworkmanager-connection_setting_cdma.h" - -namespace ConnectionSettings -{ - class CDMA; - class Serial; - - class CDMAConnection : public PPPConnection - { - Q_OBJECT - - public: - CDMAConnection(); - ~CDMAConnection(); - CDMA* getCDMASetting() const; - Serial* getSerialSetting() const; - Connection* duplicate(); - }; -} // namespace ConnectionSettings - -#endif - 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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -// KDE includes -#include <kdebug.h> - -// TQt includes -#include <tqhostaddress.h> - -// TQT_DBus includes -#include <tqdbuserror.h> -#include <tqdbusconnection.h> - -// NM includes -#include <NetworkManager.h> - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-cdma_device.h" -#include "dbus/cdmaproxy.h" - -class CDMADevicePrivate -{ -public: - CDMADevicePrivate(TQString service, TQString obj_path) - : nmCDMA(service, obj_path) - {} - ~CDMADevicePrivate() {} - - DBus::CDMADeviceProxy nmCDMA; -}; - -CDMADevice::CDMADevice (const TQString & obj_path) - : CellularDevice(obj_path) -{ - d = new CDMADevicePrivate(NM_DBUS_SERVICE, obj_path); - d->nmCDMA.setConnection(TQT_DBusConnection::systemBus()); -} - -CDMADevice::~CDMADevice () -{ - delete d; -} - - -#include "knetworkmanager-cdma_device.moc" diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_CDMADEVICE_H -#define KNETWORKMANAGER_CDMADEVICE_H - -// std includes -#include <stdint.h> - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-cellular_device.h" - -class KNetworkManager; - -class CDMADevicePrivate; - -class CDMADevice : public CellularDevice -{ - Q_OBJECT - - 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 <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -// KNM includes -#include "knetworkmanager-cellular_device.h" - -CellularDevice::CellularDevice (const TQString & obj_path) - : Device(obj_path) -{ -} - -CellularDevice::~CellularDevice() -{ -} - -#include "knetworkmanager-cellular_device.moc" diff --git a/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 <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_CELLULARDEVICE_H -#define KNETWORKMANAGER_CELLULARDEVICE_H - -// KNM includes -#include "knetworkmanager-device.h" - -class CellularDevice : public Device -{ - Q_OBJECT - - 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 deleted file mode 100644 index ea88749..0000000 --- a/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-cellular_device_tray.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -/// TQt includes -#include <tqwidget.h> // for TQt::WidgetFlags - -// KDE includes -#include <kdebug.h> -#include <klocale.h> -#include <kiconloader.h> - -// TQt DBus -#include <tqdbusobjectpath.h> - - -// KNM includes -#include "knetworkmanager-cellular_device_tray.h" -#include "knetworkmanager-cellular_device.h" -#include "knetworkmanager-menuitem.h" -#include "knetworkmanager-menu_subhead.h" -#include "knetworkmanager-connection_store.h" -#include "knetworkmanager-cdma_connection.h" -#include "knetworkmanager-gsm_connection.h" -#include "knetworkmanager-nm_proxy.h" - -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-connection_setting_ipv4.h" -#include "knetworkmanager-connection_setting_cdma.h" -#include "knetworkmanager-connection_setting_gsm.h" -#include "knetworkmanager-connection_settings_dialog.h" - -#if !defined(NM_CHECK_VERSION) -#define NM_CHECK_VERSION(x,y,z) 0 -#endif - -using namespace ConnectionSettings; - -class CellularDeviceTrayPrivate -{ - public: - CellularDeviceTrayPrivate() {} - ~CellularDeviceTrayPrivate() {} - - CellularDevice* dev; -}; - -void CellularDeviceTray::newConnection() -{ - // create an appropriate connection - Connection* conn = 0; - switch (d->dev->getDeviceType()) { -#if NM_CHECK_VERSION(0,8,992) - case NM_DEVICE_TYPE_MODEM: -#else - case DEVICE_TYPE_GSM: -#endif - conn = new GSMConnection(); - break; -#if NM_CHECK_VERSION(0,8,992) -#else - case DEVICE_TYPE_CDMA: - conn = new CDMAConnection(); - break; -#endif - default: - break; - } - - // edit the new connection - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, tray(), "connect_something", false, TQt::WDestructiveClose); - dlg->show(); -} - - -void CellularDeviceTray::addMenuItems(KPopupMenu* menu) -{ - ConnectionStore* connectionStore = ConnectionStore::getInstance(); - - // device title - Subhead* subhead = new Subhead (menu, "subhead", d->dev->getInterface(), SmallIcon("nm_device_wwan", TQIconSet::Automatic)); - menu->insertItem (subhead, -1, -1); - - //menu->insertSeparator(); - NMProxy* nm = NMProxy::getInstance(); - Connection* active_conn = nm->getActiveConnection(d->dev); - if (active_conn) - kdDebug() << active_conn->getObjectPath().data() << endl; - - // get all available Connections for cellular devices - // WILLTODO : repeat for GSM - TQValueList<Connection*> connections = connectionStore->getConnections(NM_SETTING_CDMA_SETTING_NAME); - for (TQValueList<Connection*>::iterator it = connections.begin(); it != connections.end(); ++it) - { - CDMAConnection* cellularconn = dynamic_cast<CDMAConnection*>(*it); - if (cellularconn) - { - // cellular connection found :) - Info* info = cellularconn->getInfoSetting(); - IPv4* ip = cellularconn->getIPv4Setting(); - - // lets create a nice name for this connection - if (info) - { - TQString title = info->getName(); - if (ip) - title += TQString(" (%1)").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)); - } - } - } - connections = connectionStore->getConnections(NM_SETTING_GSM_SETTING_NAME); - for (TQValueList<Connection*>::iterator it = connections.begin(); it != connections.end(); ++it) - { - GSMConnection* cellularconn = dynamic_cast<GSMConnection*>(*it); - if (cellularconn) - { - // cellular connection found :) - Info* info = cellularconn->getInfoSetting(); - IPv4* ip = cellularconn->getIPv4Setting(); - - // lets create a nice name for this connection - if (info) - { - TQString title = info->getName(); - if (ip) - title += TQString(" (%1)").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)); - } - } - } - - // bring the device down - KAction* deactivate = tray()->actionCollection()->action("deactivate_device"); - if (deactivate) - deactivate->plug(menu); - - menu->insertSeparator(); -} - -CellularDeviceTray::CellularDeviceTray (CellularDevice* dev, KSystemTray * parent, const char * name) - : DeviceTrayComponent (dev, parent, name) -{ - d = new CellularDeviceTrayPrivate(); - d->dev = dev; - - setPixmapForState(NM_DEVICE_STATE_ACTIVATED, "nm_device_wwan"); -} - -CellularDeviceTray::~CellularDeviceTray () -{ - delete d; -} - - -#include "knetworkmanager-cellular_device_tray.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-connection.cpp b/tdenetworkmanager/src/knetworkmanager-connection.cpp deleted file mode 100644 index f0da309..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection.cpp +++ /dev/null @@ -1,299 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -/* qt headers */ -#include <tqvaluelist.h> - -/* kde headers */ -#include <kdebug.h> -#include <klocale.h> - -/* TQDbus headers */ -#include <tqdbusconnection.h> -#include <tqdbusobjectpath.h> -#include <tqdbusdata.h> -#include <tqdbusdatamap.h> -#include <tqdbusvariant.h> - -/* NM headers */ -#include <NetworkManager.h> - -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_dbus.h" -#include "knetworkmanager-connection_secrets_dbus.h" -#include "knetworkmanager-connection_setting.h" -#include "knetworkmanager-nmsettings.h" -#include <stdio.h> - -extern unsigned char vpn_new_credentials_needed; - -using namespace ConnectionSettings; - -namespace ConnectionSettings -{ - -class ConnectionPrivate -{ - public: - ConnectionPrivate(Connection* parent) - { - conn_dbus = new ConnectionDBus(parent); - conn_secrets_dbus = new ConnectionSecretsDBus(parent); - secrets_requested = false; - } - ~ConnectionPrivate() {} - - TQT_DBusObjectPath obj_path; - ConnectionDBus* conn_dbus; - ConnectionSecretsDBus* conn_secrets_dbus; - TQValueList<ConnectionSetting*> settings; - TQString specific_object; - bool secrets_requested; -}; - -} - -/* - class Connection -*/ -Connection::Connection() -{ - d = new ConnectionPrivate(this); - - NMSettings* nmSettings = NMSettings::getInstance(); - d->obj_path = nmSettings->getObjPathForConnection(); - - TQT_DBusConnection conn = TQT_DBusConnection::systemBus(); - - if (!registerObject(conn, objectPath())) - kdError() << "registerobjectpath failed" << endl; - - // get notified whenever NM needs a secret - connect(d->conn_secrets_dbus, TQT_SIGNAL(SecretsNeeded(const TQString&, const TQStringList&, bool)), this, TQT_SLOT(slotSecretsNeeded(const TQString&, const TQStringList&, bool))); -} - -Connection::~Connection() -{ - for (TQValueList<ConnectionSetting*>::Iterator it= d->settings.begin(); it != d->settings.end(); ++it) - { - delete (*it); - *it = NULL; - } - delete d; -} - -ConnectionSetting* -Connection::getSetting(const TQString& type) const -{ - // find a setting by its type - for (TQValueList<ConnectionSetting*>::ConstIterator it = d->settings.begin(); it != d->settings.end(); ++it) - { - if ((*it)->getType() == type) - return (*it); - } - return NULL; -} - -TQValueList<ConnectionSetting*> -Connection::getSettings() const -{ - return d->settings; -} - -void -Connection::appendSetting(ConnectionSetting* setting) -{ - // that's our setting now :) - d->settings.append(setting); - connect(setting, TQT_SIGNAL(validityChanged()), this, TQT_SLOT(slotSettingValidityChanged())); -} - -void -Connection::setSpecificObject(const TQString& obj_path) -{ - d->specific_object = obj_path; -} - -TQString -Connection::getSpecificObject() const -{ - return d->specific_object; -} - -TQT_DBusObjectPath -Connection::getObjectPath() const -{ - return d->obj_path; -} - -TQString -Connection::objectPath() const -{ - return d->obj_path; -} - -bool -Connection::isValid() const -{ - bool retval = true; - // check if every enabled setting is valid - for (TQValueList<ConnectionSetting*>::ConstIterator it = d->settings.begin(); it != d->settings.end(); ++it) - { - if ((*it)->getEnabled()) - retval &= (*it)->isValid(); - } - return retval; -} - -void -Connection::slotSecretsNeeded(const TQString& setting_name, const TQStringList& hints, bool request_new) -{ - printf("Connection::slotSecretsNeeded %s, new: %s\n\r", setting_name.ascii(), (request_new ? "yes" : "no")); - kdDebug() << "Connection::slotSecretsNeeded " << setting_name.ascii() << ", new: " << (request_new ? "yes" : "no") << endl; - ConnectionSetting* setting = getSetting(setting_name); - - // If needed, request new VPN credentials - if (strcmp("vpn", setting_name.ascii()) == 0) { - if (vpn_new_credentials_needed == 1) { - vpn_new_credentials_needed = 0; - request_new = 1; - } - } - - if (!setting) - { - // send an error to NM - d->conn_secrets_dbus->SendGetSecretsReply(NULL); - } - else - { - if (!request_new && setting->hasSecrets()) - { - // if the setting has secrets just send them - d->conn_secrets_dbus->SendGetSecretsReply(setting); - } - else - { - // NetworkManager asks for new secrets, ask user for new secrets/retry - d->secrets_requested = true; - emit SecretsNeeded(this, setting, hints, request_new); - } - } -} - -void -Connection::slotSecretsProvided(ConnectionSetting* setting) -{ - if (!d->secrets_requested) - return; - - if (!setting) - { - // send all settings to NM - d->conn_secrets_dbus->SendGetSecretsReply(NULL); - } - else - { - // if we have the secrets already send them to NM - d->conn_secrets_dbus->SendGetSecretsReply(setting); - } - d->secrets_requested = false; -} - -void -Connection::slotSecretsError() -{ - if (!d->secrets_requested) - return; - - d->conn_secrets_dbus->SendGetSecretsError(); - d->secrets_requested = false; -} - -TQT_DBusObjectBase* -Connection::createInterface(const TQString& interfaceName) -{ - // the interfaces are already created, just return the right one - if (interfaceName == NM_DBUS_IFACE_SETTINGS_CONNECTION) - return d->conn_dbus; - - if (interfaceName == NM_DBUS_IFACE_SETTINGS_CONNECTION_SECRETS) - return d->conn_secrets_dbus; - - return NULL; -} - -TQString -Connection::getType() -{ - return TQString(); -} - -void -Connection::slotSettingValidityChanged() -{ - emit validityChanged(); -} - -void -Connection::slotAboutToBeRemoved() -{ - d->conn_dbus->slotAboutToBeRemoved(); -} -void -Connection::slotUpdated() -{ - d->conn_dbus->slotUpdated(); -} - -void -Connection::updateSettings(Connection* conn) -{ - TQValueList<ConnectionSetting*> settings = conn->getSettings(); - // copy all settings over to the new connection - for (TQValueList<ConnectionSetting*>::Iterator it = settings.begin(); it != settings.end(); ++it) - { - ConnectionSetting* other_setting = *it; - ConnectionSetting* my_setting = getSetting(other_setting->getType()); - if (my_setting) - { - my_setting->fromMap(other_setting->toMap()); - my_setting->fromSecretsMap(other_setting->toSecretsMap(false)); - } - else - { - // should not happen - } - } -} - -bool -Connection::awaitingSecrets() -{ - return d->secrets_requested; -} - -#include "knetworkmanager-connection.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-connection.h b/tdenetworkmanager/src/knetworkmanager-connection.h deleted file mode 100644 index a370700..0000000 --- a/tdenetworkmanager/src/knetworkmanager-connection.h +++ /dev/null @@ -1,133 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-connection.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_CONNECTION_H -#define KNETWORKMANAGER_CONNECTION_H - -#include <tqmap.h> -#include <tqobject.h> - -#include "knetworkmanager-connection_setting.h" -#include "dbus/connection.h" -#include "dbus/connectionnode.h" - -class AccessPoint; -class TQT_DBusObjectPath; - -namespace ConnectionSettings -{ - - class WirelessSecurity; - class Connection; - class ConnectionSetting; - class ConnectionPrivate; - class Info; - class Wired; - class Wireless; - class WirelessSecurity; - class IPv4; - - typedef TQMap<TQString, SettingsMap> ConnectionMap; - - // a connection wraps multiple settings - class Connection : public TQObject, DBus::ConnectionNode - { - Q_OBJECT - - public: - Connection(); - virtual ~Connection(); - - virtual TQString getID() const = 0; - virtual void setID(const TQString& id) = 0; - - // get a specific setting - ConnectionSetting* getSetting(const TQString&) const; - - // get all settings of this connection - TQValueList<ConnectionSetting*> getSettings() const; - - // attach a new setting - virtual void appendSetting(ConnectionSetting* setting); - - // ugly stuff introduced by NM - void setSpecificObject(const TQString&); - TQString getSpecificObject() const; - - // sometimes its usefull to have the object_path - TQT_DBusObjectPath getObjectPath() const; - - // is the connection valid? - virtual bool isValid() const; - - // the connections type (only for KNM use) - virtual TQString getType(); - - // duplicate - virtual Connection* duplicate() = 0; - - // update the settings from another connection - void updateSettings(Connection*); - - // true if the NM requested new secrets for this connection - bool awaitingSecrets(); - - public slots: - - // gets called from NM when it needs the secrets - void slotSecretsNeeded(const TQString& setting_name, const TQStringList& hints, bool request_new); - - // gets called when the GUI provided new secrets - void slotSecretsProvided(ConnectionSetting* setting); - - // signal a failure in getting new secrets - void slotSecretsError(); - - // gets called when a settings validity changes - void slotSettingValidityChanged(); - - // gets called when the connection is about to be removed - void slotAboutToBeRemoved(); - - // gets called when the connections settings changed - void slotUpdated(); - - protected: - // implementations for ConnectionNode - TQT_DBusObjectBase* createInterface(const TQString& interfaceName); - TQString objectPath() const; - - signals: - - // signal when we need new secrets - void SecretsNeeded(Connection* connection, ConnectionSetting* setting, const TQStringList& hints, bool request_new); - - // signal gets emitted when connections validity changes - void validityChanged(); - - private: - ConnectionPrivate* d; - }; -} -#endif /* KNETWORKMANAGER_CONNECTION_H */ diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -/* qt headers */ -#include <tqvaluelist.h> - -/* kde headers */ -#include <kdebug.h> -#include <klocale.h> - -/* TQDbus headers */ -#include <tqdbusconnection.h> -#include <tqdbusobjectpath.h> -#include <tqdbusdata.h> -#include <tqdbusdatamap.h> -#include <tqdbusvariant.h> -#include <tqdbuserror.h> - -/* NM headers */ -#include <NetworkManager.h> - -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_dbus.h" -#include "knetworkmanager-connection_setting.h" -#include "knetworkmanager-nmsettings.h" -#include "xmlmarshaller.h" - -using namespace ConnectionSettings; - -namespace ConnectionSettings -{ - -class ConnectionDBusPrivate -{ - public: - ConnectionDBusPrivate() {} - ~ConnectionDBusPrivate() {} - - ConnectionSettings::Connection* parent; -}; -} - -/* - class Connection -*/ -ConnectionDBus::ConnectionDBus(ConnectionSettings::Connection* parent) - : TQObject(parent) -{ - d = new ConnectionDBusPrivate(); - d->parent = parent; -} - -ConnectionDBus::~ConnectionDBus() -{ - delete d; -} - -bool -ConnectionDBus::GetID(TQString& id, TQT_DBusError& /*error*/) -{ - kdDebug() << "Connection::GetID" << endl; - id = d->parent->getID(); - - return true; -} - -bool -ConnectionDBus::GetSettings(TQT_DBusDataMap<TQString>& settings, TQT_DBusError& /*error*/) -{ - kdDebug() << "Connection::GetSettings, obj: " << objectPath().ascii() << endl; - - TQValueList<ConnectionSetting*> all_settings = d->parent->getSettings(); - - // FIXME: ugly conversions, ask Kevin on how to make it better - for (TQValueList<ConnectionSetting*>::Iterator it = all_settings.begin(); it != all_settings.end(); ++it) - { - kdDebug() << " Processing Setting '" << (*it)->getType().ascii() << "'" << endl; - // only append this setting if it is really used - if (!(*it)->getEnabled()) - { - kdDebug() << " Setting '" << (*it)->getType().ascii() << "' is not enabled, discarding" << endl; - continue; - } - - if (!(*it)->isValid()) - { - kdDebug() << " Setting '" << (*it)->getType().ascii() << "' is not valid, discarding" << endl; - continue; - } - - // copy the settingsmap over to a variantmap - TQMap<TQString, TQT_DBusData> map = (*it)->toMap(); - - // only take used settings - if (map.size() == 0) - { - kdDebug() << " Setting '" << (*it)->getType().ascii() << "' is empty, discarding" << endl; - continue; - } - - kdDebug() << " Attach setting '" << (*it)->getType().ascii() << "'" << endl; - - TQMap<TQString, TQT_DBusVariant> variant_map; - - for (TQMap<TQString, TQT_DBusData>::Iterator it2 = map.begin(); it2 != map.end(); ++it2) - { - TQString dataxml = XMLMarshaller::fromTQT_DBusData(it2.data()); - kdDebug() << " " << it2.key().ascii() << ": " << dataxml.replace('\n', ' ').ascii() << endl; - TQT_DBusVariant var; - var.value = it2.data(); - var.signature = var.value.buildDBusSignature(); - variant_map.insert(it2.key(), var); - } - - // convert the variantma - TQT_DBusDataMap<TQString> map2 = TQT_DBusDataMap<TQString>(variant_map); - TQT_DBusData data = TQT_DBusData::fromStringKeyMap(map2); - - // insert this setting - settings.insert((*it)->getType(), data); - } - - return true; -} - -bool -ConnectionDBus::Update(const TQT_DBusDataMap<TQString>& properties, TQT_DBusError& error) -{ - // FIXME - return true; -} - -bool -ConnectionDBus::Delete(TQT_DBusError& error) -{ - // FIXME - return true; -} - - -void -ConnectionDBus::handleMethodReply(const TQT_DBusMessage& reply) -{ - TQT_DBusConnection::systemBus().send(reply); -} - -bool -ConnectionDBus::handleSignalSend(const TQT_DBusMessage& reply) -{ - TQT_DBusConnection::systemBus().send(reply); - return true; -} - - -TQString -ConnectionDBus::objectPath() const -{ - return TQString(d->parent->getObjectPath()); -} - -void -ConnectionDBus::slotAboutToBeRemoved() -{ - // tell NM about us being removed - emitRemoved(); -} - -void -ConnectionDBus::slotUpdated() -{ - TQT_DBusDataMap<TQString> settings; - TQT_DBusError error; - if (GetSettings(settings, error)) - emitUpdated(settings); -} - -#include "knetworkmanager-connection_dbus.moc" diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_CONNECTION_DBUS_H -#define KNETWORKMANAGER_CONNECTION_DBUS_H - -#include <hal/libhal.h> -#include <stdint.h> -#include <tqhostaddress.h> -#include <tqmap.h> -#include <tqvariant.h> -#include <tqobject.h> - -#include "knetworkmanager-connection_setting.h" -#include "dbus/connection.h" -#include "dbus/connectionnode.h" - -class TQT_DBusObjectPath; - -namespace ConnectionSettings -{ - - class Connection; - class ConnectionSetting; - class ConnectionDBusPrivate; - - // DBUS abstraction for a connection - class ConnectionDBus : public TQObject, public DBus::Connection - { - Q_OBJECT - - public: - ConnectionDBus(ConnectionSettings::Connection* parent); - ~ConnectionDBus(); - - public slots: - void slotAboutToBeRemoved(); - void slotUpdated(); - - protected: - // implementations of the Setting DBus-interface - bool GetID(TQString& id, TQT_DBusError& error); - bool GetSettings(TQT_DBusDataMap<TQString>& settings, TQT_DBusError& error); - bool Update(const TQT_DBusDataMap<TQString>& properties, TQT_DBusError& error); - bool Delete(TQT_DBusError& error); - - // used from both interfaces - void handleMethodReply(const TQT_DBusMessage& reply); - bool handleSignalSend(const TQT_DBusMessage& reply); - TQString objectPath() const; - - private: - ConnectionDBusPrivate* d; - }; -} -#endif /* KNETWORKMANAGER_CONNECTION_DBUS_H */ diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -/* qt headers */ -#include <tqhostaddress.h> -#include <tqvariant.h> -#include <tqvaluelist.h> - -/* kde headers */ -#include <kdebug.h> -#include <klocale.h> - -/* TQDbus headers */ -#include <tqdbusconnection.h> -#include <tqdbusobjectpath.h> -#include <tqdbusdata.h> -#include <tqdbusdatalist.h> -#include <tqdbusdatamap.h> -#include <tqdbusvariant.h> -#include <tqdbuserror.h> -#include <tqdbusmessage.h> - -/* NM headers */ -#include <NetworkManager.h> - -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_secrets_dbus.h" -#include "knetworkmanager-connection_dbus.h" -#include "knetworkmanager-connection_setting.h" -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-connection_setting_ipv4.h" -#include "knetworkmanager-connection_setting_wired.h" -#include "knetworkmanager-connection_setting_wireless.h" -#include "knetworkmanager-connection_setting_wireless_security.h" -#include "knetworkmanager-accesspoint.h" -#include "knetworkmanager-nmsettings.h" -#include "xmlmarshaller.h" -#include "stdio.h" - -using namespace ConnectionSettings; - -namespace ConnectionSettings -{ - -class ConnectionSecretsDBusPrivate -{ - public: - ConnectionSecretsDBusPrivate(Connection* par) - : parent(par) - , currentRequest(-1) - {} - ~ConnectionSecretsDBusPrivate() {} - - Connection* parent; - int currentRequest; -}; - -} - -/* - class Connection -*/ -ConnectionSecretsDBus::ConnectionSecretsDBus(Connection* parent) - : TQObject(parent) -{ - d = new ConnectionSecretsDBusPrivate(parent); -} - -ConnectionSecretsDBus::~ConnectionSecretsDBus() -{ - delete d; -} - -void -ConnectionSecretsDBus::SendGetSecretsError() -{ - GetSecretsAsyncError(d->currentRequest, TQT_DBusError::stdFailed("Requested setting is empty")); -} - -void -ConnectionSecretsDBus::SendGetSecretsReply(ConnectionSettings::ConnectionSetting* setting) -{ - TQT_DBusMessage reply; - - kdDebug() << "SendGetSecretsReply1 id " << d->currentRequest << endl; - - // if no secret is needed we should not send one, right? - if (d->currentRequest < 0) - return; - kdDebug() << "SendGetSecretsReply2" << endl; -/* - // no such setting - if (!setting) - { - GetSecretsAsyncError(d->currentRequest, TQT_DBusError::stdFailed("Requested setting is unknown")); - } - else - { - kdDebud() << "SendGetSecretsReply3" << endl; - // copy the settingsmap over to a variantmap - TQMap<TQString, TQT_DBusData> map = setting->toSecretsMap(); - - // only take used settings - if (map.size() == 0) - { - kdDebug() << "SendGetSecretsReply4" << endl; - GetSecretsAsyncError(d->currentRequest, TQT_DBusError::stdFailed("Requested setting is empty")); - } - else - { - kdDebug() << "SendGetSecretsReply5" << endl; - TQT_DBusDataMap<TQString> secrets(map); - - TQMap<TQString, TQT_DBusVariant> secrets; - for (TQMap<TQString, TQT_DBusData>::Iterator it2 = map.begin(); it2 != map.end(); ++it2) - { - TQT_DBusVariant var; - var.value = it2.data(); - var.signature = var.value.buildDBusSignature(); - secrets.insert(it2.key(), var); - } - kdDebug() << "SendGetSecretsReply6" << endl; - - GetSecretsAsyncReply(d->currentRequest, secrets); - } - }*/ - - TQT_DBusDataMap<TQString> settings; - TQValueList<ConnectionSetting*> all_settings = d->parent->getSettings(); - - // FIXME: ugly conversions, ask Kevin on how to make it better - for (TQValueList<ConnectionSetting*>::Iterator it = all_settings.begin(); it != all_settings.end(); ++it) - { - kdDebug() << " Processing Setting '" << (*it)->getType().ascii() << "'" << endl; - if (!(*it)->isValid()) - { - kdDebug() << " Setting '" << (*it)->getType().ascii() << "' is not valid, discarding" << endl; - continue; - } - - // copy the settingsmap over to a variantmap - TQMap<TQString, TQT_DBusData> map = (*it)->toSecretsMap(); - - // only take used settings - if (map.size() == 0) - { - kdDebug() << " Setting '" << (*it)->getType().ascii() << "' is empty, discarding" << endl; - continue; - } - - kdDebug() << " Attach setting '" << (*it)->getType().ascii() << "'" << endl; - - TQMap<TQString, TQT_DBusVariant> variant_map; - - for (TQMap<TQString, TQT_DBusData>::Iterator it2 = map.begin(); it2 != map.end(); ++it2) - { - TQString dataxml = XMLMarshaller::fromTQT_DBusData(it2.data()); - kdDebug() << " " << it2.key().ascii() << ": " << dataxml.replace('\n', ' ').ascii() << endl; - TQT_DBusVariant var; - var.value = it2.data(); - var.signature = var.value.buildDBusSignature(); - variant_map.insert(it2.key(), var); - } - - // convert the variantma - TQT_DBusDataMap<TQString> map2 = TQT_DBusDataMap<TQString>(variant_map); - TQT_DBusData data = TQT_DBusData::fromStringKeyMap(map2); - - // insert this setting - settings.insert((*it)->getType(), data); - } - - GetSecretsAsyncReply(d->currentRequest, settings); - d->currentRequest = -1; - -} - -void -ConnectionSecretsDBus::GetSecretsAsync(int id, const TQString& setting_name, const TQStringList& hints, bool request_new) -{ - printf("Connection::GetSecretsAsync for setting %s, %s\n\r", setting_name.ascii(), id); - kdDebug() << "Connection::GetSecretsAsync for setting " << setting_name.ascii() << ", " << id << endl; - d->currentRequest = id; - emit SecretsNeeded(setting_name, hints, request_new); -} - -void -ConnectionSecretsDBus::handleMethodReply(const TQT_DBusMessage& reply) -{ - TQT_DBusConnection::systemBus().send(reply); -} - -bool -ConnectionSecretsDBus::handleSignalSend(const TQT_DBusMessage& reply) -{ - TQT_DBusConnection::systemBus().send(reply); - return true; -} - -TQString -ConnectionSecretsDBus::objectPath() const -{ - return TQString(d->parent->getObjectPath()); -} - - -#include "knetworkmanager-connection_secrets_dbus.moc" diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_CONNECTION_SECRETS_DBUS_H -#define KNETWORKMANAGER_CONNECTION_SECRETS_DBUS_H - -#include <hal/libhal.h> -#include <stdint.h> -#include <tqhostaddress.h> -#include <tqmap.h> -#include <tqvariant.h> -#include <tqobject.h> - -#include "knetworkmanager-connection_setting.h" -#include "dbus/connection.h" -#include "dbus/connectionnode.h" - -class AccessPoint; -class TQT_DBusObjectPath; -namespace ConnectionSettings -{ - - class WirelessSecurity; - class Connection; - class ConnectionSetting; - class ConnectionSecretsDBusPrivate; - - // a connection wraps multiple settings - class ConnectionSecretsDBus : public TQObject, public DBus::Secrets - { - Q_OBJECT - - 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_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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -// qt headers -#include <tqwidget.h> -#include <tqlineedit.h> -#include <tqcheckbox.h> -#include <tqlayout.h> -#include <tqcombobox.h> -#include <tqspinbox.h> -#include <tqiconset.h> -#include <kiconloader.h> -#include <tqwidgetstack.h> -#include <kuser.h> - -// knm headers -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting_gsm.h" -#include "knetworkmanager-connection_setting_gsm_widget.h" -#include "knetworkmanager-device.h" - -#include "connection_setting_gsm.h" - -using namespace ConnectionSettings; - -GSMWidgetImpl::GSMWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl) - : WidgetInterface(parent, name, fl) -{ - _gsmsetting = dynamic_cast<ConnectionSettings::GSM*> (conn->getSetting(NM_SETTING_GSM_SETTING_NAME)); - - TQVBoxLayout* 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_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 <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#include <nm-setting-ppp.h> - -// qt headers -#include <tqwidget.h> -#include <tqlineedit.h> -#include <tqcheckbox.h> -#include <tqlayout.h> -#include <tqcombobox.h> -#include <tqspinbox.h> -#include <tqiconset.h> -#include <kiconloader.h> -#include <tqwidgetstack.h> -#include <kuser.h> - -// knm headers -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting_ppp.h" -#include "knetworkmanager-connection_setting_ppp_widget.h" -#include "knetworkmanager-device.h" - -#include "connection_setting_ppp.h" - -using namespace ConnectionSettings; - -PPPWidgetImpl::PPPWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl) - : WidgetInterface(parent, name, fl) -{ - _pppsetting = dynamic_cast<ConnectionSettings::PPP*> (conn->getSetting(NM_SETTING_PPP_SETTING_NAME)); - - TQVBoxLayout* 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_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 <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#include <limits.h> -// qt headers -#include <tqwidget.h> -#include <tqlineedit.h> -#include <tqcheckbox.h> -#include <tqlayout.h> -#include <tqcombobox.h> -#include <tqspinbox.h> -#include <tqiconset.h> -#include <kiconloader.h> -#include <tqwidgetstack.h> -#include <kuser.h> - -// knm headers -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting_serial.h" -#include "knetworkmanager-connection_setting_serial_widget.h" -#include "knetworkmanager-device.h" - -#include "connection_setting_serial.h" - -using namespace ConnectionSettings; - -SerialWidgetImpl::SerialWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl) - : WidgetInterface(parent, name, fl) -{ - _serialsetting = dynamic_cast<ConnectionSettings::Serial*> (conn->getSetting(NM_SETTING_SERIAL_SETTING_NAME)); - - TQVBoxLayout* 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_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 <[email protected]>, <[email protected]> - * Author: Timothy Pearson <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -// qt headers -#include <tqwidget.h> -#include <tqcombobox.h> -#include <tqtabwidget.h> -#include <tqpushbutton.h> -#include <tqwidgetstack.h> -#include <tqapplication.h> -#include <tqlabel.h> - -// kde headers -#include <kiconloader.h> -#include <kdebug.h> -#include <kpushbutton.h> - -// TQt DBus headers -#include <tqdbuserror.h> -#include <tqdbusobjectpath.h> - -// NM headers -#include <NetworkManager.h> - -// knm headers -#include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-connection_setting.h" -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-connection_setting_ipv4.h" -#include "knetworkmanager-connection_setting_wired.h" -#include "knetworkmanager-connection_setting_cdma.h" -#include "knetworkmanager-connection_setting_gsm.h" -#include "knetworkmanager-connection_setting_wireless.h" -#include "knetworkmanager-connection_setting_wireless_security.h" -#include "knetworkmanager-devicestore.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-wired_connection.h" -#include "knetworkmanager-wireless_connection.h" -#include "knetworkmanager-vpn_connection.h" -#include "knetworkmanager-connection_store.h" -#include "knetworkmanager-connection_settings_dialog.h" -#include "knetworkmanager-connection_setting_cdma_widget.h" -#include "knetworkmanager-connection_setting_gsm_widget.h" -#include "knetworkmanager-connection_setting_ppp_widget.h" -#include "knetworkmanager-connection_setting_serial_widget.h" -#include "knetworkmanager-connection_setting_wireless_widget.h" -#include "knetworkmanager-connection_setting_wireless_security_widget.h" -#include "knetworkmanager-connection_setting_ipv4_widget.h" -#include "knetworkmanager-connection_setting_info_widget.h" -#include "knetworkmanager-connection_setting_vpn_widget.h" -#include "knetworkmanager-device.h" -#include "knetworkmanager-nm_proxy.h" -#include "knetworkmanager-storage.h" -#include "knetworkmanager-wireless_network.h" -#include "knetworkmanager-wireless_manager.h" - -#if !defined(NM_CHECK_VERSION) -#define NM_CHECK_VERSION(x,y,z) 0 -#endif - -char use_new_wireless_essid = 0; -TQByteArray new_wireless_essid; - -ConnectionSettingsDialogImpl::ConnectionSettingsDialogImpl(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting, TQWidget* parent, const char* name, bool modal, WFlags fl) - : ConnectionSettingsDialog(parent, name, modal, fl) - , _conn(conn) - , _setting(setting) - , _new_conn(new_conn) -{ - updateDialogForDeviceType(); - - // get notified if device combo changes - connect(btnConnect, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotConnect()) ); - connect(pbNext, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotNext()) ); - connect(pbBack, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotBack()) ); - connect(pbCancel, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotCancel()) ); - connect(pbSave, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSave()) ); - - // nice images for the buttons - btnConnect->setIconSet(SmallIcon ("connect_creating", TQIconSet::Automatic)); - pbNext->setIconSet(SmallIcon ("1rightarrow", TQIconSet::Automatic)); - pbBack->setIconSet(SmallIcon ("1leftarrow", TQIconSet::Automatic)); - pbCancel->setIconSet(SmallIcon("cancel", TQIconSet::Automatic)); - pbSave->setIconSet(SmallIcon("ok", TQIconSet::Automatic)); - - // enable or disable buttons accroding to the current state - slotEnableButtons(); -} - -ConnectionSettingsDialogImpl::~ConnectionSettingsDialogImpl() -{ - kdDebug() << "ConnectionSettingsDialogImpl::~ConnectionSettingsDialogImpl" << endl; -} - -TQValueList<WidgetInterface*> -ConnectionSettingsDialogImpl::createWidgetsForWireless(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) -{ - TQValueList<WidgetInterface*> ret; - - // widgetlist for wireless connection - ret.append(new ConnectionSettings::WirelessWidgetImpl(conn, new_conn)); - ret.append(new ConnectionSettings::WirelessSecurityWidgetImpl(conn, new_conn)); - ret.append(new ConnectionSettings::IPv4WidgetImpl(conn)); - ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); - - if (ret.isEmpty()) - { - // we have a problem here, NetworkManager asked for a setting we do not have - kdError() << k_funcinfo << "Unexpected setting requested" << endl; - } - - return ret; -} - -TQValueList<WidgetInterface*> -ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting, const TQByteArray& essid) -{ - TQValueList<WidgetInterface*> ret; - - // Set ESSID -// _wireless_setting = dynamic_cast<Wireless*> (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); -// _info_setting = dynamic_cast<Info*> (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME)); -// _wireless_setting->setEssid(essid); -// if (!_hasName) -// { -// // the connection has no name yet -> just take the essid for it -// _info_setting->setName(essid); -// } - - // widgetlist for wireless connection - ret.append(new ConnectionSettings::WirelessSecurityWidgetImpl(conn, new_conn)); - ret.append(new ConnectionSettings::IPv4WidgetImpl(conn)); - ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); - - if (ret.isEmpty()) - { - // we have a problem here, NetworkManager asked for a setting we do not have - kdError() << k_funcinfo << "Unexpected setting requested" << endl; - } - - return ret; -} - -TQValueList<WidgetInterface*> -ConnectionSettingsDialogImpl::createWidgetsForWired(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) -{ - TQValueList<WidgetInterface*> ret; - - // widgetlist for wired connection - ret.append(new ConnectionSettings::IPv4WidgetImpl(conn)); - ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); - - return ret; -} - -TQValueList<WidgetInterface*> -ConnectionSettingsDialogImpl::createWidgetsForVPN(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) -{ - TQValueList<WidgetInterface*> ret; - - // widgetlist for wired connection - ret.append(new ConnectionSettings::VPNWidgetImpl(conn, new_conn)); - ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); - - return ret; -} - -TQValueList<WidgetInterface*> -ConnectionSettingsDialogImpl::createWidgetsForCDMA(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) -{ - TQValueList<WidgetInterface*> ret; - - // widgetlist for wired connection - ret.append(new ConnectionSettings::CDMAWidgetImpl(conn)); - ret.append(new ConnectionSettings::SerialWidgetImpl(conn)); - ret.append(new ConnectionSettings::PPPWidgetImpl(conn)); - ret.append(new ConnectionSettings::IPv4WidgetImpl(conn)); - ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); - - return ret; -} - -TQValueList<WidgetInterface*> -ConnectionSettingsDialogImpl::createWidgetsForGSM(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) -{ - TQValueList<WidgetInterface*> ret; - - // widgetlist for wired connection - ret.append(new ConnectionSettings::GSMWidgetImpl(conn)); - ret.append(new ConnectionSettings::PPPWidgetImpl(conn)); - ret.append(new ConnectionSettings::SerialWidgetImpl(conn)); - ret.append(new ConnectionSettings::IPv4WidgetImpl(conn)); - ret.append(new ConnectionSettings::InfoWidgetImpl(conn)); - - return ret; -} - -void -ConnectionSettingsDialogImpl::createWidgetsForConnection(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting) -{ - /* - Currently two modes: - * dev == NULL -> Connection should be edited without the wish to start a connection - * dev != NULL -> A connection should be edited for connection on this device - */ - - if (!conn) - { - // TODO: create an empty widget and show an error - kdWarning() << k_funcinfo << "Not handled yet" << endl; - } - else - { - TQValueList<WidgetInterface*> widgets; - // TODO: move to a factory class - if (conn->getType() == NM_SETTING_WIRELESS_SETTING_NAME) { - if (use_new_wireless_essid == 0) { - widgets = createWidgetsForWireless(conn, new_conn, setting); - } - else { - createWidgetsForWirelessKnownESSID(conn, new_conn, setting, new_wireless_essid); - new_wireless_essid = NULL; - } - } - else if (conn->getType() == NM_SETTING_WIRED_SETTING_NAME) - widgets = createWidgetsForWired(conn, new_conn, setting); - else if (conn->getType() == NM_SETTING_CDMA_SETTING_NAME) - widgets = createWidgetsForCDMA(conn, new_conn, setting); - else if (conn->getType() == NM_SETTING_GSM_SETTING_NAME) - widgets = createWidgetsForGSM(conn, new_conn, setting); - else if (conn->getType() == NM_SETTING_VPN_SETTING_NAME) - widgets = createWidgetsForVPN(conn, new_conn, setting); - else - { - kdWarning() << k_funcinfo << "Not handled yet" << endl; - } - - int id; - for (TQValueList<WidgetInterface*>::Iterator it = widgets.begin(); it != widgets.end(); ++it) - { - id = wstackSettings->addWidget(*it); - _widgetIds.append(id); - } - - if (widgets.begin() != widgets.end()) - activateWidget(*widgets.begin()); - } -} - -void -ConnectionSettingsDialogImpl::updateDialogForDeviceType() -{ - // clear our tabview first - TQWidget *page = NULL; - while ( (page = wstackSettings->visibleWidget()) != NULL) - { - wstackSettings->removeWidget(page); - delete page; - } - - if (_conn) - { - connect(_conn, TQT_SIGNAL(validityChanged()), this, TQT_SLOT(slotEnableButtons())); - createWidgetsForConnection(_conn, _new_conn, _setting); - } - else - { - // this should never happen - TQLabel* lbl = new TQLabel(wstackSettings, "Unknown Device Type"); - wstackSettings->addWidget(lbl); - - wstackSettings->raiseWidget(lbl); - } -} - -int -ConnectionSettingsDialogImpl::getDeviceTypeFromConnection(Connection* conn) -{ - if (conn->getType() == NM_SETTING_WIRELESS_SETTING_NAME) -#if NM_CHECK_VERSION(0,8,992) - return NM_DEVICE_TYPE_WIFI; -#else - return DEVICE_TYPE_802_11_WIRELESS; -#endif - else if (conn->getType() == NM_SETTING_WIRED_SETTING_NAME) -#if NM_CHECK_VERSION(0,8,992) - return NM_DEVICE_TYPE_ETHERNET; -#else - return DEVICE_TYPE_802_3_ETHERNET; -#endif - else if (conn->getType() == NM_SETTING_GSM_SETTING_NAME) -#if NM_CHECK_VERSION(0,8,992) - return NM_DEVICE_TYPE_MODEM; -#else - return DEVICE_TYPE_GSM; -#endif - else if (conn->getType() == NM_SETTING_CDMA_SETTING_NAME) -#if NM_CHECK_VERSION(0,8,992) - return NM_DEVICE_TYPE_MODEM; -#else - return DEVICE_TYPE_CDMA; -#endif - -#if NM_CHECK_VERSION(0,8,992) - return NM_DEVICE_TYPE_UNKNOWN; -#else - return DEVICE_TYPE_UNKNOWN; -#endif -} - -void -ConnectionSettingsDialogImpl::slotConnect() -{ - DeviceStore* dstore = DeviceStore::getInstance(); - Device* dev = dstore->getDevices(getDeviceTypeFromConnection(_conn)).first(); - ConnectionStore* cstore = ConnectionStore::getInstance(); - NMProxy* nm = NMProxy::getInstance(); - TQT_DBusError err; - - // add the connection to the store - cstore->addConnection(_conn); - - // activate device - if (dev && _conn && nm) - { - int id; - if (_conn->awaitingSecrets()) - { - _conn->Connection::slotSecretsProvided(NULL); - } - else - { - - // VPN connection needs a special specific object - if (_conn->getType() == NM_SETTING_VPN_SETTING_NAME) - { - TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection(); - TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn); -#if NM_CHECK_VERSION(0,8,992) - nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), device, act_conn, err); -#else - nm->ActivateConnectionAsync(id,NM_DBUS_SERVICE_USER_SETTINGS, _conn->getObjectPath(), device, act_conn, err); -#endif - } - else - { - // we need to call ActivateDevice async -#if NM_CHECK_VERSION(0,8,992) - nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), TQT_DBusObjectPath(QCString(dev->getObjectPath())), _conn->getObjectPath(), err); -#else - nm->ActivateConnectionAsync(id, NM_DBUS_SERVICE_USER_SETTINGS, _conn->getObjectPath(), TQT_DBusObjectPath(TQCString(dev->getObjectPath())), _conn->getObjectPath(), err); -#endif - } - } - } - - emit connectionSaved(); - this->close(true); -} - -void -ConnectionSettingsDialogImpl::slotSave() -{ - // Make sure settings are committed - TQValueList<int>::Iterator current = _widgetIds.find(wstackSettings->id(wstackSettings->visibleWidget())); - if (current != _widgetIds.fromLast()) - { - WidgetInterface* widget = NULL; - - // let the widget know about it being the active one - widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current)); - if (widget) - deactivateWidget(widget); - } - - // Now save - ConnectionStore* cstore = ConnectionStore::getInstance(); - NMProxy* nm = NMProxy::getInstance(); - TQT_DBusError err; - - // add the connection to the store - cstore->addConnection(_conn); - - // if the connection waits for new secrets - // signal an error to NM, the user only wants to save - // the connection - if (_conn->awaitingSecrets()) - _conn->slotSecretsError(); - - emit connectionSaved(); - this->close(true); -} - -void -ConnectionSettingsDialogImpl::slotCancel() -{ - _conn->slotSecretsError(); - close(); -} - -void -ConnectionSettingsDialogImpl::slotNext() -{ - TQValueList<int>::Iterator current = _widgetIds.find(wstackSettings->id(wstackSettings->visibleWidget())); - if (current != _widgetIds.fromLast()) - { - WidgetInterface* widget = NULL; - - // let the widget know about it being the active one - widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current)); - if (widget) - deactivateWidget(widget); - - // next widget - current++; - - // let the widget know about it being the active one - widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current)); - if (widget) - activateWidget(widget); - } - slotEnableButtons(); -} - -void -ConnectionSettingsDialogImpl::slotBack() -{ - TQValueList<int>::Iterator current = _widgetIds.find(wstackSettings->id(wstackSettings->visibleWidget())); - if (current != _widgetIds.begin()) - { - WidgetInterface* widget = NULL; - - // let the widget know about it being the active one - widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current)); - if (widget) - deactivateWidget(widget); - - // one back - current--; - - // let the widget know about it being the active one - widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current)); - if (widget) - activateWidget(widget); - } - slotEnableButtons(); -} - -void -ConnectionSettingsDialogImpl::activateWidget(WidgetInterface* widget) -{ - // allow the widget to press next - connect(widget, TQT_SIGNAL(next()), this, TQT_SLOT(slotNext())); - - // allow the widget to do some initialization - widget->Activate(); - - // show the widget - wstackSettings->raiseWidget(widget); - -} - -void -ConnectionSettingsDialogImpl::deactivateWidget(WidgetInterface* widget) -{ - // allow the widget to press next - disconnect(widget, TQT_SIGNAL(next()), this, TQT_SLOT(slotNext())); - - // allow the widget to do some initialization - widget->Deactivate(); -} - -void -ConnectionSettingsDialogImpl::slotEnableButtons() -{ - // enable the buttons according to the current state - - TQValueList<int>::Iterator current = _widgetIds.find(wstackSettings->id(wstackSettings->visibleWidget())); - bool enabled; - - /* - Next: enabled if another widget is available - */ - enabled = true; - if (current == _widgetIds.fromLast()) - enabled = false; - pbNext->setEnabled(enabled); - - /* - Back: enabled if the current widget has a predecessor - */ - enabled = true; - if (current == _widgetIds.begin()) - enabled = false; - pbBack->setEnabled(enabled); - - /* - Connect: only show connect if the connection is valid - */ - if (_conn) - { - btnConnect->setEnabled(_conn->isValid()); - pbSave->setEnabled(_conn->isValid()); - - } -} - -#include "knetworkmanager-connection_settings_dialog.moc" diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#include <tqtimer.h> -#include <tquuid.h> -#include <tqdbusobjectpath.h> - -#include <kstaticdeleter.h> -#include <kapplication.h> -#include <kdebug.h> - -#include "knetworkmanager-connection_store.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting.h" -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-connection_setting_ipv4.h" -#include "knetworkmanager-connection_setting_wired.h" -#include "knetworkmanager-connection_setting_wireless.h" -#include "knetworkmanager-connection_setting_wireless_security.h" - -using namespace ConnectionSettings; - -static KStaticDeleter<ConnectionStore> sd; - -ConnectionStore* ConnectionStore::_instance = NULL; - -ConnectionStore* -ConnectionStore::getInstance() -{ - if (_instance) - return _instance; - return sd.setObject(_instance, new ConnectionStore()); -} - -ConnectionStore::ConnectionStore() - : _connectionList() -{ - // defer the connection init a bit - TQTimer::singleShot(0, this, TQT_SLOT(slotInit())); -} - -ConnectionStore::~ConnectionStore() -{ - for (TQValueList<Connection*>::Iterator it = _connectionList.begin(); it != _connectionList.end(); ++it) - { - delete (*it); - *it = NULL; - } -} - -void -ConnectionStore::slotInit() -{ - -} - -void -ConnectionStore::slotSecretsNeeded(Connection* conn, ConnectionSetting* setting, const TQStringList& hints, bool request_new) -{ - kdDebug() << "ConnectionStore::slotSecretsNeeded" << endl; - emit SecretsNeeded(conn, setting, hints, request_new); -} - -void -ConnectionStore::addConnection(Connection* con) -{ - if (_connectionList.find(con) != _connectionList.end()) - { - con->slotUpdated(); - emit signalConnectionUpdated(con); - return; - } - - // check if the connection has an ID already - if (con->getID().isEmpty()) - { - // set unique id for this connection - con->setID(createNewConnectionID()); - } - - // we own the connection now - _connectionList.append(con); - - // let's get notified if the connection asks for new secrets - connect(con, TQT_SIGNAL(SecretsNeeded(Connection*, ConnectionSetting*, const TQStringList&, bool)), - this, TQT_SLOT(slotSecretsNeeded(Connection*, ConnectionSetting*, const TQStringList&, bool))); - - // new connection, ring ring - emit signalConnectionAdded(con); -} - -void -ConnectionStore::removeConnection(Connection* con) -{ - // check if the connection is != NULL - if (!con) - return; - - // remove the object from our list - if (_connectionList.remove(con) == 0) - return; - - // notify everybody about the removed connection - emit signalConnectionRemoved(con); - - // delete the connection, it will deregister itself from NM - con->slotAboutToBeRemoved(); - delete con; -} - -Connection* -ConnectionStore::getConnection(const TQString& obj_path) -{ - // find a connection by obj_path - TQValueList<Connection*>::Iterator it = _connectionList.begin(); - for (; it != _connectionList.end(); ++it) - if (TQString((*it)->getObjectPath()) == obj_path) - return (*it); - return NULL; -} - -TQValueList<Connection*> -ConnectionStore::getConnections(const TQString& type) -{ - // return a list of connection - if (type.isEmpty()) - return _connectionList; - else - { - TQValueList<Connection*> ret; - for (TQValueList<Connection*>::Iterator it = _connectionList.begin(); it != _connectionList.end(); ++it) - { - if ( (*it)->getType() == type) - ret.append(*it); - } - return ret; - } -} - -TQString -ConnectionStore::createNewConnectionID() -{ - bool unique; - TQString id; - - do - { - unique = true; - - // 16 bytes of randomness should be enougth for getting a unique ID - id = TQUuid::createUuid().toString(); - id = id.replace("{",""); - id = id.replace("}",""); - - // nevertheless check if the id is used already - TQValueList<Connection*>::Iterator it = _connectionList.begin(); - for (; it != _connectionList.end(); ++it) - { - if ((*it)->getID() == id) - { - unique = false; - break; - } - } - } while (unique == false); - - return id; -} - -#include "knetworkmanager-connection_store.moc" diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_CONNECTION_STORE_H -#define KNETWORKMANAGER_CONNECTION_STORE_H - -#include <tqvaluelist.h> -#include <tqobject.h> - -namespace ConnectionSettings -{ - class Connection; - class ConnectionSetting; -} - -using namespace ConnectionSettings; - -class ConnectionStore : public TQObject -{ - Q_OBJECT - - - public: - static ConnectionStore* getInstance(); - ~ConnectionStore(); - - // add a new connection to the store - void addConnection(ConnectionSettings::Connection*); - - // get all connections - TQValueList<ConnectionSettings::Connection*> getConnections(const TQString& type = TQString()); - - // get a connection by ID - ConnectionSettings::Connection* getConnection(const TQString&); - - // delete the specified connection from the store and delete it - void removeConnection(ConnectionSettings::Connection*); - - public slots: - // has to be called as response to the signal SecretsNeeded - void slotSecretsNeeded(Connection* connection, ConnectionSetting* setting, const TQStringList& hints, bool request_new); - - signals: - // emitted when a new connection is added to the store - void signalConnectionAdded(ConnectionSettings::Connection*); - - // emitted when a connection was updated - void signalConnectionUpdated(ConnectionSettings::Connection*); - - // emitted when a connection is removed from the store - void signalConnectionRemoved(ConnectionSettings::Connection*); - - // emitted when a connection needs new secrets - void SecretsNeeded(ConnectionSettings::Connection* connection, ConnectionSettings::ConnectionSetting* setting, const TQStringList& hints, bool request_new); - - private slots: - void slotInit(); - - private: - ConnectionStore(); - TQString createNewConnectionID(); - - TQValueList<ConnectionSettings::Connection*> _connectionList; - static ConnectionStore* _instance; -}; - -#endif /* KNETWORKMANAGER_CONNECTION_STORE_H */ diff --git a/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 <[email protected]>, <[email protected]> - * Will Stephenson <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#include <NetworkManager.h> - -#include "knetworkmanager.h" -#include "knetworkmanager-nm_proxy.h" -#include "knetworkmanager-device.h" -#include "dbus/deviceproxy.h" -#include "knetworkmanager-hal_device_proxy.h" - - -#include <kdebug.h> -#include <tqhostaddress.h> - -#include <tqdbuserror.h> -#include <tqdbusconnection.h> -#include <tqdbusproxy.h> - - -class NMDeviceProxy : public DBus::DeviceProxy -{ - public: - NMDeviceProxy(const TQString& service, const TQString& path, TQObject* parent = 0, const char* name = 0) - : DeviceProxy(service, path, parent, name) - { - - } - - TQString getObjectPath() const - { - return m_baseProxy->path(); - } -}; - -class DevicePrivate -{ -public: - DevicePrivate(TQString service, TQString obj_path) - : nmDevice(service, obj_path) - , halDevice(NULL) - {} - ~DevicePrivate() {} - - NMDeviceProxy nmDevice; - HalDeviceProxy* halDevice; -}; - -TQ_UINT32 Device::getDeviceType() const -{ - TQT_DBusError err; - TQ_UINT32 type = d->nmDevice.getDeviceType(err); - kdWarning() << k_funcinfo << err.name() << err.message() << endl; - return type; -} - -TQString Device::getInterface() const -{ - TQT_DBusError err; - return d->nmDevice.getInterface(err); -} - -TQString Device::getUdi() const -{ - TQT_DBusError err; - return d->nmDevice.getUdi(err); -} - -TQString Device::getDriver() const -{ - TQT_DBusError err; - return d->nmDevice.getDriver(err); -} - -TQ_UINT32 Device::getCapabilities() const -{ - TQT_DBusError err; - return d->nmDevice.getCapabilities(err); -} - -TQ_INT32 Device::getIp4Address() const -{ - TQT_DBusError err; - return d->nmDevice.getIp4Address(err); -} - -NMDeviceState Device::getState() const -{ - TQT_DBusError err; - return (NMDeviceState)d->nmDevice.getState(err); -} - -TQString Device::getVendor() const -{ - // FIXME: ask hal - return ""; -} - -TQString Device::getProduct() const -{ - // FIXME: ask hal - return ""; -} - -TQString Device::getObjectPath() const -{ - return d->nmDevice.getObjectPath(); -} - -void Device::slotStateChanged(TQ_UINT32 state) -{ - emit StateChanged((NMDeviceState)state); -} - -void Device::slotDeactivate() -{ - // FIXME: the method was removed from NM API, use nm_proxy instead - NMProxy* nm = NMProxy::getInstance(); - - nm->deactivateDevice(this); - -// TQT_DBusError err; -// d->nmDevice.Deactivate(err); -} - -Device::Device (const TQString & obj_path) -{ - d = new DevicePrivate(NM_DBUS_SERVICE, obj_path); - - // create the NM Device Proxy - d->nmDevice.setConnection(TQT_DBusConnection::systemBus()); - - connect(&(d->nmDevice), TQT_SIGNAL(StateChanged(TQ_UINT32)), this, TQT_SLOT(slotStateChanged(TQ_UINT32))); -// d->halDevice = new HalDeviceProxy(); -} - -Device::~Device () -{ -// delete d->halDevice; - delete d; -} - - -#include "knetworkmanager-device.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-device.h b/tdenetworkmanager/src/knetworkmanager-device.h deleted file mode 100644 index 2a12ec8..0000000 --- a/tdenetworkmanager/src/knetworkmanager-device.h +++ /dev/null @@ -1,74 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-device.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig <[email protected]>, <[email protected]> - * Will Stephenson <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_DEVICE_H -#define KNETWORKMANAGER_DEVICE_H - -#include <NetworkManager.h> - -#include "knetworkmanager.h" - -#include <stdint.h> - -class KNetworkManager; -class Network; -class IP4Config; - -class DevicePrivate; - -class Device : public TQObject -{ - Q_OBJECT - - 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-device_tray.cpp b/tdenetworkmanager/src/knetworkmanager-device_tray.cpp deleted file mode 100644 index e0c05a9..0000000 --- a/tdenetworkmanager/src/knetworkmanager-device_tray.cpp +++ /dev/null @@ -1,337 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-device_tray.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -class WirelessDialog; - -// TQt includes -#include <tqevent.h> -#include <tqvbox.h> -#include <tqlayout.h> -#include <tqpushbutton.h> -#include <tqbitmap.h> -#include <tqimage.h> -#include <tqpixmap.h> -#include <tqpixmapcache.h> -#include <tqpainter.h> -#include <tqstyle.h> -#include <tqtimer.h> - -// KDE includes -#include <dcopclient.h> -#include <kdebug.h> -#include <kdialogbase.h> -#include <knotifyclient.h> -#include <knotifydialog.h> -#include <kiconeffect.h> -#include <klocale.h> -#include <kstdguiitem.h> -#include <khelpmenu.h> -#include <kprocess.h> -#include <kiconloader.h> -#include <kconfig.h> -#include <kmessagebox.h> -#include <kglobalsettings.h> - -// KNM includes -#include "knetworkmanager-device_tray.h" -#include "knetworkmanager-device.h" -#include "knetworkmanager-menu_subhead.h" -#include "knetworkmanager-connection_settings_dialog.h" -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-nm_proxy.h" -#include "knetworkmanager-connection.h" - -using namespace ConnectionSettings; - -class DeviceTrayPrivate -{ - public: - - DeviceTrayPrivate() - : dev(NULL) - { - tooltips[NM_DEVICE_STATE_UNKNOWN] = i18n("Unknown"); - tooltips[NM_DEVICE_STATE_UNAVAILABLE] = i18n("Down"); - tooltips[NM_DEVICE_STATE_UNMANAGED] = i18n("Unmanaged"); - tooltips[NM_DEVICE_STATE_DISCONNECTED] = i18n("Disconnected"); - tooltips[NM_DEVICE_STATE_PREPARE] = i18n("Preparing"); - tooltips[NM_DEVICE_STATE_CONFIG] = i18n("Configuration"); - tooltips[NM_DEVICE_STATE_NEED_AUTH] = i18n("Awaiting authentication"); - tooltips[NM_DEVICE_STATE_IP_CONFIG] = i18n("IP configuration"); - tooltips[NM_DEVICE_STATE_ACTIVATED] = i18n("Activated"); - tooltips[NM_DEVICE_STATE_FAILED] = i18n("Failed"); - } - - ~DeviceTrayPrivate() {} - - Device* dev; - TQMap<NMDeviceState, TQMovie> movies; - TQMap<NMDeviceState, TQPixmap> pixmaps; - TQMap<NMDeviceState, TQString> tooltips; -}; - -Device* DeviceTray::getDevice() const -{ - return d->dev; -} - -TQString DeviceTray::getTooltipText() -{ - NMDeviceState state = d->dev->getState(); - TQString tooltip = TQString(); - - if (!d->tooltips[state].isEmpty()) - tooltip += i18n("State: %1").arg(d->tooltips[state]); - - return tooltip; -} - -void DeviceTray::enterEvent (TQEvent* /*e*/) -{ - // show tooltip - TQToolTip::remove (this); - TQString tooltip = getTooltipText(); - - if (!tooltip.isEmpty()) - TQToolTip::add (this, tooltip); -} - - -void DeviceTray::setPixmap(const TQPixmap& pixmap) -{ - /* - int oldPixmapWidth = pixmap.size().width(); - int oldPixmapHeight = pixmap.size().height(); - - // we want to show the interface name - TQString iface = d->dev->getInterface(); - - // grab a font - TQFont iface_font = KGlobalSettings::generalFont(); -// iface_font.setBold(true); - - // resize the font to fit the icon's size - float fontSize = iface_font.pointSizeFloat(); - TQFontMetrics qfm(iface_font); - int height = qfm.height(); - int width = qfm.width(iface); - float factor = 1.0f; - float factor2 = 1.0f; - - if (height > (oldPixmapHeight / 2.0f)) - factor = float(oldPixmapHeight / 2.0f) / float(height); - - if (width > (oldPixmapWidth / 1.1f)) - factor2 = float(oldPixmapWidth / 1.1f) / float(width); - - fontSize *= (factor2 < factor) ? factor2 : factor; - - iface_font.setPointSizeFloat( fontSize); - - // draw the text to a bitmap and put is as an overlay on top of the pixmap - TQPixmap iface_pixmap(oldPixmapWidth, oldPixmapHeight); - iface_pixmap.fill(TQt::white); - TQPainter p(&iface_pixmap); - p.setFont(iface_font); - p.setPen(TQt::blue); - p.drawText(iface_pixmap.rect(), TQt::AlignHCenter | TQt::AlignBottom, iface); - iface_pixmap.setMask(iface_pixmap.createHeuristicMask()); - TQImage iface_image = iface_pixmap.convertToImage(); - - TQImage pixmap_with_overlay = pixmap.convertToImage(); - KIconEffect::overlay(pixmap_with_overlay, iface_image); - - TQPixmap new_pixmap; - new_pixmap.convertFromImage(pixmap_with_overlay); - // call base-class setPixmap - KSystemTray::setPixmap(new_pixmap); -*/ - KSystemTray::setPixmap(pixmap); -} - -void DeviceTray::contextMenuAboutToShow (KPopupMenu* menu) -{ - menu->clear(); - - // insert title - menu->insertTitle (SmallIcon ("knetworkmanager", TQIconSet::Automatic), "KNetworkManager", -1, -1); - - // let the specific device_tray add its items - addMenuItems(menu); - - // quit - menu->insertSeparator (); - KAction* quitAction = actionCollection ()->action (KStdAction::name (KStdAction::Quit)); - if (quitAction) - quitAction->plug (menu); -} - -void DeviceTray::resizeEvent ( TQResizeEvent * ) -{ - // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes - loadIcons(); - updateTrayIcon(m_currentIconState); -} - -void DeviceTray::setPixmapForState(NMDeviceState state, TQMovie movie) -{ - d->movies[state] = movie; - slotUpdateDeviceState(); -} - -void DeviceTray::setPixmapForState(NMDeviceState state, TQPixmap pixmap) -{ - d->pixmaps[state] = pixmap; - slotUpdateDeviceState(); -} - -void DeviceTray::updateTrayIcon(NMDeviceState state) -{ - // stop the old movie to avoid unnecessary wakups - if (movie()) - movie()->pause(); - - if (d->movies.find(state) != d->movies.end() && !d->movies[state].isNull()) - { - if (m_currentIconState != state) { - // Clear the icon pixmap as the movie may be a different size - TQPixmap nullPixmap; - setPixmap(nullPixmap); - } - - // animation desired - int frame = -1; - if (movie()) - frame = movie()->frameNumber(); - - // set the movie - setMovie(d->movies[state]); - - // start at the same frame as the movie before - if (frame > 0) - movie()->step(frame); - - // start the animation - movie()->unpause(); - } - else if (d->pixmaps.find(state) != d->pixmaps.end() && !d->pixmaps[state].isNull()) - setPixmap(d->pixmaps[state]); - else - setPixmap(loadSizedIcon("KNetworkManager", width())); - - m_currentIconState = state; -} - -void DeviceTray::updateActions(NMDeviceState state) -{ - // allow device deactivation only when device is activated - KAction* deactivate = actionCollection()->action("deactivate_device"); - if (deactivate) - deactivate->setEnabled( (state == NM_DEVICE_STATE_ACTIVATED || - state == NM_DEVICE_STATE_IP_CONFIG || - state == NM_DEVICE_STATE_PREPARE || - state == NM_DEVICE_STATE_CONFIG || - state == NM_DEVICE_STATE_NEED_AUTH) ); -} - -void DeviceTray::updateActiveConnection(NMDeviceState state) -{ - if (state != NM_DEVICE_STATE_ACTIVATED) - return; - - NMProxy* nm = NMProxy::getInstance(); - Connection* active_conn = nm->getActiveConnection(d->dev); - if (active_conn) - { - Info* info = dynamic_cast<Info*>(active_conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME)); - if (info) - info->setTimestamp(TQDateTime::currentDateTime()); - } -} - -void DeviceTray::slotUpdateDeviceState(NMDeviceState state) -{ - updateTrayIcon(state); - updateActions(state); - updateActiveConnection(state); -} - -void DeviceTray::slotUpdateDeviceState() -{ - slotUpdateDeviceState(d->dev->getState()); -} - -void DeviceTray::loadIcons() { - d->pixmaps[NM_DEVICE_STATE_UNKNOWN] = loadSizedIcon("nm_no_connection", width()); - d->pixmaps[NM_DEVICE_STATE_UNMANAGED] = loadSizedIcon("nm_no_connection", width()); - d->pixmaps[NM_DEVICE_STATE_UNAVAILABLE] = loadSizedIcon("nm_no_connection", width()); - d->pixmaps[NM_DEVICE_STATE_DISCONNECTED] = loadSizedIcon("nm_no_connection", width()); - - d->movies[NM_DEVICE_STATE_PREPARE] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage01_connecting", KIcon::Panel)); - d->movies[NM_DEVICE_STATE_PREPARE].pause(); - - d->movies[NM_DEVICE_STATE_CONFIG] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage02_connecting", KIcon::Panel)); - d->movies[NM_DEVICE_STATE_CONFIG].pause(); - - d->movies[NM_DEVICE_STATE_IP_CONFIG] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage03_connecting", KIcon::Panel)); - d->movies[NM_DEVICE_STATE_IP_CONFIG].pause(); - - d->movies[NM_DEVICE_STATE_NEED_AUTH] = d->movies[NM_DEVICE_STATE_CONFIG]; - d->movies[NM_DEVICE_STATE_NEED_AUTH].pause(); - - d->pixmaps[NM_DEVICE_STATE_ACTIVATED] = loadSizedIcon("ok", width()); - - d->pixmaps[NM_DEVICE_STATE_FAILED] = loadSizedIcon("nm_no_connection", width()); -} - -DeviceTray::DeviceTray (Device* dev) : KSystemTray () -{ - d = new DeviceTrayPrivate(); - d->dev = dev; - - m_currentIconState = NM_DEVICE_STATE_UNKNOWN; - loadIcons(); - - // get notified when the device state changes - connect(dev, TQT_SIGNAL(StateChanged(NMDeviceState)), this, TQT_SLOT(slotUpdateDeviceState(NMDeviceState))); - - setMouseTracking (true); - - // defer the initial call to slotUpdateDeviceState as it will crash knm when called directly from here - // virtual method calls are not allowed in constructor - TQTimer::singleShot(0, this, TQT_SLOT(slotUpdateDeviceState())); - - // Actions used for plugging into the menu - new KAction (i18n ("Deactivate connection..."), - SmallIcon ("no", TQIconSet::Automatic), 0, - dev, TQT_SLOT (slotDeactivate()), actionCollection (), "deactivate_device"); -} - -DeviceTray::~DeviceTray () -{ - delete d; -} - - -#include "knetworkmanager-device_tray.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-device_tray.h b/tdenetworkmanager/src/knetworkmanager-device_tray.h deleted file mode 100644 index 5b390ad..0000000 --- a/tdenetworkmanager/src/knetworkmanager-device_tray.h +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-device_tray.h - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_DEVICE_TRAY_H -#define KNETWORKMANAGER_DEVICE_TRAY_H - -#include <tqmap.h> -#include <tqtimer.h> - -#include <tqtooltip.h> -#include <ksystemtray.h> -#include <kuniqueapplication.h> -#include <kpopupmenu.h> -#include <kactionclasses.h> -#include <kstdaction.h> -#include <kstdguiitem.h> - -#include <tqlayout.h> -#include <tqlabel.h> -#include <tqcheckbox.h> -#include <tqprogressbar.h> -#include <tqguardedptr.h> - -#include <NetworkManager.h> -#include "knetworkmanager.h" - -#define NM_DEVICE_STATE_VPN_PREPARE 100 -#define NM_DEVICE_STATE_VPN_ACTIVATED 101 - -class Device; -class DeviceTrayPrivate; - -class DeviceTray : public KSystemTray -{ - Q_OBJECT - - - public: - DeviceTray (Device*); - ~DeviceTray (); - - void contextMenuAboutToShow (KPopupMenu* menu); - virtual void addMenuItems(KPopupMenu* menu) = 0; - Device* getDevice() const; - - protected: - void setPixmapForState(NMDeviceState, TQMovie); - void setPixmapForState(NMDeviceState, TQPixmap); - void resizeEvent ( TQResizeEvent * ); - - virtual TQString getTooltipText(); - - public slots: - void setPixmap(const TQPixmap &); - void slotUpdateDeviceState(NMDeviceState); - void slotUpdateDeviceState(); - - private: - void updateTrayIcon(NMDeviceState); - void updateActions(NMDeviceState); - void updateActiveConnection(NMDeviceState); - void enterEvent (TQEvent*); - void loadIcons(); - - DeviceTrayPrivate* d; - NMDeviceState m_currentIconState; -}; - -#endif /* KNETWORKMANAGER_DEVICE_TRAY_H */ diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#include <NetworkManager.h> - -#include "knetworkmanager.h" -#include "knetworkmanager-devicestore.h" -#include "knetworkmanager-wired_device.h" -#include "knetworkmanager-wireless_device.h" -#include "knetworkmanager-gsm_device.h" -#include "knetworkmanager-cdma_device.h" -#include "knetworkmanager-device.h" -#include "knetworkmanager-nm_proxy.h" -#include "dbus/deviceproxy.h" - -#include <tqdbuserror.h> -#include <tqdbusobjectpath.h> -#include <tqdbusconnection.h> - -#include <kdebug.h> - -#if !defined(NM_CHECK_VERSION) -#define NM_CHECK_VERSION(x,y,z) 0 -#endif - -class DeviceStorePrivate -{ - public: - DeviceStorePrivate() {} - ~DeviceStorePrivate() {} - - TQMap<TQString, Device*> devices; - static DeviceStore* store; -}; - -DeviceStore* DeviceStorePrivate::store = NULL; - -DeviceStore* DeviceStore::getInstance() -{ - if (DeviceStorePrivate::store) - return DeviceStorePrivate::store; - return (DeviceStorePrivate::store = new DeviceStore()); -} - -void DeviceStore::slotDeviceRemoved(const TQT_DBusObjectPath & obj_path) -{ - kdDebug() << "DeviceStore::slotDeviceRemoved" << endl; - TQMap<TQString, Device*>::Iterator it = d->devices.find(TQString(obj_path)); - if (it != d->devices.end()) - { - // remove this device - Device* dev = it.data(); - - emit DeviceRemoved(dev); - - d->devices.remove(it); - delete dev; - dev = NULL; - } -} - -void DeviceStore::slotDeviceAdded(const TQT_DBusObjectPath & obj_path) -{ - // just start an update - Device* dev = createDevice(obj_path); - if (dev) - emit DeviceAdded(dev); -} - -Device* DeviceStore::createDevice(const TQT_DBusObjectPath &obj_path) -{ - TQT_DBusError err; - // if we have this device already in our list goto the next one - TQMap<TQString, Device*>::Iterator it = d->devices.find(obj_path); - if ( it != d->devices.end()) - return it.data(); - - // FIXME: ugly stuff is going on here, better pass the DeviceProxy to the Device's constructor instead of the object_path - DBus::DeviceProxy* dev = new DBus::DeviceProxy(NM_DBUS_SERVICE, obj_path); - Device* new_dev = NULL; - - if (dev) - { - dev->setConnection(TQT_DBusConnection::systemBus()); - TQ_UINT32 type = dev->getDeviceType(err); - - //printf("Device obj_path: %s\n\r", obj_path->data()); - - // FIXME: This should not be hardcoded, it would be better if wireless, wired etc. modules register their device type - // select the right device type and create the appropriate objects - switch(type) - { -#if NM_CHECK_VERSION(0,8,992) - case NM_DEVICE_TYPE_WIFI: -#else - case DEVICE_TYPE_802_11_WIRELESS: -#endif - new_dev = new WirelessDevice(obj_path); - break; -#if NM_CHECK_VERSION(0,8,992) - case NM_DEVICE_TYPE_ETHERNET: -#else - case DEVICE_TYPE_802_3_ETHERNET: -#endif - new_dev = new WiredDevice(obj_path); - break; -#if NM_CHECK_VERSION(0,8,992) - case NM_DEVICE_TYPE_MODEM: -#else - case DEVICE_TYPE_GSM: -#endif - new_dev = new GSMDevice(obj_path); - break; -#if NM_CHECK_VERSION(0,8,992) -#else - case DEVICE_TYPE_CDMA: -#endif - new_dev = new CDMADevice(obj_path); - break; - default: - kdWarning() << k_funcinfo << "Unknown devicetype" << endl; - new_dev = new Device(obj_path); - break; - } - - // insert the new device into our list - if (new_dev) - d->devices.insert(obj_path, new_dev); - - delete dev; - } - else - kdWarning() << k_funcinfo << "Dev is Null" << endl; - - return new_dev; -} - -void DeviceStore::updateDevices() -{ - NMProxy* nm = NMProxy::getInstance(); - TQValueList<TQT_DBusObjectPath> obj_paths; - TQT_DBusError err; - - // get a list of NM devices - nm->GetDevices(obj_paths, err); - - // create a list of KNM devices - for (TQValueList<TQT_DBusObjectPath>::Iterator it = obj_paths.begin(); it != obj_paths.end(); ++it) - { - createDevice((*it)); - } -} - -TQValueList<Device*> DeviceStore::getDevices(TQ_UINT32 type) -{ - updateDevices(); - - if (type == 0) - return d->devices.values(); - else - { - // only return devices of a special type - TQValueList<Device*> devs; - for (TQMap<TQString, Device*>::Iterator it = d->devices.begin(); it != d->devices.end(); ++it) - { - if (it.data()->getDeviceType() == type) - devs.append(it.data()); - } - return devs; - } -} - -Device* DeviceStore::getDevice(TQT_DBusObjectPath objpath) -{ - return d->devices[objpath]; -} - -DeviceStore::DeviceStore ( TQObject * parent, const char * name ) : TQObject( parent, name ) -{ - d = new DeviceStorePrivate(); - - // get notified from NM when devices are added or removed - NMProxy* nm = NMProxy::getInstance(); - connect(nm, TQT_SIGNAL(DeviceAdded(const TQT_DBusObjectPath& )), this, TQT_SLOT(slotDeviceAdded(const TQT_DBusObjectPath&))); - connect(nm, TQT_SIGNAL(DeviceRemoved(const TQT_DBusObjectPath& )), this, TQT_SLOT(slotDeviceRemoved(const TQT_DBusObjectPath&))); -} - -DeviceStore::~DeviceStore () -{ - // delete all devicepointers - while (d->devices.begin() != d->devices.end()) - delete d->devices.begin().data(); - - // delete private data - delete d; -} - - -#include "knetworkmanager-devicestore.moc" diff --git a/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 <[email protected]>, <[email protected]> - * Will Stephenson <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_DEVICESTORE_H -#define KNETWORKMANAGER_DEVICESTORE_H - -#include "knetworkmanager.h" - -class TQT_DBusObjectPath; -class DeviceStorePrivate; -class Device; - -class DeviceStore : public TQObject -{ - Q_OBJECT - - - public: - static DeviceStore* getInstance(); - TQValueList<Device*> getDevices(TQ_UINT32 type = 0); - Device* getDevice(TQT_DBusObjectPath); - - public slots: - void slotDeviceAdded(const TQT_DBusObjectPath&); - void slotDeviceRemoved(const TQT_DBusObjectPath&); - - protected: - DeviceStore ( TQObject * parent = 0, const char * name = 0); - ~DeviceStore (); - - signals: - void DeviceStoreChanged(); - void DeviceAdded(Device*); - void DeviceRemoved(Device*); - - private: - void updateDevices(); - Device* createDevice(const TQT_DBusObjectPath&); - - DeviceStorePrivate* d; -}; - -#endif /* KNETWORKMANAGER_DEVICESTORE_H */ diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -/* qt headers */ -#include <tqhostaddress.h> -#include <tqvariant.h> -#include <tqvaluelist.h> - -/* kde headers */ -#include <kdebug.h> -#include <klocale.h> - -/* TQDbus headers */ -#include <tqdbusconnection.h> -#include <tqdbusobjectpath.h> -#include <tqdbusdata.h> -#include <tqdbusdatamap.h> -#include <tqdbusvariant.h> - -/* NM headers */ -#include <NetworkManager.h> - -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-generic_connection.h" -#include "knetworkmanager-connection_setting.h" -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-nmsettings.h" - -using namespace ConnectionSettings; - -/* - class GenericConnection -*/ -GenericConnection::GenericConnection(const TQString& type) - : Connection() -{ - // every connection needs an info-setting - appendSetting(new Info(this, type, "")); -} - -TQString -GenericConnection::getType() -{ - Info* info = dynamic_cast<Info*>(getSetting("connection")); - if (info) - return info->getDevType(); - else - return TQString(); -} - -TQString -GenericConnection::getID() const -{ - return getInfoSetting()->getUUID(); -} - -void -GenericConnection::setID(const TQString& id) -{ - getInfoSetting()->setUUID(id); -} - -Info* GenericConnection::getInfoSetting() const -{ - return dynamic_cast<Info*>(getSetting("connection")); -} - -#include "knetworkmanager-generic_connection.moc" diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_GENERIC_CONNECTION_H -#define KNETWORKMANAGER_GENERIC_CONNECTION_H - -#include <tqmap.h> -#include <tqobject.h> - -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting.h" -#include "dbus/connection.h" -#include "dbus/connectionnode.h" - -class TQDBusObjectPath; - -namespace ConnectionSettings -{ - - class ConnectionSetting; - class Info; - - class GenericConnection : public Connection - { - Q_OBJECT - - 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 <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#include "knetworkmanager-gsm_connection.h" - -#include <nm-setting-gsm.h> -#include "knetworkmanager-connection_setting_serial.h" - -ConnectionSettings::GSMConnection::GSMConnection() - : PPPConnection(NM_SETTING_GSM_SETTING_NAME) -{ - appendSetting(new GSM(this)); - appendSetting(new Serial(this)); -} - -ConnectionSettings::GSMConnection::~GSMConnection() -{ - -} - -ConnectionSettings::GSM* ConnectionSettings::GSMConnection::getGSMSetting() const -{ - return dynamic_cast<GSM*>(getSetting(NM_SETTING_GSM_SETTING_NAME)); -} - -ConnectionSettings::Serial* ConnectionSettings::GSMConnection::getSerialSetting() const -{ - return dynamic_cast<Serial*>(getSetting(NM_SETTING_SERIAL_SETTING_NAME)); -} - -ConnectionSettings::Connection* ConnectionSettings::GSMConnection::duplicate() -{ - GSMConnection* conn = new GSMConnection(); - conn->updateSettings(this); - return conn; -} -#include "knetworkmanager-gsm_connection.moc" - -// vim: sw=4 sts=4 noet tw=100 diff --git a/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 <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_GSM_CONNECTION_H -#define KNETWORKMANAGER_GSM_CONNECTION_H - -#include "knetworkmanager-ppp_connection.h" -#include "knetworkmanager-connection_setting_gsm.h" - -namespace ConnectionSettings -{ - class GSM; - class Serial; - - class GSMConnection : public PPPConnection - { - Q_OBJECT - - public: - GSMConnection(); - ~GSMConnection(); - GSM* getGSMSetting() const; - Serial* getSerialSetting() const; - Connection* duplicate(); - }; -}; // namespace ConnectionSettings - -#endif - 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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -// KDE includes -#include <kdebug.h> - -// TQt includes -#include <tqhostaddress.h> - -// TQT_DBus includes -#include <tqdbuserror.h> -#include <tqdbusconnection.h> - -// NM includes -#include <NetworkManager.h> - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-gsm_device.h" -#include "dbus/gsmproxy.h" - -class GSMDevicePrivate -{ -public: - GSMDevicePrivate(TQString service, TQString obj_path) - : nmGSM(service, obj_path) - {} - ~GSMDevicePrivate() {} - - DBus::GSMDeviceProxy nmGSM; -}; - -GSMDevice::GSMDevice (const TQString & obj_path) - : CellularDevice(obj_path) -{ - d = new GSMDevicePrivate(NM_DBUS_SERVICE, obj_path); - d->nmGSM.setConnection(TQT_DBusConnection::systemBus()); -} - -GSMDevice::~GSMDevice () -{ - delete d; -} - - -#include "knetworkmanager-gsm_device.moc" diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_GSMDEVICE_H -#define KNETWORKMANAGER_GSMDEVICE_H - -// std includes -#include <stdint.h> - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-cellular_device.h" - -class KNetworkManager; - -class GSMDevicePrivate; - -class GSMDevice : public CellularDevice -{ - Q_OBJECT - - 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 <[email protected]>, <[email protected]> - * Will Stephenson <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#include "knetworkmanager.h" -#include "knetworkmanager-hal_device_proxy.h" - -#include <kdebug.h> -#include <tqhostaddress.h> - -class HalDeviceProxyPrivate -{ -public: - HalDeviceProxyPrivate() {} - ~HalDeviceProxyPrivate() {} - - void getHalProperty (const TQCString& udi, const TQCString& property, TQCString& result); - - TQString udi; -}; - -HalDeviceProxy::HalDeviceProxy (const TQString & udi) -{ - d = new HalDeviceProxyPrivate; - d->udi = udi; -} - -HalDeviceProxy::~HalDeviceProxy () -{ - delete d; -} - -bustype -HalDeviceProxy::getBustype () const -{ - TQCString device_udi = d->udi.utf8(); - TQCString parent_udi = ""; - TQCString subsystem = ""; - - d->getHalProperty (device_udi, "info.parent", parent_udi); - d->getHalProperty (parent_udi, "linux.subsystem", subsystem); - - if (TQString::compare (subsystem, "pci") == 0) - return BUS_PCI; - else if (TQString::compare (subsystem, "usb") == 0) - return BUS_USB; - else if (TQString::compare (subsystem, "pcmcia") == 0) - return BUS_PCMCIA; - else - return BUS_UNKNOWN; -} - -TQString -HalDeviceProxy::getProduct () const -{ - return ""; -} - -TQString -HalDeviceProxy::getVendor () const -{ - return ""; -} - -void -HalDeviceProxyPrivate::getHalProperty (const TQCString& udi, const TQCString& property, TQCString& result) -{ -//FIXME: convert to qt3-dbus-api -/* - DBusConnection* con = _ctx->getDBus ()->getConnection (); - LibHalContext* hal_ctx = NULL; - char* prop_val = NULL; - - if (!con || !property) { - goto out; - } - - if (!dbus_bus_name_has_owner (con, "org.freedesktop.Hal", NULL)) { - kdDebug() << "Error: HAL seems not to be running." << endl; - goto out; - } - - hal_ctx = libhal_ctx_new (); - - if (!libhal_ctx_set_dbus_connection (hal_ctx, con)) { - goto out; - } - - if (!libhal_ctx_init (hal_ctx, NULL)) { - goto out; - } - - prop_val = libhal_device_get_property_string (hal_ctx, udi, property, NULL); - result = prop_val; - libhal_free_string (prop_val); -out: - if (hal_ctx) { - libhal_ctx_shutdown (hal_ctx, NULL); - libhal_ctx_free (hal_ctx); - } -*/ - return; -} - -#include "knetworkmanager-hal_device_proxy.moc" diff --git a/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 <[email protected]>, <[email protected]> - * Will Stephenson <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_HALDEVICEPROXY_H -#define KNETWORKMANAGER_HALDEVICEPROXY_H - -// KNM includes -#include "knetworkmanager.h" - -// HAL includes -#include <hal/libhal.h> - -// std includes -#include <stdint.h> - -class KNetworkManager; - -enum bustype { - BUS_PCI = 0, - BUS_USB = 1, - BUS_PCMCIA = 2, - BUS_UNKNOWN = 15 -}; - -class HalDeviceProxyPrivate; - -class HalDeviceProxy : public TQObject -{ - Q_OBJECT - - 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 <[email protected]>, <[email protected]> - * Will Stephenson <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -// KDE includes -#include <kdebug.h> - -// TQtDBus includes -#include <tqdbusconnection.h> -#include <tqdbusproxy.h> -#include <tqdbusdata.h> -#include <tqdbusdatalist.h> -#include <tqdbuserror.h> -#include <tqdbusobjectpath.h> - -// NM includes -#include <NetworkManager.h> - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-nm_proxy.h" -#include "knetworkmanager-device.h" -#include "knetworkmanager-devicestore.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_store.h" -#include "dbus/activeconnectionproxy.h" - -class NMProxyPrivate -{ - public: - NMProxyPrivate() - {} - - static NMProxy* nm; -}; - -NMProxy* NMProxyPrivate::nm = NULL; - -Device* NMProxy::getDefaultDevice() -{ - TQT_DBusObjectPath connpath = getDefaultActiveConnection(); - if (!connpath.isEmpty()) - { - TQT_DBusObjectPath devpath = getDeviceForActiveConnection(connpath); - if (!devpath.isEmpty()) - return DeviceStore::getInstance()->getDevice(devpath); - } - return NULL; -} - -TQT_DBusObjectPath NMProxy::getDeviceForActiveConnection(TQT_DBusObjectPath act_conn_path) -{ - TQT_DBusError err; - - // we need a proxy for every active connection - DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, act_conn_path); - act_conn->setConnection(TQT_DBusConnection::systemBus()); - - if (act_conn) - { - // get details about the active connection - TQValueList<TQT_DBusObjectPath> devs = act_conn->getDevices(err); - if (!devs.isEmpty()) - return devs.first(); - delete act_conn; - } - - return TQT_DBusObjectPath(); - -} - -TQT_DBusObjectPath NMProxy::getDefaultActiveConnection() -{ - TQT_DBusError err; - TQValueList<TQT_DBusObjectPath> connections; - - // get a list of all active connections from NM - connections = NetworkManagerProxy::getActiveConnections(err); - - for (TQValueList<TQT_DBusObjectPath>::Iterator it = connections.begin(); it != connections.end(); ++it) - { - // we need a proxy for every active connection - DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, (*it)); - act_conn->setConnection(TQT_DBusConnection::systemBus()); - - if (act_conn) - { - if (act_conn->getDefault(err)) - { - delete act_conn; - return *it; - } - delete act_conn; - } - - } - - return TQT_DBusObjectPath(); - -} - -ConnectionSettings::Connection* NMProxy::getActiveConnection(const Device* dev) -{ - TQT_DBusError err; - TQValueList<TQT_DBusObjectPath> connections; - - // get a list of all active connections from NM - connections = NetworkManagerProxy::getActiveConnections(err); - - for (TQValueList<TQT_DBusObjectPath>::Iterator it = connections.begin(); it != connections.end(); ++it) - { - // we need a proxy for every active connection - DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, (*it)); - act_conn->setConnection(TQT_DBusConnection::systemBus()); - - if (act_conn) - { - // get details about the active connection - TQString service = act_conn->getServiceName(err); - TQT_DBusObjectPath conn = act_conn->getConnection(err); - TQT_DBusObjectPath specific_obj = act_conn->getSpecificObject(err); - TQValueList<TQT_DBusObjectPath> devs = act_conn->getDevices(err); - for (TQValueList<TQT_DBusObjectPath>::Iterator it2 = devs.begin(); it2 != devs.end(); ++it2) - { - if (TQString(*it2) == dev->getObjectPath()) - { - // here is the connection we were looking for - ConnectionStore* cstore = ConnectionStore::getInstance(); - if (cstore) - return cstore->getConnection(TQString(conn)); - } - } - delete act_conn; - } - - } - - return NULL; -} - -TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > NMProxy::getActiveConnectionsMap() -{ - TQT_DBusError err; - TQValueList<TQT_DBusObjectPath> connections; - TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > map; - ConnectionStore* cstore = ConnectionStore::getInstance(); - DeviceStore* dstore = DeviceStore::getInstance(); - bool found = false; - - if (!dstore || !cstore) - return map; - - // get a list of all active connections from NM - connections = NetworkManagerProxy::getActiveConnections(err); - - for (TQValueList<TQT_DBusObjectPath>::Iterator it = connections.begin(); it != connections.end(); ++it) - { - // we need a proxy for every active connection - DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, (*it)); - act_conn->setConnection(TQT_DBusConnection::systemBus()); - - if (act_conn) - { - // get details about the active connection - TQString service = act_conn->getServiceName(err); - TQT_DBusObjectPath conn = act_conn->getConnection(err); - TQT_DBusObjectPath specific_obj = act_conn->getSpecificObject(err); - TQValueList<TQT_DBusObjectPath> devs = act_conn->getDevices(err); - found = false; - for (TQValueList<TQT_DBusObjectPath>::Iterator it2 = devs.begin(); it2 != devs.end(); ++it2) - { - Device* device = dstore->getDevice(*it2); - ConnectionSettings::Connection* connection = cstore->getConnection(TQString(conn)); - if (connection) - { - map.append(TQPair<ConnectionSettings::Connection*, Device*>(connection, device)); - found = true; - } - } - if (!found) - { - // no device found for this connection -> just add it without device - ConnectionSettings::Connection* connection = cstore->getConnection(TQString(conn)); - if (connection) - map.append(TQPair<ConnectionSettings::Connection*, Device*>(connection, NULL)); - } - delete act_conn; - } - - } - - return map; -} - -NMProxy::NMProxy() - : NetworkManagerProxy(NM_DBUS_SERVICE, NM_DBUS_PATH) -{ - d = new NMProxyPrivate(); - NetworkManagerProxy::setConnection(TQT_DBusConnection::systemBus()); -} - -void NMProxy::deactivateConnection(const ConnectionSettings::Connection* conn, const Device* dev) -{ - TQT_DBusError err; - TQValueList<TQT_DBusObjectPath> connections; - - // get a list of all active connections from NM - connections = NetworkManagerProxy::getActiveConnections(err); - - for (TQValueList<TQT_DBusObjectPath>::Iterator it = connections.begin(); it != connections.end(); ++it) - { - // we need a proxy for every active connection - DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, (*it)); - act_conn->setConnection(TQT_DBusConnection::systemBus()); - - if (act_conn) - { - if (act_conn->getConnection(err) == conn->getObjectPath()) - { - if (dev) - { - // get details about the active connection - TQValueList<TQT_DBusObjectPath> devs = act_conn->getDevices(err); - for (TQValueList<TQT_DBusObjectPath>::Iterator it2 = devs.begin(); it2 != devs.end(); ++it2) - { - if (TQString(*it2) == dev->getObjectPath()) - { - // this is the right one - DeactivateConnection(*it, err); - return; - } - } - } - else - { - DeactivateConnection(*it, err); - } - } - delete act_conn; - } - } - -} - -void NMProxy::deactivateConnectionPath(TQT_DBusObjectPath obj_path) -{ - TQT_DBusError err; - DeactivateConnection(obj_path, err); -} - -void NMProxy::deactivateDevice(const Device* dev) -{ - TQT_DBusError err; - TQValueList<TQT_DBusObjectPath> connections; - - // get a list of all active connections from NM - connections = NetworkManagerProxy::getActiveConnections(err); - - for (TQValueList<TQT_DBusObjectPath>::Iterator it = connections.begin(); it != connections.end(); ++it) - { - // we need a proxy for every active connection - DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, (*it)); - act_conn->setConnection(TQT_DBusConnection::systemBus()); - - if (act_conn) - { - // get details about the active connection - TQValueList<TQT_DBusObjectPath> devs = act_conn->getDevices(err); - for (TQValueList<TQT_DBusObjectPath>::Iterator it2 = devs.begin(); it2 != devs.end(); ++it2) - { - if (TQString(*it2) == dev->getObjectPath()) - { - // this is the right one - DeactivateConnection(*it, err); - return; - } - } - delete act_conn; - } - } -} - -bool NMProxy::isNMRunning() -{ - // Ask DBus if the NetworkManager service is available - TQT_DBusProxy* proxy = new TQT_DBusProxy("org.freedesktop.DBus", "/", "org.freedesktop.DBus", TQT_DBusConnection::systemBus()); - TQValueList<TQT_DBusData> params; - params.append(TQT_DBusData::fromString(NM_DBUS_SERVICE)); - TQT_DBusMessage reply = proxy->sendWithReply("NameHasOwner", params); - bool ret = reply.first().toBool(); - delete proxy; - return ret; -} - -NMProxy::~NMProxy() -{ - delete d; -} - -NMProxy* NMProxy::getInstance() -{ - if (NMProxyPrivate::nm) - return NMProxyPrivate::nm; - return (NMProxyPrivate::nm = new NMProxy()); -} - - -#include "knetworkmanager-nm_proxy.moc" diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_NMPROXY_H -#define KNETWORKMANAGER_NMPROXY_H - -#include "dbus/networkmanagerproxy.h" - -namespace ConnectionSettings -{ - class Connection; -} -class Device; -class NMProxyPrivate; - -class NMProxy : public DBus::NetworkManagerProxy -{ - Q_OBJECT - - public: - static NMProxy* getInstance(); - - Device* getDefaultDevice(); - TQT_DBusObjectPath getDeviceForActiveConnection(TQT_DBusObjectPath act_conn); - TQT_DBusObjectPath getDefaultActiveConnection(); - ConnectionSettings::Connection* getActiveConnection(const Device* dev); - void deactivateDevice(const Device* dev); - void deactivateConnection(const ConnectionSettings::Connection* conn, const Device* dev); - void deactivateConnectionPath(TQT_DBusObjectPath obj_path); - TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > getActiveConnectionsMap(); - bool isNMRunning(); - - protected: - NMProxy (); - ~NMProxy (); - - private: - NMProxyPrivate * d; -}; - -#endif /* KNETWORKMANAGER_NMPROXY_H */ diff --git a/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 <[email protected]>, <[email protected]> - * Valentine Sinitsyn <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#include <stdlib.h> -#include <kdebug.h> - -#include <NetworkManager.h> - -#include <tqdbusobjectpath.h> -#include <tqdbusconnection.h> - -#include "knetworkmanager.h" -#include "knetworkmanager-nmsettings.h" -#include "knetworkmanager-connection_setting.h" -#include "knetworkmanager-connection_store.h" -#include "knetworkmanager-connection.h" - -#if !defined(NM_CHECK_VERSION) -#define NM_CHECK_VERSION(x,y,z) 0 -#endif - -class NMSettingsPrivate -{ - public: - NMSettingsPrivate() - : obj_path_index(0) - { - - } - - ~NMSettingsPrivate() - { - - } - - int obj_path_index; -}; - - -NMSettings* NMSettings::_instance = NULL; - -NMSettings* NMSettings::getInstance() -{ - // return singleton instance - if (_instance) - return _instance; - return (_instance = new NMSettings()); -} - -NMSettings::NMSettings() -{ - d = new NMSettingsPrivate(); - TQT_DBusConnection conn = TQT_DBusConnection::systemBus(); - - kdDebug() << "NMSettings::NMSettings" << endl; - -#if NM_CHECK_VERSION(0,8,992) - if (!conn.requestName("org.freedesktop.NetworkManagerUserSettings")) - kdError() << "req name failed for " << "org.freedesktop.NetworkManagerUserSettings" << endl; -#else - // request the name for the settings interface - if (!conn.requestName(NM_DBUS_SERVICE_USER_SETTINGS)) - kdError() << "req name failed for " << NM_DBUS_SERVICE_USER_SETTINGS << endl; -#endif - - // request the name for the connections here too - if (!conn.requestName(NM_DBUS_IFACE_SETTINGS_CONNECTION)) - kdError() << "req name failed for " << NM_DBUS_IFACE_SETTINGS_CONNECTION << endl; - - // request the name for the connections here too - if (!conn.requestName(NM_DBUS_IFACE_SETTINGS_CONNECTION_SECRETS)) - kdError() << "req name failed for " << NM_DBUS_IFACE_SETTINGS_CONNECTION_SECRETS << endl; - - // register on the DBus - if (!conn.registerObject(objectPath(), this)) - kdError() << "registerobjectpath failed" << endl; - - - ConnectionStore* cstore = ConnectionStore::getInstance(); - - // we need to get informed about new connections... - connect(cstore, TQT_SIGNAL(signalConnectionAdded(ConnectionSettings::Connection*)), this, TQT_SLOT(slotNewConnection(ConnectionSettings::Connection*))); -} - -NMSettings::~NMSettings() -{ - delete d; - TQT_DBusConnection conn = TQT_DBusConnection::systemBus(); - conn.unregisterObject(NM_DBUS_PATH_SETTINGS); -} - - -bool NMSettings::handleSignalSend(const TQT_DBusMessage& reply) -{ - TQT_DBusConnection::systemBus().send(reply); - return true; -} - -TQString NMSettings::objectPath() const -{ - return TQString(NM_DBUS_PATH_SETTINGS); -} - -bool NMSettings::ListConnections(TQValueList<TQT_DBusObjectPath>& connections, TQT_DBusError& /*error*/) -{ - // return connections - ConnectionStore* cstore = ConnectionStore::getInstance(); - TQValueList<ConnectionSettings::Connection*> conns = cstore->getConnections(); - - for (TQValueList<ConnectionSettings::Connection*>::Iterator it = conns.begin(); it != conns.end(); ++it) - { - ConnectionSettings::Connection* conn = (*it); - connections.append(conn->getObjectPath()); - } - - return true; -} - -void NMSettings::handleMethodReply(const TQT_DBusMessage& reply) -{ - TQT_DBusConnection::systemBus().send(reply); -} - -TQT_DBusObjectPath -NMSettings::getObjPathForConnection() -{ - // just increase the number for this connection - TQT_DBusObjectPath obj_path(NM_DBUS_PATH_SETTINGS_CONNECTION"/"); - obj_path += TQString::number(d->obj_path_index++); - return obj_path; -} - -void -NMSettings::slotNewConnection(ConnectionSettings::Connection* conn) -{ - emitNewConnection(conn->getObjectPath()); -} - - -#include "knetworkmanager-nmsettings.moc" diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_NMSETTINGS_H -#define KNETWORKMANAGER_NMSETTINGS_H - -#include <tqobject.h> - -#include "knetworkmanager-connection_setting.h" -#include "dbus/networkmanagersettings.h" - -class Network; -class TQT_DBusObjectPath; -class NMSettingsPrivate; - -class NMSettings : public TQObject, DBus::SettingsInterface -{ - Q_OBJECT - - public: - /* get singleton */ - static NMSettings* getInstance(); - - ~NMSettings(); - /* request the required interface from the DBus */ -// void requestName (DBusMessage*); - - /* functions for handling method calls sended _by_ NetworkManager */ -// void getConnections (DBusMessage*); - bool handleSignalSend(const TQT_DBusMessage& reply); - TQString objectPath() const; - bool ListConnections(TQValueList<TQT_DBusObjectPath>& connections, TQT_DBusError& error); - void handleMethodReply(const TQT_DBusMessage& reply); - - /* get Connection from obj_path */ - TQT_DBusObjectPath getObjPathForConnection(); - - public slots: - /* notification about new connections */ - void slotNewConnection (ConnectionSettings::Connection*); - - private: - NMSettingsPrivate* d; - - /* private constructor -> singleton */ - NMSettings(); - - /* functions for sending signals/methodcalls _to_ NetworkManager */ - void signalNewConnection (const char*); - - /* pointer to the singleton class */ - static NMSettings* _instance; - -}; - -#endif /* KNETWORKMANAGER_NMSETTINGS_H */ diff --git a/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 <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#include "knetworkmanager-ppp_connection.h" - -#include <nm-setting-ppp.h> -#include <nm-setting-ip4-config.h> - -ConnectionSettings::PPPConnection::PPPConnection(const TQString & infoName) - : GenericConnection(infoName) -{ - appendSetting(new IPv4(this)); - appendSetting(new PPP(this)); -} - -ConnectionSettings::PPPConnection::~PPPConnection() -{ - -} - -ConnectionSettings::IPv4* ConnectionSettings::PPPConnection::getIPv4Setting() const -{ - return dynamic_cast<ConnectionSettings::IPv4*>(getSetting(NM_SETTING_IP4_CONFIG_SETTING_NAME)); -} - -ConnectionSettings::PPP* ConnectionSettings::PPPConnection::getPPPSetting() const -{ - return dynamic_cast<PPP*>(getSetting(NM_SETTING_PPP_SETTING_NAME)); -} - -#include "knetworkmanager-ppp_connection.moc" - -// vim: sw=4 sts=4 noet tw=100 diff --git a/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 <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_PPP_CONNECTION_H -#define KNETWORKMANAGER_PPP_CONNECTION_H - -#include "knetworkmanager-generic_connection.h" -#include "knetworkmanager-connection_setting_ipv4.h" -#include "knetworkmanager-connection_setting_ppp.h" - -namespace ConnectionSettings -{ - class Info; - class IPv4; - class PPP; - - class PPPConnection : public GenericConnection - { - Q_OBJECT - - public: - PPPConnection(const TQString& infoName); - ~PPPConnection(); - PPP* getPPPSetting() const; - IPv4* getIPv4Setting() const; - }; -} // namespace ConnectionSettings - -#endif - 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 <[email protected]>, <[email protected]> - * Author: Timothy Pearson <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#include <tqtimer.h> - -#include <kglobal.h> -#include <kconfig.h> -#include <kstaticdeleter.h> -#include <kdebug.h> - -#include "knetworkmanager-storage.h" -#include "knetworkmanager-connection_store.h" -#include "knetworkmanager-wireless_connection.h" -#include "knetworkmanager-wired_connection.h" -#include "knetworkmanager-cdma_connection.h" -#include "knetworkmanager-gsm_connection.h" -#include "knetworkmanager-vpn_connection.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting.h" -#include "xmlmarshaller.h" -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-connection_setting_wired.h" -#include "knetworkmanager-connection_setting_wireless.h" -#include "knetworkmanager-connection_setting_wireless_security.h" -#include "knetworkmanager-connection_setting_ipv4.h" - -using namespace ConnectionSettings; - -static KStaticDeleter<Storage> sd2; - -// private stuff -class StoragePrivate -{ - public: - StoragePrivate() {}; - ~StoragePrivate() {}; - - static Storage* _instance; -}; - -Storage* StoragePrivate::_instance = NULL; - -Storage* -Storage::getInstance() -{ - if (StoragePrivate::_instance) - return StoragePrivate::_instance; - return sd2.setObject(StoragePrivate::_instance, new Storage()); -} - -Storage::Storage() -{ - d = new StoragePrivate(); - - // defer the connection init a bit - TQTimer::singleShot(0, this, TQT_SLOT(slotInit())); -} - -Storage::~Storage() -{ - delete d; -} - -void -Storage::slotInit() -{ - ConnectionStore* cstore = ConnectionStore::getInstance(); - - // we want to get notified whenever a new connection is created, edited or deleted - connect(cstore, TQT_SIGNAL(signalConnectionAdded(ConnectionSettings::Connection*)), this, TQT_SLOT(slotConnectionAdded(ConnectionSettings::Connection*))); - connect(cstore, TQT_SIGNAL(signalConnectionRemoved(ConnectionSettings::Connection*)), this, TQT_SLOT(slotConnectionRemoved(ConnectionSettings::Connection*))); -} - -void -Storage::slotConnectionAdded(Connection* con) -{ - // connection added, save it - saveConnection(con); - KGlobal::config()->sync(); -} - -void -Storage::slotConnectionRemoved(Connection* con) -{ - // find the appropriate connection and delete it from the storage - deleteConnection(con); - KGlobal::config()->sync(); -} - -Connection* -Storage::createConnectionByType(const TQString& cType) -{ - // TODO: use a factory class here - if (cType == NM_SETTING_WIRELESS_SETTING_NAME) - return new WirelessConnection(); - else if (cType == NM_SETTING_WIRED_SETTING_NAME) - return new WiredConnection(); - else if(cType == NM_SETTING_CDMA_SETTING_NAME) - return new CDMAConnection(); - else if(cType == NM_SETTING_GSM_SETTING_NAME) - return new GSMConnection(); - else if (cType == NM_SETTING_VPN_SETTING_NAME) - return new VPNConnection(); - else - return NULL; -} - -void -Storage::restoreConnections() -{ - kdDebug() << k_funcinfo << endl; - // let's read all connections from the config-file and add them to the connection-store - ConnectionStore* store = ConnectionStore::getInstance(); - TQStringList groups = KGlobal::config()->groupList(); - const TQStringList::Iterator end = groups.end(); - for ( TQStringList::Iterator it = groups.begin(); it != end; ++it ) - { - if ( !(*it).startsWith( "Connection_" ) ) - continue; - - // restore that connection - Connection* conn = NULL; - if ( (conn = restoreConnection(*it)) != NULL) - { - // add the connection to the store - store->addConnection(conn); - } - } - -} - -Connection* -Storage::restoreConnection(const TQString& grpname) -{ - Connection* conn = NULL; - kdDebug() << k_funcinfo << " " << grpname << endl; - - // we have a connection to restore - KConfigGroup grp( KGlobal::config(), grpname); - TQString id = grp.readEntry("Id"); - TQString cType = grp.readEntry("Type"); - - // ID is needed! - if (id.isEmpty() || cType.isEmpty()) - return NULL; - - // create a new connection object by its type - conn = createConnectionByType(cType); - - // check if the connection was successfully created - if (!conn) - return NULL; - - // set the connection ID - conn->setID(id); - - // restore all appropriate settings - TQStringList settings = grp.readListEntry("Settings"); - - for (TQStringList::ConstIterator it = settings.begin(); it != settings.end(); ++it) - { - if ( !restoreSetting(conn, *it) ) - { - // setting could not be restored -> Error - kdDebug() << " Connection " << id.ascii() << " could not be restored." << endl; - kdError() << k_funcinfo << " Connection " << id << " could not be restored." << endl; - delete conn; - conn = NULL; - return NULL; - } - } - - // restore all appropriate secrets - TQStringList secrets = grp.readListEntry("Secrets"); - - for (TQStringList::ConstIterator it = secrets.begin(); it != secrets.end(); ++it) - { - if ( !restoreSecrets(conn, *it) ) - { - // setting could not be restored -> Error - kdDebug() << " Connection " << id.ascii() << " could not be restored." << endl; - kdError() << k_funcinfo << " Connection " << id << " could not be restored." << endl; - delete conn; - conn = NULL; - return NULL; - } - } - - return conn; -} - -bool -Storage::restoreSetting(Connection* conn, const TQString& setting_grp_name) -{ - kdDebug() << k_funcinfo << " " << setting_grp_name << endl; - kdDebug() << "restore setting: " << setting_grp_name.ascii() << endl; - - KConfigGroup setting_grp(KGlobal::config(), setting_grp_name); - TQMap<TQString, TQString> config_map = KGlobal::config()->entryMap(setting_grp_name); - TQString type = setting_grp.readEntry("Type"); - - // get the appropriate setting from the connection - ConnectionSetting* setting = conn->getSetting(type); - if (!setting) - { - kdWarning() << k_funcinfo << "Connection " << conn->getID() << ": Setting " << type << " could not be restored" << endl; - return false; - } - - // read the SettingsMap from kconfig - SettingsMap map; - for(TQMap<TQString, TQString>::ConstIterator it = config_map.begin(); it != config_map.end(); ++it) - { - if (!it.key().startsWith("Value_")) - continue; - - TQString key = it.key(); - // get the original name - key.replace("Value_", ""); - - TQString xmldata = it.data(); - TQT_DBusData dbusdata = XMLMarshaller::toTQT_DBusData(xmldata); - - map.insert(key, dbusdata); - } - - // restore the setting from the generated map - setting->fromMap(map); - return true; -} - -bool -Storage::restoreSecrets(Connection* conn, const TQString& secrets_grp_name) -{ - kdDebug() << k_funcinfo << " " << secrets_grp_name << endl; - kdDebug() << "restore secret: " << secrets_grp_name.ascii() << endl; - - KConfigGroup secrets_grp(KGlobal::config(), secrets_grp_name); - TQMap<TQString, TQString> config_map = KGlobal::config()->entryMap(secrets_grp_name); - TQString type = secrets_grp.readEntry("Type"); - - // get the appropriate setting from the connection - ConnectionSetting* setting = conn->getSetting(type); - if (!setting) - { - kdWarning() << k_funcinfo << "Connection " << conn->getID() << ": Secrets for setting " << type << " could not be restored" << endl; - return false; - } - - // read the SettingsMap from kconfig - SettingsMap map; - for(TQMap<TQString, TQString>::ConstIterator it = config_map.begin(); it != config_map.end(); ++it) - { - if (!it.key().startsWith("Value_")) - continue; - - TQString key = it.key(); - // get the original name - key.replace("Value_", ""); - - TQString xmldata = it.data(); - TQT_DBusData dbusdata = XMLMarshaller::toTQT_DBusData(xmldata); - - map.insert(key, dbusdata); - } - - // restore the setting from the generated map - setting->fromSecretsMap(map); - return true; -} - -bool -Storage::restoreVPNSecrets(Connection* conn, const TQString& secrets_grp_name) -{ - kdDebug() << k_funcinfo << " " << secrets_grp_name << endl; - kdDebug() << "restore secret: " << secrets_grp_name.ascii() << endl; - - KConfigGroup secrets_grp(KGlobal::config(), secrets_grp_name); - TQMap<TQString, TQString> config_map = KGlobal::config()->entryMap(secrets_grp_name); - TQString type = secrets_grp.readEntry("Type"); - - // get the appropriate setting from the connection - ConnectionSetting* setting = conn->getSetting(type); - if (!setting) - { - kdWarning() << k_funcinfo << "Connection " << conn->getID() << ": Secrets for setting " << type << " could not be restored" << endl; - return false; - } - - // read the SettingsMap from kconfig - SettingsMap map; - for(TQMap<TQString, TQString>::ConstIterator it = config_map.begin(); it != config_map.end(); ++it) - { - if (!it.key().startsWith("Value_")) - continue; - - TQString key = it.key(); - // get the original name - key.replace("Value_", ""); - - TQString xmldata = it.data(); - TQT_DBusData dbusdata = XMLMarshaller::toTQT_DBusData(xmldata); - - map.insert(key, dbusdata); - } - - // restore the setting from the generated map - setting->fromSecretsMap(map); - return true; -} - -void -Storage::saveConnections() -{ - kdDebug() << k_funcinfo << endl; - kdDebug() << "Storage::saveConnections" << endl; - printf("Storage::saveConnections\n\r"); - // write all connections we get from the connection-store to disk - ConnectionStore* store = ConnectionStore::getInstance(); - TQValueList<ConnectionSettings::Connection*> connections = store->getConnections(); - - for (TQValueList<ConnectionSettings::Connection*>::ConstIterator it = connections.begin(); it != connections.end(); ++it) - { - // save this connection - saveConnection(*it); - } - KGlobal::config()->sync(); -} - -bool -Storage::saveConnection(Connection* conn) -{ - KConfig* config = KGlobal::config(); - TQString id = conn->getID(); - TQString cType = conn->getType(); - - kdDebug() << k_funcinfo << " <" << id << ">" << endl; - kdDebug() << "Storage::saveConnection " << id.ascii() << endl; - - // connections without id are evil - if (id.isEmpty() || cType.isEmpty()) - return false; - - // let's get the config group for this connection - KConfigGroup grp(config, TQString("Connection_%1").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<ConnectionSetting*> settings = conn->getSettings(); - TQString setting_grp; - TQString secrets_grp; - - // save all settings - for (TQValueList<ConnectionSetting*>::ConstIterator it = settings.begin(); it != settings.end(); ++it) - { - if (!saveConnectionSetting(conn, *it, setting_grp)) - return false; - - if ((*it)->hasSecrets()) - { - if (!saveConnectionSecrets(conn, *it, secrets_grp)) - return false; - secrets_grps.append(secrets_grp); - } - - settings_grps.append(setting_grp); - } - - return true; -} - -bool -Storage::saveConnectionSetting(Connection* conn, ConnectionSetting* setting, TQString& setting_grp) -{ - KConfig* config = KGlobal::config(); - TQString id = conn->getID(); - TQString type = setting->getType(); - - kdDebug() << k_funcinfo << " <" << id << "> <" << type << ">" << endl; - - // ID is necessary - if (id.isEmpty()) - return false; - - // get a group for this setting - setting_grp = TQString("ConnectionSetting_%1_%2").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<ConnectionSetting*> settings = connection->getSettings(); - for (TQValueList<ConnectionSetting*>::Iterator it = settings.begin(); it != settings.end(); ++it) - { - if (hasSecretsStored(connection, *it)) - return true; - } - return false; -} - - -bool -Storage::hasSecretsStored(Connection* connection, ConnectionSetting* setting) -{ - TQString id = connection->getID(); - TQString type = setting->getType(); - - kdDebug() << "Storage::hasSecretsStored" << endl; - - // ID is necessary - if (id.isEmpty()) - return false; - - // get a group for this setting - TQString setting_grp_name = TQString("ConnectionSecrets_%1_%2").arg(id).arg(type); - - TQMap<TQString, TQString> config_map = KGlobal::config()->entryMap(setting_grp_name); - - return !(config_map.isEmpty()); -} - -bool -Storage::restoreAllSecrets(Connection* connection) -{ - TQString id = connection->getID(); - bool retval = true; - - if (id.isEmpty()) - return false; - - TQValueList<ConnectionSetting*> settings = connection->getSettings(); - for (TQValueList<ConnectionSetting*>::Iterator it = settings.begin(); it != settings.end(); ++it) - { - if (hasSecretsStored(connection, *it)) - if (!restoreSecrets(connection, *it)) - retval = false; - } - return retval; -} - -bool -Storage::restoreSecrets(Connection* connection, ConnectionSetting* setting) -{ - TQString id = connection->getID(); - TQString type = setting->getType(); - - kdDebug() << "Storage::restoreSecrets" << endl; - // ID is necessary - if (id.isEmpty()) - return false; - - // get a group for this setting - TQString setting_grp = TQString("ConnectionSecrets_%1_%2").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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_STORAGE_H -#define KNETWORKMANAGER_STORAGE_H - -#include <tqvaluelist.h> -#include <tqobject.h> - -namespace ConnectionSettings -{ - class Connection; - class ConnectionSetting; -} - -using namespace ConnectionSettings; - -class StoragePrivate; - -// This class abstracts the storage of settings and connections to the disk -class Storage : public TQObject -{ - Q_OBJECT - - - 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 deleted file mode 100644 index 62851ff..0000000 --- a/tdenetworkmanager/src/knetworkmanager-tray.cpp +++ /dev/null @@ -1,1127 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-tray.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Timo Hoenig <[email protected]>, <[email protected]> - * Will Stephenson <[email protected]>, <[email protected]> - * Valentine Sinitsyn <[email protected]> - * Helmut Schaa <[email protected]>, <[email protected]> - * Alexander Naumov <[email protected]>, <[email protected]> - * Author: Timothy Pearson <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -class WirelessDialog; - -#include <tqsignalmapper.h> -#include <tqevent.h> -#include <tqvbox.h> -#include <tqlayout.h> -#include <tqpushbutton.h> -#include <tqpixmap.h> -#include <tqpixmapcache.h> -#include <tqpainter.h> -#include <tqstyle.h> -#include <tqvaluelist.h> -#include <dcopclient.h> -#include <tqdbusobjectpath.h> -#include <kdebug.h> -#include <kdialogbase.h> -#include <knotifyclient.h> -#include <knotifydialog.h> -#include <klocale.h> -#include <kstdguiitem.h> -#include <khelpmenu.h> -#include <kprocess.h> -#include <kiconloader.h> -#include <kconfig.h> -#include <kmessagebox.h> - -#include <tqpushbutton.h> -#include <tqlayout.h> -#include <tqlabel.h> -#include <tqapplication.h> -#include <tqdialog.h> - -#include <NetworkManager.h> -#include <NetworkManagerVPN.h> - -#include <tqdbuserror.h> - -#include "xmlmarshaller.h" -#include "vpn_tray_component.h" -#include "devicetraycomponent.h" -#include "knetworkmanager-cellular_device_tray.h" -#include "knetworkmanager-cellular_device.h" -#include "knetworkmanager-device.h" -#include "knetworkmanager-devicestore.h" -#include "knetworkmanager-tray.h" -#include "knetworkmanager-menu_subhead.h" -#include "knetworkmanager-nm_proxy.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-connection_settings_dialog.h" -#include "knetworkmanager-connection_store.h" -#include "knetworkmanager-vpn_connection.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-storage.h" -#include "knetworkmanager-connection_editor.h" -#include "knetworkmanager-vpnauthenticationdialog.h" -#include "knetworkmanager-wired_device.h" -#include "knetworkmanager-wired_device_tray.h" -#include "knetworkmanager-wireless_device_tray.h" -#include "knetworkmanager-wireless_device.h" - -#include <stdio.h> - -#define KDED_NETWORK_NAME "NMNetwork" - -#if !defined(NM_CHECK_VERSION) -#define NM_CHECK_VERSION(x,y,z) 0 -#endif - -extern unsigned int current_vpn_state; -NMDeviceState nm_device_state_global; -extern unsigned char vpn_new_credentials_needed; - -NewSecretsDialog::NewSecretsDialog(ConnectionSettings::Connection *connection, TQWidget * parent, const char * name, bool modal, TQt::WFlags f) - : TQDialog(parent, name, modal, f) -{ - _connection = connection; - init(); -} - -NewSecretsDialog::~NewSecretsDialog () -{ - -} - -void NewSecretsDialog::slotDialogEdit() -{ - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(_connection, false, NULL, Tray::getInstance(), "Edit connection"); - dlg->show(); - close(); -} - -void NewSecretsDialog::reject() -{ - _connection->slotSecretsError(); - TQDialog::reject(); -} - -void NewSecretsDialog::init() -{ - ConnectionSettings::GenericConnection* conn = dynamic_cast<ConnectionSettings::GenericConnection*>(_connection); - - // if we do not have a connection bail out - if (!conn) - { - reject(); - return; - } - - // show a message to the user that the connection failed - // and allow edit or cancel - - TQLabel* label = new TQLabel(tqtr(" The connection %1 could not be established ").arg(conn->getInfoSetting()->getName()), this); - TQPushButton* buttonEdit = new TQPushButton(tr("&Edit"), this); - TQPushButton* buttonCancel = new TQPushButton(tr("&Cancel"), this); - - TQHBoxLayout *topLeftLayout = new TQHBoxLayout(); - topLeftLayout->addWidget(buttonEdit); - topLeftLayout->addWidget(buttonCancel); - - TQVBoxLayout *mainLayout = new TQVBoxLayout(this); - mainLayout->setMargin(15); - mainLayout->setSpacing(10); - mainLayout->addWidget(label); - mainLayout->addLayout(topLeftLayout); - - connect(buttonEdit, TQT_SIGNAL(clicked()), TQT_SLOT(slotDialogEdit())); - connect(buttonCancel, TQT_SIGNAL(clicked()), this, TQT_SLOT(close())); -} - -class TrayPrivate -{ - public: - TrayPrivate(TQObject* parent) - : foregroundTrayComponent(0) - , signalMapper(parent, "signal_mapper") - , current_idx(0) - {} - ~TrayPrivate() {} - - static Tray* tray; - TQValueList<TrayComponent*> trayComponents; - DeviceTrayComponent * foregroundTrayComponent; - TQSignalMapper signalMapper; - TQMap<int, TQPair<ConnectionSettings::Connection*, Device*> > act_conn_map; - int current_idx; -}; - -Tray* TrayPrivate::tray = NULL; - -Tray* Tray::getInstance() -{ - if (TrayPrivate::tray) - return TrayPrivate::tray; - else return (TrayPrivate::tray = new Tray()); -} - -void Tray::slotEditConnections() -{ - ConnectionEditorImpl* dlg = new ConnectionEditorImpl(this); - dlg->show(); -} - - -void Tray::slotEnableWireless() -{ - NMProxy* nm = NMProxy::getInstance(); - TQT_DBusError err; - if (!nm) return; - - nm->setWirelessEnabled(true, err); -} - -void Tray::slotDisableWireless() -{ - NMProxy* nm = NMProxy::getInstance(); - TQT_DBusError err; - if (!nm) return; - - nm->setWirelessEnabled(false, err); -} - -void Tray::slotOfflineMode() -{ - NMProxy* nm = NMProxy::getInstance(); - TQT_DBusError err; - if (!nm) return; - - nm->Sleep(true, err); -} - -void Tray::slotOnlineMode() -{ - NMProxy* nm = NMProxy::getInstance(); - TQT_DBusError err; - if (!nm) return; - - nm->Sleep(false, err); -} - -void Tray::slotNewVPNConnection() -{ - printf("Creating new VPN connection\n\r"); - // create a new VPN connection - Connection* conn = new VPNConnection(); - - // edit the new connection - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, this, "connect_something", false, TQt::WDestructiveClose); - dlg->show(); -} - -void Tray::contextMenuAboutToShow (KPopupMenu* menu) -{ - TQT_DBusError err; - NMProxy* nm = NMProxy::getInstance(); - - // clear menu - menu->clear(); - - if (nm->isNMRunning()) - { - - // actions for each Device - for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); - it != d->trayComponents.end(); - ++it) - { - (*it)->addMenuItems(menu); - } - - // Submenu title - Subhead* subhead = new Subhead (menu, "subhead", TQString("Connection Management"), SmallIcon("knetworkmanager_disabled", TQIconSet::Automatic)); - menu->insertItem (subhead, -1, -1); - - // New connection - KAction * newConnAction = 0; - int devices = d->trayComponents.count(); - if ( devices > 1 ) { - newConnAction = actionCollection ()->action ("new_connection_menu"); - KActionMenu* newConnActionMenu = static_cast<KActionMenu*>(newConnAction); - newConnActionMenu->popupMenu()->clear(); - TQValueList<TrayComponent*>::Iterator it; - for (it = d->trayComponents.begin(); - it != d->trayComponents.end(); - ++it) - { - DeviceTrayComponent* dev_comp = dynamic_cast<DeviceTrayComponent*> (*it); - KAction * deviceNewConnAction = 0; - if (dev_comp) - { - TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->getInterface()); - TQString menuCaption = TQString("%1").arg(dev_comp->device()->getInterface()); - if (menuCaption.contains("eth", FALSE) > 0) { - menuCaption = menuCaption.insert(0, "Wired Connection ("); - } - else if (menuCaption.contains("wlan", FALSE) > 0) { - menuCaption = menuCaption.insert(0, "Wireless Connection ("); - } - else if (menuCaption.contains("pan", FALSE) > 0) { - menuCaption = menuCaption.insert(0, "Private Area Connection ("); - } - else { - menuCaption = menuCaption.insert(0, "Unknown Connection ("); - } - menuCaption = menuCaption.append(")"); - deviceNewConnAction = actionCollection ()->action (actionName); - if (!deviceNewConnAction) { - deviceNewConnAction = new KAction (menuCaption, 0, (*it), TQT_SLOT(newConnection()), actionCollection(), actionName); - } - newConnActionMenu->insert(deviceNewConnAction); - } - } - // New VPN connection option - ++it; - KAction * deviceNewConnAction = 0; - TQString menuCaption = "VPN Connection"; - TQString actionName = TQString("new_connection_%1").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"); - TQT_BASE_OBJECT_NAME::disconnect( newConnAction, TQT_SIGNAL(activated()) ); - TQT_BASE_OBJECT_NAME::connect( newConnAction, TQT_SIGNAL(activated()), d->trayComponents[0], TQT_SLOT(newConnection())); - } - if (newConnAction) { - newConnAction->plug(menu); - } - - // turn things off - if (nm) - { - KActionMenu* disableStuffActionMenu = static_cast<KActionMenu*>(actionCollection ()->action ("deactivate_menu") ); - disableStuffActionMenu->popupMenu()->clear(); - TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > map = nm->getActiveConnectionsMap(); - d->act_conn_map.clear(); - - for (TQValueList<TQPair<ConnectionSettings::Connection*, Device*> >::Iterator it = map.begin(); it != map.end(); ++it) - { - ConnectionSettings::GenericConnection* conn = dynamic_cast<ConnectionSettings::GenericConnection*>((*it).first); - Device* dev = (*it).second; - - if (!conn) - continue; - - TQString actionName = TQString("disable_connection_%1_%2").arg(conn->getID()).arg(dev ? dev->getInterface() : ""); - KAction * deviceNewConnAction = actionCollection ()->action (actionName); - TQString actionText = conn->getInfoSetting()->getName(); - if (dev) - actionText += TQString(" (%1)").arg(dev->getInterface()); - - if (!deviceNewConnAction) { - deviceNewConnAction = new KAction (actionText, 0, &d->signalMapper, TQT_SLOT(map()), actionCollection(), actionName); - } - d->signalMapper.setMapping(deviceNewConnAction, d->current_idx); - d->act_conn_map.insert(d->current_idx, TQPair<ConnectionSettings::Connection*, Device*> (conn, dev)); - d->current_idx++; - disableStuffActionMenu->insert(deviceNewConnAction); - } - - // disable wireless - if (nm->getWirelessHardwareEnabled(err)) - { - KAction* wireless = NULL; - if (nm->getWirelessEnabled(err)) { - wireless = actionCollection ()->action ("disable_wireless"); - } else { - wireless = actionCollection ()->action ("enable_wireless"); - } - disableStuffActionMenu->insert(wireless); - } - - // offline vs. online mode - KAction* switch_mode = NULL; - if (nm->getState(err) != NM_STATE_ASLEEP) { - switch_mode = actionCollection ()->action ("offline_mode"); - } - else { - switch_mode = actionCollection ()->action ("online_mode"); - } - disableStuffActionMenu->insert(switch_mode); - - disableStuffActionMenu->plug(menu); - } - } - else - { - Subhead* subhead = new Subhead (menu, "subhead", i18n("NetworkManager is not running"), SmallIcon("stop", TQIconSet::Automatic)); - menu->insertItem (subhead, -1, -1); - } - - // Notifications - KAction* notif = actionCollection()->action("configure_notifications"); - notif->plug(menu); - - // Connection Editor - KAction* edit = actionCollection ()->action ("edit_connections"); - edit->plug(menu); - - // quit - menu->insertSeparator (); - KAction* quitAction = actionCollection ()->action (KStdAction::name (KStdAction::Quit)); - if (quitAction) - quitAction->plug (menu); -} - - -void -Tray::slotStateChanged(TQ_UINT32 state) -{ - NMState nm_state = (NMState) state; - // change tray icon according to NM's state - switch(nm_state) - { - case NM_STATE_UNKNOWN: - case NM_STATE_ASLEEP: - case NM_STATE_CONNECTING: - case NM_STATE_DISCONNECTED: - setPixmap (loadIcon ("knetworkmanager_disabled")); - break; - case NM_STATE_CONNECTED: - setPixmap (loadIcon ("knetworkmanager")); - break; - } - printf("NM state: %d\n\r", nm_state); -} - -void -Tray::enterEvent (TQEvent* /*e*/) -{ - // show tooltip - TQToolTip::remove (this); - TQString tooltip = ""; - - // build up the tooltip from all tray components - for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) - { - TrayComponent* comp = *it; - if (comp->getToolTipText().isEmpty()) - continue; - if (!tooltip.isEmpty()) - tooltip += "\n\n"; - tooltip += comp->getToolTipText().join("\n"); - } - if (!tooltip.isEmpty()) - TQToolTip::add (this, tooltip); -} - -void -Tray::slotVPNSecretsNeeded(ConnectionSettings::Connection* connection, ConnectionSettings::ConnectionSetting* setting, const TQStringList& hints, bool request_new) -{ -#warning Implement Tray::slotVPNSecretsNeeded to handle parms properly - Q_UNUSED(hints); - - Storage* storage = Storage::getInstance(); - bool hasSecretsStored = storage->hasSecretsStored(connection, setting); - - printf("Tray::slotVPNSecretsNeeded\n\r"); - kdDebug() << "Tray::slotVPNSecretsNeeded" << endl; - - // default secrets handling for all other connection types - // 1) if we have secrets stored, restore them and send them back to NM - // 2) if NM requests new secrets we should allow the user to retry the - // connection or to edit it - - //if (hasSecretsStored && (!request_new)) - if (hasSecretsStored) - { - printf("Tray::slotVPNSecretsNeeded: Restoring saved secrets\n\r"); - // We have secrets stored, restore them -// if (storage->restoreVPNSecrets(connection, setting)) -// { - int number_of_secrets_found = 0; - ConnectionSettings::VPNConnection* conn = dynamic_cast<ConnectionSettings::VPNConnection*>(connection); - TQString id = connection->getID(); - TQString type = setting->getType(); - - printf("restoreVPNSecrets\n\r"); - // ID is necessary - if (id.isEmpty()) { - printf("VPN connection ID is empty!\n\r"); - } - else { - // Get a group for this setting - TQString setting_grp = TQString("ConnectionSecrets_%1_%2").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<TQString, TQString> config_map = KGlobal::config()->entryMap(setting_grp); - TQString typetwo = secrets_grp.readEntry("Type"); - - // // get the appropriate setting from the connection - // ConnectionSetting* setting = conn->getSetting(typetwo); - // if (!setting) - // { - // printf("Secrets cannot be restored!\n\r"); - // } - - // Read the SettingsMap from kconfig - // This loop reads the secrets information map only - TQMap<TQString, TQString> map; - for(TQMap<TQString, TQString>::ConstIterator it = config_map.begin(); it != config_map.end(); ++it) - { - if (!it.key().startsWith("Value_")) - continue; - - TQString key = it.key(); - // Get the original key name - key.replace("Value_", ""); - - TQString xmldata = it.data(); - // Remove the annoying XML <string> stuff - xmldata.replace("<string>", ""); - xmldata.replace("</string>", ""); - //printf("Got %s with value %s\n\r", key.ascii(), xmldata.ascii()); - map.insert(key, xmldata); - number_of_secrets_found++; - } - if (number_of_secrets_found > 0) { - printf("Got secrets from file, continuing...\n\r"); - - // Good, we have new secrets now, update the settings - //map = _vpnAuthWidget->getPasswords(); - ConnectionSetting* propcore = conn->getVPNSettingConnectionCore(); - SettingsMap othersettingsmap = propcore->toMap(); - - // Pull the username and gateway out of map to stuff in the NM standard settings matrix - othersettingsmap.insert("user", TQT_DBusData::fromString(map["user"])); - map.erase("user"); - othersettingsmap.insert("domain", TQT_DBusData::fromString(map["domain"])); - map.erase("domain"); - - if (!request_new) { - propcore->fromMap(othersettingsmap); - VPN* prop = dynamic_cast<VPN*>(propcore); - prop->setSecrets(map); - conn->slotSecretsProvided(prop); - } - else { - printf("Tray::slotVPNSecretsNeeded: New secrets requested\n\r"); - // OK, NM requests new secrets...do something! - ConnectionSettings::VPNConnection* conn = dynamic_cast<ConnectionSettings::VPNConnection*>(connection); - VPNAuthenticationDialog* auth = new VPNAuthenticationDialog(conn, this, "vpnauth"); - // Prefill the password dialog with cached credentials - TQString passdata; - for(TQMap<TQString, TQString>::ConstIterator it = map.begin(); it != map.end(); ++it) - { - passdata = it.data(); - // Remove any non-typable characters from the string! - passdata.remove("\r"); - passdata.remove("\n"); - passdata.remove("\t"); - //printf("Trying to set %s to value %s\n\r", it.key().ascii(), passdata.ascii()); - auth->setPasswords(it.key(), passdata); - } - auth->show(); - } - - //connection->slotSecretsProvided(setting); - } - else { - printf("Tray::slotVPNSecretsNeeded: New secrets needed\n\r"); - // OK, NM needs new secrets...do something! - ConnectionSettings::VPNConnection* conn = dynamic_cast<ConnectionSettings::VPNConnection*>(connection); - VPNAuthenticationDialog* auth = new VPNAuthenticationDialog(conn, this, "vpnauth"); - auth->show(); - } - } -// } - } - else - { - printf("Tray::slotVPNSecretsNeeded: New secrets needed\n\r"); - // OK, NM needs new secrets...do something! - ConnectionSettings::VPNConnection* conn = dynamic_cast<ConnectionSettings::VPNConnection*>(connection); - VPNAuthenticationDialog* auth = new VPNAuthenticationDialog(conn, this, "vpnauth"); - auth->show(); - } -} - -void -Tray::slotSecretsNeeded(ConnectionSettings::Connection* connection, ConnectionSettings::ConnectionSetting* setting, const TQStringList& hints, bool request_new) -{ - Storage* storage = Storage::getInstance(); - bool hasSecretsStored = storage->hasSecretsStored(connection, setting); - - // FIXME ugly secrets handling for VPN - if (connection->getType() == NM_SETTING_VPN_SETTING_NAME) - { - if (vpn_new_credentials_needed == 1) { - printf("VPN connection failed with bad credentials\n\r"); - vpn_new_credentials_needed = 0; - request_new = 1; - } - slotVPNSecretsNeeded(connection, setting, hints, request_new); - return; - } - - // default secrets handling for all other connection types - // 1) if we have secrets stored, restore them and send them back to NM - // 2) if NM requests new secrets we should allow the user to retry the - // connection or to edit it - - if (hasSecretsStored && !request_new) - { - // We have secrets stored, restore them - if (storage->restoreSecrets(connection, setting)) - { - connection->slotSecretsProvided(setting); - } - } - else - { - // ok, NM requests new secrets, let's ask the user if he wants to retry - // or edit the connection - NewSecretsDialog* dlg = new NewSecretsDialog(connection, this, "knetworkmanager"); - dlg->show(); - } -} - -void Tray::slotAddDeviceTrayComponent(Device* dev) -{ - if (dev) - createDeviceTrayComponent(dev); -} - -void Tray::slotRemoveDeviceTrayComponent(Device* dev) -{ - for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) - { - DeviceTrayComponent* dev_comp = dynamic_cast<DeviceTrayComponent*>(*it); - if (!dev_comp) - continue; - - if (dev_comp->device() == dev) - { - if (d->foregroundTrayComponent && dev_comp->device() == d->foregroundTrayComponent->device() ) { - d->foregroundTrayComponent = 0; - } - - // remove the appropriate action - TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->getInterface()); - KAction * deviceNewConnAction = actionCollection ()->action (actionName); - - if (!deviceNewConnAction) - { - delete deviceNewConnAction; - deviceNewConnAction = NULL; - } - // remove device_tray and delete it - d->trayComponents.remove(it); - delete dev_comp; - - if (contextMenu()->isVisible()) { - contextMenu()->hide(); - } - - break; - } - } -} - -void Tray::createDeviceTrayComponent(Device* dev) -{ - bool trayExists = false; - - if (!dev) return; - - // check if we have already a trayicon for this device - for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) - { - DeviceTrayComponent* dev_comp = dynamic_cast<DeviceTrayComponent*> (*it); - if (dev_comp) - if (dev_comp->device() == dev) - { - trayExists = true; - break; - } - } - - // create the appropriate device tray icon - if (!trayExists) - { - DeviceTrayComponent* devTray = 0; - // different tray icons for different device types! - switch (dev->getDeviceType()) - { -#if NM_CHECK_VERSION(0,8,992) - case NM_DEVICE_TYPE_ETHERNET: -#else - case DEVICE_TYPE_802_3_ETHERNET: -#endif - devTray = new WiredDeviceTray(dynamic_cast<WiredDevice*>(dev), this, "wired_device_tray"); - break; -#if NM_CHECK_VERSION(0,8,992) - case NM_DEVICE_TYPE_WIFI: -#else - case DEVICE_TYPE_802_11_WIRELESS: -#endif - devTray = new WirelessDeviceTray(static_cast<WirelessDevice*>(dev), this, "wireless_device_tray"); - break; -#if NM_CHECK_VERSION(0,8,992) - case NM_DEVICE_TYPE_MODEM: -#else - case DEVICE_TYPE_GSM: - case DEVICE_TYPE_CDMA: -#endif - devTray = new CellularDeviceTray(static_cast<CellularDevice*>(dev), this, "cellular_device_tray"); - break; - default: - kdWarning() << k_funcinfo << "UDI: " << dev->getUdi() << " has unknown devicetype: " << dev->getDeviceType() << endl; - } - if(devTray) - { - connect( devTray, TQT_SIGNAL(needsCenterStage(TrayComponent*,bool)), - TQT_SLOT(trayComponentNeedsCenterStage(TrayComponent*,bool))); - connect( devTray, TQT_SIGNAL(uiUpdated()), TQT_SLOT(trayUiChanged())); - d->trayComponents.append(devTray); - //WILLTODO: sort - } - } -} - -void Tray::createVPNTrayComponent() -{ - bool trayExists = false; - - // check if we have already a trayicon for this device - for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) - { - VPNTrayComponent* vpn_comp = dynamic_cast<VPNTrayComponent*> (*it); - if (vpn_comp) - { - trayExists = true; - break; - } - } - - // create the appropriate device tray icon - if (!trayExists) - { - TrayComponent* devTray = new VPNTrayComponent(this, "vpn_device_tray"); - if(devTray) - { - d->trayComponents.append(devTray); - //WILLTODO: sort - } - } -} - -void Tray::updateDeviceTrays() -{ - // create one tray-icon for each device - DeviceStore* store = DeviceStore::getInstance(); - TQValueList<Device*> devices = store->getDevices(); - - // check for newly added devices - for (TQValueList<Device*>::iterator it = devices.begin(); it != devices.end(); ++it) - { - Device* dev = (*it); - if (dev) - createDeviceTrayComponent(dev); - else - kdWarning() << k_funcinfo << "got a NULL-Device" << endl; - } - - // add the VPN componenet as it is not associated with a device - createVPNTrayComponent(); -} - -void Tray::mousePressEvent( TQMouseEvent *e ) -{ - if ( !TQT_TQRECT_OBJECT(rect()).contains( e->pos() ) ) { - return; - } - switch ( e->button() ) { - case Qt::LeftButton: - contextMenuAboutToShow(contextMenu()); - contextMenu()->popup(e->globalPos()); - break; - default: - KSystemTray::mousePressEvent( e ); - break; - } -} - -void Tray::slotDeactivateConnection(int index) -{ - ConnectionSettings::Connection* conn = d->act_conn_map[index].first; - Device* dev = d->act_conn_map[index].second; - NMProxy* nm = NMProxy::getInstance(); - - if (conn) { - TQString actionText = conn->getObjectPath().data(); - nm->deactivateConnection(conn, dev); - } -} - -void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt) -{ - DeviceTrayComponent * dtc = dynamic_cast<DeviceTrayComponent*>(component); - if (dtc) { - kdDebug() << k_funcinfo << dtc->device()->getInterface() << " : " << needsIt << endl; - Device * device = dtc->device(); - if (needsIt) { - if (d->foregroundTrayComponent) { - disconnect(d->foregroundTrayComponent->device(), TQT_SIGNAL(StateChanged(NMDeviceState)), this, 0 ); - } - d->foregroundTrayComponent = dtc; - connect(device, TQT_SIGNAL(StateChanged(NMDeviceState)), - TQT_SLOT(slotUpdateDeviceState(NMDeviceState))); - } else { - disconnect(device, TQT_SIGNAL(StateChanged(NMDeviceState)), this, 0 ); - //use active default - NMProxy* nm = NMProxy::getInstance(); - device = nm->getDefaultDevice(); - if ( device ) { - // identify the new foreground - for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) - { - DeviceTrayComponent* newDtc = dynamic_cast<DeviceTrayComponent*> (*it); - if ( newDtc && newDtc->device() == device ) { - d->foregroundTrayComponent = newDtc; - break; - } - } - kdDebug() << " Device " << dtc->device()->getInterface() << " background, new foreground device: " << device->getInterface() << endl; - connect(device, TQT_SIGNAL(StateChanged(NMDeviceState)), - TQT_SLOT(slotUpdateDeviceState(NMDeviceState))); - slotUpdateDeviceState(device->getState()); - } - } - } -} - -void Tray::slotUpdateDeviceState() -{ - // FIXME -} - -void Tray::slotUpdateDeviceState(NMDeviceState state) -{ - updateTrayIcon(state); - updateActiveConnection(state); -} - -void Tray::trayUiChanged() -{ - DeviceTrayComponent * dtc = d->foregroundTrayComponent; - if (dtc) { - updateTrayIcon(dtc->device()->getState()); - } -} -void Tray::updateTrayIcon(NMDeviceState state) -{ - // Get all active connections - char active_vpn=0; - char found_any_active_connection=0; - - ConnectionStore* connectionStore = ConnectionStore::getInstance(); - NMProxy* nm = NMProxy::getInstance(); - TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > map = nm->getActiveConnectionsMap(); - - // get all available VPN Connections - TQValueList<Connection*> connections = connectionStore->getConnections(NM_SETTING_VPN_SETTING_NAME); - if (!connections.empty()) - { - for (TQValueList<Connection*>::iterator it = connections.begin(); it != connections.end(); ++it) - { - VPNConnection* vpnconn = dynamic_cast<VPNConnection*>(*it); - if (vpnconn) - { - // VPN connection found :) - Info* info = vpnconn->getInfoSetting(); - - // lets create a nice name for this connection - if (info) - { - TQString title = info->getName(); - for (TQValueList<TQPair<ConnectionSettings::Connection*, Device*> >::Iterator it = map.begin(); it != map.end(); ++it) - { - ConnectionSettings::GenericConnection* conn = dynamic_cast<ConnectionSettings::GenericConnection*>((*it).first); - - if (conn) { - if (strcmp(info->getName(), conn->getInfoSetting()->getName()) == 0) { - active_vpn = 1; - } - } - } - } - } - } - } - - found_any_active_connection = 0; - // Get all active connections - TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > allconnmap = nm->getActiveConnectionsMap(); - for (TQValueList<TQPair<ConnectionSettings::Connection*, Device*> >::Iterator it = allconnmap.begin(); it != allconnmap.end(); ++it) - { - ConnectionSettings::GenericConnection* conn = dynamic_cast<ConnectionSettings::GenericConnection*>((*it).first); - - if (!conn) - continue; - - // Found an active connection - found_any_active_connection = 1; - } - -// if (found_any_active_connection == 1) { -// printf("Active connection found\n\r"); -// } - - if ((current_vpn_state == NM_VPN_CONNECTION_STATE_FAILED) || (current_vpn_state == NM_VPN_CONNECTION_STATE_DISCONNECTED)) { - active_vpn = 0; - } - - if (active_vpn == 0) { - // stop the old movie to avoid unnecessary wakups - DeviceTrayComponent * dtc = d->foregroundTrayComponent; - - if (movie()) - movie()->pause(); - - if ((dtc) && (found_any_active_connection == 1)) { - - if (!dtc->movieForState(state).isNull()) - { - // animation desired - int frame = -1; - if (movie()) - frame = movie()->frameNumber(); - - // set the movie - setMovie(dtc->movieForState(state)); - - // start at the same frame as the movie before - if (frame > 0) - movie()->step(frame); - - // start the animation - movie()->unpause(); - } - else if (!dtc->pixmapForState(state).isNull()) - setPixmap(dtc->pixmapForState(state)); - else - setPixmap(loadIcon("knetworkmanager")); - } - else { - setPixmap(loadIcon("knetworkmanager")); - } - } - else { - printf("VPN state: %d\n\r", current_vpn_state); - //printf("Activated is: %d\n\r", NM_VPN_CONNECTION_STATE_ACTIVATED); - // stop the old movie to avoid unnecessary wakups - DeviceTrayComponent * dtc = d->foregroundTrayComponent; - - if (movie()) - movie()->pause(); - - if (dtc) { - if (current_vpn_state == NM_VPN_CONNECTION_STATE_ACTIVATED) { - setPixmap(loadIcon("nm_device_vpn")); - } - if ((current_vpn_state == NM_VPN_CONNECTION_STATE_PREPARE) || (current_vpn_state == NM_VPN_CONNECTION_STATE_NEED_AUTH) || (current_vpn_state == NM_VPN_CONNECTION_STATE_CONNECT) || (current_vpn_state == NM_VPN_CONNECTION_STATE_IP_CONFIG_GET)) { - int frame = -1; - if (movie()) - frame = movie()->frameNumber(); - - // set the movie - if ((current_vpn_state == NM_VPN_CONNECTION_STATE_PREPARE) || (current_vpn_state == NM_VPN_CONNECTION_STATE_NEED_AUTH)) { - setMovie(TQMovie(KGlobal::iconLoader()->moviePath("nm_stage02_connecting_vpn", KIcon::Panel))); - } - if ((current_vpn_state == NM_VPN_CONNECTION_STATE_CONNECT) || (current_vpn_state == NM_VPN_CONNECTION_STATE_IP_CONFIG_GET)) { - setMovie(TQMovie(KGlobal::iconLoader()->moviePath("nm_stage03_connecting_vpn", KIcon::Panel))); - } - - // start at the same frame as the movie before - if (frame > 0) - movie()->step(frame); - - // start the animation - movie()->unpause(); - } - } - } - - nm_device_state_global = state; - //printf("Device state: %d\n\r", nm_device_state_global); -} - -void Tray::updateActiveConnection(NMDeviceState state) -{ - if (state != NM_DEVICE_STATE_ACTIVATED) - return; - - NMProxy* nm = NMProxy::getInstance(); - if (d->foregroundTrayComponent) { - Connection* active_conn = nm->getActiveConnection(d->foregroundTrayComponent->device()); - if (active_conn) - { - Info* info = dynamic_cast<Info*>(active_conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME)); - if (info) - info->setTimestamp(TQDateTime::currentDateTime()); - } - } -} - -void Tray::slotDeviceAddedNotify(Device* dev) -{ - kdDebug() << "Tray::slotDeviceAddedNotify" << endl; - KNotifyClient::event( winId(), "knm-nm-device-added", i18n("New network device %1 found").arg(dev->getInterface()) ); -} - -void Tray::slotDeviceRemovedNotify(Device* dev) -{ - kdDebug() << "Tray::slotDeviceRemovedNotify" << endl; - KNotifyClient::event( winId(), "knm-nm-device-removed", i18n("Network device %1 removed").arg(dev->getInterface()) ); -} - -void Tray::slotVPNBannerShow(const TQString& vpnbanner) -{ - printf("VPN banner: %s\n\r", vpnbanner.ascii()); - KNotifyClient::event(winId(), "knm-nm-vpn-banner", vpnbanner); -} - -void Tray::slotStateChangedNotify(TQ_UINT32 state) -{ - NMState nm_state = (NMState) state; - // change tray icon according to NM's state - switch(nm_state) - { - case NM_STATE_CONNECTING: - KNotifyClient::event( winId(), "knm-nm-connecting", i18n("NetworkManager is connecting") ); - break; - case NM_STATE_DISCONNECTED: - KNotifyClient::event( winId(), "knm-nm-disconnected", i18n("NetworkManager is now disconnected") ); - break; - case NM_STATE_CONNECTED: - KNotifyClient::event( winId(), "knm-nm-connected", i18n("NetworkManager is now connected") ); - break; - case NM_STATE_ASLEEP: - KNotifyClient::event( winId(), "knm-nm-sleeping", i18n("KNetworkManager Offline") ); - break; - case NM_STATE_UNKNOWN: - - default: - break; - } -} - -void Tray::slotEditNotifications() -{ - KNotifyDialog::configure(this); -} - -Tray::Tray () : KSystemTray () -{ - d = new TrayPrivate(TQT_TQOBJECT(this)); - - connect(&d->signalMapper, TQT_SIGNAL(mapped(int)), this, TQT_SLOT(slotDeactivateConnection(int))); - - setPixmap (loadIcon ("knetworkmanager")); - setMouseTracking (true); - - // Actions used for plugging into the menu - new KAction (i18n ("Switch to offline mode"), - SmallIcon ("no", TQIconSet::Automatic), 0, - TQT_TQOBJECT(this), TQT_SLOT (slotOfflineMode()), actionCollection (), "offline_mode"); - - new KAction (i18n ("Switch to online mode"), - SmallIcon ("ok", TQIconSet::Automatic), 0, - TQT_TQOBJECT(this), TQT_SLOT (slotOnlineMode()), actionCollection (), "online_mode"); - - new KAction (i18n ("Disable Wireless"), - SmallIcon ("wireless_off", TQIconSet::Automatic), 0, - TQT_TQOBJECT(this), TQT_SLOT (slotDisableWireless()), actionCollection (), "disable_wireless"); - - new KAction (i18n ("Enable Wireless"), - SmallIcon ("wireless", TQIconSet::Automatic), 0, - TQT_TQOBJECT(this), TQT_SLOT (slotEnableWireless()), actionCollection (), "enable_wireless"); - - new KAction (i18n ("Edit Connections"), - SmallIcon ("edit", TQIconSet::Automatic), 0, - TQT_TQOBJECT(this), TQT_SLOT (slotEditConnections()), actionCollection (), "edit_connections"); - - new KAction (i18n ("Configure Notifications"), - SmallIcon ("knotify", TQIconSet::Automatic), 0, - TQT_TQOBJECT(this), TQT_SLOT (slotEditNotifications()), actionCollection (), "configure_notifications"); - - // this action is only connected when the menu is shown, hence the 0 receiver - new KAction (i18n ("New connection ..."), - SmallIcon ("filenew", TQIconSet::Automatic), 0, - TQT_TQOBJECT(this), 0, actionCollection (), "new_connection"); - - new KActionMenu (i18n ("New connection ..."), - SmallIcon ("filenew", TQIconSet::Automatic), - actionCollection(), "new_connection_menu"); - - new KActionMenu (i18n ("Deactivate connection..."), - SmallIcon ("no", TQIconSet::Automatic), - actionCollection (), "deactivate_menu"); - - // get notified when NM's state changes - NMProxy* nm = NMProxy::getInstance(); - connect(nm, TQT_SIGNAL(StateChange(TQ_UINT32)), this, TQT_SLOT(slotStateChanged(TQ_UINT32))); - - // get notifier when NM requests new secrets - ConnectionStore* cstore = ConnectionStore::getInstance(); - connect(cstore, TQT_SIGNAL(SecretsNeeded(ConnectionSettings::Connection*, ConnectionSettings::ConnectionSetting*, const TQStringList&, bool)), this, TQT_SLOT(slotSecretsNeeded(ConnectionSettings::Connection*, ConnectionSettings::ConnectionSetting*, const TQStringList&, bool))); - - // get notified about new/removed devices - DeviceStore* store = DeviceStore::getInstance(); - connect(store, TQT_SIGNAL(DeviceStoreChanged()), this, TQT_SLOT(updateDeviceTrays())); - connect(store, TQT_SIGNAL(DeviceAdded(Device*)), this, TQT_SLOT(slotAddDeviceTrayComponent(Device*))); - connect(store, TQT_SIGNAL(DeviceRemoved(Device*)), this, TQT_SLOT(slotRemoveDeviceTrayComponent(Device*))); - - // Notifications - connect(store, TQT_SIGNAL(DeviceAdded(Device*)), this, TQT_SLOT(slotDeviceAddedNotify(Device*))); - connect(store, TQT_SIGNAL(DeviceRemoved(Device*)), this, TQT_SLOT(slotDeviceRemovedNotify(Device*))); - connect(nm, TQT_SIGNAL(StateChange(TQ_UINT32)), this, TQT_SLOT(slotStateChangedNotify(TQ_UINT32))); - - - // initial setup of the device-trays - updateDeviceTrays(); - - TQT_DBusError err; - slotStateChanged(nm->getState(err)); -} - -Tray::~Tray () -{ - delete d; -} - -#include "knetworkmanager-tray.moc" - diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -/* qt headers */ -#include <tqhostaddress.h> -#include <tqvariant.h> -#include <tqvaluelist.h> - -/* kde headers */ -#include <kdebug.h> -#include <klocale.h> - -/* TQDbus headers */ -#include <tqdbusconnection.h> -#include <tqdbusobjectpath.h> -#include <tqdbusdata.h> -#include <tqdbusdatamap.h> -#include <tqdbusvariant.h> - -/* NM headers */ -#include <NetworkManager.h> - -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-vpn_connection.h" -#include "knetworkmanager-connection_setting.h" -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-connection_setting_ipv4.h" -#include "knetworkmanager-connection_setting_vpn.h" -#include "knetworkmanager-nmsettings.h" - -using namespace ConnectionSettings; - -/* - class VPNConnection -*/ -VPNConnection::VPNConnection() - : GenericConnection(NM_SETTING_VPN_SETTING_NAME) -{ - // add all settings needed for a VPN connection - appendSetting(new VPN(this)); - - // TODO: Maybe IPv4 Setting? -} - -VPN* VPNConnection::getVPNSetting() const -{ - return dynamic_cast<VPN*>(getSetting(NM_SETTING_VPN_SETTING_NAME)); -} - -ConnectionSetting* VPNConnection::getVPNSettingConnectionCore() const -{ - return getSetting(NM_SETTING_VPN_SETTING_NAME); -} - -Connection* VPNConnection::duplicate() -{ - VPNConnection* conn = new VPNConnection(); - conn->updateSettings(this); - return conn; -} - - -#include "knetworkmanager-vpn_connection.moc" diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_VPN_CONNECTION_H -#define KNETWORKMANAGER_VPN_CONNECTION_H - -#include <tqmap.h> -#include <tqobject.h> - -#include "knetworkmanager-generic_connection.h" -#include "knetworkmanager-connection_setting.h" -#include "knetworkmanager-connection_setting_vpn.h" - -class TQDBusObjectPath; - -namespace ConnectionSettings -{ - - class VPN; - - class VPNConnection : public GenericConnection - { - Q_OBJECT - - public: - VPNConnection(); - - VPN* getVPNSetting() const; - ConnectionSetting* getVPNSettingConnectionCore() const; - Connection* duplicate(); - }; -} -#endif /* KNETWORKMANAGER_VPN_CONNECTION_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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -// KDE includes -#include <kdebug.h> - -// TQt includes -#include <tqhostaddress.h> - -// TQT_DBus includes -#include <tqdbuserror.h> -#include <tqdbusconnection.h> - -// NM includes -#include <NetworkManager.h> -#include <NetworkManagerVPN.h> - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-vpn_device.h" -#include "dbus/vpnconnectionproxy.h" -#include "knetworkmanager-hal_device_proxy.h" - -class VPNDevicePrivate -{ -public: - VPNDevicePrivate(TQString service, TQString obj_path) - : nmVPN(service, obj_path) - {} - ~VPNDevicePrivate() {} - - DBus::VPNConnectionProxy nmVPN; -}; - -TQ_UINT32 VPNDevice::getState() -{ - TQT_DBusError err; - return d->nmVPN.getVpnState(err); -} - -VPNDevice::VPNDevice (const TQString & obj_path) - : Device(obj_path) -{ - d = new VPNDevicePrivate(NM_DBUS_IFACE_SETTINGS_CONNECTION, obj_path); - d->nmVPN.setConnection(TQT_DBusConnection::systemBus()); -} - -VPNDevice::~VPNDevice () -{ - delete d; -} - - -#include "knetworkmanager-vpn_device.moc" diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_VPNDEVICE_H -#define KNETWORKMANAGER_VPNDEVICE_H - -// std includes -#include <stdint.h> - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-device.h" - -class KNetworkManager; - -class VPNDevicePrivate; - -class VPNDevice : public Device -{ - Q_OBJECT - - public: - VPNDevice (const TQString & obj_path ); - ~VPNDevice (); - - TQ_UINT32 getState(); - - private: - VPNDevicePrivate * d; -}; - -#endif /* KNETWORKMANAGER_VPNDEVICE_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 <[email protected]>, <[email protected]> - * Author: Timothy Pearson <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -// KDE includes -#include <kdebug.h> - -// TQt includes -#include <tqhostaddress.h> - -// TQT_DBus includes -#include <tqdbuserror.h> -#include <tqdbusconnection.h> -#include <tqdbusobjectpath.h> - -// NM includes -#include <NetworkManager.h> -#include <NetworkManagerVPN.h> - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-tray.h" -#include "knetworkmanager-vpn_plugin.h" -#include "dbus/vpnpluginproxy.h" -#include "knetworkmanager-hal_device_proxy.h" -#include "knetworkmanager-nm_proxy.h" - -#if !defined(NM_CHECK_VERSION) -#define NM_CHECK_VERSION(x,y,z) 0 -#endif - -unsigned int current_vpn_state = 0; -extern NMDeviceState nm_device_state_global; -extern TQT_DBusObjectPath vpn_attempt_this_conn; -unsigned char vpn_new_credentials_needed = 0; - -class VPNDBUSPluginPrivate -{ -public: - VPNDBUSPluginPrivate(TQString service, TQString obj_path) - : nmVPNDBUS(service, obj_path) - {} - ~VPNDBUSPluginPrivate() {} - - DBus::VPNPluginProxy nmVPNDBUS; -}; - -TQ_UINT32 VPNDBUSPlugin::getState() -{ - TQT_DBusError err; - return d->nmVPNDBUS.getState(err); -} - -void VPNDBUSPlugin::slotStateChanged(TQ_UINT32 state) -{ - current_vpn_state = state+1; - Tray* tray = Tray::getInstance(); - tray->slotUpdateDeviceState(nm_device_state_global); - //emit StateChanged((NMDeviceState)state); -} - -void VPNDBUSPlugin::slotLoginBanner(const TQString& banner) -{ - Tray* tray = Tray::getInstance(); - tray->slotVPNBannerShow(banner); -} - -void VPNDBUSPlugin::slotFailure(TQ_UINT32 failure_reason) -{ - printf("VPN failure code %d\n\r", failure_reason); - - if ((failure_reason == 0) || (failure_reason == 1) || (failure_reason == 2)) { - // Try to connect again using cached information; request new login though - printf("Reactivate VPN connection on default device\n\r"); - vpn_new_credentials_needed = 1; - int id; - TQT_DBusError err; - NMProxy* nm = NMProxy::getInstance(); - TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection(); - TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn); -#if NM_CHECK_VERSION(0,8,992) - nm->ActivateConnectionAsync(id,"org.freedesktop.NetworkManagerUserSettings", vpn_attempt_this_conn, device, act_conn, err); -#else - nm->ActivateConnectionAsync(id,NM_DBUS_SERVICE_USER_SETTINGS, vpn_attempt_this_conn, device, act_conn, err); -#endif - } -} - -VPNDBUSPlugin::VPNDBUSPlugin () - : TQObject() -{ - d = new VPNDBUSPluginPrivate(NM_VPN_DBUS_PLUGIN_INTERFACE, NM_VPN_DBUS_PLUGIN_PATH); - d->nmVPNDBUS.setConnection(TQT_DBusConnection::systemBus()); - - // Connect the state changed signal to the handler - connect(&(d->nmVPNDBUS), TQT_SIGNAL(StateChanged(TQ_UINT32)), this, TQT_SLOT(slotStateChanged(TQ_UINT32))); - - // Connect the failure signal to the handler - connect(&(d->nmVPNDBUS), TQT_SIGNAL(Failure(TQ_UINT32)), this, TQT_SLOT(slotFailure(TQ_UINT32))); - - // And the banner signal - connect(&(d->nmVPNDBUS), TQT_SIGNAL(LoginBanner(const TQString&)), this, TQT_SLOT(slotLoginBanner(const TQString&))); -} - -VPNDBUSPlugin::~VPNDBUSPlugin () -{ - delete d; -} - - -#include "knetworkmanager-vpn_plugin.moc" diff --git a/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 <[email protected]>, <[email protected]> - * Author: Timothy Pearson <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_VPNDBUSPLUGIN_H -#define KNETWORKMANAGER_VPNDBUSPLUGIN_H - -// std includes -#include <stdint.h> - -// KNM includes -#include "knetworkmanager.h" - -class KNetworkManager; - -class VPNDBUSPluginPrivate; - -class VPNDBUSPlugin : public TQObject -{ - Q_OBJECT - - 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-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 <[email protected]>, <[email protected]> - * Helmut Schaa <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#define SERVICE_DIR "/etc/NetworkManager/VPN" - -#include <klocale.h> -#include <tqdir.h> -#include <kdebug.h> -#include <kconfig.h> - -#include "knetworkmanager-vpnmanager.h" -#include "knetworkmanager-vpnservice.h" -#include "knetworkmanager-vpnplugin.h" - -/* - * class VPNManager - * - */ -VPNServiceList -VPNManager::getVPNServices () -{ - bool status = false; - VPNServiceList list; - - TQDir serviceDir(SERVICE_DIR, TQString(), TQDir::Name|TQDir::IgnoreCase, TQDir::Files); - TQStringList services = serviceDir.entryList ().grep (".name", true); - - if (services.count () > 0) - { - status = true; - // read in all available Services - for (TQStringList::Iterator i = services.begin (); i != services.end (); ++i) { - TQString service = SERVICE_DIR + TQString ("/") + *i; - KConfig* kconfig = new KConfig (service, true, true, "config"); - kconfig->setGroup ("VPN Connection"); - -kdDebug() << "VPN Service " << kconfig->readEntry ("name", TQString()).ascii() << endl; - - // create new VPNService Object - VPNService* vpnservice = new VPNService(kconfig->readEntry ("name", TQString()), kconfig->readEntry ("service", TQString()), TQT_TQOBJECT(KNetworkManager::getInstance())); - if (!vpnservice->getVPNPlugin()) - delete vpnservice; - else - list.push_back(vpnservice); - delete kconfig; - } - } - - return list; -} - -VPNService* -VPNManager::getVPNService(TQString service_type) -{ - bool status = false; - VPNServiceList list; - - TQDir serviceDir(SERVICE_DIR, TQString(), TQDir::Name|TQDir::IgnoreCase, TQDir::Files); - TQStringList services = serviceDir.entryList ().grep (".name", true); - - if (services.count () > 0) - { - status = true; - // read in all available Services - for (TQStringList::Iterator i = services.begin (); i != services.end (); ++i) { - TQString service = SERVICE_DIR + TQString ("/") + *i; - KConfig* kconfig = new KConfig (service, true, true, "config"); - kconfig->setGroup ("VPN Connection"); - - if (kconfig->readEntry ("service", TQString()) == service_type) - { - // create new VPNService Object - VPNService* vpnservice = new VPNService(kconfig->readEntry ("name", TQString()), kconfig->readEntry ("service", TQString()), TQT_TQOBJECT(KNetworkManager::getInstance())); - if (!vpnservice->getVPNPlugin()) - delete vpnservice; - else - return vpnservice; - } - } - } - return NULL; - -} - -#include "knetworkmanager-vpnmanager.moc" diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -/* qt headers */ -#include <tqhostaddress.h> -#include <tqvariant.h> -#include <tqvaluelist.h> - -/* kde headers */ -#include <kdebug.h> -#include <klocale.h> - -/* TQDbus headers */ -#include <tqdbusconnection.h> -#include <tqdbusobjectpath.h> -#include <tqdbusdata.h> -#include <tqdbusdatamap.h> -#include <tqdbusvariant.h> - -/* NM headers */ -#include <NetworkManager.h> - -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-wired_connection.h" -#include "knetworkmanager-connection_setting.h" -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-connection_setting_ipv4.h" -#include "knetworkmanager-connection_setting_wired.h" -#include "knetworkmanager-connection_setting_8021x.h" -#include "knetworkmanager-nmsettings.h" - -using namespace ConnectionSettings; - -/* - class WiredConnection -*/ -WiredConnection::WiredConnection() - : GenericConnection(NM_SETTING_WIRED_SETTING_NAME) -{ - // add all settings needed for a wired connection - appendSetting(new Wired(this)); - appendSetting(new IPv4(this)); -} - -Wired* WiredConnection::getWiredSetting() const -{ - return dynamic_cast<Wired*>(getSetting(NM_SETTING_WIRED_SETTING_NAME)); -} - -IPv4* WiredConnection::getIPv4Setting() const -{ - return dynamic_cast<IPv4*>(getSetting("ipv4")); -} - -Connection* WiredConnection::duplicate() -{ - WiredConnection* conn = new WiredConnection(); - conn->updateSettings(this); - return conn; -} - -#include "knetworkmanager-wired_connection.moc" diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_WIRED_CONNECTION_H -#define KNETWORKMANAGER_WIRED_CONNECTION_H - -#include <tqmap.h> -#include <tqobject.h> -#include <nm-setting-wired.h> - -#include "knetworkmanager-generic_connection.h" -#include "knetworkmanager-connection_setting.h" - -class TQDBusObjectPath; - -namespace ConnectionSettings -{ - - class Wired; - class IPv4; - - class WiredConnection : public GenericConnection - { - Q_OBJECT - - public: - WiredConnection(); - - Wired* getWiredSetting() const; - IPv4* getIPv4Setting() const; - Connection* duplicate(); - }; -} -#endif /* KNETWORKMANAGER_WIRED_CONNECTION_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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -// KDE includes -#include <kdebug.h> - -// TQt includes -#include <tqhostaddress.h> - -// TQT_DBus includes -#include <tqdbuserror.h> -#include <tqdbusconnection.h> - -// NM includes -#include <NetworkManager.h> - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-wired_device.h" -#include "dbus/wiredproxy.h" -#include "knetworkmanager-hal_device_proxy.h" - -class WiredDevicePrivate -{ -public: - WiredDevicePrivate(TQString service, TQString obj_path) - : nmWired(service, obj_path) - {} - ~WiredDevicePrivate() {} - - DBus::WiredDeviceProxy nmWired; -}; - -TQString WiredDevice::getHwAddress() -{ - TQT_DBusError err; - return d->nmWired.getHwAddress(err); -} - -TQ_UINT32 WiredDevice::getSpeed() -{ - TQT_DBusError err; - return d->nmWired.getSpeed(err); -} - -bool WiredDevice::getCarrier() const -{ - TQT_DBusError err; - return d->nmWired.getCarrier(err); -} - -WiredDevice::WiredDevice (const TQString & obj_path) - : Device(obj_path) -{ - d = new WiredDevicePrivate(NM_DBUS_SERVICE, obj_path); - d->nmWired.setConnection(TQT_DBusConnection::systemBus()); -} - -WiredDevice::~WiredDevice () -{ - delete d; -} - - -#include "knetworkmanager-wired_device.moc" diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_WIREDDEVICE_H -#define KNETWORKMANAGER_WIREDDEVICE_H - -// std includes -#include <stdint.h> - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-device.h" - -class KNetworkManager; - -class WiredDevicePrivate; - -class WiredDevice : public Device -{ - Q_OBJECT - - 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 deleted file mode 100644 index 7e96886..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wired_device_tray.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wired_device_tray.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -// TQt includes -#include <tqevent.h> -#include <tqvbox.h> -#include <tqlayout.h> -#include <tqpushbutton.h> -#include <tqbitmap.h> -#include <tqimage.h> -#include <tqpixmap.h> -#include <tqpixmapcache.h> -#include <tqpainter.h> -#include <tqstyle.h> -#include <tqstring.h> - -// KDE includes -#include <kdebug.h> -#include <klocale.h> -#include <kiconloader.h> - -// TQt DBus -#include <tqdbusobjectpath.h> - - -// KNM includes -#include "knetworkmanager-wired_device_tray.h" -#include "knetworkmanager-wired_device.h" -#include "knetworkmanager-menuitem.h" -#include "knetworkmanager-menu_subhead.h" -#include "knetworkmanager-connection_store.h" -#include "knetworkmanager-wired_connection.h" -#include "knetworkmanager-nm_proxy.h" - -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-connection_setting_ipv4.h" -#include "knetworkmanager-connection_setting_wired.h" -#include "knetworkmanager-connection_settings_dialog.h" - -using namespace ConnectionSettings; - -class WiredDeviceTrayPrivate -{ - public: - WiredDeviceTrayPrivate() {} - ~WiredDeviceTrayPrivate() {} - - WiredDevice* dev; -}; - -void WiredDeviceTray::newConnection() -{ - // create a new wired connection - Connection* conn = new WiredConnection(); - - // edit the new connection - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, tray(), "connect_something", false, TQt::WDestructiveClose); - dlg->show(); -} - - -void WiredDeviceTray::addMenuItems(KPopupMenu* menu) -{ - ConnectionStore* connectionStore = ConnectionStore::getInstance(); - - // device title - Subhead* subhead = new Subhead (menu, "subhead", TQString("Wired Connection (%1)").arg(d->dev->getInterface()), SmallIcon("wired", TQIconSet::Automatic)); - menu->insertItem (subhead, -1, -1); - - // bolding subhead instead - //menu->insertSeparator(); - - if (!d->dev->getCarrier()) - { - // no carrier -> do not show any connections - subhead = new Subhead(menu, "subhead2", i18n("Cable disconnected"), SmallIcon("no", TQIconSet::Automatic)); - menu->insertItem(subhead, -1, -1); - } - else - { - NMProxy* nm = NMProxy::getInstance(); - Connection* active_conn = nm->getActiveConnection(d->dev); - if (active_conn) - kdDebug() << active_conn->getObjectPath().data() << endl; - - // get all available Connections for wired devices - TQValueList<Connection*> connections = connectionStore->getConnections(NM_SETTING_WIRED_SETTING_NAME); - int connectionItems = 0; - for (TQValueList<Connection*>::iterator it = connections.begin(); it != connections.end(); ++it) - { - WiredConnection* wiredconn = dynamic_cast<WiredConnection*>(*it); - if (wiredconn) - { - // wired connection found :) - Info* info = wiredconn->getInfoSetting(); - IPv4* ip = wiredconn->getIPv4Setting(); - - // lets create a nice name for this connection - if (info) - { - TQString title = info->getName(); - if (ip) - title += TQString(" (%1)").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)); - } - } - } - - if ( connectionItems == 0) { - // menu->insertSeparator(); - int id = menu->insertItem(SmallIcon("filenew", TQIconSet::Automatic), i18n("Create new wired connection"), this, TQT_SLOT(newConnection())); - } - // bring the device down - KAction* deactivate = tray()->actionCollection()->action("deactivate_device"); - if (deactivate) - deactivate->plug(menu); - - } -} - -WiredDeviceTray::WiredDeviceTray (WiredDevice* dev, KSystemTray * parent, const char * name ) - : DeviceTrayComponent (dev, parent, name) -{ - d = new WiredDeviceTrayPrivate(); - d->dev = dev; - - setPixmapForState(NM_DEVICE_STATE_ACTIVATED, "nm_device_wired"); - -} - -WiredDeviceTray::~WiredDeviceTray () -{ - delete d; -} - -#include "knetworkmanager-wired_device_tray.moc" diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -/* qt headers */ -#include <tqhostaddress.h> -#include <tqvariant.h> -#include <tqvaluelist.h> - -/* kde headers */ -#include <kdebug.h> -#include <klocale.h> - -/* TQDbus headers */ -#include <tqdbusconnection.h> -#include <tqdbusobjectpath.h> -#include <tqdbusdata.h> -#include <tqdbusdatamap.h> -#include <tqdbusvariant.h> - -/* NM headers */ -#include <NetworkManager.h> - -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-wireless_connection.h" -#include "knetworkmanager-connection_dbus.h" -#include "knetworkmanager-connection_secrets_dbus.h" -#include "knetworkmanager-connection_setting.h" -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-connection_setting_ipv4.h" -#include "knetworkmanager-connection_setting_wireless.h" -#include "knetworkmanager-connection_setting_wireless_security.h" -#include "knetworkmanager-connection_setting_8021x.h" -#include "knetworkmanager-nmsettings.h" - -using namespace ConnectionSettings; - -/* - class WirelessConnection -*/ -WirelessConnection::WirelessConnection() - : GenericConnection(NM_SETTING_WIRELESS_SETTING_NAME) -{ - // create all settings needed for a wireless connection - appendSetting(new IPv4(this)); - appendSetting(new Wireless(this)); - appendSetting(new WirelessSecurity(this)); - appendSetting(new IEEE8021x(this)); -} - -Wireless* WirelessConnection::getWirelessSetting() const -{ - return dynamic_cast<Wireless*>(getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); -} - -WirelessSecurity* WirelessConnection::getWirelessSecuritySetting() const -{ - return dynamic_cast<WirelessSecurity*>(getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)); -} - -IPv4* WirelessConnection::getIPv4Setting() const -{ - return dynamic_cast<IPv4*>(getSetting(NM_SETTING_IP4_CONFIG_SETTING_NAME)); -} - -Connection* WirelessConnection::duplicate() -{ - WirelessConnection* conn = new WirelessConnection(); - conn->updateSettings(this); - return conn; -} - -#include "knetworkmanager-wireless_connection.moc" diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_WIRELESS_CONNECTION_H -#define KNETWORKMANAGER_WIRELESS_CONNECTION_H - -#include <tqmap.h> -#include <tqobject.h> -#include <nm-setting-wireless.h> - -#include "knetworkmanager-generic_connection.h" -#include "knetworkmanager-connection_setting.h" - -class TQDBusObjectPath; -namespace ConnectionSettings -{ - - class Info; - class Wireless; - class WirelessSecurity; - class IPv4; - - typedef TQMap<TQString, SettingsMap> ConnectionMap; - - class WirelessConnection : public GenericConnection - { - Q_OBJECT - - public: - WirelessConnection(); - - Wireless* getWirelessSetting() const; - WirelessSecurity* getWirelessSecuritySetting() const; - IPv4* getIPv4Setting() const; - Connection* duplicate(); - }; -} -#endif /* KNETWORKMANAGER_WIRELESS_CONNECTION_H */ 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 <[email protected]>, <[email protected]> - * Will Stephenson <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -// NM includes -#include <NetworkManager.h> - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-wireless_device.h" -#include "dbus/accesspointproxy.h" -#include "dbus/wirelessproxy.h" -#include "knetworkmanager-accesspoint.h" - -// KDE includes -#include <kdebug.h> - -// TQt includes -#include <tqhostaddress.h> -#include <tqmap.h> -#include <tqvaluelist.h> - -// TQt-Dbus includes -#include <tqdbusconnection.h> -#include <tqdbuserror.h> -#include <tqdbusobjectpath.h> - -class WirelessDevicePrivate -{ -public: - WirelessDevicePrivate(TQString service, TQString obj_path) - : nmWireless(service, obj_path) - {} - - ~WirelessDevicePrivate() - { - // cleanup the AP-list - for (TQMap<TQT_DBusObjectPath, AccessPoint*>::Iterator it = aps.begin(); it != aps.end(); ++it) - { - AccessPoint* p = it.data(); - delete p; - } - } - - DBus::WirelessDeviceProxy nmWireless; - TQMap<TQT_DBusObjectPath, AccessPoint *> aps; -}; - -WirelessDevice::WirelessDevice (const TQString & obj_path) - : Device(obj_path) -{ - d = new WirelessDevicePrivate(NM_DBUS_SERVICE, obj_path); - d->nmWireless.setConnection(TQT_DBusConnection::systemBus()); - - // get notified when the devices properties change - connect(&(d->nmWireless), TQT_SIGNAL(PropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)), this, TQT_SLOT(slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&))); - connect(&(d->nmWireless), TQT_SIGNAL(AccessPointAdded(const TQT_DBusObjectPath&)), this, TQT_SLOT(slotAccessPointAdded(const TQT_DBusObjectPath&))); - connect(&(d->nmWireless), TQT_SIGNAL(AccessPointRemoved(const TQT_DBusObjectPath&)), this, TQT_SLOT(slotAccessPointRemoved(const TQT_DBusObjectPath&))); -} - -WirelessDevice::~WirelessDevice () -{ - delete d; -} - -void WirelessDevice::slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>& properties) -{ - // TODO: optimization: emit different signals for each property - emit propertiesChanged(); -} - -void WirelessDevice::slotAccessPointAdded(const TQT_DBusObjectPath& obj_path) -{ - AccessPoint* ap = 0; - - if ( !d->aps.contains(obj_path)) { - // we do not know this AP yet, add it to the list - ap = new AccessPoint(obj_path, this, "access_point_object"); - d->aps.insert(obj_path, ap); - } - else - ap = d->aps[obj_path]; - - // notify about the new accesspoint - emit accessPointAdded(ap); -} - -void WirelessDevice::slotAccessPointRemoved(const TQT_DBusObjectPath& obj_path) -{ - AccessPoint* ap = 0; - - if ( d->aps.contains(obj_path)) { - ap = d->aps[obj_path]; - - // notify about the AP removal - emit accessPointRemoved(obj_path); - - // remove the appropriate AP from our list - d->aps.remove(obj_path); - delete ap; - } - else - { - // nothing we can do here - kdDebug() << k_funcinfo << "NM requests removal of unknown AP " << obj_path << endl; - } -} - -TQValueList<AccessPoint*> WirelessDevice::accessPoints() -{ - // update our AP list - if (d->aps.isEmpty()) { - updateAPList(); - } - - return d->aps.values(); -} - -void WirelessDevice::updateAPList() -{ - TQT_DBusError err; - TQValueList<TQT_DBusObjectPath> aps; - - // get the APs from NM - if (d->nmWireless.GetAccessPoints(aps, err)) - { - // for each AP - for (TQValueList<TQT_DBusObjectPath>::iterator it = aps.begin(); it != aps.end(); ++it) - { - // create an AP-object for each objectpath - if (d->aps.contains(*it)) { - continue; - } - AccessPoint* ap = new AccessPoint(*it, this, "access_point_object"); - d->aps.insert(*it, ap); - } - } - else - kdWarning() << k_funcinfo << "Could not get a list of wireless accesspoints over DBus." << endl; - -} - -TQValueList<AccessPoint*> WirelessDevice::accessPointsForEssid( TQByteArray essid) -{ - TQValueList<AccessPoint*> aps; - // the DBus proxy is shared - for (TQMap<TQT_DBusObjectPath, AccessPoint*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) - { - AccessPoint * ap = it.data(); - if (essid.isNull() || (ap && ap->getSsidByteArray() == essid)) - aps.append(ap); - } - return aps; -} - -AccessPoint * WirelessDevice::getActiveAccessPoint() -{ - TQT_DBusError err; - TQT_DBusObjectPath obj_path; - - AccessPoint * ap = 0; - //fixme, listen to signal and use cached value - obj_path = d->nmWireless.getActiveAccessPoint(err); - if (!obj_path.isEmpty()) { - if (d->aps.contains(obj_path)) { - ap = d->aps[obj_path]; - } else { - kdWarning() << k_funcinfo << "No object for active access point found!" << endl; - } - } - return ap; -} - -TQ_UINT32 WirelessDevice::getWirelessCapabilities() const -{ - TQT_DBusError err; - return d->nmWireless.getWirelessCapabilities(err); -} - -TQ_UINT32 WirelessDevice::getBitrate() const -{ - TQT_DBusError err; - return d->nmWireless.getBitrate(err); -} - -#include "knetworkmanager-wireless_device.moc" diff --git a/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 <[email protected]>, <[email protected]> - * Will Stephenson <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_WIRELESS_DEVICE_H -#define KNETWORKMANAGER_WIRELESS_DEVICE_H - -#include "knetworkmanager.h" -#include "knetworkmanager-device.h" - -#include <stdint.h> - -#include <tqdbusvariant.h> - -class KNetworkManager; -class AccessPoint; -class WirelessDevicePrivate; - -class WirelessDevice : public Device -{ - Q_OBJECT - - public: - WirelessDevice (const TQString & obj_path ); - ~WirelessDevice (); - - TQ_UINT32 getWirelessCapabilities() const; - TQValueList<AccessPoint*> accessPointsForEssid(TQByteArray essid = TQByteArray()); - TQValueList<AccessPoint*> accessPoints(); - AccessPoint * getActiveAccessPoint(); - TQ_UINT32 getBitrate() const; - - public slots: - void slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>& properties); - void slotAccessPointAdded(const TQT_DBusObjectPath&); - void slotAccessPointRemoved(const TQT_DBusObjectPath&); - - signals: - void propertiesChanged(); - void accessPointAdded(AccessPoint *); - void accessPointRemoved(const TQString &); - - private: - void updateAPList(); - - WirelessDevicePrivate * d; -}; - -#endif /* KNETWORKMANAGER_WIRELESS_DEVICE_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp deleted file mode 100644 index 443fdec..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp +++ /dev/null @@ -1,391 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wireless_device_tray.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -// TQt includes -#include <tqevent.h> -#include <tqvbox.h> -#include <tqlayout.h> -#include <tqpushbutton.h> -#include <tqbitmap.h> -#include <tqimage.h> -#include <tqpixmap.h> -#include <tqpixmapcache.h> -#include <tqpainter.h> -#include <tqstyle.h> -#include <tqstring.h> -#include <tqguardedptr.h> - -// KDE includes -#include <kdebug.h> -#include <kiconloader.h> -#include <klocale.h> -#include <knotifyclient.h> - -// QT DBus -#include <tqdbuserror.h> -#include <tqdbusobjectpath.h> - -// KNM includes -#include "knetworkmanager-wireless_device_tray.h" -#include "knetworkmanager-wireless_device.h" -#include "knetworkmanager-wireless_menuitem.h" -#include "knetworkmanager-wireless_network.h" -#include "knetworkmanager-accesspoint.h" -#include "knetworkmanager-menu_subhead.h" -#include "knetworkmanager-connection_store.h" -#include "knetworkmanager-wireless_connection.h" -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-connection_setting_wireless.h" -#include "knetworkmanager-connection_setting_wireless_security.h" -#include "knetworkmanager-nm_proxy.h" -#include "knetworkmanager-wireless_manager.h" -#include "knetworkmanager-connection_settings_dialog.h" - -using namespace ConnectionSettings; - -extern char use_new_wireless_essid; -extern TQByteArray new_wireless_essid; - -class WirelessDeviceTrayPrivate -{ - public: - WirelessDeviceTrayPrivate() :dev(0), activeAccessPoint(0) { } - ~WirelessDeviceTrayPrivate() {} - - WirelessDevice* dev; - TQGuardedPtr<AccessPoint> activeAccessPoint; -}; - -TQStringList WirelessDeviceTray::getToolTipText() -{ - TQStringList tooltip = DeviceTrayComponent::getToolTipText(); - - AccessPoint * ap = d->dev->getActiveAccessPoint(); - if (ap) - tooltip.append(i18n("Network: %1").arg(ap->getDisplaySsid())); - - return tooltip; -} - -void WirelessDeviceTray::newConnection() -{ - // create a new wireless connection - Connection* conn = new WirelessConnection(); - - // open a dialog for editing the connection - use_new_wireless_essid = 0; // deactivate autofill for now - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, tray(), "connect_something", false, TQt::WDestructiveClose); - dlg->show(); -} - -bool WirelessDeviceTray::findMatchingNetwork(const WirelessConnection* conn, const TQValueList<WirelessNetwork>& nets, WirelessNetwork& net) -{ - Wireless* wireless = conn->getWirelessSetting(); - WirelessSecurity* security = conn->getWirelessSecuritySetting(); - - if (!wireless && !security) - return false; - - for (TQValueList<WirelessNetwork>::ConstIterator it = nets.begin(); it != nets.end(); ++it) - { - if (wireless->getEssid() == (*it).getSsid()) - { - net = *it; - return true; - } - } - return false; -} - -WirelessConnection* WirelessDeviceTray::findMatchingConnection(const WirelessNetwork& net, const TQValueList<WirelessConnection*>& connections) -{ - // try to find a connection matching this network - for (TQValueList<WirelessConnection*>::ConstIterator it = connections.begin(); it != connections.end(); ++it) - { - Wireless* wireless = (*it)->getWirelessSetting(); - WirelessSecurity* security = (*it)->getWirelessSecuritySetting(); - - // should not happen but its ever better to check - if (!wireless || !security) - continue; - - if (wireless->getEssid() == net.getSsid()) - { - return *it; - } - } - - return NULL; -} - -void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) -{ - printf("Updating wireless network list\n\r"); - - // get all wireless networks - TQValueList<WirelessNetwork> nets = WirelessManager::getWirelessNetworks(d->dev); - - // get all wireless connections - TQValueList<WirelessConnection*> conns = WirelessManager::getWirelessConnections(); - - // get the currently active connection - NMProxy* nm = NMProxy::getInstance(); - Connection* active_conn = nm->getActiveConnection(d->dev); - if (active_conn) - kdDebug() << active_conn->getObjectPath().data() << endl; - - // add all wireless connections in range - // (we may have more then one connection per network) - for (TQValueList<WirelessConnection*>::iterator it = conns.begin(); it != conns.end(); ++it) - { - WirelessNetworkItem* wirelessNetworkItem; - WirelessNetwork net; - - // only show connections which are in range - if ( !findMatchingNetwork(*it, nets, net) ) - continue; - - wirelessNetworkItem = new WirelessNetworkItem (menu, - d->dev, - net, - *it, - false); - int id = menu->insertItem (wirelessNetworkItem, -1, -1); - menu->setItemChecked(id, ((Connection*)(*it) == active_conn)); - menu->connectItem(id, wirelessNetworkItem, TQT_SLOT(slotActivate())); - } - - // now add all connections which are not in range to a submenu - TQPopupMenu* popup = new TQPopupMenu(menu); - - uint networkItemsAdded = 0; - for (TQValueList<WirelessConnection*>::iterator it = conns.begin(); it != conns.end(); ++it) - { - WirelessNetworkItem* wirelessNetworkItem; - WirelessNetwork net; - - // only show connections which are out of range - if ( findMatchingNetwork(*it, nets, net) ) - continue; - - Info* info = (*it)->getInfoSetting(); - Wireless* wireless = (*it)->getWirelessSetting(); - - if (!info || !wireless) - continue; - - wirelessNetworkItem = new WirelessNetworkItem (menu, - d->dev, - net, - *it, - false); - - int id = popup->insertItem (wirelessNetworkItem, -1, -1); - popup->connectItem(id, wirelessNetworkItem, TQT_SLOT(slotActivate())); - networkItemsAdded += 1; - } - - if (networkItemsAdded) { - menu->insertSeparator(); - menu->insertItem(i18n("Connect to saved network"), popup); - } - -// // List available unsaved networks - TQPopupMenu* newpopup = new TQPopupMenu(menu); - WirelessConnection* newconn; - uint newnetworkItemsAdded = 0; - TQValueList<WirelessNetwork> newnets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID); - - for (TQValueList<WirelessNetwork>::Iterator it = newnets.begin(); it != newnets.end(); ++it) - { - // Only display networks with no existing connnection - if ( findMatchingConnection(*it, conns) != NULL) - continue; - - WirelessNetworkItem* wirelessNetworkItem; - wirelessNetworkItem = new WirelessNetworkItem (menu, - d->dev, - *it, - NULL, - false); - - int id = newpopup->insertItem (wirelessNetworkItem, -1, -1); - newpopup->connectItem(id, this, TQT_SLOT(newConnection())); - - newnetworkItemsAdded += 1; - } - - if (newnetworkItemsAdded) { - menu->insertSeparator(); - menu->insertItem(i18n("Connect to new network"), newpopup); - } - // Signal done with wireless menu - //menu->insertSeparator(); -} - -void WirelessDeviceTray::addMenuItems(KPopupMenu* menu) -{ - NMProxy* nm = NMProxy::getInstance(); - TQT_DBusError err; - - // device title - Subhead* subhead = new Subhead (menu, "subhead", TQString("Wireless Connection (%1)").arg(d->dev->getInterface()), SmallIcon("wireless", TQIconSet::Automatic)); - menu->insertItem (subhead, -1, -1); - - // bolding subhead instead - //menu->insertSeparator(); - - if (!nm->getWirelessEnabled(err)) - { - // wireless disabled -> do not show any connections - subhead = new Subhead(menu, "subhead2", i18n("Wireless disabled"), SmallIcon("no", TQIconSet::Automatic)); - menu->insertItem(subhead, -1, -1); - } - else if (!nm->getWirelessHardwareEnabled(err)) - { - // wireless disabled -> do not show any connections - subhead = new Subhead(menu, "subhead2", i18n("Wireless disabled by Killswitch"), SmallIcon("no", TQIconSet::Automatic)); - menu->insertItem(subhead, -1, -1); - } - else - { - // networks - addWirelessNetworks(menu); - - // bring the device down - KAction* deactivate = tray()->actionCollection()->action("deactivate_device"); - if (deactivate) - deactivate->plug(menu); - } - menu->insertSeparator(); -} - -void WirelessDeviceTray::slotUpdateDeviceState(NMDeviceState state) -{ - slotCheckActiveAccessPoint(); - if (state == NM_DEVICE_STATE_ACTIVATED) - { - // trigger an update of the connections seen bssids property - - AccessPoint * ap = d->dev->getActiveAccessPoint(); - if (ap) { - int strength = ap->getStrength(); - - if (strength > 80) - setPixmapForState((NMDeviceState)state, "nm_signal_100"); - else if (strength > 55) - setPixmapForState((NMDeviceState)state, "nm_signal_75"); - else if (strength > 30) - setPixmapForState((NMDeviceState)state, "nm_signal_50"); - else if (strength > 5) - setPixmapForState((NMDeviceState)state, "nm_signal_25"); - else - setPixmapForState((NMDeviceState)state, "nm_signal_00"); - } - } -} - -void WirelessDeviceTray::slotCheckActiveAccessPoint() -{ - // the active AP changed, if a connection is already active we have roamed - // thus add the bssid to the list of seen bssids - NMProxy* nm = NMProxy::getInstance(); - if (!nm) - return; - - WirelessConnection* active_conn = dynamic_cast<WirelessConnection*>(nm->getActiveConnection(d->dev)); - if (active_conn && d->dev->getState() == NM_DEVICE_STATE_ACTIVATED) - { - if ( d->dev->getActiveAccessPoint() != d->activeAccessPoint) { - if (!d->activeAccessPoint.isNull()) - disconnect( d->activeAccessPoint, TQT_SIGNAL(strengthChanged(TQ_UINT8)), this, TQT_SLOT(apStrengthChanged(TQ_UINT8))); - - d->activeAccessPoint = d->dev->getActiveAccessPoint(); - if ( d->activeAccessPoint ) { - connect( d->activeAccessPoint, TQT_SIGNAL(strengthChanged(TQ_UINT8)), this, TQT_SLOT(apStrengthChanged(TQ_UINT8))); - ConnectionSettings::Wireless* wireless = active_conn->getWirelessSetting(); - wireless->addSeenBssid(d->activeAccessPoint->getHwAddress()); - } - } - } -} - -void WirelessDeviceTray::apStrengthChanged(TQ_UINT8 strength) -{ - kdDebug() << k_funcinfo << (uint)strength << endl; - NMDeviceState state = device()->getState(); - if (strength > 80) - setPixmapForState(state, "nm_signal_100"); - else if (strength > 55) - setPixmapForState(state, "nm_signal_75"); - else if (strength > 30) - setPixmapForState(state, "nm_signal_50"); - else if (strength > 5) - setPixmapForState(state, "nm_signal_25"); - else - setPixmapForState(state, "nm_signal_00"); - emit uiUpdated(); -} - -void WirelessDeviceTray::slotAccessPointAdded(AccessPoint* ap) -{ - KNotifyClient::event( tray()->winId(), "knm-nm-network-found", i18n("KNetworkManager New Wireless Network Found") ); -} - -void WirelessDeviceTray::slotAccessPointRemoved(const TQString&) -{ - KNotifyClient::event( tray()->winId(), "knm-nm-network-gone", i18n("KNetworkManager Wireless Network Disappeared") ); -} - -WirelessDeviceTray::WirelessDeviceTray (WirelessDevice* dev, KSystemTray * parent, const char * name) - : DeviceTrayComponent (dev, parent, name) -{ - d = new WirelessDeviceTrayPrivate(); - d->dev = dev; - - // we want other icons for wireless devices - setPixmapForState(NM_DEVICE_STATE_UNKNOWN, "wireless_off"); - setPixmapForState(NM_DEVICE_STATE_UNAVAILABLE, "wireless_off"); - setPixmapForState(NM_DEVICE_STATE_UNMANAGED, "wireless_off"); - setPixmapForState(NM_DEVICE_STATE_DISCONNECTED, "wireless"); - setPixmapForState(NM_DEVICE_STATE_ACTIVATED, "nm_signal_50"); - - // get notified when the device state changes - connect(dev, TQT_SIGNAL(StateChanged(NMDeviceState)), this, TQT_SLOT(slotUpdateDeviceState(NMDeviceState))); - - // if the active access point changed but not the connection we roamed to a new AP - connect(dev, TQT_SIGNAL(propertiesChanged()), this, TQT_SLOT(slotCheckActiveAccessPoint())); - - // get notified of all AP changes - connect(dev, TQT_SIGNAL(accessPointAdded(AccessPoint*)), this, TQT_SLOT(slotAccessPointAdded(AccessPoint*))); - connect(dev, TQT_SIGNAL(accessPointRemoved(const TQString&)), this, TQT_SLOT(slotAccessPointRemoved(const TQString&))); -} - -WirelessDeviceTray::~WirelessDeviceTray () -{ - delete d; -} - - -#include "knetworkmanager-wireless_device_tray.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp deleted file mode 100644 index c77d2ad..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wireless_manager.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wireless_manager.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -// other includes -#include <time.h> - -// QT DBus -#include <tqdbusobjectpath.h> - -// KNM includes -#include "knetworkmanager-wireless_manager.h" -#include "knetworkmanager-wireless_device.h" -#include "knetworkmanager-wireless_network.h" -#include "knetworkmanager-accesspoint.h" -#include "knetworkmanager-connection_store.h" -#include "knetworkmanager-wireless_connection.h" -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-connection_setting_wireless.h" -#include "knetworkmanager-connection_setting_wireless_security.h" -#include "knetworkmanager-nm_proxy.h" -#include "knetworkmanager-devicestore.h" - -#if !defined(NM_CHECK_VERSION) -#define NM_CHECK_VERSION(x,y,z) 0 -#endif - -TQValueList<WirelessNetwork> WirelessManager::getWirelessNetworks(WirelessDevice* dev, TQ_UINT32 match) -{ - TQValueList<WirelessNetwork> nets; - TQValueList<AccessPoint*> aps; - // fetch all APs - aps = WirelessManager::getAccessPoints(dev); - - // now group the APs together according to their security settings - for (TQValueList<AccessPoint*>::Iterator apit = aps.begin(); apit != aps.end(); ++apit) - { - bool found = false; - - // no hidden APs - AccessPoint * ap = *apit; - if ( ap ) { - if (!ap->isValid()) - continue; - - if (ap->getSsid().count() == 0) - continue; - - // check if we have a network matching this AP - for (TQValueList<WirelessNetwork>::Iterator netIt = nets.begin(); netIt != nets.end(); ++netIt) - { - if ((*netIt).contains(ap) ) - { - // we alread have a network where this AP belongs to - found = true; - - // attach this ap to the network - (*netIt).addAP(ap); - - /* // FIXME active? - if (active_ap) - { - // here is the active_ap - if (!(*net).getActive() && ((*ap) == *active_ap)) - (*net).setActive(true); - }*/ - break; - } - } - - if (!found) - { - // create a new network-descriptor according to this ap - WirelessNetwork net(match); - net.addAP(ap); - nets.append(net); - } - } - } - return nets; -} - -TQValueList<AccessPoint*> WirelessManager::getAccessPoints(WirelessDevice* dev) -{ - // build up AP list depending on one device or on all devices - if (dev) { - return dev->accessPoints(); - } - else { - TQValueList<AccessPoint *> aps; - DeviceStore* store = DeviceStore::getInstance(); - if (store) - { -#if NM_CHECK_VERSION(0,8,992) - TQValueList<Device*> devs = store->getDevices(NM_DEVICE_TYPE_WIFI); -#else - TQValueList<Device*> devs = store->getDevices(DEVICE_TYPE_802_11_WIRELESS); -#endif - for (TQValueList<Device*>::Iterator it = devs.begin(); it != devs.end(); ++it) - { - WirelessDevice* wdev = dynamic_cast<WirelessDevice*>(*it); - if (!wdev) - continue; - // add all APs from this device - aps +=wdev->accessPoints(); - } - } - return aps; - } -} - -TQValueList<WirelessConnection*> WirelessManager::getWirelessConnections() -{ - TQValueList<WirelessConnection*> conns; - ConnectionStore* store = ConnectionStore::getInstance(); - - // get all wireless connections - TQValueList<Connection*> connections = store->getConnections(NM_SETTING_WIRELESS_SETTING_NAME); - for (TQValueList<Connection*>::Iterator it = connections.begin(); it != connections.end(); ++it) - { - // cast to WirelessConnection* - WirelessConnection* wireless_conn = dynamic_cast<WirelessConnection*>(*it); - if (!wireless_conn) - continue; - conns.append(wireless_conn); - } - return conns; -} - -TQValueList<AccessPoint*> WirelessManager::getAccessPointsForEssid(TQByteArray essid, WirelessDevice* dev) -{ - // build up AP list depending on one device or on all devices - if (dev) - return dev->accessPointsForEssid(essid); - else - { - TQValueList<AccessPoint*> aps; - DeviceStore* store = DeviceStore::getInstance(); - if (store) - { -#if NM_CHECK_VERSION(0,8,992) - TQValueList<Device*> devs = store->getDevices(NM_DEVICE_TYPE_WIFI); -#else - TQValueList<Device*> devs = store->getDevices(DEVICE_TYPE_802_11_WIRELESS); -#endif - for (TQValueList<Device*>::Iterator it = devs.begin(); it != devs.end(); ++it) - { - WirelessDevice* wdev = dynamic_cast<WirelessDevice*>(*it); - if (!wdev) - continue; - // add all APs from this device - aps += wdev->accessPointsForEssid(essid); - } - } - return aps; - } -} - - diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp deleted file mode 100644 index ba509dd..0000000 --- a/tdenetworkmanager/src/knetworkmanager-wireless_network.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager-wireless_network.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -// NM includes -#include <NetworkManager.h> - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-accesspoint.h" -#include "knetworkmanager-wireless_network.h" - -// KDE includes -#include <kdebug.h> - -// TQt includes -#include <tqhostaddress.h> -#include <tqvaluelist.h> - -using namespace ConnectionSettings; - -class WirelessNetworkPrivate -{ - public: - WirelessNetworkPrivate() - : active(false) - { - } - - ~WirelessNetworkPrivate() - { - } - - bool active; - - TQ_UINT32 match; - TQValueList<const AccessPoint*> aps; -}; - -WirelessNetwork::WirelessNetwork(const WirelessNetwork& other) -{ - d = new WirelessNetworkPrivate(*other.d); -} - -WirelessNetwork::WirelessNetwork(TQ_UINT32 match) -{ - d = new WirelessNetworkPrivate(); - - // which attributes have to match - d->match = match; -} - -WirelessNetwork::~WirelessNetwork() -{ - delete d; -} - -WirelessNetwork& WirelessNetwork::operator= (const WirelessNetwork& other) -{ - if (d) - delete d; - d = new WirelessNetworkPrivate(*other.d); - return *this; -} - -bool WirelessNetwork::contains (const AccessPoint * const ap) -{ - if ( (d->match & MATCH_SSID) && getSsid() != ap->getSsidByteArray()) - return false; - - // AP matches - return true; -} - -bool WirelessNetwork::addAP(const AccessPoint * const ap) -{ - if ( this->contains( ap ) || d->aps.isEmpty()) - { - d->aps.append(ap); - return true; - } - return false; -} - -const TQByteArray WirelessNetwork::getSsid() const -{ - if ( !d->aps.isEmpty() ) { - return (*(d->aps.begin()))->getSsidByteArray(); - } else { - return TQByteArray(); - } -} - -TQString WirelessNetwork::getDisplaySsid() const -{ - if (!d->aps.isEmpty()) { - return (*(d->aps.begin()))->getDisplaySsid(); - } else { - return TQString(); - } -} - -TQ_UINT32 WirelessNetwork::getFlags() const -{ - TQ_UINT32 flags = NM_802_11_AP_FLAGS_NONE; - for (TQValueList<const AccessPoint*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) - { - flags |= (*it)->getFlags(); - } - return flags; -} - -TQ_UINT32 WirelessNetwork::getWpaFlags() const -{ - TQ_UINT32 flags = NM_802_11_AP_SEC_NONE; - for (TQValueList<const AccessPoint*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) - { - flags |= (*it)->getWpaFlags(); - } - return flags; -} - -TQ_UINT32 WirelessNetwork::getRsnFlags() const -{ - TQ_UINT32 flags = NM_802_11_AP_SEC_NONE; - for (TQValueList<const AccessPoint*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) - { - flags |= (*it)->getRsnFlags(); - } - return flags; -} - -bool WirelessNetwork::isEncrypted() const -{ - return (getFlags() && NM_802_11_AP_FLAGS_PRIVACY); -} - -TQ_UINT8 WirelessNetwork::getStrength() const -{ - TQ_UINT8 strength = 0; - for (TQValueList<const AccessPoint*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) - { - if ((*it)->getStrength() > strength) - strength = (*it)->getStrength(); - } - return strength; -} - -void WirelessNetwork::setActive(bool a) -{ - d->active=a; -} - -bool WirelessNetwork::getActive() const -{ - return d->active; -} - diff --git a/tdenetworkmanager/src/knetworkmanager.cpp b/tdenetworkmanager/src/knetworkmanager.cpp deleted file mode 100644 index 81532e0..0000000 --- a/tdenetworkmanager/src/knetworkmanager.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/*************************************************************************** - * - * knetworkmanager.cpp - A NetworkManager frontend for KDE - * - * Copyright (C) 2005, 2006 Novell, Inc. - * - * Author: Helmut Schaa <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -// KDE includes -#include <kdebug.h> -#include <klocale.h> - -// NM includes -#include <NetworkManager.h> -#include <NetworkManagerVPN.h> - -// TQDBus includes -#include <tqdbusdata.h> - -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-tray.h" -#include "knetworkmanager-devicestore.h" -#include "knetworkmanager-device.h" -#include "knetworkmanager-cellular_device.h" -#include "knetworkmanager-wireless_device.h" -#include "knetworkmanager-wired_device.h" -#include "knetworkmanager-vpn_device.h" -#include "knetworkmanager-cellular_device_tray.h" -#include "knetworkmanager-wireless_device_tray.h" -#include "knetworkmanager-wired_device_tray.h" -#include "knetworkmanager-nmsettings.h" -#include "knetworkmanager-storage.h" -#include "xmlmarshaller.h" - -// KNM includes -#include "vpn_tray_component.h" -#include "knetworkmanager-connection_store.h" -#include "knetworkmanager-vpn_connection.h" -#include "knetworkmanager-nm_proxy.h" -#include "knetworkmanager-vpn_plugin.h" - -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-connection_setting_vpn.h" -#include "knetworkmanager-connection_settings_dialog.h" - -#include <stdio.h> - -// TQt includes -#include <tqstring.h> -#include <tqobject.h> - -// KDE includes -#include <kglobal.h> -#include <kiconloader.h> - -char active_vpn_prev = 0; -extern NMDeviceState nm_device_state_global; -VPNDBUSPlugin* vpnproxy; - -class KNetworkManagerPrivate -{ - public: - KNetworkManagerPrivate() {} - ~KNetworkManagerPrivate() {} - static KNetworkManager* _ctx; -}; - -KNetworkManager* KNetworkManagerPrivate::_ctx = NULL; - -KNetworkManager* KNetworkManager::getInstance() -{ - return KNetworkManagerPrivate::_ctx; -} - -void -KNetworkManager::slotShutDown() -{ - // cleanup code - Storage* storage = Storage::getInstance(); - - // save all connections (if not done already) - storage->saveConnections(); -} - -void KNetworkManager::timerEvent( TQTimerEvent *e ) -{ - Tray* tray = Tray::getInstance(); - tray->slotUpdateDeviceState(nm_device_state_global); -} - -KNetworkManager::KNetworkManager () : KUniqueApplication () -{ - d = new KNetworkManagerPrivate(); - d->_ctx = this; - - // we need to get informed when shutting down - connect(this, TQT_SIGNAL(shutDown()), this, TQT_SLOT(slotShutDown())); - - // Start the VPN icon timer - // startTimer( 1000 ); // 1-second timer - - // Connect to the VPN bus - vpnproxy = new VPNDBUSPlugin(); - - // create the main-tray-icon - Tray* tray = Tray::getInstance(); - tray->show(); - setMainWidget(tray); - - // create the settings interface - NMSettings::getInstance(); - - // restore all known connections first - Storage* storage = Storage::getInstance(); - storage->restoreConnections(); -} - -KNetworkManager::~KNetworkManager() -{ - delete vpnproxy; - delete d; -} - -#include "knetworkmanager.moc" - diff --git a/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 0355bad..02cd662 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,8 @@ * **************************************************************************/ -// KDE includes +// TDE includes +#include <kglobal.h> #include <kaboutdata.h> #include <kcmdlineargs.h> #include <dcopclient.h> @@ -31,22 +32,23 @@ // TQt includes #include <tqtimer.h> -// KNM includes -#include "knetworkmanager.h" +// 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) 2005, 2006 Novell, Inc."); -static const char* knm_webpage = I18N_NOOP("http://opensuse.org/Projects/KNetworkManager"); +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 ("knetworkmanager", I18N_NOOP("KNetworkManager"), - knm_version, knm_descr, KAboutData::License_GPL, - knm_copy, 0, knm_webpage ); + KAboutData aboutData ("tdenetworkmanager", I18N_NOOP("TDENetworkManager"), + tdenm_version, tdenm_descr, KAboutData::License_GPL, + tdenm_copy, 0, tdenm_webpage ); + aboutData.addAuthor ("Timothy Pearson", I18N_NOOP("TDE Rewrite"), "[email protected]"); aboutData.addAuthor ("Helmut Schaa", I18N_NOOP("Maintainer"), "[email protected]"); aboutData.addAuthor ("Timo Hoenig", I18N_NOOP("Maintainer"), "[email protected]"); aboutData.addAuthor ("Will Stephenson", I18N_NOOP("Additional code"), "[email protected]"); @@ -55,10 +57,20 @@ kdemain (int argc, char* argv[]) KCmdLineArgs::init (argc, argv, &aboutData); - if (KNetworkManager::start ()) { - KNetworkManager app; - app.disableSessionManagement (); - return app.exec (); + if (TDENetworkManager::start()) { + TDENetworkManager app; + 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/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/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#include <tqobject.h> - -#include "secret_storage_plugin.h" - -SecretStoragePlugin::SecretStoragePlugin(TQObject* parent, const char* name, const TQStringList& args) - : Plugin(parent, name, args) -{ - -} - -SecretStoragePlugin::~SecretStoragePlugin() -{ - -} - -bool SecretStoragePlugin::saveSecret(TQString& key, TQMap<TQString, TQString>& secrets) -{ - return false; -} - -void SecretStoragePlugin::restoreSecretsAsync(TQString& key) -{ - // just emit an error - TQMap<TQString, TQString> empty; - emit signalSecretsRestored(key, empty, false); -} - - - -#include "secret_storage_plugin.moc" diff --git a/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 <[email protected]>, <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef KNETWORKMANAGER_SECRET_STORAGE_PLUGIN_H -#define KNETWORKMANAGER_SECRET_STORAGE_PLUGIN_H - -#include <tqwidget.h> -#include <tqmap.h> -#include <tqdbusdata.h> -#include <tqdbusvariant.h> -#include "knetworkmanager-plugin.h" - -#define KNETWORKMANAGER_SECRET_STORAGE_PLUGIN "KNetworkManager/SecretStoragePlugin" - -class SecretStoragePlugin : public Plugin -{ - Q_OBJECT - - public: - SecretStoragePlugin(TQObject*, const char*, const TQStringList&); - virtual ~SecretStoragePlugin(); - - virtual bool saveSecret(TQString& key, TQMap<TQString, TQString>& secrets); - virtual void restoreSecretsAsync(TQString& key); - - signals: - void signalSecretsRestored(TQString& key, TQMap<TQString, TQString>, bool); -}; - - -#endif /* KNETWORKMANAGER_SECRET_STORAGE_PLUGIN_H */ - diff --git a/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/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/knetworkmanager-connection_setting.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.cpp index 50d7423..48d09f0 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,10 +34,10 @@ #include <tqdbusdata.h> #include <tqdbusdatamap.h> -/* 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/knetworkmanager-connection_setting.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting.h index f189117..8264df9 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_8021x.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.cpp index 4904f01..b900ca5 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,12 +34,12 @@ #include <tqdbusdata.h> #include <tqdbusdatamap.h> -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection_setting_8021x.h" -#include "knetworkmanager-accesspoint.h" -#include "knetworkmanager-connection_setting_wireless.h" -#include "knetworkmanager-connection.h" +/* 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/knetworkmanager-connection_setting_8021x.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_8021x.h index a5c593e..77f6ffa 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include <tqdbusdata.h> -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" #include "qbidirectionalmap.h" /* NM */ #include <nm-setting-8021x.h> diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_cdma.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.cpp index 854590c..8b45362 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,10 +34,10 @@ #include <tqdbusdata.h> #include <tqdbusdatamap.h> -/* 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/knetworkmanager-connection_setting_cdma.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_cdma.h index c0825b3..5af53a2 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include <tqdbusdata.h> -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" /* NM headers */ #include <nm-setting-cdma.h> diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_gsm.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.cpp index cd38c3f..c414ce2 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,10 +34,10 @@ #include <tqdbusdata.h> #include <tqdbusdatamap.h> -/* 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 <NetworkManager.h> diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_gsm.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_gsm.h index ac912ae..8ea477b 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include <tqdbusdata.h> -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" /* NM headers */ #include <nm-setting-gsm.h> diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_info.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.cpp index 225d002..11053c7 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,10 +34,10 @@ #include <tqdbusdata.h> #include <tqdbusdatamap.h> -/* 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/knetworkmanager-connection_setting_info.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_info.h index 705387b..2cd0fce 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include <tqdatetime.h> #include <tqdbusdata.h> -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" /* NM headers */ #include <nm-setting-connection.h> diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_ipv4.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.cpp index 15f8978..e6de6ed 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,9 +34,9 @@ #include <tqdbusdata.h> #include <tqdbusdatamap.h> -/* 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/knetworkmanager-connection_setting_ipv4.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ipv4.h index 7788769..773f4cf 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include <tqdbusdata.h> -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" /* NM headers */ #include <nm-setting-ip4-config.h> diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_ppp.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.cpp index 257a012..77481b0 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -37,10 +37,10 @@ #include <tqdbusdata.h> #include <tqdbusdatamap.h> -/* 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/knetworkmanager-connection_setting_ppp.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_ppp.h index 9f72e42..f3625fa 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include <tqdbusdata.h> -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" namespace ConnectionSettings { diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_serial.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.cpp index 4861e7b..25ce87d 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,10 +34,10 @@ #include <tqdbusdata.h> #include <tqdbusdatamap.h> -/* 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/knetworkmanager-connection_setting_serial.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_serial.h index 40099a7..c401ef6 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include <tqdbusdata.h> -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" /* NM headers */ #include <nm-setting-ppp.h> diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_vpn.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.cpp index 22e8b20..07fb9a8 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,9 +34,9 @@ #include <tqdbusdata.h> #include <tqdbusdatamap.h> -/* 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/knetworkmanager-connection_setting_vpn.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_vpn.h index 6850fc2..1e0a174 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include <tqdatetime.h> #include <tqdbusdata.h> -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" /* NM headers */ #include <nm-setting-vpn.h> diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_wired.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.cpp index 03aa61f..237f841 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -37,10 +37,10 @@ /* NM headers */ #include <nm-setting-wired.h> -/* 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/knetworkmanager-connection_setting_wired.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wired.h index 9da930e..475a00a 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -32,7 +32,7 @@ #include <tqobject.h> #include <tqdbusdata.h> -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" #include <nm-setting-wired.h> namespace ConnectionSettings diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.cpp index 2e1db8e..c8fd100 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -35,11 +35,11 @@ #include <tqdbusdata.h> #include <tqdbusdatamap.h> -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection_setting_wireless.h" -#include "knetworkmanager-connection_setting_wireless_security.h" -#include "knetworkmanager-accesspoint.h" +/* 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/knetworkmanager-connection_setting_wireless.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless.h index acdec94..3fdf87a 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -32,7 +32,7 @@ #include <tqobject.h> #include <tqdbusdata.h> -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" #include "qbidirectionalmap.h" /* NM headers */ #include <nm-setting-wireless.h> diff --git a/tdenetworkmanager/src/knetworkmanager-connection_setting_wireless_security.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.cpp index a01f8f6..3844ede 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -34,12 +34,12 @@ #include <tqdbusdata.h> #include <tqdbusdatamap.h> -/* knetworkmanager headers */ -#include "knetworkmanager.h" -#include "knetworkmanager-connection_setting_wireless_security.h" -#include "knetworkmanager-accesspoint.h" -#include "knetworkmanager-connection_setting_wireless.h" -#include "knetworkmanager-connection.h" +/* 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/knetworkmanager-connection_setting_wireless_security.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_setting_wireless_security.h index 187fd37..952f600 100644 --- a/tdenetworkmanager/src/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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,7 +33,7 @@ #include <tqdbusdata.h> -#include "knetworkmanager-connection_setting.h" +#include "tdenetman-connection_setting.h" #include "qbidirectionalmap.h" /* NM */ #include <nm-setting-wireless-security.h> diff --git a/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp new file mode 100644 index 0000000..86ce9ee --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp @@ -0,0 +1,138 @@ +/*************************************************************************** + * + * tdenetman-cellular_device_tray.cpp - A NetworkManager frontend for TDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa <[email protected]>, <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + **************************************************************************/ + +/// TQt includes +#include <tqwidget.h> // for TQt::WidgetFlags + +// TDE includes +#include <kdebug.h> +#include <klocale.h> +#include <kiconloader.h> + +// TDENM 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() {} + + TQString dev; +}; + +void CellularDeviceTray::newConnection() +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(d->dev)); + + // create an appropriate connection + TDENetworkConnection* conn = 0; + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + switch (deviceConnMan->deviceType()) { + case TDENetworkDeviceType::Modem: + conn = new TDEModemConnection(); + nm->loadConnectionAllowedValues(conn); + break; + + default: + break; + } + + // edit the new connection + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, TQByteArray(), tray(), "connect_something", false, TQt::WDestructiveClose); + dlg->show(); +} + + +void CellularDeviceTray::addMenuItems(KPopupMenu* menu) +{ + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(d->dev)); + + // device title + 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 = 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<TDEModemConnection*>(*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->UUID, 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 (TQString dev, KSystemTray * parent, const char * name) + : DeviceTrayComponent (dev, parent, name) +{ + hwdevices = KGlobal::hardwareDevices(); + 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/knetworkmanager-cellular_device_tray.h b/tdenetworkmanager/src/tdenetman-cellular_device_tray.h index 282cc3e..e5aa4cf 100644 --- a/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.h +++ b/tdenetworkmanager/src/tdenetman-cellular_device_tray.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager.h - A NetworkManager frontend for KDE + * tdenetman.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -27,8 +27,8 @@ #ifndef KNETWORKMANAGER_CELLULAR_DEVICE_TRAY_H #define KNETWORKMANAGER_CELLULAR_DEVICE_TRAY_H -// KNM includes -#include "knetworkmanager.h" +// TDENM includes +#include "tdenetman.h" #include "devicetraycomponent.h" // predefs @@ -40,7 +40,7 @@ class CellularDeviceTray : public DeviceTrayComponent Q_OBJECT public: - CellularDeviceTray (CellularDevice*, KSystemTray * parent = 0, const char * name = 0); + CellularDeviceTray (TQString, KSystemTray * parent = 0, const char * name = 0); ~CellularDeviceTray (); void addMenuItems(KPopupMenu* menu); @@ -50,6 +50,7 @@ class CellularDeviceTray : public DeviceTrayComponent private: CellularDeviceTrayPrivate* d; + TDEHardwareDevices* hwdevices; }; #endif /* KNETWORKMANAGER_CELLULAR_DEVICE_TRAY_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-connection_editor.cpp b/tdenetworkmanager/src/tdenetman-connection_editor.cpp index e787a79..5a00c30 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_editor.cpp +++ b/tdenetworkmanager/src/tdenetman-connection_editor.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-connection_editor.cpp - A NetworkManager frontend for KDE + * tdenetman-connection_editor.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -41,18 +41,9 @@ #include <klocale.h> #include <kcombobox.h> -// knm headers -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-connection.h" -#include "knetworkmanager-wired_connection.h" -#include "knetworkmanager-wireless_connection.h" -#include "knetworkmanager-vpn_connection.h" -#include "knetworkmanager-connection_store.h" -#include "knetworkmanager-connection_editor.h" -#include "knetworkmanager-connection_settings_dialog.h" -#include "knetworkmanager-storage.h" -#include "knetworkmanager-vpnservice.h" -#include "knetworkmanager-vpnmanager.h" +// tdenm headers +#include "tdenetman-connection_editor.h" +#include "tdenetman-connection_settings_dialog.h" using namespace ConnectionSettings; @@ -63,28 +54,30 @@ class ConnectionListViewItem : public KListViewItem { public: - ConnectionListViewItem(TQListView* parent, GenericConnection* connection) + ConnectionListViewItem(TQListView* parent, TDENetworkConnection* connection) : 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) + } + else if (_conn->type() == TDENetworkConnectionType::VPN) { setPixmap(0, KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small)); - else + } + else { setPixmap(0, KGlobal::iconLoader()->loadIcon("help", KIcon::Small)); + } } } - GenericConnection* _conn; + TDENetworkConnection* _conn; }; /* @@ -110,8 +103,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); @@ -129,8 +123,9 @@ ConnectionEditorImpl::ConnectionEditorImpl(TQWidget* parent, const char* name, b ConnectionEditorImpl::~ConnectionEditorImpl() { // remove the popupmenu - if (pbNew->popup()) + if (pbNew->popup()) { delete pbNew->popup(); + } } /* @@ -139,7 +134,7 @@ ConnectionEditorImpl::~ConnectionEditorImpl() void ConnectionEditorImpl::slotNewWirelessConnection() { // create a new wireless connection - slotEditNewConnection(new WirelessConnection()); + slotEditNewConnection(new TDEWiFiConnection()); } /* @@ -147,7 +142,7 @@ void ConnectionEditorImpl::slotNewWirelessConnection() */ void ConnectionEditorImpl::slotNewWiredConnection() { - slotEditNewConnection(new WiredConnection()); + slotEditNewConnection(new TDEWiredEthernetConnection()); } /* @@ -155,21 +150,21 @@ void ConnectionEditorImpl::slotNewWiredConnection() */ void ConnectionEditorImpl::slotNewVPNConnection() { - slotEditNewConnection(new VPNConnection()); +// slotEditNewConnection(new TDEVPNConnection()); } /* * */ -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); - connect(dlg, TQT_SIGNAL(connectionSaved()), this, TQT_SLOT(slotRefershConnectionList())); + ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, TQByteArray(), this, "connect_something", false, TQt::WDestructiveClose); + connect(dlg, TQT_SIGNAL(connectionSaved()), this, TQT_SLOT(slotRefreshConnectionList())); dlg->show(); } -void ConnectionEditorImpl::slotRefershConnectionList() +void ConnectionEditorImpl::slotRefreshConnectionList() { fillConnectionList(); } @@ -180,22 +175,22 @@ void ConnectionEditorImpl::slotRefershConnectionList() void ConnectionEditorImpl::slotEditCurrentConnection() { ConnectionListViewItem* item = dynamic_cast<ConnectionListViewItem*>(lvConnections->currentItem()); - if (!item) + if (!item) { return; + } - Connection* conn = item->_conn; - Storage* storage = Storage::getInstance(); - bool hasSecretsStored = storage->hasSecretsStored(conn); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (!nm) { + return; + } + + TDENetworkConnection* conn = item->_conn; // we need the secrets for editing - if (hasSecretsStored) - storage->restoreAllSecrets(conn); + nm->loadConnectionSecrets(conn->UUID); - ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, false, NULL, 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) - storage->saveConnections(); } @@ -205,16 +200,21 @@ void ConnectionEditorImpl::slotEditCurrentConnection() void ConnectionEditorImpl::slotRemoveCurrentConnection() { ConnectionListViewItem* item = dynamic_cast<ConnectionListViewItem*>(lvConnections->currentItem()); - if (!item) + if (!item) { return; + } - ConnectionStore* cstore = ConnectionStore::getInstance(); - Connection* conn = item->_conn; + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (!nm) { + return; + } + + TDENetworkConnection* conn = item->_conn; lvConnections->takeItem(item); delete item; - cstore->removeConnection(conn); + nm->deleteConnection(conn->UUID); } /* @@ -222,29 +222,18 @@ void ConnectionEditorImpl::slotRemoveCurrentConnection() */ void ConnectionEditorImpl::fillConnectionList() { - ConnectionStore* cstore = ConnectionStore::getInstance(); - TQValueList<Connection*> conns = cstore->getConnections(); - TQValueList<Connection*>::Iterator it = conns.begin(); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (!nm) { + return; + } lvConnections->clear(); - for (; it != conns.end(); ++it) - { - GenericConnection* conn = dynamic_cast<GenericConnection*>(*it); - if (conn) - { - Info* info = conn->getInfoSetting(); - if (info) - { - new ConnectionListViewItem(lvConnections, conn); - } - else - kdWarning() << k_funcinfo << "Connection without Info setting, drop it." << endl; - } - else - kdWarning() << k_funcinfo << "non-generic connection, dropping it." << endl; - + 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" +#include "tdenetman-connection_editor.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-connection_editor.h b/tdenetworkmanager/src/tdenetman-connection_editor.h index a0a7567..66283e2 100644 --- a/tdenetworkmanager/src/knetworkmanager-connection_editor.h +++ b/tdenetworkmanager/src/tdenetman-connection_editor.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-connection_editor.h - A NetworkManager frontend for KDE + * tdenetman-connection_editor.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -25,14 +25,15 @@ #ifndef KNETWORKMANAGER_CONNECTION_EDITOR_H #define KNETWORKMANAGER_CONNECTION_EDITOR_H -// qt headers +// tqt headers #include <tqvaluelist.h> -// qt autogenerated headers +// tqt autogenerated headers #include "connection_editor.h" -// knm headers -#include "knetworkmanager-connection_setting.h" +// TDE headers +#include <tdehardwaredevices.h> +#include <tdenetworkconnections.h> class TQWidget; class Device; @@ -56,8 +57,8 @@ class ConnectionEditorImpl : public ConnectionEditor void slotEditCurrentConnection(); void slotNewWirelessConnection(); void slotNewWiredConnection(); - void slotEditNewConnection(Connection* conn); - void slotRefershConnectionList(); + void slotEditNewConnection(TDENetworkConnection* conn); + void slotRefreshConnectionList(); void slotNewVPNConnection(); private: diff --git a/tdenetworkmanager/src/knetworkmanager-menu_subhead.cpp b/tdenetworkmanager/src/tdenetman-menu_subhead.cpp index 5a69cd5..f370ba6 100644 --- a/tdenetworkmanager/src/knetworkmanager-menu_subhead.cpp +++ b/tdenetworkmanager/src/tdenetman-menu_subhead.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-tray.cpp - A NetworkManager frontend for KDE + * tdenetman-tray.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -48,7 +48,7 @@ class WirelessDialog; #include <kconfig.h> #include <kmessagebox.h> -#include "knetworkmanager-menu_subhead.h" +#include "tdenetman-menu_subhead.h" Subhead::Subhead (TQWidget* parent, const char* name, const TQString & caption, const TQPixmap icon) : TQWidget (parent, name) diff --git a/tdenetworkmanager/src/knetworkmanager-menu_subhead.h b/tdenetworkmanager/src/tdenetman-menu_subhead.h index 8891fc4..0ec811a 100644 --- a/tdenetworkmanager/src/knetworkmanager-menu_subhead.h +++ b/tdenetworkmanager/src/tdenetman-menu_subhead.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager.h - A NetworkManager frontend for KDE + * tdenetman.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -44,7 +44,7 @@ #include <tqprogressbar.h> #include <tqguardedptr.h> -#include "knetworkmanager.h" +#include "tdenetman.h" class Subhead : public TQWidget { diff --git a/tdenetworkmanager/src/knetworkmanager-menuitem.cpp b/tdenetworkmanager/src/tdenetman-menuitem.cpp index b13563e..795273f 100644 --- a/tdenetworkmanager/src/knetworkmanager-menuitem.cpp +++ b/tdenetworkmanager/src/tdenetman-menuitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-menuitem.cpp - A NetworkManager frontend for KDE + * tdenetman-menuitem.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006, 2008 Novell, Inc. * @@ -25,7 +25,7 @@ * **************************************************************************/ -#include "knetworkmanager-menuitem.h" +#include "tdenetman-menuitem.h" #include <tqevent.h> #include <tqguardedptr.h> @@ -49,82 +49,69 @@ #include <kconfig.h> #include <kmessagebox.h> -#include <tqdbusobjectpath.h> -#include <tqdbuserror.h> - -#include "knetworkmanager-connection.h" -#include "knetworkmanager-device.h" -#include "knetworkmanager-nm_proxy.h" -#include "knetworkmanager-vpn_plugin.h" - -#if !defined(NM_CHECK_VERSION) -#define NM_CHECK_VERSION(x,y,z) 0 -#endif - -TQString currentVPNDevice; -TQT_DBusObjectPath vpn_attempt_this_conn; - using namespace ConnectionSettings; class NetworkMenuItemPrivate { public: - NetworkMenuItemPrivate(Device* device, Connection* connection) + NetworkMenuItemPrivate(TQString device, TQString connection) : dev(device), conn(connection) { } ~NetworkMenuItemPrivate() {} - - TQGuardedPtr<Device> dev; - TQGuardedPtr<Connection> conn; + + TQString dev; + TQString conn; }; void NetworkMenuItem::slotActivate() { - int id; - TQT_DBusError err; kdDebug() << "NetworkMenuItem::slotActivate()" << endl; - NMProxy* nm = NMProxy::getInstance(); - if (d->dev && d->conn) + TDEHardwareDevices* hwdevices = KGlobal::hardwareDevices(); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(d->dev)); + TDENetworkConnection* conn = nm->findConnectionByUUID(d->conn); + + if (dev && conn) { - NMProxy* nm = NMProxy::getInstance(); - if (nm) + TDENetworkConnectionManager* deviceConnMan = 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 " << 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(conn->UUID); + if ((result == TDENetworkConnectionStatus::Disconnected) + || (result == TDENetworkConnectionStatus::Invalid)) { + // } - else + else { kdDebug() << "ActivateDevice failed" << endl; + } } } - 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->getObjectPath().data()); - TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection(); - TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn); - vpn_attempt_this_conn = d->conn->getObjectPath(); -#if NM_CHECK_VERSION(0,8,992) - nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", d->conn->getObjectPath(), device, act_conn, err); -#else - nm->ActivateConnectionAsync(id,NM_DBUS_SERVICE_USER_SETTINGS, d->conn->getObjectPath(), device, act_conn, err); -#endif + printf("Activate Connection %s on default device\n\r", conn->UUID.ascii()); + + TDENetworkConnectionStatus::TDENetworkConnectionStatus result = nm->initiateConnection(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 (TQString dev, TQString conn, TQObject* parent, const char* name) : TQObject(parent, name) { d = new NetworkMenuItemPrivate(dev, conn); @@ -137,4 +124,4 @@ NetworkMenuItem::~NetworkMenuItem () -#include "knetworkmanager-menuitem.moc" +#include "tdenetman-menuitem.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-menuitem.h b/tdenetworkmanager/src/tdenetman-menuitem.h index 5f9f6eb..d7a3b48 100644 --- a/tdenetworkmanager/src/knetworkmanager-menuitem.h +++ b/tdenetworkmanager/src/tdenetman-menuitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-menuitem.h - A NetworkManager frontend for KDE + * tdenetman-menuitem.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006, 2008 Novell, Inc. * @@ -28,6 +28,9 @@ #include <tqobject.h> +#include <tdehardwaredevices.h> +#include <tdenetworkconnections.h> + class Device; class NetworkMenuItemPrivate; @@ -41,7 +44,7 @@ class NetworkMenuItem : public TQObject Q_OBJECT public: - NetworkMenuItem (Device* dev, ConnectionSettings::Connection* 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/knetworkmanager-nm_vpn_proxy.cpp b/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.cpp index 737f4ef..cfe48ab 100644 --- a/tdenetworkmanager/src/knetworkmanager-nm_vpn_proxy.cpp +++ b/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-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 <kdebug.h> // TQtDBus includes @@ -38,13 +38,13 @@ #include <NetworkManager.h> #include <NetworkManagerVPN.h> -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-nm_vpn_proxy.h" -#include "knetworkmanager-device.h" -#include "knetworkmanager-devicestore.h" -//#include "knetworkmanager-connection.h" -#include "knetworkmanager-connection_store.h" +// TDENM 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 @@ -78,4 +78,4 @@ NMVPNProxy* NMVPNProxy::getInstance() } -#include "knetworkmanager-nm_vpn_proxy.moc" +#include "tdenetman-nm_vpn_proxy.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-nm_vpn_proxy.h b/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.h index af5f8ec..bbd29df 100644 --- a/tdenetworkmanager/src/knetworkmanager-nm_vpn_proxy.h +++ b/tdenetworkmanager/src/tdenetman-nm_vpn_proxy.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-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/knetworkmanager-plugin.cpp b/tdenetworkmanager/src/tdenetman-plugin.cpp index cb1d2b7..c39e8da 100644 --- a/tdenetworkmanager/src/knetworkmanager-plugin.cpp +++ b/tdenetworkmanager/src/tdenetman-plugin.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-plugin.cpp - A NetworkManager frontend for KDE + * tdenetman-plugin.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * @@ -22,7 +22,7 @@ * **************************************************************************/ -#include "knetworkmanager-plugin.h" +#include "tdenetman-plugin.h" Plugin::Plugin(TQObject* parent, const char* name, const TQStringList& ) : TQObject(parent, name) @@ -35,4 +35,4 @@ Plugin::~Plugin() } -#include "knetworkmanager-plugin.moc" +#include "tdenetman-plugin.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-plugin.h b/tdenetworkmanager/src/tdenetman-plugin.h index 3a500ac..9d8a3cc 100644 --- a/tdenetworkmanager/src/knetworkmanager-plugin.h +++ b/tdenetworkmanager/src/tdenetman-plugin.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-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/knetworkmanager-pluginmanager.cpp b/tdenetworkmanager/src/tdenetman-pluginmanager.cpp index b9b22f6..7a6cace 100644 --- a/tdenetworkmanager/src/knetworkmanager-pluginmanager.cpp +++ b/tdenetworkmanager/src/tdenetman-pluginmanager.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-pluginmanager.cpp - A NetworkManager frontend for KDE + * tdenetman-pluginmanager.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * @@ -27,40 +27,40 @@ #include <kdebug.h> #include <klocale.h> -#include "knetworkmanager-pluginmanager.h" +#include "tdenetman-pluginmanager.h" PluginManager* PluginManager::_instance; PluginManager* PluginManager::getInstance() { - if (_instance) + 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<KPluginInfo*>::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it) + for(TQValueList<KPluginInfo*>::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<KPluginInfo*>::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<KPluginInfo*>::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it) - { - if ((*it)->service()->serviceTypes().contains(serviceType) > 0) - if ((*it)->property(property).toString().contains(value)) + for(TQValueList<KPluginInfo*>::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it) { + if ((*it)->service()->serviceTypes().contains(serviceType) > 0) { + if ((*it)->property(property).toString().contains(value)) { ret.append( (*it)->pluginName() ); + } + } } return ret; } @@ -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<KPluginInfo*>::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it) - { + for(TQValueList<KPluginInfo*>::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it) { // load Plugin loadPlugin((*it)->pluginName()); } @@ -125,17 +122,19 @@ Plugin* PluginManager::loadPlugin(const TQString& pluginID) // try to load Plugin int error = 0; KPluginInfo* info = infoForPluginID(pluginID); +<<<<<<< HEAD:tdenetworkmanager/src/knetworkmanager-pluginmanager.cpp Plugin *plugin = KParts::ComponentFactory::createInstanceFromQuery<Plugin>( TQString::fromLatin1( "KNetworkManager/Plugin" ), +======= + Plugin *plugin = KParts::ComponentFactory::createInstanceFromQuery<Plugin>( TQString::fromLatin1( "TDENetworkManager/Plugin" ), +>>>>>>> 75d5225a52e81e369e4bcef45bee258724573688:tdenetworkmanager/src/tdenetman-pluginmanager.cpp 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,13 +171,13 @@ Plugin* PluginManager::loadPlugin(const TQString& pluginID) KPluginInfo * PluginManager::infoForPluginID( const TQString& pluginID ) const { TQValueList<KPluginInfo *>::ConstIterator it; - for ( it = this->_plugins.begin(); it != this->_plugins.end(); ++it ) - { - if ( ( *it )->pluginName() == pluginID ) + for ( it = this->_plugins.begin(); it != this->_plugins.end(); ++it ) { + if ( ( *it )->pluginName() == pluginID ) { return *it; + } } return 0L; } -#include "knetworkmanager-pluginmanager.moc" +#include "tdenetman-pluginmanager.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-pluginmanager.h b/tdenetworkmanager/src/tdenetman-pluginmanager.h index efe6c63..262da0f 100644 --- a/tdenetworkmanager/src/knetworkmanager-pluginmanager.h +++ b/tdenetworkmanager/src/tdenetman-pluginmanager.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-pluginmanager.h - A NetworkManager frontend for KDE + * tdenetman-pluginmanager.h - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * @@ -29,8 +29,8 @@ #include <tqmap.h> #include <tqvaluelist.h> -#include "knetworkmanager-plugin.h" -#include "knetworkmanager.h" +#include "tdenetman-plugin.h" +#include "tdenetman.h" class KPluginInfo; diff --git a/tdenetworkmanager/src/tdenetman-tray.cpp b/tdenetworkmanager/src/tdenetman-tray.cpp new file mode 100644 index 0000000..b8674b1 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-tray.cpp @@ -0,0 +1,970 @@ +/*************************************************************************** + * + * tdenetman-tray.cpp - A NetworkManager frontend for TDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Timo Hoenig <[email protected]>, <[email protected]> + * Will Stephenson <[email protected]>, <[email protected]> + * Valentine Sinitsyn <[email protected]> + * Helmut Schaa <[email protected]>, <[email protected]> + * Alexander Naumov <[email protected]>, <[email protected]> + * Author: Timothy Pearson <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + **************************************************************************/ + +#include <tqsignalmapper.h> +#include <tqevent.h> +#include <tqvbox.h> +#include <tqlayout.h> +#include <tqpushbutton.h> +#include <tqpixmap.h> +#include <tqpixmapcache.h> +#include <tqpainter.h> +#include <tqstyle.h> +#include <tqvaluelist.h> +#include <dcopclient.h> +#include <kdebug.h> +#include <kdialogbase.h> +#include <knotifyclient.h> +#include <knotifydialog.h> +#include <klocale.h> +#include <kstdguiitem.h> +#include <khelpmenu.h> +#include <kprocess.h> +#include <kiconloader.h> +#include <kconfig.h> +#include <kmessagebox.h> + +#include <tqpushbutton.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqapplication.h> +#include <tqdialog.h> + +#include "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 "vpn_tray_component.h" + +#include <stdio.h> + +TDENetworkConnectionStatus::TDENetworkConnectionStatus nm_device_state_global = TDENetworkConnectionStatus::Invalid; + +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, TQByteArray(), 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<TrayComponent*> trayComponents; + DeviceTrayComponent * foregroundTrayComponent; + TQSignalMapper signalMapper; + TQMap<int, TDENetworkConnection*> 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::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(); + + nm->loadConnectionInformation(); + + // clear menu + menu->clear(); + + if (!(nm->backendStatus() & TDENetworkGlobalManagerFlags::BackendUnavailable)) { + // actions for each Device + for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) { + (*it)->addMenuItems(menu); + } + + // Submenu title + Subhead* subhead = new Subhead (menu, "subhead", TQString("Connection Management"), SmallIcon("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<KActionMenu*>(newConnAction); + newConnActionMenu->popupMenu()->clear(); + TQValueList<TrayComponent*>::Iterator it; + for (it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) { + DeviceTrayComponent* dev_comp = dynamic_cast<DeviceTrayComponent*> (*it); + KAction * deviceNewConnAction = 0; + if (dev_comp) { + TDENetworkDevice* dev_comp_dev = dynamic_cast<TDENetworkDevice*>(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 ("); + } + else if (menuCaption.contains("wlan", FALSE) > 0) { + menuCaption = menuCaption.insert(0, "Wireless Connection ("); + } + else if (menuCaption.contains("pan", FALSE) > 0) { + menuCaption = menuCaption.insert(0, "Private Area Connection ("); + } + else { + menuCaption = menuCaption.insert(0, "Unknown Connection ("); + } + menuCaption = menuCaption.append(")"); + deviceNewConnAction = actionCollection ()->action (actionName); + if (!deviceNewConnAction) { + deviceNewConnAction = new KAction (menuCaption, 0, (*it), TQT_SLOT(newConnection()), actionCollection(), actionName); + } + newConnActionMenu->insert(deviceNewConnAction); + } + } + // New VPN connection option + ++it; + KAction * deviceNewConnAction = 0; + TQString menuCaption = "VPN Connection"; + TQString actionName = TQString("new_connection_%1").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"); + TQT_BASE_OBJECT_NAME::disconnect( newConnAction, TQT_SIGNAL(activated()) ); + TQT_BASE_OBJECT_NAME::connect( newConnAction, TQT_SIGNAL(activated()), d->trayComponents[0], TQT_SLOT(newConnection())); + } + if (newConnAction) { + newConnAction->plug(menu); + } + + // turn things off + if (nm) { + KActionMenu* disableStuffActionMenu = static_cast<KActionMenu*>(actionCollection ()->action ("deactivate_menu") ); + disableStuffActionMenu->popupMenu()->clear(); + 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<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) + { + TrayComponent* comp = *it; + if (comp->getToolTipText().isEmpty()) { + continue; + } + if (!tooltip.isEmpty()) { + tooltip += "\n\n"; + } + tooltip += comp->getToolTipText().join("\n"); + } + if (!tooltip.isEmpty()) { + TQToolTip::add (this, tooltip); + } +} + +void +Tray::slotSecretsNeeded(TDENetworkConnection* connection, const TQStringList& hints, bool request_new) +{ + // For now assume secrets are already in NM... +} + +void Tray::slotAddDeviceTrayComponent(TQString dev) +{ + createDeviceTrayComponent(dev); +} + +void Tray::slotRemoveDeviceTrayComponent(TQString dev) +{ + for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) + { + DeviceTrayComponent* dev_comp = dynamic_cast<DeviceTrayComponent*>(*it); + if (!dev_comp) { + continue; + } + + if (dev_comp->device() == dev) + { + if (d->foregroundTrayComponent && dev_comp->device() == d->foregroundTrayComponent->device() ) { + d->foregroundTrayComponent = 0; + } + + // remove the appropriate action + TDENetworkDevice* dev_comp_dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(dev_comp->device())); + TQString actionName = TQString("new_connection_%1").arg(dev_comp_dev->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(TQString dev) +{ + bool trayExists = false; + + // check if we have already a trayicon for this device + for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) + { + DeviceTrayComponent* dev_comp = dynamic_cast<DeviceTrayComponent*> (*it); + if (dev_comp) + if (dev_comp->device() == dev) + { + trayExists = true; + break; + } + } + + // create the appropriate device tray icon + if (!trayExists) + { + DeviceTrayComponent* devTray = 0; + TDENetworkDevice* new_tray_dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(dev)); + TDENetworkConnectionManager* deviceConnMan = new_tray_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 << " 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::createVPNTrayComponent() +{ + bool trayExists = false; + + // check if we have already a trayicon for this device + for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) + { + VPNTrayComponent* vpn_comp = dynamic_cast<VPNTrayComponent*> (*it); + if (vpn_comp) + { + trayExists = true; + break; + } + } + + // create the appropriate device tray icon + if (!trayExists) + { + TrayComponent* devTray = new VPNTrayComponent(this, "vpn_device_tray"); + if(devTray) + { + d->trayComponents.append(devTray); + //WILLTODO: sort + } + } +} + +void Tray::updateDeviceTrays() +{ + // create one tray-icon for each device + 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<TDENetworkDevice*>(*it); + if (dev) { + createDeviceTrayComponent(dev->uniqueID()); + } + else { + kdWarning() << k_funcinfo << "got a NULL-Device" << endl; + } + } + + // add the VPN componenet as it is not associated with a device + createVPNTrayComponent(); +} + +void Tray::mousePressEvent( TQMouseEvent *e ) +{ + if ( !TQT_TQRECT_OBJECT(rect()).contains( e->pos() ) ) { + return; + } + switch ( e->button() ) { + case Qt::LeftButton: + contextMenuAboutToShow(contextMenu()); + contextMenu()->popup(e->globalPos()); + break; + default: + KSystemTray::mousePressEvent( e ); + break; + } +} + +void Tray::slotDeactivateConnection(int index) +{ + TDENetworkConnection* conn = d->act_conn_map[index]; + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + if (!nm) return; + + if (conn) { + nm->deactivateConnection(conn->UUID); + } +} + +void Tray::connectTrayDeviceManager() { + if (d->foregroundTrayComponent) { + TDENetworkDevice* foreground_tray_dev = dynamic_cast<TDENetworkDevice*>(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<TDENetworkDevice*>(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<TDENetworkDevice*>(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) +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + DeviceTrayComponent * dtc = dynamic_cast<DeviceTrayComponent*>(component); + if (dtc) { + TDENetworkDevice* dtc_comp_dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(dtc->device())); + kdDebug() << k_funcinfo << dtc_comp_dev->deviceNode() << " : " << needsIt << endl; + TDENetworkDevice * device = dtc_comp_dev; + if (needsIt) { + if (d->foregroundTrayComponent) { + disconnectTrayDeviceManager(); + } + d->foregroundTrayComponent = dtc; + connectTrayDeviceManager(); + } + else { + disconnectTrayDeviceManager(); + + // use active default + TQStringList defaultDevices = nm->defaultNetworkDevices(); + if (defaultDevices.count() > 0) { + // identify the new foreground + for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) { + DeviceTrayComponent* newDtc = dynamic_cast<DeviceTrayComponent*> (*it); + if ( newDtc && newDtc->device() == defaultDevices[0] ) { + d->foregroundTrayComponent = newDtc; + break; + } + } + kdDebug() << " Device " << dtc_comp_dev->deviceNode() << " background, new foreground device: " << device->deviceNode() << endl; + connectTrayDeviceManager(); + updateTrayDeviceManagerState(); + } + } + } +} + +void Tray::slotUpdateDeviceState() +{ + // FIXME +} + +void Tray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus prevState, TQString hwAddress) +{ + printf("Device state: %d\n\r", newState); + + updateTrayIcon(newState); + updateActiveConnection(newState); +} + +void Tray::trayUiChanged() +{ + DeviceTrayComponent * dtc = d->foregroundTrayComponent; + if (dtc) { + TDENetworkDevice* dtc_comp_dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(dtc->device())); + TDENetworkConnectionManager* deviceConnMan = dtc_comp_dev->connectionManager(); + updateTrayIcon(deviceConnMan->deviceInformation().statusFlags); + } +} + +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<TDEVPNConnection*>(*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 + 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"); +// } + + TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags current_vpn_state = (KGlobal::networkManager()->backendStatus() & TDENetworkGlobalManagerFlags::VPNMask); + if ((current_vpn_state & TDENetworkGlobalManagerFlags::VPNFailed) || (current_vpn_state & TDENetworkGlobalManagerFlags::VPNDisconnected)) { + active_vpn = 0; + } + + // stop the old movie to avoid unnecessary wakups + DeviceTrayComponent * dtc = d->foregroundTrayComponent; + + if (movie()) { + movie()->pause(); + } + + 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(); + } + else if (!dtc->pixmapForState(state).isNull()) { + setPixmap(dtc->pixmapForState(state)); + } + else { + setPixmap(loadIcon("tdenetworkmanager")); + } + } + else { + setPixmap(loadIcon("tdenetworkmanager")); + } + } + 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 + DeviceTrayComponent * dtc = d->foregroundTrayComponent; + + if (movie()) + movie()->pause(); + + if (dtc) { + if (current_vpn_state & TDENetworkGlobalManagerFlags::VPNConnected) { + setPixmap(loadIcon("nm_device_vpn")); + } + 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 & TDENetworkGlobalManagerFlags::VPNEstablishingLink) + || (current_vpn_state & TDENetworkGlobalManagerFlags::VPNNeedAuthorization)) { + setMovie(TQMovie(KGlobal::iconLoader()->moviePath("nm_stage02_connecting_vpn", KIcon::Panel))); + } + if ((current_vpn_state & TDENetworkGlobalManagerFlags::VPNConfiguringProtocols) + || (current_vpn_state & TDENetworkGlobalManagerFlags::VPNVerifyingProtocols)) { + setMovie(TQMovie(KGlobal::iconLoader()->moviePath("nm_stage03_connecting_vpn", KIcon::Panel))); + } + + // start at the same frame as the movie before + if (frame > 0) + movie()->step(frame); + + // start the animation + movie()->unpause(); + } + } + } + + nm_device_state_global = state; + //printf("Device state: %d\n\r", nm_device_state_global); +} + +void Tray::updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) +{ + if (state != TDENetworkConnectionStatus::Connected) { + return; + } +} + +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()) ); +} + +void Tray::slotDeviceRemovedNotify(TDENetworkDevice* dev) +{ + kdDebug() << "Tray::slotDeviceRemovedNotify" << endl; + KNotifyClient::event( winId(), "tdenm-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(), "tdenm-nm-connecting", i18n("NetworkManager is connecting") ); + } + else if (nm_state & TDENetworkGlobalManagerFlags::Disconnected) { + KNotifyClient::event( winId(), "tdenm-nm-disconnected", i18n("NetworkManager is now disconnected") ); + } + else if (nm_state & TDENetworkGlobalManagerFlags::Connected) { + KNotifyClient::event( winId(), "tdenm-nm-connected", i18n("NetworkManager is now connected") ); + } + else if (nm_state & TDENetworkGlobalManagerFlags::Sleeping) { + KNotifyClient::event( winId(), "tdenm-nm-sleeping", i18n("TDENetworkManager Offline") ); + } + else if (nm_state & TDENetworkGlobalManagerFlags::Unknown) { + // + } +} + +void Tray::slotEditNotifications() +{ + KNotifyDialog::configure(this); +} + +void Tray::slotGenericDeviceAdded(TDEGenericDevice *dev) +{ + TDENetworkDevice* netdev = dynamic_cast<TDENetworkDevice*>(dev); + if (netdev) { + slotAddDeviceTrayComponent(netdev->uniqueID()); + slotDeviceAddedNotify(netdev); + } +} + +void Tray::slotGenericDeviceRemoved(TDEGenericDevice *dev) +{ + TDENetworkDevice* netdev = dynamic_cast<TDENetworkDevice*>(dev); + if (netdev) { + slotRemoveDeviceTrayComponent(netdev->uniqueID()); + slotDeviceRemovedNotify(netdev); + } +} + +void Tray::slotGenericHardwareEvent(TDEHardwareEvent::TDEHardwareEvent event, TQString) +{ + if (event == TDEHardwareEvent::HardwareListModified) { + updateDeviceTrays(); + connectTrayDeviceManager(); + } +} + +void Tray::slotVPNEventHandler(TDENetworkVPNEventType::TDENetworkVPNEventType event, TQString message) +{ + if (event == TDENetworkVPNEventType::LoginBanner) { + slotVPNBannerShow(message); + } +} + +Tray::Tray() : KSystemTray() +{ + hwdevices = KGlobal::hardwareDevices(); + + 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 + 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(KGlobal::networkManager(), TQT_SIGNAL(vpnEvent(TDENetworkVPNEventType::TDENetworkVPNEventType, TQString)), this, TQT_SLOT(slotVPNEventHandler(TDENetworkVPNEventType::TDENetworkVPNEventType, TQString))); + + + // 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/knetworkmanager-tray.h b/tdenetworkmanager/src/tdenetman-tray.h index cbce02b..fc02aa7 100644 --- a/tdenetworkmanager/src/knetworkmanager-tray.h +++ b/tdenetworkmanager/src/tdenetman-tray.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager.h - A NetworkManager frontend for KDE + * tdenetman.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -49,7 +49,7 @@ #include <tqprogressbar.h> #include <tqguardedptr.h> -#include "knetworkmanager.h" +#include "tdenetman.h" namespace ConnectionSettings { @@ -84,39 +84,47 @@ 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 slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus prevState, TQString hwAddress); void slotNewVPNConnection(); void slotVPNBannerShow(const TQString& vpnbanner); - protected slots: + protected slots: void updateDeviceTrays(); - void slotAddDeviceTrayComponent(Device*); - void slotRemoveDeviceTrayComponent(Device*); + void slotAddDeviceTrayComponent(TQString); + void slotRemoveDeviceTrayComponent(TQString); void slotDeactivateConnection(int); void trayComponentNeedsCenterStage(TrayComponent*, bool); void trayUiChanged(); void slotEditNotifications(); + private slots: + void slotGenericDeviceAdded(TDEGenericDevice*); + void slotGenericDeviceRemoved(TDEGenericDevice*); + void slotGenericHardwareEvent(TDEHardwareEvent::TDEHardwareEvent, TQString); + void slotVPNEventHandler(TDENetworkVPNEventType::TDENetworkVPNEventType event, TQString message); + private: - void updateTrayIcon(NMDeviceState); - void updateActiveConnection(NMDeviceState); - void mousePressEvent( TQMouseEvent *e ); + void updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + void updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus); + void mousePressEvent(TQMouseEvent *e); void createVPNTrayComponent(); - void createDeviceTrayComponent(Device*); - void enterEvent (TQEvent*); + void createDeviceTrayComponent(TQString); + void enterEvent(TQEvent*); + void connectTrayDeviceManager(); + void disconnectTrayDeviceManager(); + void updateTrayDeviceManagerState(); TrayPrivate* d; - + TDEHardwareDevices* hwdevices; }; class NewSecretsDialog : public TQDialog @@ -125,7 +133,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 +142,7 @@ class NewSecretsDialog : public TQDialog void reject(); private: - ConnectionSettings::Connection* _connection; + TDENetworkConnection* _connection; }; #endif /* KNETWORKMANAGER_TRAY_H */ diff --git a/tdenetworkmanager/src/knetworkmanager-vpnauthenticationdialog.cpp b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp index ffeb933..4b100ed 100644 --- a/tdenetworkmanager/src/knetworkmanager-vpnauthenticationdialog.cpp +++ b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-vpnauthenticationdialog.cpp - A NetworkManager frontend for KDE + * tdenetman-vpnauthenticationdialog.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * @@ -38,32 +38,20 @@ #include <kiconloader.h> #include <tqmap.h> -#include <tqdbusobjectpath.h> -#include <tqdbuserror.h> - -#include "knetworkmanager-vpnservice.h" -#include "knetworkmanager-vpnmanager.h" -#include "knetworkmanager-vpnauthenticationdialog.h" -#include "knetworkmanager-vpn_connection.h" -#include "knetworkmanager-nm_proxy.h" -#include "knetworkmanager-connection_setting_vpn.h" -#include "knetworkmanager-connection_setting_info.h" - -extern TQT_DBusObjectPath vpn_attempt_this_conn; - -using namespace ConnectionSettings; - +#include "tdenetman-vpnservice.h" +#include "tdenetman-vpnmanager.h" +#include "tdenetman-vpnauthenticationdialog.h" /* * 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,44 +107,18 @@ VPNAuthenticationDialog::~VPNAuthenticationDialog() bool VPNAuthenticationDialog::close(bool alsoDelete) { - // no secrets provided, tell NM - _conn->slotSecretsError(); return AuthenticationDialog::close(alsoDelete); } void VPNAuthenticationDialog::ok() { - // Good, we have new secrets now, update the settings - TQMap<TQString, TQString> mypwds; - - mypwds = _vpnAuthWidget->getPasswords(); - ConnectionSetting* propcore = _conn->getVPNSettingConnectionCore(); - SettingsMap othersettingsmap = propcore->toMap(); - - // Pull the username and gateway out of mypwds to stuff in the NM standard settings matrix - othersettingsmap.insert("user", TQT_DBusData::fromString(mypwds["user"])); - mypwds.erase("user"); - othersettingsmap.insert("domain", TQT_DBusData::fromString(mypwds["domain"])); - mypwds.erase("domain"); -// othersettingsmap.erase("Commit to disk"); -// if (chkStorePasswordsPermanent->isChecked() == true) { -// othersettingsmap.insert("Commit to disk", TQT_DBusData::fromString("true")); -// } -// else { -// othersettingsmap.insert("Commit to disk", TQT_DBusData::fromString("false")); -// } - - propcore->fromMap(othersettingsmap); - VPN* prop = dynamic_cast<VPN*>(propcore); - prop->setSecrets(mypwds); - _conn->slotSecretsProvided(prop); TQDialog::done(0); } -void VPNAuthenticationDialog::setPasswords(TQString name, TQString value) { - if (value.length() > 0) { +void VPNAuthenticationDialog::setPasswords(TDENetworkSettingsMap secrets) { + if (secrets.count() > 0) { chkStorePasswordsPermanent->setChecked(true); - _vpnAuthWidget->setPasswords(name, value); + _vpnAuthWidget->setPasswords(secrets); } } @@ -169,11 +131,8 @@ void VPNAuthenticationDialog::cancel() printf("Attempting to deactivate VPN connection...\n\r"); - // Disconnect the attempted connection - _conn->slotSecretsError(); - // Quit the dialog TQDialog::done(1); } -#include "knetworkmanager-vpnauthenticationdialog.moc" +#include "tdenetman-vpnauthenticationdialog.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-vpnauthenticationdialog.h b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h index 8c43e7d..750526d 100644 --- a/tdenetworkmanager/src/knetworkmanager-vpnauthenticationdialog.h +++ b/tdenetworkmanager/src/tdenetman-vpnauthenticationdialog.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-authenticationdialog.h - A NetworkManager frontend for KDE + * tdenetman-authenticationdialog.h - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * @@ -30,28 +30,26 @@ #include <kprocess.h> #include <kconfig.h> -#include "knetworkmanager.h" +#include <tdehardwaredevices.h> +#include <tdenetworkconnections.h> + +#include "tdenetman.h" #include "vpnauthentication.h" -#include "knetworkmanager-vpnplugin.h" -#include "knetworkmanager-vpnmanager.h" +#include "tdenetman-vpnplugin.h" +#include "tdenetman-vpnmanager.h" -class KNetworkManager; +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); + void setPasswords(TDENetworkSettingsMap secrets); virtual bool close(bool); protected slots: @@ -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 new file mode 100644 index 0000000..aa777f1 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-vpnmanager.cpp @@ -0,0 +1,126 @@ +/*************************************************************************** + * + * tdenetman-vpnmanager.cpp - A NetworkManager frontend for TDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Timo Hoenig <[email protected]>, <[email protected]> + * Helmut Schaa <[email protected]>, <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + **************************************************************************/ + +#include <klocale.h> +#include <tqdir.h> +#include <kdebug.h> +#include <kconfig.h> + +#include "tdenetman-vpnmanager.h" +#include "tdenetman-vpnservice.h" +#include "tdenetman-vpnplugin.h" + +/* + * class VPNManager + * + */ +VPNServiceList +VPNManager::getVPNServices () +{ + VPNServiceList list; + + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkVPNTypeList availablePlugins = nm->availableVPNTypes(); + + 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(serviceString, serviceString, TQT_TQOBJECT(TDENetworkManager::getInstance())); + if (!vpnservice->getVPNPlugin()) { + delete vpnservice; + } + else { + list.push_back(vpnservice); + } + } + } + + return list; +} + +VPNService* +VPNManager::getVPNService(TQString service_type) +{ + VPNServiceList list; + + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkVPNTypeList availablePlugins = nm->availableVPNTypes(); + + 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(service_type, service_type, TQT_TQOBJECT(TDENetworkManager::getInstance())); + if (!vpnservice->getVPNPlugin()) { + delete vpnservice; + } + else { + return vpnservice; + } + } + } + } + + return NULL; +} + +#include "tdenetman-vpnmanager.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-vpnmanager.h b/tdenetworkmanager/src/tdenetman-vpnmanager.h index 769d2c3..d80e7c5 100644 --- a/tdenetworkmanager/src/knetworkmanager-vpnmanager.h +++ b/tdenetworkmanager/src/tdenetman-vpnmanager.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-vpnmanager.h - A NetworkManager frontend for KDE + * tdenetman-vpnmanager.h - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * @@ -26,16 +26,13 @@ #ifndef KNETWORKMANAGER_VPNMANAGER_H #define KNETWORKMANAGER_VPNMANAGER_H -#include <NetworkManager/NetworkManager.h> -#include <NetworkManager/NetworkManagerVPN.h> - #include <tqobject.h> #include <tqguardedptr.h> -#include "knetworkmanager.h" -#include "knetworkmanager-vpnplugin.h" +#include "tdenetman.h" +#include "tdenetman-vpnplugin.h" -class KNetworkManager; +class TDENetworkManager; class VPNService; typedef TQValueList<VPNService*> VPNServiceList; diff --git a/tdenetworkmanager/src/knetworkmanager-vpnplugin.cpp b/tdenetworkmanager/src/tdenetman-vpnplugin.cpp index 02ef8fe..65e1b96 100644 --- a/tdenetworkmanager/src/knetworkmanager-vpnplugin.cpp +++ b/tdenetworkmanager/src/tdenetman-vpnplugin.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-vpnplugin.cpp - A NetworkManager frontend for KDE + * tdenetman-vpnplugin.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * @@ -24,7 +24,7 @@ #include <tqwidget.h> -#include "knetworkmanager-vpnplugin.h" +#include "tdenetman-vpnplugin.h" /*********************** * class VPNConfigWidget @@ -41,19 +41,24 @@ VPNConfigWidget::VPNConfigWidget(TQWidget* parent, const char* name) } -void VPNConfigWidget::setVPNData(const TQStringList& /*routes*/, const TQMap<TQString, TQString>& /*properties*/) +void VPNConfigWidget::setVPNData(TDENetworkSingleRouteConfigurationList& /*routes*/, TDENetworkSettingsMap& /*properties*/, TDENetworkSettingsMap& /*secrets*/) { } -TQMap<TQString, TQString> VPNConfigWidget::getVPNProperties() +TDENetworkSettingsMap VPNConfigWidget::getVPNProperties() { - return TQMap<TQString, TQString>(); + return TDENetworkSettingsMap(); } -TQStringList VPNConfigWidget::getVPNRoutes() +TDENetworkSettingsMap VPNConfigWidget::getVPNSecrets() { - return TQStringList(); + return TDENetworkSettingsMap(); +} + +TDENetworkSingleRouteConfigurationList VPNConfigWidget::getVPNRoutes() +{ + return TDENetworkSingleRouteConfigurationList(); } bool VPNConfigWidget::hasChanged() @@ -67,7 +72,7 @@ bool VPNConfigWidget::isValid(TQStringList& /*err_msg*/) } /****************************** -* class VPNAuthentiactionWidget +* class VPNAuthenticationWidget ******************************/ VPNAuthenticationWidget::VPNAuthenticationWidget(TQWidget* parent, const char* name) @@ -81,17 +86,17 @@ VPNAuthenticationWidget::~VPNAuthenticationWidget() } -TQMap<TQString, TQString> VPNAuthenticationWidget::getPasswords() +TDENetworkSettingsMap VPNAuthenticationWidget::getPasswords() { - return TQMap<TQString, TQString>(); + return TDENetworkSettingsMap(); } -void VPNAuthenticationWidget::setPasswords(TQString name, TQString value) +void VPNAuthenticationWidget::setPasswords(TDENetworkSettingsMap secrets) { } -void VPNAuthenticationWidget::setVPNData(const TQStringList& /*routes*/, const TQMap<TQString, TQString>& /*properties*/) +void VPNAuthenticationWidget::setVPNData(TDENetworkSingleRouteConfigurationList& /*routes*/, TDENetworkSettingsMap& /*properties*/, TDENetworkSettingsMap& /*secrets*/) { } @@ -125,4 +130,4 @@ VPNAuthenticationWidget* VPNPlugin::CreateAuthenticationWidget(TQWidget*) return NULL; } -#include "knetworkmanager-vpnplugin.moc" +#include "tdenetman-vpnplugin.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-vpnplugin.h b/tdenetworkmanager/src/tdenetman-vpnplugin.h index 3b8b625..0ec909c 100644 --- a/tdenetworkmanager/src/knetworkmanager-vpnplugin.h +++ b/tdenetworkmanager/src/tdenetman-vpnplugin.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-vpnplugin.h - A NetworkManager frontend for KDE + * tdenetman-vpnplugin.h - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * @@ -27,11 +27,13 @@ #include <tqwidget.h> #include <tqmap.h> -#include <tqdbusdata.h> -#include <tqdbusvariant.h> -#include "knetworkmanager-plugin.h" -#define KNETWORKMANAGER_VPNPLUGIN "KNetworkManager/VPNPlugin" +#include <tdehardwaredevices.h> +#include <tdenetworkconnections.h> + +#include "tdenetman-plugin.h" + +#define KNETWORKMANAGER_VPNPLUGIN "TDENetworkManager/VPNPlugin" class VPNConfigWidget : public TQWidget { @@ -41,9 +43,10 @@ class VPNConfigWidget : public TQWidget virtual ~VPNConfigWidget(); VPNConfigWidget(TQWidget* parent = NULL, const char* name = NULL); - virtual void setVPNData(const TQStringList&, const TQMap<TQString,TQString>&); - virtual TQMap<TQString, TQString> getVPNProperties(); - virtual TQStringList getVPNRoutes(); + virtual void setVPNData(TDENetworkSingleRouteConfigurationList&, TDENetworkSettingsMap&, TDENetworkSettingsMap&); + virtual TDENetworkSettingsMap getVPNProperties(); + virtual TDENetworkSettingsMap getVPNSecrets(); + virtual TDENetworkSingleRouteConfigurationList getVPNRoutes(); virtual bool hasChanged(); virtual bool isValid(TQStringList&); }; @@ -56,9 +59,9 @@ class VPNAuthenticationWidget : public TQWidget virtual ~VPNAuthenticationWidget(); VPNAuthenticationWidget(TQWidget* parent = NULL, const char* name = NULL); - virtual void setVPNData(const TQStringList&, const TQMap<TQString, TQString>&); - virtual TQMap<TQString, TQString> getPasswords(); - virtual void setPasswords(TQString value, TQString data); + virtual void setVPNData(TDENetworkSingleRouteConfigurationList&, TDENetworkSettingsMap&, TDENetworkSettingsMap&); + virtual TDENetworkSettingsMap getPasswords(); + virtual void setPasswords(TDENetworkSettingsMap secrets); virtual bool needsUserInteraction(); }; diff --git a/tdenetworkmanager/src/knetworkmanager-vpnservice.cpp b/tdenetworkmanager/src/tdenetman-vpnservice.cpp index 84daa0c..d97cf82 100644 --- a/tdenetworkmanager/src/knetworkmanager-vpnservice.cpp +++ b/tdenetworkmanager/src/tdenetman-vpnservice.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-vpnservice.cpp - A NetworkManager frontend for KDE + * tdenetman-vpnservice.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * @@ -36,9 +36,9 @@ #include <kconfig.h> #include <kplugininfo.h> -#include "knetworkmanager-pluginmanager.h" -#include "knetworkmanager-vpnservice.h" -#include "knetworkmanager-vpnplugin.h" +#include "tdenetman-pluginmanager.h" +#include "tdenetman-vpnservice.h" +#include "tdenetman-vpnplugin.h" /* * class VPNService @@ -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) - { - TQStringList list = plugMan->getPluginList("KNetworkManager/VPNPlugin", "X-NetworkManager-Services", serviceName); - if (list.size() > 0) - { - // get the first VPN Plugin handling our VPNService + if (plugMan) { + TQStringList list = plugMan->getPluginList("TDENetworkManager/VPNPlugin", "X-NetworkManager-Services", serviceName); + if (list.size() > 0) { + // get the first VPN Plugin handling our VPNService VPNPlugin* vpnPlugin = dynamic_cast<VPNPlugin*>( plugMan->getPlugin(list.first()) ); if (vpnPlugin) { @@ -120,4 +118,4 @@ TQString VPNService::getName() const return _name; } -#include "knetworkmanager-vpnservice.moc" +#include "tdenetman-vpnservice.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-vpnservice.h b/tdenetworkmanager/src/tdenetman-vpnservice.h index 51a03f6..ed6004f 100644 --- a/tdenetworkmanager/src/knetworkmanager-vpnservice.h +++ b/tdenetworkmanager/src/tdenetman-vpnservice.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-vpnservice.h - A NetworkManager frontend for KDE + * tdenetman-vpnservice.h - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. * @@ -26,16 +26,13 @@ #ifndef KNETWORKMANAGER_VPN_SERVICE_H #define KNETWORKMANAGER_VPN_SERVICE_H -#include <NetworkManager/NetworkManager.h> -#include <NetworkManager/NetworkManagerVPN.h> - #include <tqobject.h> #include <tqguardedptr.h> -#include "knetworkmanager.h" -#include "knetworkmanager-vpnplugin.h" +#include "tdenetman.h" +#include "tdenetman-vpnplugin.h" -class KNetworkManager; +class TDENetworkManager; class VPNService; class KConfigGroup; diff --git a/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp new file mode 100644 index 0000000..8a91142 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp @@ -0,0 +1,157 @@ +/*************************************************************************** + * + * tdenetman-wired_device_tray.cpp - A NetworkManager frontend for TDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa <[email protected]>, <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + **************************************************************************/ + +// TQt includes +#include <tqevent.h> +#include <tqvbox.h> +#include <tqlayout.h> +#include <tqpushbutton.h> +#include <tqbitmap.h> +#include <tqimage.h> +#include <tqpixmap.h> +#include <tqpixmapcache.h> +#include <tqpainter.h> +#include <tqstyle.h> +#include <tqstring.h> + +// TDE includes +#include <kdebug.h> +#include <klocale.h> +#include <kiconloader.h> + +// TQt DBus +#include <tqdbusobjectpath.h> + + +// TDENM 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() {} + + 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, TQByteArray(), tray(), "connect_something", false, TQt::WDestructiveClose); + dlg->show(); +} + + +void WiredDeviceTray::addMenuItems(KPopupMenu* menu) +{ + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(d->dev)); + + // device title + 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 = 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 = 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<TDEWiredEthernetConnection*>(*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->UUID, 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 (TQString dev, KSystemTray * parent, const char * name ) + : DeviceTrayComponent (dev, parent, name) +{ + hwdevices = KGlobal::hardwareDevices(); + 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/knetworkmanager-wired_device_tray.h b/tdenetworkmanager/src/tdenetman-wired_device_tray.h index 7fcab3b..53d8ad1 100644 --- a/tdenetworkmanager/src/knetworkmanager-wired_device_tray.h +++ b/tdenetworkmanager/src/tdenetman-wired_device_tray.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager.h - A NetworkManager frontend for KDE + * tdenetman.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -27,10 +27,10 @@ #ifndef KNETWORKMANAGER_WIRED_DEVICE_TRAY_H #define KNETWORKMANAGER_WIRED_DEVICE_TRAY_H -// KNM includes +// TDENM includes #include "devicetraycomponent.h" -#include "knetworkmanager.h" +#include "tdenetman.h" // predefs class WiredDevice; @@ -42,7 +42,7 @@ class WiredDeviceTray : public DeviceTrayComponent public: - WiredDeviceTray (WiredDevice*, KSystemTray * parent = 0, const char * name = 0); + WiredDeviceTray (TQString, KSystemTray * parent = 0, const char * name = 0); ~WiredDeviceTray (); void addMenuItems(KPopupMenu* menu); @@ -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 new file mode 100644 index 0000000..337df5f --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp @@ -0,0 +1,474 @@ +/*************************************************************************** + * + * tdenetman-wireless_device_tray.cpp - A NetworkManager frontend for TDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa <[email protected]>, <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + **************************************************************************/ + +// TQt includes +#include <tqevent.h> +#include <tqvbox.h> +#include <tqlayout.h> +#include <tqpushbutton.h> +#include <tqbitmap.h> +#include <tqimage.h> +#include <tqpixmap.h> +#include <tqpixmapcache.h> +#include <tqpainter.h> +#include <tqstyle.h> +#include <tqstring.h> +#include <tqguardedptr.h> + +// TDE includes +#include <kdebug.h> +#include <kiconloader.h> +#include <klocale.h> +#include <knotifyclient.h> + +// TDENM 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; + +class WirelessDeviceTrayPrivate +{ + public: + WirelessDeviceTrayPrivate() :dev(0), activeAccessPoint(0) { } + ~WirelessDeviceTrayPrivate() {} + + TQString dev; + TQGuardedPtr<TDENetworkWiFiAPInfo> activeAccessPoint; +}; + +TQStringList WirelessDeviceTray::getToolTipText() +{ + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(d->dev)); + + TQStringList tooltip = DeviceTrayComponent::getToolTipText(); + + TDENetworkConnectionManager* deviceConnMan = 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() +{ + newConnection(0); +} + +void WirelessDeviceTray::newConnection(int id) +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + // create a new wireless connection + TDENetworkConnection* conn = new TDEWiFiConnection(); + nm->loadConnectionAllowedValues(conn); + + // open a dialog for editing the connection + 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(); +} + +bool WirelessDeviceTray::findMatchingNetwork(const TDEWiFiConnection* conn, const TQValueList<WirelessNetwork>& nets, WirelessNetwork& net) +{ + const TDEWiFiConnection* wireless = dynamic_cast<const TDEWiFiConnection*>(conn); + + if (!wireless) { + return false; + } + + for (TQValueList<WirelessNetwork>::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<TDEWiFiConnection*>& connections) +{ + // try to find a connection matching this network + for (TQValueList<TDEWiFiConnection*>::ConstIterator it = connections.begin(); it != connections.end(); ++it) { + const TDEWiFiConnection* wireless = dynamic_cast<const TDEWiFiConnection*>(*it); + + if (!wireless) { + continue; + } + + if (wireless->SSID == net.getSsid()) + { + return *it; + } + } + + return NULL; +} + +void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu) +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(d->dev)); + + printf("Updating wireless network list\n\r"); + + // get all wireless networks + TQValueList<WirelessNetwork> nets = WirelessManager::getWirelessNetworks(dev); + + // get all wireless connections + TQValueList<TDEWiFiConnection*> conns = WirelessManager::getWirelessConnections(); + + // get the currently active connection + TDENetworkConnectionManager* deviceConnMan = 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<TDEWiFiConnection*>::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)->UUID, + 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<TDEWiFiConnection*>::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<const TDEWiFiConnection*>(*it); + + if (!wireless) { + continue; + } + + wirelessNetworkItem = new WirelessNetworkItem (menu, + d->dev, + net, + (*it)->UUID, + 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<WirelessNetwork> newnets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID); + + newWirelessPopupSSIDMap.clear(); + for (TQValueList<WirelessNetwork>::Iterator it = newnets.begin(); it != newnets.end(); ++it) + { + // Only display networks with no existing connnection + if ( findMatchingConnection(*it, conns) != NULL) + continue; + + WirelessNetworkItem* wirelessNetworkItem; + wirelessNetworkItem = new WirelessNetworkItem (menu, + d->dev, + *it, + NULL, + false); + + int id = newpopup->insertItem (wirelessNetworkItem, -1, -1); + newWirelessPopupSSIDMap[id] = (*it).getSsid(); + newpopup->connectItem(id, this, TQT_SLOT(newConnection(int))); + + 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) +{ + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(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(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 newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus prevState, TQString hwAddress) +{ + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(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()); + return; + } + + printf("Wireless state: %d\n\r", newState); + + slotCheckActiveAccessPoint(); + + 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); + if (ap) { + int strength = (ap->signalQuality*100.0); + + if (strength > 80) { + setPixmapForStates(newState, "nm_signal_100"); + } + else if (strength > 55) { + setPixmapForStates(newState, "nm_signal_75"); + } + else if (strength > 30) { + setPixmapForStates(newState, "nm_signal_50"); + } + else if (strength > 5) { + setPixmapForStates(newState, "nm_signal_25"); + } + else { + setPixmapForStates(newState, "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 + + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(d->dev)); + + // get the currently active connection + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkConnectionManager* deviceConnMan = 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) { + d->activeAccessPoint = activeap; + if ( d->activeAccessPoint ) { + TDEWiFiConnection* wireless = dynamic_cast<TDEWiFiConnection*>(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) +{ + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(d->dev)); + + if (event == TDENetworkAPEventType::SignalStrengthChanged) { + TDENetworkConnectionManager* deviceConnMan = 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(), "tdenm-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") ); +} + +void WirelessDeviceTray::tdeHardwareEventHandler(TDEHardwareEvent::TDEHardwareEvent event, TQString) +{ + if (event == TDEHardwareEvent::HardwareListModified) { + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(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) { + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(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) +{ + hwdevices = KGlobal::hardwareDevices(); + 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"); + + // 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 () +{ + delete d; +} + + +#include "tdenetman-wireless_device_tray.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h b/tdenetworkmanager/src/tdenetman-wireless_device_tray.h index 46b25f1..ee50a78 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h +++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager.h - A NetworkManager frontend for KDE + * tdenetman.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -27,29 +27,23 @@ #ifndef KNETWORKMANAGER_WIRELESS_DEVICE_TRAY_H #define KNETWORKMANAGER_WIRELESS_DEVICE_TRAY_H -// KNM includes -#include "knetworkmanager.h" +// TDENM includes +#include "tdenetman.h" #include "devicetraycomponent.h" -#include "knetworkmanager-wireless_network.h" +#include "tdenetman-wireless_network.h" // predefinitions 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 (TQString, KSystemTray * parent = 0, const char * name = 0); + ~WirelessDeviceTray (); void addMenuItems(KPopupMenu* menu); @@ -60,22 +54,31 @@ class WirelessDeviceTray : public DeviceTrayComponent TQStringList getToolTipText(); public slots: - void slotUpdateDeviceState(NMDeviceState); + void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString); void slotCheckActiveAccessPoint(); void newConnection(); + void newConnection(int); + protected slots: - void apStrengthChanged(TQ_UINT8 strength); - void slotAccessPointAdded(AccessPoint*); - void slotAccessPointRemoved(const TQString&); + void apPropertyChanged(TDEMACAddress BSSID, TDENetworkAPEventType::TDENetworkAPEventType event); + void slotAccessPointAdded(TDENetworkWiFiAPInfo*); + void slotAccessPointRemoved(TDEMACAddress); + + private slots: + void tdeHardwareEventHandler(TDEHardwareEvent::TDEHardwareEvent, TQString); + void tdeAccessPointStatusChangedHandler(TDEMACAddress, TDENetworkAPEventType::TDENetworkAPEventType); private: - void addWirelessNetworks (KPopupMenu* menu); + void addWirelessNetworks(KPopupMenu* menu); TQValueList<WirelessNetwork> getWirelessNetworks(); - TQValueList<ConnectionSettings::WirelessConnection*> getWirelessConnections(); - ConnectionSettings::WirelessConnection* findMatchingConnection(const WirelessNetwork& net, const TQValueList<ConnectionSettings::WirelessConnection*>& connection); - bool findMatchingNetwork(const ConnectionSettings::WirelessConnection* conn, const TQValueList<WirelessNetwork>& nets, WirelessNetwork& net); + TQValueList<TDEWiFiConnection*> getWirelessConnections(); + TDEWiFiConnection* findMatchingConnection(const WirelessNetwork& net, const TQValueList<TDEWiFiConnection*>& connection); + bool findMatchingNetwork(const TDEWiFiConnection* conn, const TQValueList<WirelessNetwork>& nets, WirelessNetwork& net); + void setPixmapForStates(TDENetworkConnectionStatus::TDENetworkConnectionStatus states, TQString pixmap); + TQMap<int, TQByteArray> newWirelessPopupSSIDMap; WirelessDeviceTrayPrivate* d; + TDEHardwareDevices* hwdevices; }; diff --git a/tdenetworkmanager/src/tdenetman-wireless_manager.cpp b/tdenetworkmanager/src/tdenetman-wireless_manager.cpp new file mode 100644 index 0000000..747fc04 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-wireless_manager.cpp @@ -0,0 +1,181 @@ +/*************************************************************************** + * + * tdenetman-wireless_manager.cpp - A NetworkManager frontend for TDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa <[email protected]>, <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + **************************************************************************/ + +// other includes +#include <time.h> + +// TDENM includes +#include "tdenetman-wireless_manager.h" + +TQValueList<WirelessNetwork> WirelessManager::getWirelessNetworks(TDENetworkDevice* dev, TQ_UINT32 match) +{ + TQValueList<WirelessNetwork> nets; + TQValueList<TDENetworkWiFiAPInfo*> aps; + // fetch all APs + aps = WirelessManager::getAccessPoints(dev); + + // now group the APs together according to their security settings + for (TQValueList<TDENetworkWiFiAPInfo*>::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<WirelessNetwork>::Iterator netIt = nets.begin(); netIt != nets.end(); ++netIt) { + 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->BSSID, (dev)?dev->uniqueID():TQString::null); + + /* // 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->BSSID, (dev)?dev->uniqueID():TQString::null); + nets.append(net); + } + } + } + return nets; +} + +TQValueList<TDENetworkWiFiAPInfo*> internalGetAccessPoints(TDENetworkDevice* dev) { + TQValueList<TDENetworkWiFiAPInfo*> 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<TDENetworkWiFiAPInfo*>(neighbor); + if (!apInfo) { + continue; + } + list.append(apInfo); + } + } + return list; +} + +TQValueList<TDENetworkWiFiAPInfo*> WirelessManager::getAccessPoints(TDENetworkDevice* dev) +{ + // build up AP list depending on one device or on all devices + if (dev) { + return internalGetAccessPoints(dev); + } + else { + TQValueList<TDENetworkWiFiAPInfo *> 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<TDENetworkDevice*>(*it); + if (wdev) { + aps += internalGetAccessPoints(wdev); + } + } + } + return aps; + } +} + +TQValueList<TDEWiFiConnection*> WirelessManager::getWirelessConnections() +{ + TQValueList<TDEWiFiConnection*> 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<TDEWiFiConnection*>(*it); + if (!wireless_conn) { + continue; + } + conns.append(wireless_conn); + } + } + + return conns; +} + +TQValueList<TDENetworkWiFiAPInfo*> internalGetAccessPointsWithESSID(TQByteArray essid, TDENetworkDevice* dev) { + TQValueList<TDENetworkWiFiAPInfo*> 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<TDENetworkWiFiAPInfo*>(neighbor); + if (!apInfo) { + continue; + } + if (apInfo->SSID == essid) { + list.append(apInfo); + } + } + } + return list; +} + +TQValueList<TDENetworkWiFiAPInfo*> 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<TDENetworkWiFiAPInfo*> 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<TDENetworkDevice*>(*it); + if (wdev) { + aps += internalGetAccessPointsWithESSID(essid, wdev); + } + } + } + return aps; + } +} + + diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_manager.h b/tdenetworkmanager/src/tdenetman-wireless_manager.h index f90fce7..8baf68e 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_manager.h +++ b/tdenetworkmanager/src/tdenetman-wireless_manager.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-wireless_manager.h - A NetworkManager frontend for KDE + * tdenetman-wireless_manager.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -29,12 +29,9 @@ #include <tqguardedptr.h> #include <tqmap.h> -// KNM includes -#include "knetworkmanager.h" -#include "knetworkmanager-device_tray.h" -#include "knetworkmanager-accesspoint.h" -#include "knetworkmanager-wireless_device.h" -#include "knetworkmanager-wireless_network.h" +// TDENM includes +#include "tdenetman.h" +#include "tdenetman-wireless_network.h" namespace ConnectionSettings { @@ -46,16 +43,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<WirelessNetwork> getWirelessNetworks(WirelessDevice* dev = 0, TQ_UINT32 match = WirelessNetwork::MATCH_SSID); + static TQValueList<WirelessNetwork> getWirelessNetworks(TDENetworkDevice* dev = 0, TQ_UINT32 match = WirelessNetwork::MATCH_SSID); // get all aps from either one device or from all available devices - static TQValueList<AccessPoint*> getAccessPoints(WirelessDevice* dev = 0); + static TQValueList<TDENetworkWiFiAPInfo*> getAccessPoints(TDENetworkDevice* dev = 0); // get a list of all known wireless connections - static TQValueList<ConnectionSettings::WirelessConnection*> getWirelessConnections(); + static TQValueList<TDEWiFiConnection*> getWirelessConnections(); // get a list of all APs with a specific SSID - static TQValueList<AccessPoint*> getAccessPointsForEssid(TQByteArray, WirelessDevice* dev = 0); + static TQValueList<TDENetworkWiFiAPInfo*> getAccessPointsForEssid(TQByteArray, TDENetworkDevice* dev = 0); }; diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.cpp b/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp index f8bedae..38021e0 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.cpp +++ b/tdenetworkmanager/src/tdenetman-wireless_menuitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-tray.cpp - A NetworkManager frontend for KDE + * tdenetman-tray.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -33,6 +33,7 @@ #include <tqpixmapcache.h> #include <tqpainter.h> #include <tqstyle.h> +#include <tqimage.h> #include <dcopclient.h> #include <kdebug.h> #include <kdialogbase.h> @@ -45,40 +46,32 @@ #include <kiconloader.h> #include <kconfig.h> #include <kmessagebox.h> -#include <NetworkManager.h> -#include <tqdbusobjectpath.h> -#include <tqdbuserror.h> - -#include "knetworkmanager-wireless_menuitem.h" -#include "knetworkmanager-wireless_network.h" -#include "knetworkmanager-connection_setting_info.h" -#include "knetworkmanager-wireless_connection.h" -#include "knetworkmanager-nm_proxy.h" - -#if !defined(NM_CHECK_VERSION) -#define NM_CHECK_VERSION(x,y,z) 0 -#endif +#include "tdenetman-wireless_menuitem.h" +#include "tdenetman-wireless_network.h" using namespace ConnectionSettings; void WirelessNetworkItem::slotActivate() { - NMProxy* nm = NMProxy::getInstance(); - int id; - TQT_DBusError err; + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(_dev)); + + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkConnection* conn = nm->findConnectionByUUID(_conn); + + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + printf("slotActivate\n\r"); - if (_dev && nm) + if (_dev && deviceConnMan) { - if ( _conn ) + 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() << "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; + } } else @@ -92,22 +85,26 @@ void WirelessNetworkItem::slotActivate() TQString WirelessNetworkItem::getDisplayText() { + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + TDENetworkConnection* conn = nm->findConnectionByUUID(_conn); + 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 @@ -116,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); @@ -129,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); } @@ -148,9 +155,11 @@ WirelessNetworkItem::sizeHint () return TQSize (_width, _height); } -WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, Device* dev, WirelessNetwork& net, WirelessConnection* conn, bool adhoc) +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; @@ -168,8 +177,10 @@ WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, Device* dev, WirelessNetw _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; @@ -189,9 +200,11 @@ 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, TQString dev, WirelessNetwork& net, bool adhoc) : NetworkMenuItem(dev, NULL, 0, 0 ), TQCustomMenuItem () { + hwdevices = KGlobal::hardwareDevices(); + parent = p; _adhoc = adhoc; _net = net; @@ -235,4 +248,4 @@ WirelessNetworkItem::~WirelessNetworkItem () -#include "knetworkmanager-wireless_menuitem.moc" +#include "tdenetman-wireless_menuitem.moc" diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.h b/tdenetworkmanager/src/tdenetman-wireless_menuitem.h index 98b6321..6bb5ef4 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_menuitem.h +++ b/tdenetworkmanager/src/tdenetman-wireless_menuitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager.h - A NetworkManager frontend for KDE + * tdenetman.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -25,7 +25,7 @@ #ifndef KNETWORKMANAGER_WIRELESSMENUITEM_H #define KNETWORKMANAGER_WIRELESSMENUITEM_H -#include "knetworkmanager-menuitem.h" +#include "tdenetman-menuitem.h" #include <tqmap.h> #include <tqtimer.h> @@ -44,23 +44,22 @@ #include <tqprogressbar.h> #include <tqguardedptr.h> -#include "knetworkmanager-wireless_network.h" -#include "knetworkmanager-connection.h" +#include "tdenetman-wireless_network.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* 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(); @@ -68,21 +67,23 @@ class WirelessNetworkItem : public NetworkMenuItem, public TQCustomMenuItem private: TQString getDisplayText(); - bool _adhoc; + bool _adhoc; WirelessNetwork _net; - Device* _dev; - ConnectionSettings::WirelessConnection* _conn; - - /* menu item */ - int _width; - int _height; - int _border; - - /* elements */ - int _textHeight; - int _widgetHeight; - - int _space; + TQString _dev; + TQString _conn; + + /* 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 new file mode 100644 index 0000000..91ccffd --- /dev/null +++ b/tdenetworkmanager/src/tdenetman-wireless_network.cpp @@ -0,0 +1,285 @@ +/*************************************************************************** + * + * tdenetman-wireless_network.cpp - A NetworkManager frontend for TDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa <[email protected]>, <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + **************************************************************************/ + +// TDENM includes +#include "tdenetman.h" +#include "tdenetman-wireless_network.h" + +// TDE includes +#include <kdebug.h> + +// TQt includes +#include <tqhostaddress.h> +#include <tqvaluelist.h> + +class WirelessNetworkPrivate +{ + public: + WirelessNetworkPrivate() + : active(false) + { + } + + ~WirelessNetworkPrivate() + { + } + + bool active; + + TQ_UINT32 match; + TQMap<TDEMACAddress,TQString> aps; +}; + +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 + 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 TDEMACAddress ap) +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(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; + } + + // AP matches + return true; +} + +bool WirelessNetwork::addAP(const TDEMACAddress ap, const TQString dev) +{ + if ( this->contains(ap) || d->aps.isEmpty()) { + d->aps[ap] = dev; + return true; + } + return false; +} + +const TQByteArray WirelessNetwork::getSsid() const +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + if ( !d->aps.isEmpty() ) { + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(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(); + } +} + +TQString WirelessNetwork::getDisplaySsid() const +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + if (!d->aps.isEmpty()) { + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(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(); + } +} + +TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getFlags() const +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; + for (TQMap<TDEMACAddress,TQString>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(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 +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; + for (TQMap<TDEMACAddress,TQString>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) + { + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(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 +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None; + for (TQMap<TDEMACAddress,TQString>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) + { + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(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; +} + +bool WirelessNetwork::isEncrypted() const +{ + return (getFlags() & TDENetworkWiFiAPFlags::PrivacySupport); +} + +TQ_UINT8 WirelessNetwork::getStrength() const +{ + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); + + TQ_UINT8 strength = 0; + for (TQMap<TDEMACAddress,TQString>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) { + TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(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; +} + +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/tdenetman-wireless_network.h index addce7a..8aec5cc 100644 --- a/tdenetworkmanager/src/knetworkmanager-wireless_network.h +++ b/tdenetworkmanager/src/tdenetman-wireless_network.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager-wireless_network.h - A NetworkManager frontend for KDE + * tdenetman-wireless_network.h - A NetworkManager frontend for TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -25,19 +25,15 @@ #ifndef KNETWORKMANAGER_WIRELESS_NETWORK_H #define KNETWORKMANAGER_WIRELESS_NETWORK_H -#include "knetworkmanager.h" -#include "knetworkmanager-device.h" +#include "tdenetman.h" #include <stdint.h> -class KNetworkManager; -class AccessPoint; -class WirelessNetworkPrivate; +#include <tdehardwaredevices.h> +#include <tdenetworkconnections.h> -namespace ConnectionSettings -{ - class WirelessConnection; -} +class TDENetworkManager; +class WirelessNetworkPrivate; /* A wireless network represents multiple accesspoints @@ -61,19 +57,19 @@ class WirelessNetwork WirelessNetwork& operator= (const WirelessNetwork&); // check if the AccessPoint represents the same net - bool contains(const AccessPoint * const); + bool contains(const TDEMACAddress); // add an AP to the Network - bool addAP(const AccessPoint * const); + bool addAP(const TDEMACAddress, const TQString); // 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; @@ -90,7 +86,8 @@ class WirelessNetwork bool operator==(const WirelessNetwork&); private: - WirelessNetworkPrivate * d; + WirelessNetworkPrivate * d; + TDEHardwareDevices* hwdevices; }; #endif /* KNETWORKMANAGER_WIRELESS_NETWORK_H */ diff --git a/tdenetworkmanager/src/tdenetman.cpp b/tdenetworkmanager/src/tdenetman.cpp new file mode 100644 index 0000000..d9f2ad1 --- /dev/null +++ b/tdenetworkmanager/src/tdenetman.cpp @@ -0,0 +1,95 @@ +/*************************************************************************** + * + * tdenetman.cpp - A NetworkManager frontend for TDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Helmut Schaa <[email protected]>, <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + **************************************************************************/ + +// TDE includes +#include <kdebug.h> +#include <klocale.h> +#include <tdehardwaredevices.h> +#include <tdenetworkconnections.h> + +// KNM includes +#include "tdenetman.h" +#include "tdenetman-tray.h" + +#include <stdio.h> + +// TQt includes +#include <tqstring.h> +#include <tqobject.h> + +// TDE includes +#include <kglobal.h> +#include <kiconloader.h> + +extern TDENetworkConnectionStatus::TDENetworkConnectionStatus nm_device_state_global; + +class TDENetworkManagerPrivate +{ + public: + TDENetworkManagerPrivate() {} + ~TDENetworkManagerPrivate() {} + + static TDENetworkManager* _ctx; +}; + +TDENetworkManager* TDENetworkManagerPrivate::_ctx = NULL; + +TDENetworkManager* TDENetworkManager::getInstance() +{ + return TDENetworkManagerPrivate::_ctx; +} + +void +TDENetworkManager::slotShutDown() +{ + // +} + +void TDENetworkManager::timerEvent( TQTimerEvent *e ) +{ + Tray* tray = Tray::getInstance(); + tray->slotUpdateDeviceState(nm_device_state_global, TDENetworkConnectionStatus::Invalid, TQString()); +} + +TDENetworkManager::TDENetworkManager() : KUniqueApplication() +{ + d = new TDENetworkManagerPrivate(); + 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); +} + +TDENetworkManager::~TDENetworkManager() +{ + delete d; +} + +#include "tdenetman.moc" + diff --git a/tdenetworkmanager/src/knetworkmanager.h b/tdenetworkmanager/src/tdenetman.h index cb48772..6365b89 100644 --- a/tdenetworkmanager/src/knetworkmanager.h +++ b/tdenetworkmanager/src/tdenetman.h @@ -1,6 +1,6 @@ /*************************************************************************** * - * knetworkmanager.h - A NetworkManager frontend for KDE + * tdenetman.h - A NetworkManager frontend for TDE * * Copyright (C) 2005 Novell, Inc. * @@ -25,30 +25,30 @@ #ifndef KNETWORKMANAGER_H #define KNETWORKMANAGER_H -// KDE includes +// TDE includes #include <kuniqueapplication.h> -// KNM includes +// TDENM 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/src/knetworkmanager.la.cpp b/tdenetworkmanager/src/tdenetman.la.cpp index 3d480c4..3d480c4 100644 --- a/tdenetworkmanager/src/knetworkmanager.la.cpp +++ b/tdenetworkmanager/src/tdenetman.la.cpp diff --git a/tdenetworkmanager/src/knetworkmanager_dummy.cpp b/tdenetworkmanager/src/tdenetman_dummy.cpp index efd89d8..efd89d8 100644 --- a/tdenetworkmanager/src/knetworkmanager_dummy.cpp +++ b/tdenetworkmanager/src/tdenetman_dummy.cpp diff --git a/tdenetworkmanager/src/knetworkmanager.desktop b/tdenetworkmanager/src/tdenetworkmanager.desktop index fc9b45f..c313d6f 100644 --- a/tdenetworkmanager/src/knetworkmanager.desktop +++ b/tdenetworkmanager/src/tdenetworkmanager.desktop @@ -1,8 +1,8 @@ [Desktop Entry] Encoding=UTF-8 -Name=KNetworkManager +Name=TDENetworkManager Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার -Name[sv]=Knetworkmanager +Name[sv]=TDEnetworkmanager GenericName=Network Manager GenericName[bn]=নেটওয়ার্ক ম্যানেজার GenericName[br]=Merour rouedad @@ -19,8 +19,8 @@ GenericName[sr]=Управник мреже GenericName[sr@Latn]=Upravnik mreže GenericName[sv]=Nätverksverktyg GenericName[tr]=Ağ Yöneticisi -Exec=knetworkmanager -Icon=knetworkmanager +Exec=tdenetworkmanager +Icon=tdenetworkmanager Type=Application Comment=A TDE frontend for NetworkManager Comment[bg]=Интерфейс за NetworkManager (TDE) @@ -43,5 +43,5 @@ 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 +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/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 4128f11..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, @@ -21,8 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef TRAY_COMPONENT_H #define TRAY_COMPONENT_H -#include <NetworkManager.h> - #include <tqmap.h> #include <tqmovie.h> #include <tqobject.h> diff --git a/tdenetworkmanager/src/vpn_tray_component.cpp b/tdenetworkmanager/src/vpn_tray_component.cpp index 68ad8a1..019e6c3 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 <kdebug.h> #include <klocale.h> #include <kiconloader.h> @@ -31,28 +31,26 @@ #include <tqdbusobjectpath.h> -// KNM includes +// TDENM 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_settings_dialog.h" #include <stdio.h> 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<TQPair<ConnectionSettings::Connection*, Device*> > map = nm->getActiveConnectionsMap(); + TDEGlobalNetworkManager* nm = KGlobal::networkManager(); // get all available VPN Connections - TQValueList<Connection*> connections = connectionStore->getConnections(NM_SETTING_VPN_SETTING_NAME); - if (!connections.empty()) - { - TQPopupMenu* popup = new TQPopupMenu(menu); - for (TQValueList<Connection*>::iterator it = connections.begin(); it != connections.end(); ++it) - { - VPNConnection* vpnconn = dynamic_cast<VPNConnection*>(*it); - if (vpnconn) - { - // VPN connection found :) - Info* info = vpnconn->getInfoSetting(); - - // lets create a nice name for this connection - if (info) - { - TQString title = info->getName(); + TQPopupMenu* popup = NULL; + TDENetworkConnectionList* allconmap = nm->connections(); + for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) { + TDEVPNConnection* conn = dynamic_cast<TDEVPNConnection*>(*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<TQPair<ConnectionSettings::Connection*, Device*> >::Iterator it = map.begin(); it != map.end(); ++it) - { - ConnectionSettings::GenericConnection* conn = dynamic_cast<ConnectionSettings::GenericConnection*>((*it).first); - - if (conn) { - if (strcmp(info->getName(), conn->getInfoSetting()->getName()) == 0) { - vpn_found = 1; - any_vpn_found = 1; - } - } - } - - if (vpn_found == 1) { - printf("Active VPN connection found\n\r"); - } - else { - int id = popup->insertItem(SmallIcon ("encrypted", TQIconSet::Automatic), title, item, TQT_SLOT(slotActivate())); - inactive_vpn_connections++; - } - - //menu->setItemChecked(id, ((*it) == active_conn)); - } - } + 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; } - TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection(); - TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn); + 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++; + } + + //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); diff --git a/tdenetworkmanager/src/vpn_tray_component.h b/tdenetworkmanager/src/vpn_tray_component.h index 2af5b55..3f1af35 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 TDE * * Copyright (C) 2005, 2006 Novell, Inc. * @@ -25,10 +25,14 @@ #ifndef VPN_TRAY_COMPONENT_H #define VPN_TRAY_COMPONENT_H -// KNM includes +// TDE includes +#include <tdehardwaredevices.h> +#include <tdenetworkconnections.h> + +// TDENM includes #include "traycomponent.h" -#include "knetworkmanager.h" +#include "tdenetman.h" class VPNTrayComponent : public TrayComponent { 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 <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#include "xmlmarshaller.h" - -#include <tqdbusdata.h> -#include <tqdbusdatalist.h> -#include <tqdbusdatamap.h> -#include <tqdbusobjectpath.h> -#include <tqdbusvariant.h> - -#include <tqdom.h> -#include <tqvaluelist.h> - -#include <kdebug.h> - -static TQDomElement fromBool(bool value, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("bool"); - TQDomText text = doc.createTextNode((value ? "true" : "false")); - - element.appendChild(text); - - return element; -} - -static TQDomElement fromByte(TQ_UINT8 value, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("byte"); - TQDomText text = doc.createTextNode(TQString::number(value)); - - element.appendChild(text); - - return element; -} - -static TQDomElement fromInt16(TQ_INT16 value, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("int16"); - TQDomText text = doc.createTextNode(TQString::number(value)); - - element.appendChild(text); - - return element; -} - -static TQDomElement fromUInt16(TQ_UINT16 value, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("uin16"); - TQDomText text = doc.createTextNode(TQString::number(value)); - - element.appendChild(text); - - return element; -} - -static TQDomElement fromInt32(TQ_INT32 value, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("int32"); - TQDomText text = doc.createTextNode(TQString::number(value)); - - element.appendChild(text); - - return element; -} - -static TQDomElement fromUInt32(TQ_UINT32 value, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("uint32"); - TQDomText text = doc.createTextNode(TQString::number(value)); - - element.appendChild(text); - - return element; -} - -static TQDomElement fromInt64(TQ_INT64 value, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("int64"); - TQDomText text = doc.createTextNode(TQString::number(value)); - - element.appendChild(text); - - return element; -} - -static TQDomElement fromUInt64(TQ_UINT64 value, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("uint64"); - TQDomText text = doc.createTextNode(TQString::number(value)); - - element.appendChild(text); - - return element; -} - -static TQDomElement fromDouble(double value, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("double"); - TQDomText text = doc.createTextNode(TQString::number(value)); - - element.appendChild(text); - - return element; -} - -static TQDomElement fromString(const TQString& value, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("string"); - TQDomText text = doc.createTextNode(value); // TODO: espace - - element.appendChild(text); - - return element; -} - -static TQDomElement fromObjectPath(const TQT_DBusObjectPath& value, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("objectpath"); - TQDomText text = doc.createTextNode(value); - - element.appendChild(text); - - return element; -} - -static TQDomElement fromByteKeyMap(const TQT_DBusDataMap<TQ_UINT8>& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap<TQ_UINT8>::const_iterator it = map.begin(); - TQT_DBusDataMap<TQ_UINT8>::const_iterator endIt = map.end(); - for (; it != endIt; ++it) - { - TQDomElement entryElement = doc.createElement("entry"); - - entryElement.appendChild(fromByte(it.key(), ownerDoc)); - entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc)); - - element.appendChild(entryElement); - } - - return element; -} - -static TQDomElement fromInt16KeyMap(const TQT_DBusDataMap<TQ_INT16>& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap<TQ_INT16>::const_iterator it = map.begin(); - TQT_DBusDataMap<TQ_INT16>::const_iterator endIt = map.end(); - for (; it != endIt; ++it) - { - TQDomElement entryElement = doc.createElement("entry"); - - entryElement.appendChild(fromInt16(it.key(), ownerDoc)); - entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc)); - - element.appendChild(entryElement); - } - - return element; -} - -static TQDomElement fromUInt16KeyMap(const TQT_DBusDataMap<TQ_UINT16>& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap<TQ_UINT16>::const_iterator it = map.begin(); - TQT_DBusDataMap<TQ_UINT16>::const_iterator endIt = map.end(); - for (; it != endIt; ++it) - { - TQDomElement entryElement = doc.createElement("entry"); - - entryElement.appendChild(fromUInt16(it.key(), ownerDoc)); - entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc)); - - element.appendChild(entryElement); - } - - return element; -} - -static TQDomElement fromInt32KeyMap(const TQT_DBusDataMap<TQ_INT32>& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap<TQ_INT32>::const_iterator it = map.begin(); - TQT_DBusDataMap<TQ_INT32>::const_iterator endIt = map.end(); - for (; it != endIt; ++it) - { - TQDomElement entryElement = doc.createElement("entry"); - - entryElement.appendChild(fromInt32(it.key(), ownerDoc)); - entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc)); - - element.appendChild(entryElement); - } - - return element; -} - -static TQDomElement fromUInt32KeyMap(const TQT_DBusDataMap<TQ_UINT32>& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap<TQ_UINT32>::const_iterator it = map.begin(); - TQT_DBusDataMap<TQ_UINT32>::const_iterator endIt = map.end(); - for (; it != endIt; ++it) - { - TQDomElement entryElement = doc.createElement("entry"); - - entryElement.appendChild(fromUInt32(it.key(), ownerDoc)); - entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc)); - - element.appendChild(entryElement); - } - - return element; -} - -static TQDomElement fromInt64KeyMap(const TQT_DBusDataMap<TQ_INT64>& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap<TQ_INT64>::const_iterator it = map.begin(); - TQT_DBusDataMap<TQ_INT64>::const_iterator endIt = map.end(); - for (; it != endIt; ++it) - { - TQDomElement entryElement = doc.createElement("entry"); - - entryElement.appendChild(fromInt16(it.key(), ownerDoc)); - entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc)); - - element.appendChild(entryElement); - } - - return element; -} - -static TQDomElement fromUInt64KeyMap(const TQT_DBusDataMap<TQ_UINT64>& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap<TQ_UINT64>::const_iterator it = map.begin(); - TQT_DBusDataMap<TQ_UINT64>::const_iterator endIt = map.end(); - for (; it != endIt; ++it) - { - TQDomElement entryElement = doc.createElement("entry"); - - entryElement.appendChild(fromUInt64(it.key(), ownerDoc)); - entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc)); - - element.appendChild(entryElement); - } - - return element; -} - -static TQDomElement fromStringKeyMap(const TQT_DBusDataMap<TQString>& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap<TQString>::const_iterator it = map.begin(); - TQT_DBusDataMap<TQString>::const_iterator endIt = map.end(); - for (; it != endIt; ++it) - { - TQDomElement entryElement = doc.createElement("entry"); - - entryElement.appendChild(fromString(it.key(), ownerDoc)); - entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc)); - - element.appendChild(entryElement); - } - - return element; -} - -static TQDomElement fromObjectPathKeyMap(const TQT_DBusDataMap<TQT_DBusObjectPath>& map, const TQDomDocument& ownerDoc) -{ - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("map"); - - if (map.isEmpty()) return element; - - TQT_DBusDataMap<TQT_DBusObjectPath>::const_iterator it = map.begin(); - TQT_DBusDataMap<TQT_DBusObjectPath>::const_iterator endIt = map.end(); - for (; it != endIt; ++it) - { - TQDomElement entryElement = doc.createElement("entry"); - - entryElement.appendChild(fromObjectPath(it.key(), ownerDoc)); - entryElement.appendChild(XMLMarshaller::fromTQT_DBusData(it.data(), ownerDoc)); - - element.appendChild(entryElement); - } - - return element; -} - -static bool toBool(const TQDomElement& element) -{ - return element.text() == "true"; -} - -static TQ_UINT8 toByte(const TQDomElement& element) -{ - uint number = element.text().toUInt(); - if (number > 255) return 0; - return number; -} - -static TQ_INT16 toInt16(const TQDomElement& element) -{ - return element.text().toShort(); -} - -static TQ_UINT16 toUInt16(const TQDomElement& element) -{ - return element.text().toUShort(); -} - -static TQ_INT32 toInt32(const TQDomElement& element) -{ - return element.text().toInt(); -} - -static TQ_UINT32 toUInt32(const TQDomElement& element) -{ - return element.text().toUInt(); -} - -static TQ_INT64 toInt64(const TQDomElement& element) -{ - return element.text().toLongLong(); -} - -static TQ_UINT64 toUInt64(const TQDomElement& element) -{ - return element.text().toULongLong(); -} - -static double toDouble(const TQDomElement& element) -{ - return element.text().toDouble(); -} - -static TQString toString(const TQDomElement& element) -{ - return element.text(); -} - -static TQT_DBusObjectPath toObjectPath(const TQDomElement& element) -{ - return TQCString(element.text().ascii()); -} - -static TQT_DBusData::Type typeFromEntry(const TQDomElement& element) -{ - for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling()) - { - if (!child.isElement()) continue; - - TQDomElement childElement = child.toElement(); - - if (childElement.tagName() == "byte") return TQT_DBusData::Byte; - if (childElement.tagName() == "int16") return TQT_DBusData::Int16; - if (childElement.tagName() == "uint16") return TQT_DBusData::UInt16; - if (childElement.tagName() == "int32") return TQT_DBusData::Int32; - if (childElement.tagName() == "uint32") return TQT_DBusData::UInt32; - if (childElement.tagName() == "int64") return TQT_DBusData::Int64; - if (childElement.tagName() == "uint64") return TQT_DBusData::UInt64; - if (childElement.tagName() == "string") return TQT_DBusData::String; - if (childElement.tagName() == "objectpath") return TQT_DBusData::ObjectPath; - } - - return TQT_DBusData::Invalid; -} - -static TQT_DBusData toByteKeyMap(const TQDomElement& element) -{ - TQT_DBusDataMap<TQ_UINT8> map; - - for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling()) - { - if (!child.isElement()) continue; - - TQDomElement entryElement = child.toElement(); - if (entryElement.tagName() != "entry") continue; - - for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - TQDomElement childElement = entryChild.toElement(); - if (childElement.tagName() != "byte") continue; - - TQ_UINT8 key = toByte(childElement); - - TQT_DBusData data; - for (entryChild = entryChild.nextSibling(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - data = XMLMarshaller::toTQT_DBusData(entryChild.toElement()); - if (data.isValid()) break; - } - - if (!data.isValid()) return TQT_DBusData(); - - map.insert(key, data); - break; - } - } - - return TQT_DBusData::fromByteKeyMap(map); -} - -static TQT_DBusData toInt16KeyMap(const TQDomElement& element) -{ - TQT_DBusDataMap<TQ_INT16> map; - - for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling()) - { - if (!child.isElement()) continue; - - TQDomElement entryElement = child.toElement(); - if (entryElement.tagName() != "entry") continue; - - for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - TQDomElement childElement = entryChild.toElement(); - if (childElement.tagName() != "int16") continue; - - TQ_INT16 key = toInt16(childElement); - - TQT_DBusData data; - for (entryChild = entryChild.nextSibling(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - data = XMLMarshaller::toTQT_DBusData(entryChild.toElement()); - if (data.isValid()) break; - } - - if (!data.isValid()) return TQT_DBusData(); - - map.insert(key, data); - break; - } - } - - return TQT_DBusData::fromInt16KeyMap(map); -} - -static TQT_DBusData toUInt16KeyMap(const TQDomElement& element) -{ - TQT_DBusDataMap<TQ_UINT16> map; - - for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling()) - { - if (!child.isElement()) continue; - - TQDomElement entryElement = child.toElement(); - if (entryElement.tagName() != "entry") continue; - - for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - TQDomElement childElement = entryChild.toElement(); - if (childElement.tagName() != "uint16") continue; - - TQ_UINT16 key = toUInt16(childElement); - - TQT_DBusData data; - for (entryChild = entryChild.nextSibling(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - data = XMLMarshaller::toTQT_DBusData(entryChild.toElement()); - if (data.isValid()) break; - } - - if (!data.isValid()) return TQT_DBusData(); - - map.insert(key, data); - break; - } - } - - return TQT_DBusData::fromUInt16KeyMap(map); -} - -static TQT_DBusData toInt32KeyMap(const TQDomElement& element) -{ - TQT_DBusDataMap<TQ_INT32> map; - - for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling()) - { - if (!child.isElement()) continue; - - TQDomElement entryElement = child.toElement(); - if (entryElement.tagName() != "entry") continue; - - for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - TQDomElement childElement = entryChild.toElement(); - if (childElement.tagName() != "int32") continue; - - TQ_INT32 key = toInt32(childElement); - - TQT_DBusData data; - for (entryChild = entryChild.nextSibling(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - data = XMLMarshaller::toTQT_DBusData(entryChild.toElement()); - if (data.isValid()) break; - } - - if (!data.isValid()) return TQT_DBusData(); - - map.insert(key, data); - break; - } - } - - return TQT_DBusData::fromInt32KeyMap(map); -} - -static TQT_DBusData toUInt32KeyMap(const TQDomElement& element) -{ - TQT_DBusDataMap<TQ_UINT32> map; - - for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling()) - { - if (!child.isElement()) continue; - - TQDomElement entryElement = child.toElement(); - if (entryElement.tagName() != "entry") continue; - - for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - TQDomElement childElement = entryChild.toElement(); - if (childElement.tagName() != "uint32") continue; - - TQ_UINT32 key = toUInt32(childElement); - - TQT_DBusData data; - for (entryChild = entryChild.nextSibling(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - data = XMLMarshaller::toTQT_DBusData(entryChild.toElement()); - if (data.isValid()) break; - } - - if (!data.isValid()) return TQT_DBusData(); - - map.insert(key, data); - break; - } - } - - return TQT_DBusData::fromUInt32KeyMap(map); -} - -static TQT_DBusData toInt64KeyMap(const TQDomElement& element) -{ - TQT_DBusDataMap<TQ_INT64> map; - - for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling()) - { - if (!child.isElement()) continue; - - TQDomElement entryElement = child.toElement(); - if (entryElement.tagName() != "entry") continue; - - for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - TQDomElement childElement = entryChild.toElement(); - if (childElement.tagName() != "int64") continue; - - TQ_INT64 key = toInt64(childElement); - - TQT_DBusData data; - for (entryChild = entryChild.nextSibling(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - data = XMLMarshaller::toTQT_DBusData(entryChild.toElement()); - if (data.isValid()) break; - } - - if (!data.isValid()) return TQT_DBusData(); - - map.insert(key, data); - break; - } - } - - return TQT_DBusData::fromInt64KeyMap(map); -} - -static TQT_DBusData toUInt64KeyMap(const TQDomElement& element) -{ - TQT_DBusDataMap<TQ_UINT64> map; - - for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling()) - { - if (!child.isElement()) continue; - - TQDomElement entryElement = child.toElement(); - if (entryElement.tagName() != "entry") continue; - - for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - TQDomElement childElement = entryChild.toElement(); - if (childElement.tagName() != "uint64") continue; - - TQ_UINT64 key = toUInt64(childElement); - - TQT_DBusData data; - for (entryChild = entryChild.nextSibling(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - data = XMLMarshaller::toTQT_DBusData(entryChild.toElement()); - if (data.isValid()) break; - } - - if (!data.isValid()) return TQT_DBusData(); - - map.insert(key, data); - break; - } - } - - return TQT_DBusData::fromUInt64KeyMap(map); -} - -static TQT_DBusData toStringKeyMap(const TQDomElement& element) -{ - TQT_DBusDataMap<TQString> map; - - for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling()) - { - if (!child.isElement()) continue; - - TQDomElement entryElement = child.toElement(); - if (entryElement.tagName() != "entry") continue; - - for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - TQDomElement childElement = entryChild.toElement(); - if (childElement.tagName() != "string") continue; - - TQString key = toString(childElement); - - TQT_DBusData data; - for (entryChild = entryChild.nextSibling(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - data = XMLMarshaller::toTQT_DBusData(entryChild.toElement()); - if (data.isValid()) break; - } - - if (!data.isValid()) return TQT_DBusData(); - - map.insert(key, data); - break; - } - } - - return TQT_DBusData::fromStringKeyMap(map); -} - -static TQT_DBusData toObjectPathKeyMap(const TQDomElement& element) -{ - TQT_DBusDataMap<TQT_DBusObjectPath> map; - - for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling()) - { - if (!child.isElement()) continue; - - TQDomElement entryElement = child.toElement(); - if (entryElement.tagName() != "entry") continue; - - for (TQDomNode entryChild = entryElement.firstChild(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - TQDomElement childElement = entryChild.toElement(); - if (childElement.tagName() != "objectpath") continue; - - TQT_DBusObjectPath key = toObjectPath(childElement); - - TQT_DBusData data; - for (entryChild = entryChild.nextSibling(); !entryChild.isNull(); - entryChild = entryChild.nextSibling()) - { - if (!entryChild.isElement()) continue; - - data = XMLMarshaller::toTQT_DBusData(entryChild.toElement()); - if (data.isValid()) break; - } - - if (!data.isValid()) return TQT_DBusData(); - - map.insert(key, data); - break; - } - } - - return TQT_DBusData::fromObjectPathKeyMap(map); -} - -TQDomElement XMLMarshaller::fromTQT_DBusData(const TQT_DBusData& data, const TQDomDocument& ownerDoc) -{ - switch (data.type()) - { - case TQT_DBusData::Invalid: - kdWarning() << "XMLMarsaller::fromTQT_DBusData: data is invalid" << endl; - return TQDomElement(); - - case TQT_DBusData::Bool: - return fromBool(data.toBool(), ownerDoc); - - case TQT_DBusData::Byte: - return fromByte(data.toByte(), ownerDoc); - - case TQT_DBusData::Int16: - return fromInt16(data.toInt16(), ownerDoc); - - case TQT_DBusData::UInt16: - return fromUInt16(data.toUInt16(), ownerDoc); - - case TQT_DBusData::Int32: - return fromInt32(data.toInt32(), ownerDoc); - - case TQT_DBusData::UInt32: - return fromUInt32(data.toUInt32(), ownerDoc); - - case TQT_DBusData::Int64: - return fromInt64(data.toInt64(), ownerDoc); - - case TQT_DBusData::UInt64: - return fromUInt64(data.toUInt64(), ownerDoc); - - case TQT_DBusData::Double: - return fromDouble(data.toDouble(), ownerDoc); - - case TQT_DBusData::String: - return fromString(data.toString(), ownerDoc); - - case TQT_DBusData::ObjectPath: - return fromObjectPath(data.toObjectPath(), ownerDoc); - - case TQT_DBusData::List: - { - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("list"); - TQT_DBusDataList list = data.toList(); - if (list.isEmpty()) - { - element.setAttribute("signature", data.buildDBusSignature().data()); - } - else - { - TQValueList<TQT_DBusData> items = list.toTQValueList(); - TQValueList<TQT_DBusData>::const_iterator it = items.begin(); - TQValueList<TQT_DBusData>::const_iterator endIt = items.end(); - for (; it != endIt; ++it) - { - TQDomElement itemElement = fromTQT_DBusData(*it, ownerDoc); - - if (!itemElement.isNull()) element.appendChild(itemElement); - } - } - - return element; - } - - case TQT_DBusData::Struct: - { - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("struct"); - - TQValueList<TQT_DBusData> members = data.toStruct(); - TQValueList<TQT_DBusData>::const_iterator it = members.begin(); - TQValueList<TQT_DBusData>::const_iterator endIt = members.end(); - for (; it != endIt; ++it) - { - TQDomElement memberElement = fromTQT_DBusData(*it, ownerDoc); - - if (!memberElement.isNull()) element.appendChild(memberElement); - } - return element; - } - - case TQT_DBusData::Variant: - { - TQDomDocument doc = ownerDoc; - TQDomElement element = doc.createElement("variant"); - - TQT_DBusVariant variant = data.toVariant(); - - element.setAttribute("signature", variant.signature); - - TQDomElement dataElement = fromTQT_DBusData(variant.value, ownerDoc); - if (!dataElement.isNull()) element.appendChild(dataElement); - - return element; - } - - case TQT_DBusData::Map: - { - TQDomElement mapElement; - - switch (data.keyType()) - { - case TQT_DBusData::Byte: - mapElement = fromByteKeyMap(data.toByteKeyMap(), ownerDoc); - break; - - case TQT_DBusData::Int16: - mapElement = fromInt16KeyMap(data.toInt16KeyMap(), ownerDoc); - break; - - case TQT_DBusData::UInt16: - mapElement = fromUInt16KeyMap(data.toUInt16KeyMap(), ownerDoc); - break; - - case TQT_DBusData::Int32: - mapElement = fromInt32KeyMap(data.toInt32KeyMap(), ownerDoc); - break; - - case TQT_DBusData::UInt32: - mapElement = fromUInt32KeyMap(data.toUInt32KeyMap(), ownerDoc); - break; - - case TQT_DBusData::Int64: - mapElement = fromInt64KeyMap(data.toInt64KeyMap(), ownerDoc); - break; - - case TQT_DBusData::UInt64: - mapElement = fromUInt64KeyMap(data.toUInt64KeyMap(), ownerDoc); - break; - - case TQT_DBusData::String: - mapElement = fromStringKeyMap(data.toStringKeyMap(), ownerDoc); - break; - - case TQT_DBusData::ObjectPath: - mapElement = fromObjectPathKeyMap(data.toObjectPathKeyMap(), ownerDoc); - break; - - default: - return TQDomElement(); - } - - if (!mapElement.hasChildNodes()) - { - mapElement.setAttribute("signature", data.buildDBusSignature().data()); - } - - return mapElement; - } - } - - return TQDomElement(); -} - -TQT_DBusData XMLMarshaller::toTQT_DBusData(const TQDomElement& element) -{ - if (element.isNull()) return TQT_DBusData(); - - if (element.tagName() == "bool") return TQT_DBusData::fromBool(toBool(element)); - if (element.tagName() == "byte") return TQT_DBusData::fromByte(toByte(element)); - if (element.tagName() == "int16") return TQT_DBusData::fromInt16(toInt16(element)); - if (element.tagName() == "uint16") return TQT_DBusData::fromUInt16(toUInt16(element)); - if (element.tagName() == "int32") return TQT_DBusData::fromInt32(toInt32(element)); - if (element.tagName() == "uint32") return TQT_DBusData::fromUInt32(toUInt32(element)); - if (element.tagName() == "int64") return TQT_DBusData::fromInt64(toInt64(element)); - if (element.tagName() == "uint64") return TQT_DBusData::fromUInt64(toUInt64(element)); - if (element.tagName() == "double") return TQT_DBusData::fromDouble(toDouble(element)); - if (element.tagName() == "string") return TQT_DBusData::fromString(toString(element)); - if (element.tagName() == "objectpath") return TQT_DBusData::fromObjectPath(toObjectPath(element)); - - if (element.tagName() == "list") - { - if (element.hasChildNodes()) - { - TQValueList<TQT_DBusData> list; - - for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling()) - { - if (!child.isElement()) continue; - - TQT_DBusData itemData = toTQT_DBusData(child.toElement()); - if (itemData.isValid()) list << itemData; - } - - return TQT_DBusData::fromList(list); - } - - // TODO handle empty list with signatures as hint - } - - if (element.tagName() == "struct") - { - TQValueList<TQT_DBusData> members; - - for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling()) - { - if (!child.isElement()) continue; - - TQT_DBusData memberData = toTQT_DBusData(child.toElement()); - if (memberData.isValid()) members << memberData; - } - - return TQT_DBusData::fromStruct(members); - } - - if (element.tagName() == "variant") - { - TQT_DBusData data; - for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling()) - { - if (!child.isElement()) continue; - - TQT_DBusData childData = toTQT_DBusData(child.toElement()); - if (childData.isValid()) - { - data = childData; - break; - } - } - - if (!data.isValid()) return TQT_DBusData(); - - TQT_DBusVariant variant; - variant.signature = element.attribute("signature"); - variant.value = data; - - return TQT_DBusData::fromVariant(variant); - } - - if (element.tagName() == "map") - { - TQDomElement entryElement; - for (TQDomNode child = element.firstChild(); !child.isNull(); child = child.nextSibling()) - { - if (!child.isElement()) continue; - - TQDomElement childElement = child.toElement(); - if (childElement.tagName() == "entry") - { - entryElement = childElement; - break; - } - } - - if (entryElement.isNull()) - { - // TODO: empty map - return TQT_DBusData(); - } - - switch (typeFromEntry(entryElement)) - { - case TQT_DBusData::Byte: - return toByteKeyMap(element); - - case TQT_DBusData::Int16: - return toInt16KeyMap(element); - - case TQT_DBusData::UInt16: - return toUInt16KeyMap(element); - - case TQT_DBusData::Int32: - return toInt32KeyMap(element); - - case TQT_DBusData::UInt32: - return toUInt32KeyMap(element); - - case TQT_DBusData::Int64: - return toInt64KeyMap(element); - - case TQT_DBusData::UInt64: - return toUInt64KeyMap(element); - - case TQT_DBusData::String: - return toStringKeyMap(element); - - case TQT_DBusData::ObjectPath: - return toObjectPathKeyMap(element); - - default: - return TQT_DBusData(); - } - } - - return TQT_DBusData(); -} - -TQString XMLMarshaller::fromTQT_DBusData(const TQT_DBusData& data) -{ - TQDomDocument doc; - - TQDomElement element = fromTQT_DBusData(data, doc); - if (element.isNull()) return TQString(); - - doc.appendChild(element); - return doc.toString(); -} - -TQT_DBusData XMLMarshaller::toTQT_DBusData(const TQString& xmlString) -{ - TQDomDocument doc; - - if (!doc.setContent(xmlString)) return TQT_DBusData(); - - return toTQT_DBusData(doc.documentElement()); -} - diff --git a/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 <[email protected]> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - **************************************************************************/ - -#ifndef XMLMARSHALLER_H -#define XMLMARSHALLER_H - -class TQT_DBusData; -class TQDomDocument; -class TQDomElement; -class TQString; - -class XMLMarshaller -{ -public: - static TQDomElement fromTQT_DBusData(const TQT_DBusData& data, const TQDomDocument& ownerDoc); - - static TQT_DBusData toTQT_DBusData(const TQDomElement& element); - - static TQString fromTQT_DBusData(const TQT_DBusData& data); - - static TQT_DBusData toTQT_DBusData(const TQString& xmlString); -}; - -#endif - diff --git a/tdenetworkmanager/knetworkmanager.conf b/tdenetworkmanager/tdenetworkmanager.conf index 82a596f..82a596f 100644 --- a/tdenetworkmanager/knetworkmanager.conf +++ b/tdenetworkmanager/tdenetworkmanager.conf diff --git a/tdenetworkmanager/vpn-plugins/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/CMakeLists.txt new file mode 100644 index 0000000..d5f6e8e --- /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/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 <[email protected]> Helmut Schaa <[email protected]>, <[email protected]> Thomas Kallenberg <[email protected]> <[email protected]> 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/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/tdenetman-openvpn.cpp index 020df5a..7cee87a 100644 --- a/tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.cpp +++ b/tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-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. * @@ -36,12 +36,11 @@ #include <tqwidgetstack.h> #include <tqfileinfo.h> #include <tqhostaddress.h> -#include <tqdbusdata.h> -#include "knetworkmanager-openvpn.h" +#include "tdenetman-openvpn.h" typedef KGenericFactory<OpenVPNPlugin> OpenVPNPluginFactory; -K_EXPORT_COMPONENT_FACTORY( knetworkmanager_openvpn, OpenVPNPluginFactory("knetworkmanager_openvpn")); +K_EXPORT_COMPONENT_FACTORY( tdenetman_openvpn, OpenVPNPluginFactory("tdenetman_openvpn")); /************************************ * OpenVPNPlugin @@ -177,21 +176,23 @@ void OpenVPNConfig::getCipherModes() { // get all possible cipher modes TQString openvpn = findOpenVPNBinary(); - if (!openvpn.isNull()) - { + 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)) + if (!cipherHelper->start(KProcess::Block, KProcess::Stdout)) { kdDebug() << "error starting openvpn" << endl; + } } - } -void OpenVPNConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties) +void OpenVPNConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets) { + m_vpnProperties = properties; + m_vpnSecrets = secrets; + // fill up our inputfields for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it) { @@ -283,63 +284,98 @@ void OpenVPNConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, if (!routes.empty()) { _openvpnWidget->chkIPAdresses->setChecked(true); - _openvpnWidget->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())); + } + _openvpnWidget->routes->setText(routesText.join(" ")); } } -TQMap<TQString, TQString>OpenVPNConfig::getVPNProperties() +TDENetworkSettingsMap OpenVPNConfig::getVPNProperties() { - // build a StingList of properties - TQMap<TQString, TQString> strlist; - - strlist.insert("connection-type", TQString::number(OpenVPNConnectionType::mapConnectionType2String((OpenVPNConnectionType::CONNECTIONTYPE)_openvpnWidget->cboConnectionType->currentItem()))); - strlist.insert("remote", TQString(_openvpnWidget->gateway->text())); + // 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()) - strlist.insert("port", _openvpnWidget->port->text()); + if (!_openvpnWidget->port->text().isEmpty() && !_openvpnWidget->chkDefaultPort->isChecked()) { + m_vpnProperties.insert("port", _openvpnWidget->port->text()); + } + else { + m_vpnProperties.remove("port"); + } - strlist.insert("ca", TQString(_openvpnWidget->editCA->url())); - strlist.insert("cert",TQString(_openvpnWidget->editCert->url() )); - strlist.insert("key", TQString(_openvpnWidget->editKey->url())); + 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()) - strlist.insert("cipher", TQString(_openvpnWidget->cboCipher->currentText())); + if (_openvpnWidget->chkUseCipher->isChecked()) { + m_vpnProperties.insert("cipher", TQString(_openvpnWidget->cboCipher->currentText())); + } + else { + m_vpnProperties.remove("cipher"); + } - if (_openvpnWidget->chkUseLZO->isChecked()) - strlist.insert("comp-lzo", TQString("true")); - else - strlist.insert("comp-lzo", TQString("false")); + if (_openvpnWidget->chkUseLZO->isChecked()) { + m_vpnProperties.insert("comp-lzo", TQString("true")); + } + else { + m_vpnProperties.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())); + 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()) { - strlist.insert("tap-dev", "true"); - strlist.insert("proto-tcp", "true"); - } else { - strlist.insert("tap-dev", "false"); - strlist.insert("proto-tcp", "false"); + 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"); } - if (_openvpnWidget->chkUseTLS->isChecked()) - strlist.insert("ta", TQString(_openvpnWidget->editTLSAuth->url())); + m_vpnProperties.insert("ta-dir", TQString(_openvpnWidget->cboDirection->currentText())); + + return m_vpnProperties; +} - strlist.insert("ta-dir", TQString(_openvpnWidget->cboDirection->currentText())); +TDENetworkSettingsMap OpenVPNConfig::getVPNSecrets() { + // Build a list of secrets + // FIXME - return strlist; + return m_vpnSecrets; } -TQStringList OpenVPNConfig::getVPNRoutes() +TDENetworkSingleRouteConfigurationList OpenVPNConfig::getVPNRoutes() { + TDENetworkSingleRouteConfigurationList ret; TQStringList strlist; - if(_openvpnWidget->chkIPAdresses->isChecked()) - { + if(_openvpnWidget->chkIPAdresses->isChecked()) { strlist = TQStringList::split(" ", _openvpnWidget->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; } bool OpenVPNConfig::hasChanged() @@ -526,7 +562,7 @@ OpenVPNAuthentication::~OpenVPNAuthentication() } -void OpenVPNAuthentication::setVPNData(const TQStringList& /*routes*/, const TQMap<TQString, TQString>& properties) +void OpenVPNAuthentication::setVPNData(TDENetworkSingleRouteConfigurationList& /*routes*/, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets) { // find the connection type property for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it) @@ -539,7 +575,7 @@ void OpenVPNAuthentication::setVPNData(const TQStringList& /*routes*/, const TQM } } -TQMap<TQString, TQString> OpenVPNAuthentication::getPasswords() +TDENetworkSettingsMap OpenVPNAuthentication::getPasswords() { TQMap<TQString, TQString> pwds; if ((_connectionType == OpenVPNConnectionType::PASSWORD) || (_connectionType == OpenVPNConnectionType::X509USERPASS)) @@ -550,10 +586,10 @@ TQMap<TQString, TQString> OpenVPNAuthentication::getPasswords() return pwds; } -void OpenVPNAuthentication::setPasswords(TQString name, TQString value) { - if (name == TQString("password")) { +void OpenVPNAuthentication::setPasswords(TDENetworkSettingsMap secrets) { + if (secrets.contains("password")) { _openvpnAuth->editUserPassword->erase(); - _openvpnAuth->editUserPassword->insert(value); + _openvpnAuth->editUserPassword->insert(secrets["password"]); } } @@ -564,3 +600,4 @@ bool OpenVPNAuthentication::needsUserInteraction() return false; } +#include "tdenetman-openvpn.moc"
\ No newline at end of file diff --git a/tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.h b/tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-openvpn.h index 4b43b18..2f8889d 100644 --- a/tdenetworkmanager/vpn-plugins/openvpn/src/knetworkmanager-openvpn.h +++ b/tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-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. * @@ -31,7 +31,7 @@ #include <tqlayout.h> #include <kprocess.h> -#include "knetworkmanager-vpnplugin.h" +#include "tdenetman-vpnplugin.h" #include "openvpnprop.h" #include "openvpnauth.h" @@ -68,11 +68,12 @@ class OpenVPNConfig : public VPNConfigWidget Q_OBJECT public: - void setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties); - TQMap<TQString, TQString> getVPNProperties(); - TQStringList getVPNRoutes(); + void setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets); + TDENetworkSettingsMap getVPNProperties(); + TDENetworkSettingsMap getVPNSecrets(); + TDENetworkSingleRouteConfigurationList getVPNRoutes(); bool hasChanged(); - bool isValid(TQStringList& ); + bool isValid(TQStringList&); OpenVPNConfig(TQWidget* parent); ~OpenVPNConfig(); @@ -86,6 +87,9 @@ class OpenVPNConfig : public VPNConfigWidget void getCipherModes(); TQString findOpenVPNBinary(); + TDENetworkSettingsMap m_vpnProperties; + TDENetworkSettingsMap m_vpnSecrets; + protected slots: void languageChange(); }; @@ -97,9 +101,9 @@ class OpenVPNAuthentication : public VPNAuthenticationWidget public: OpenVPNAuthentication(TQWidget* parent = NULL, char* name = NULL); ~OpenVPNAuthentication(); - void setVPNData(const TQStringList&, const TQMap<TQString, TQString>&); - TQMap<TQString, TQString> getPasswords(); - void setPasswords(TQString name, TQString value); + void setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets); + TDENetworkSettingsMap getPasswords(); + void setPasswords(TDENetworkSettingsMap secrets); bool needsUserInteraction(); private: diff --git a/tdenetworkmanager/vpn-plugins/openvpn/knetworkmanager_openvpn.desktop b/tdenetworkmanager/vpn-plugins/openvpn/tdenetman_openvpn.desktop index ece3c52..dad55c0 100644 --- a/tdenetworkmanager/vpn-plugins/openvpn/knetworkmanager_openvpn.desktop +++ b/tdenetworkmanager/vpn-plugins/openvpn/tdenetman_openvpn.desktop @@ -2,12 +2,12 @@ Encoding=UTF-8 Type=Service Icon= -ServiceTypes=KNetworkManager/VPNPlugin -X-TDE-Library=knetworkmanager_openvpn +ServiceTypes=TDENetworkManager/VPNPlugin +X-TDE-Library=tdenetman_openvpn X-NetworkManager-Services=openvpn -X-TDE-PluginInfo-Author=Helmut Schaa -X-TDE-PluginInfo-Name=knetworkmanager_openvpn +X-TDE-PluginInfo-Author=Timothy Pearson +X-TDE-PluginInfo-Name=tdenetman_openvpn X-TDE-PluginInfo-Version=0.1 X-TDE-PluginInfo-Website= X-TDE-PluginInfo-Category=VPNService 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 <[email protected]> Helmut Schaa <[email protected]>, <[email protected]> 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/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/tdenetman-pptp.cpp index 452fb23..3475dd5 100644 --- a/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp +++ b/tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-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. * @@ -35,10 +35,10 @@ #include <kgenericfactory.h> #include <tqlabel.h> -#include "knetworkmanager-pptp.h" +#include "tdenetman-pptp.h" typedef KGenericFactory<PPTPPlugin> PPTPPluginFactory; -K_EXPORT_COMPONENT_FACTORY( knetworkmanager_pptp, PPTPPluginFactory("knetworkmanager_pptp")); +K_EXPORT_COMPONENT_FACTORY(tdenetman_pptp, PPTPPluginFactory("tdenetman_pptp")); PPTPPlugin::PPTPPlugin(TQObject* parent, const char* name, const TQStringList& args) @@ -86,8 +86,10 @@ void PPTPConfig::languageChange() } -void PPTPConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties) -{ +void PPTPConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets) { + m_vpnProperties = properties; + m_vpnSecrets = secrets; + // fill up our inputfields (only textfields atm) for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it) { @@ -144,42 +146,61 @@ void PPTPConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQ if (!routes.empty()) { _pptpWidget->chkIPAdresses->setChecked(true); - _pptpWidget->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())); + } + _pptpWidget->routes->setText(routesText.join(" ")); } } -TQMap<TQString, TQString> PPTPConfig::getVPNProperties() -{ - // build a StingList of properties - TQMap<TQString, TQString> 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")); +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. - //strlist.insert("ppp-connection-type", "pptp"); + //m_vpnProperties.insert("ppp-connection-type", "pptp"); + + return m_vpnProperties; +} + +TDENetworkSettingsMap PPTPConfig::getVPNSecrets() { + // Build a list of secrets + // FIXME - return strlist; + return m_vpnSecrets; } -TQStringList PPTPConfig::getVPNRoutes() +TDENetworkSingleRouteConfigurationList PPTPConfig::getVPNRoutes() { + TDENetworkSingleRouteConfigurationList ret; TQStringList strlist; - if(_pptpWidget->chkIPAdresses->isChecked()) - { + if(_pptpWidget->chkIPAdresses->isChecked()) { strlist = TQStringList::split(" ", _pptpWidget->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; } bool PPTPConfig::hasChanged() @@ -211,11 +232,11 @@ PPTPAuthentication::~PPTPAuthentication() } -TQMap<TQString, TQString> PPTPAuthentication::getPasswords() +TDENetworkSettingsMap PPTPAuthentication::getPasswords() { // network-manager-pptp will fail hard if "CHAP" is not the // first element in the username&password list. - TQMap<TQString, TQString> pwds; + TDENetworkSettingsMap pwds; //pwds.insert("CHAP", "CHAP"); pwds.insert("user", TQString(_pptpAuth->username->text())); pwds.insert("password", TQString(_pptpAuth->password->password())); @@ -223,9 +244,11 @@ TQMap<TQString, TQString> PPTPAuthentication::getPasswords() return pwds; } -void PPTPAuthentication::setPasswords(TQString name, TQString value) { - if (name == TQString("password")) { +void PPTPAuthentication::setPasswords(TDENetworkSettingsMap secrets) { + if (secrets.contains("password")) { _pptpAuth->password->erase(); - _pptpAuth->password->insert(value); + _pptpAuth->password->insert(secrets["password"]); } -}
\ No newline at end of file +} + +#include "tdenetman-pptp.moc"
\ No newline at end of file diff --git a/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.h b/tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-pptp.h index ca7b3b0..6f80300 100644 --- a/tdenetworkmanager/vpn-plugins/pptp/src/knetworkmanager-pptp.h +++ b/tdenetworkmanager/vpn-plugins/pptp/src/tdenetman-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. * @@ -30,7 +30,7 @@ #include <tqwidget.h> #include <tqlayout.h> -#include "knetworkmanager-vpnplugin.h" +#include "tdenetman-vpnplugin.h" #include "pptpprop.h" #include "pptpauth.h" @@ -51,9 +51,10 @@ class PPTPConfig : public VPNConfigWidget Q_OBJECT public: - void setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties); - TQMap<TQString, TQString> getVPNProperties(); - TQStringList getVPNRoutes(); + void setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets); + TDENetworkSettingsMap getVPNProperties(); + TDENetworkSettingsMap getVPNSecrets(); + TDENetworkSingleRouteConfigurationList getVPNRoutes(); bool hasChanged(); bool isValid(TQStringList& ); @@ -63,6 +64,9 @@ class PPTPConfig : public VPNConfigWidget private: PPTPConfigWidget* _pptpWidget; + TDENetworkSettingsMap m_vpnProperties; + TDENetworkSettingsMap m_vpnSecrets; + protected slots: void languageChange(); }; @@ -74,8 +78,8 @@ class PPTPAuthentication : public VPNAuthenticationWidget public: PPTPAuthentication(TQWidget* parent = NULL, char* name = NULL); ~PPTPAuthentication(); - TQMap<TQString, TQString> getPasswords(); - void setPasswords(TQString name, TQString value); + TDENetworkSettingsMap getPasswords(); + void setPasswords(TDENetworkSettingsMap secrets); private: PPTPAuthenticationWidget* _pptpAuth; diff --git a/tdenetworkmanager/vpn-plugins/pptp/knetworkmanager_pptp.desktop b/tdenetworkmanager/vpn-plugins/pptp/tdenetman_pptp.desktop index 68a0267..d5d626c 100644 --- a/tdenetworkmanager/vpn-plugins/pptp/knetworkmanager_pptp.desktop +++ b/tdenetworkmanager/vpn-plugins/pptp/tdenetman_pptp.desktop @@ -2,12 +2,12 @@ Encoding=UTF-8 Type=Service Icon= -ServiceTypes=KNetworkManager/VPNPlugin -X-TDE-Library=knetworkmanager_pptp +ServiceTypes=TDENetworkManager/VPNPlugin +X-TDE-Library=tdenetman_pptp X-NetworkManager-Services=pptp -X-TDE-PluginInfo-Author=Helmut Schaa -X-TDE-PluginInfo-Name=knetworkmanager_pptp +X-TDE-PluginInfo-Author=Timothy Pearson +X-TDE-PluginInfo-Name=tdenetman_pptp X-TDE-PluginInfo-Version=0.1 X-TDE-PluginInfo-Website= X-TDE-PluginInfo-Category=VPNService diff --git a/tdenetworkmanager/vpn-plugins/strongswan/authors b/tdenetworkmanager/vpn-plugins/strongswan/AUTHORS index 06c50d3..242ed99 100644 --- a/tdenetworkmanager/vpn-plugins/strongswan/authors +++ b/tdenetworkmanager/vpn-plugins/strongswan/AUTHORS @@ -1 +1,2 @@ +Timothy Pearson <[email protected]> Thomas Kallenberg <[email protected]>, <[email protected]> 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/src/knetworkmanager-strongswan.cpp b/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp index 39a512c..2d9e0d7 100644 --- a/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.cpp +++ b/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-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 <[email protected]>, <[email protected]> * @@ -35,10 +35,10 @@ #include <kgenericfactory.h> #include <tqlabel.h> -#include "knetworkmanager-strongswan.h" +#include "tdenetman-strongswan.h" typedef KGenericFactory<StrongswanPlugin> StrongswanPluginFactory; -K_EXPORT_COMPONENT_FACTORY( knetworkmanager_strongswan, StrongswanPluginFactory("knetworkmanager_strongswan")); +K_EXPORT_COMPONENT_FACTORY( tdenetman_strongswan, StrongswanPluginFactory("tdenetman_strongswan")); StrongswanPlugin::StrongswanPlugin(TQObject* parent, const char* name, const TQStringList& args) @@ -85,7 +85,7 @@ void StrongswanConfig::languageChange() } - // usercert agent password userkey +// usercert agent password userkey StrongswanConnectionType::CONNECTIONTYPE StrongswanConnectionType::mapString2ConnectionType(int prop) { if (prop == 0) @@ -113,79 +113,103 @@ int StrongswanConnectionType::mapConnectionType2String(CONNECTIONTYPE connType) return -1; } -void StrongswanConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties) +void StrongswanConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets) { + m_vpnProperties = properties; + m_vpnSecrets = secrets; + // fill up our inputfields (only textfields atm) - for(TQMap<TQString, TQString>::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"); } } } -TQMap<TQString, TQString> StrongswanConfig::getVPNProperties() +TDENetworkSettingsMap StrongswanConfig::getVPNProperties() { - // build a StingList of properties - TQMap<TQString, TQString> strlist; + // 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"); + } - 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->chkIPcomp->isChecked()) { + m_vpnProperties.insert("ipcomp", TQString("yes")); + } + else { + m_vpnProperties.remove("ipcomp"); + } - if (_strongswanWidget->chkUDPenc->isChecked()) - strlist.insert("encap", TQString("yes")); + if (_strongswanWidget->chkIPinner->isChecked()) { + m_vpnProperties.insert("virtual", TQString("yes")); + } + else { + m_vpnProperties.remove("virtual"); + } - if (_strongswanWidget->chkIPcomp->isChecked()) - strlist.insert("ipcomp", TQString("yes")); + return m_vpnProperties; +} - if (_strongswanWidget->chkIPinner->isChecked()) - strlist.insert("virtual", TQString("yes")); +TDENetworkSettingsMap StrongswanConfig::getVPNSecrets() { + // Build a list of secrets + // FIXME - return strlist; + return m_vpnSecrets; } -TQStringList StrongswanConfig::getVPNRoutes() +TDENetworkSingleRouteConfigurationList StrongswanConfig::getVPNRoutes() { + TDENetworkSingleRouteConfigurationList ret; +#if 0 TQStringList strlist; - /*if(_strongswanWidget->chkIPAdresses->isChecked()) - { + if(_strongswanWidget->chkIPAdresses->isChecked()) { strlist = TQStringList::split(" ", _strongswanWidget->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); + } +#endif + + return ret; } @@ -218,7 +242,7 @@ StrongswanAuthentication::~StrongswanAuthentication() } -TQMap<TQString, TQString> StrongswanAuthentication::getPasswords() +TDENetworkSettingsMap StrongswanAuthentication::getPasswords() { TQMap<TQString, TQString> pwds; pwds.insert("user", TQString(_strongswanAuth->username->text())); @@ -226,9 +250,11 @@ TQMap<TQString, TQString> StrongswanAuthentication::getPasswords() return pwds; } -void StrongswanAuthentication::setPasswords(TQString name, TQString value) { - if (name == TQString("password")) { +void StrongswanAuthentication::setPasswords(TDENetworkSettingsMap secrets) { + if (secrets.contains("password")) { _strongswanAuth->password->erase(); - _strongswanAuth->password->insert(value); + _strongswanAuth->password->insert(secrets["password"]); } -}
\ No newline at end of file +} + +#include "tdenetman-strongswan.moc"
\ No newline at end of file diff --git a/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h b/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.h index ce2f739..c1229ab 100644 --- a/tdenetworkmanager/vpn-plugins/strongswan/src/knetworkmanager-strongswan.h +++ b/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-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 <[email protected]>, <[email protected]> * @@ -30,7 +30,7 @@ #include <tqwidget.h> #include <tqlayout.h> -#include "knetworkmanager-vpnplugin.h" +#include "tdenetman-vpnplugin.h" #include "strongswanprop.h" #include "strongswanauth.h" @@ -48,17 +48,17 @@ class StrongswanPlugin : public VPNPlugin class StrongswanConnectionType { - public: - enum CONNECTIONTYPE - { - UNKNOWN = -1 - , psk = 0 - , key - , agent - }; - - static CONNECTIONTYPE mapString2ConnectionType(int string); - static int mapConnectionType2String(CONNECTIONTYPE connectionType); + public: + enum CONNECTIONTYPE + { + UNKNOWN = -1 + , psk = 0 + , key + , agent + }; + + static CONNECTIONTYPE mapString2ConnectionType(int string); + static int mapConnectionType2String(CONNECTIONTYPE connectionType); }; class StrongswanConfig : public VPNConfigWidget @@ -66,9 +66,10 @@ class StrongswanConfig : public VPNConfigWidget Q_OBJECT public: - void setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties); - TQMap<TQString, TQString> getVPNProperties(); - TQStringList getVPNRoutes(); + void setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets); + TDENetworkSettingsMap getVPNProperties(); + TDENetworkSettingsMap getVPNSecrets(); + TDENetworkSingleRouteConfigurationList getVPNRoutes(); bool hasChanged(); bool isValid(TQStringList& ); @@ -78,6 +79,9 @@ class StrongswanConfig : public VPNConfigWidget private: StrongswanConfigWidget* _strongswanWidget; + TDENetworkSettingsMap m_vpnProperties; + TDENetworkSettingsMap m_vpnSecrets; + protected slots: void languageChange(); }; @@ -89,8 +93,8 @@ class StrongswanAuthentication : public VPNAuthenticationWidget public: StrongswanAuthentication(TQWidget* parent = NULL, char* name = NULL); ~StrongswanAuthentication(); - TQMap<TQString, TQString> getPasswords(); - void setPasswords(TQString name, TQString value); + TDENetworkSettingsMap getPasswords(); + void setPasswords(TDENetworkSettingsMap secrets); private: StrongswanAuthenticationWidget* _strongswanAuth; diff --git a/tdenetworkmanager/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop b/tdenetworkmanager/vpn-plugins/strongswan/tdenetman_strongswan.desktop index f4c8f2f..7026d04 100644 --- a/tdenetworkmanager/vpn-plugins/strongswan/knetworkmanager_strongswan.desktop +++ b/tdenetworkmanager/vpn-plugins/strongswan/tdenetman_strongswan.desktop @@ -2,12 +2,12 @@ Encoding=UTF-8 Type=Service Icon= -ServiceTypes=KNetworkManager/VPNPlugin -X-TDE-Library=knetworkmanager_strongswan +ServiceTypes=TDENetworkManager/VPNPlugin +X-TDE-Library=tdenetman_strongswan X-NetworkManager-Services=strongswan -X-TDE-PluginInfo-Author=Thomas Kallenberg -X-TDE-PluginInfo-Name=knetworkmanager_strongswan +X-TDE-PluginInfo-Author=Timothy Pearson +X-TDE-PluginInfo-Name=tdenetman_strongswan X-TDE-PluginInfo-Version=0.1 X-TDE-PluginInfo-Website= X-TDE-PluginInfo-Category=VPNService 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 <[email protected]> Helmut Schaa <[email protected]>, <[email protected]> Thomas Kallenberg <[email protected]> <[email protected]> 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/src/CMakeLists.txt b/tdenetworkmanager/vpn-plugins/vpnc/src/CMakeLists.txt new file mode 100644 index 0000000..9c7a5d1 --- /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 tdeinit_tdenetworkmanager-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp index 5bab84c..272e05f 100644 --- a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.cpp +++ b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.cpp @@ -1,8 +1,9 @@ /*************************************************************************** * - * knetworkmanager-vpnc.cpp - A NetworkManager frontend for KDE + * tdenetman-vpnc.cpp - A NetworkManager frontend for TDE * * Copyright (C) 2006 Novell, Inc. + * Copyright (C) 2012 Timothy Pearson <[email protected]> * * Author: Helmut Schaa <[email protected]>, <[email protected]> * Author: Timothy Pearson <[email protected]> @@ -16,7 +17,7 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -39,11 +40,11 @@ #include <string> #include <stdio.h> -#include "knetworkmanager-vpnc.h" +#include "tdenetman-vpnc.h" using namespace std; typedef KGenericFactory<VPNCPlugin> 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 @@ -111,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) { @@ -139,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 ) { @@ -182,7 +182,7 @@ void VPNCConfig::pcfImport() 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) @@ -190,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) { @@ -213,11 +215,13 @@ void VPNCConfig::pcfImport() } } -void VPNCConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& 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<TQString, TQString>::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(); @@ -272,57 +276,86 @@ void VPNCConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQ if (!routes.empty()) { _vpncWidget->chkIPAdresses->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<TQString, TQString> VPNCConfig::getVPNProperties() -{ - // build a StingList of properties - TQMap<TQString, TQString> 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->chkUseKeepAlive->isChecked()) - strlist.insert("NAT-Keepalive packet interval", TQString(_vpncWidget->nat_keep_alive_interval->text())); + if (_vpncWidget->chkUseDomain->isChecked()) { + m_vpnProperties.insert("Domain", TQString(_vpncWidget->Domain->text())); + } + else { + m_vpnProperties.remove("Domain"); + } - switch (_vpncWidget->cboNAT->currentItem()) - { + 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()) { 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 m_vpnProperties; +} + +TDENetworkSettingsMap VPNCConfig::getVPNSecrets() { + // Build a list of secrets + // FIXME - return strlist; + return m_vpnSecrets; } -TQStringList VPNCConfig::getVPNRoutes() +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; } bool VPNCConfig::hasChanged() @@ -354,9 +387,9 @@ VPNCAuthentication::~VPNCAuthentication() } -TQMap<TQString, TQString> VPNCAuthentication::getPasswords() +TDENetworkSettingsMap VPNCAuthentication::getPasswords() { - TQMap<TQString, TQString> 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 @@ -372,7 +405,9 @@ TQMap<TQString, TQString> 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) { @@ -390,13 +425,15 @@ TQMap<TQString, TQString> 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"]); } -}
\ No newline at end of file +} + +#include "tdenetman-vpnc.moc"
\ No newline at end of file diff --git a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-vpnc.h index 35e2ee6..9999140 100644 --- a/tdenetworkmanager/vpn-plugins/vpnc/src/knetworkmanager-vpnc.h +++ b/tdenetworkmanager/vpn-plugins/vpnc/src/tdenetman-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. * @@ -31,7 +31,7 @@ #include <tqwidget.h> #include <tqlayout.h> -#include "knetworkmanager-vpnplugin.h" +#include "tdenetman-vpnplugin.h" #include "vpncprop.h" #include "vpncauth.h" @@ -50,13 +50,14 @@ class VPNCPlugin : public VPNPlugin class VPNCConfig : public VPNConfigWidget { Q_OBJECT - + public: - void setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties); - TQMap<TQString, TQString> getVPNProperties(); - TQStringList getVPNRoutes(); + void setVPNData(TDENetworkSingleRouteConfigurationList& routes, TDENetworkSettingsMap& properties, TDENetworkSettingsMap& secrets); + TDENetworkSettingsMap getVPNProperties(); + TDENetworkSettingsMap getVPNSecrets(); + TDENetworkSingleRouteConfigurationList getVPNRoutes(); bool hasChanged(); - bool isValid(TQStringList& ); + bool isValid(TQStringList&); VPNCConfig(TQWidget* parent); ~VPNCConfig(); @@ -66,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(); @@ -75,12 +79,12 @@ class VPNCConfig : public VPNConfigWidget class VPNCAuthentication : public VPNAuthenticationWidget { Q_OBJECT - + public: VPNCAuthentication(TQWidget* parent = NULL, char* name = NULL); ~VPNCAuthentication(); - TQMap<TQString, TQString> getPasswords(); - void setPasswords(TQString name, TQString value); + TDENetworkSettingsMap getPasswords(); + void setPasswords(TDENetworkSettingsMap secrets); private: VPNCAuthenticationWidget* _vpncAuth; diff --git a/tdenetworkmanager/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop b/tdenetworkmanager/vpn-plugins/vpnc/tdenetman_vpnc.desktop index e37900f..64ad398 100644 --- a/tdenetworkmanager/vpn-plugins/vpnc/knetworkmanager_vpnc.desktop +++ b/tdenetworkmanager/vpn-plugins/vpnc/tdenetman_vpnc.desktop @@ -2,12 +2,12 @@ Encoding=UTF-8 Type=Service Icon= -ServiceTypes=KNetworkManager/VPNPlugin -X-TDE-Library=knetworkmanager_vpnc +ServiceTypes=TDENetworkManager/VPNPlugin +X-TDE-Library=tdenetman_vpnc X-NetworkManager-Services=vpnc -X-TDE-PluginInfo-Author=Helmut Schaa -X-TDE-PluginInfo-Name=knetworkmanager_vpnc +X-TDE-PluginInfo-Author=Timothy Pearson +X-TDE-PluginInfo-Name=tdenetman_vpnc X-TDE-PluginInfo-Version=0.1 X-TDE-PluginInfo-Website= X-TDE-PluginInfo-Category=VPNService |