summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-09-04 13:51:32 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-09-04 13:51:32 -0500
commit9265fa10ad0ff141e4090fb280176680dd35ebef (patch)
treec83cd28521277d834f0a5991a7a04f69e255e1b3
parent082adfa55004e0e1fe5fc5c68881fa00832b3128 (diff)
downloadtdenetworkmanager-9265fa10.tar.gz
tdenetworkmanager-9265fa10.zip
Remove more unneeded files and start conversion to TDE network API
-rw-r--r--tdenetworkmanager/src/CMakeLists.txt22
-rw-r--r--tdenetworkmanager/src/devicetraycomponent.cpp123
-rw-r--r--tdenetworkmanager/src/devicetraycomponent.h29
-rw-r--r--tdenetworkmanager/src/knetworkmanager-accesspoint.cpp222
-rw-r--r--tdenetworkmanager/src/knetworkmanager-accesspoint.h75
-rw-r--r--tdenetworkmanager/src/knetworkmanager-cdma_device.cpp67
-rw-r--r--tdenetworkmanager/src/knetworkmanager-cdma_device.h51
-rw-r--r--tdenetworkmanager/src/knetworkmanager-cellular_device.cpp37
-rw-r--r--tdenetworkmanager/src/knetworkmanager-cellular_device.h40
-rw-r--r--tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp4
-rw-r--r--tdenetworkmanager/src/knetworkmanager-cellular_device_tray.h2
-rw-r--r--tdenetworkmanager/src/knetworkmanager-connection.cpp296
-rw-r--r--tdenetworkmanager/src/knetworkmanager-connection.h131
-rw-r--r--tdenetworkmanager/src/knetworkmanager-connection_dbus.cpp200
-rw-r--r--tdenetworkmanager/src/knetworkmanager-connection_dbus.h77
-rw-r--r--tdenetworkmanager/src/knetworkmanager-connection_editor.cpp21
-rw-r--r--tdenetworkmanager/src/knetworkmanager-connection_editor.h2
-rw-r--r--tdenetworkmanager/src/knetworkmanager-connection_secrets_dbus.cpp230
-rw-r--r--tdenetworkmanager/src/knetworkmanager-connection_secrets_dbus.h76
-rw-r--r--tdenetworkmanager/src/knetworkmanager-connection_store.cpp191
-rw-r--r--tdenetworkmanager/src/knetworkmanager-connection_store.h88
-rw-r--r--tdenetworkmanager/src/knetworkmanager-device.cpp166
-rw-r--r--tdenetworkmanager/src/knetworkmanager-device.h72
-rw-r--r--tdenetworkmanager/src/knetworkmanager-devicestore.cpp220
-rw-r--r--tdenetworkmanager/src/knetworkmanager-devicestore.h65
-rw-r--r--tdenetworkmanager/src/knetworkmanager-gsm_device.cpp67
-rw-r--r--tdenetworkmanager/src/knetworkmanager-gsm_device.h51
-rw-r--r--tdenetworkmanager/src/knetworkmanager-hal_device_proxy.cpp126
-rw-r--r--tdenetworkmanager/src/knetworkmanager-hal_device_proxy.h65
-rw-r--r--tdenetworkmanager/src/knetworkmanager-nm_proxy.cpp329
-rw-r--r--tdenetworkmanager/src/knetworkmanager-nm_proxy.h62
-rw-r--r--tdenetworkmanager/src/knetworkmanager-storage.cpp634
-rw-r--r--tdenetworkmanager/src/knetworkmanager-storage.h101
-rw-r--r--tdenetworkmanager/src/knetworkmanager-tray.cpp719
-rw-r--r--tdenetworkmanager/src/knetworkmanager-tray.h35
-rw-r--r--tdenetworkmanager/src/knetworkmanager-vpn_device.cpp75
-rw-r--r--tdenetworkmanager/src/knetworkmanager-vpn_device.h53
-rw-r--r--tdenetworkmanager/src/knetworkmanager-wired_device.cpp86
-rw-r--r--tdenetworkmanager/src/knetworkmanager-wired_device.h55
-rw-r--r--tdenetworkmanager/src/knetworkmanager-wired_device_tray.cpp4
-rw-r--r--tdenetworkmanager/src/knetworkmanager-wired_device_tray.h2
-rw-r--r--tdenetworkmanager/src/knetworkmanager-wireless_device.cpp207
-rw-r--r--tdenetworkmanager/src/knetworkmanager-wireless_device.h70
-rw-r--r--tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp48
-rw-r--r--tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h22
-rw-r--r--tdenetworkmanager/src/knetworkmanager-wireless_network.h6
-rw-r--r--tdenetworkmanager/src/knetworkmanager.cpp58
-rw-r--r--tdenetworkmanager/src/main.cpp7
-rw-r--r--tdenetworkmanager/src/secret_storage_plugin.cpp54
-rw-r--r--tdenetworkmanager/src/secret_storage_plugin.h53
-rw-r--r--tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp23
-rw-r--r--tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.h21
-rw-r--r--tdenetworkmanager/src/traycomponent.h2
53 files changed, 376 insertions, 5166 deletions
diff --git a/tdenetworkmanager/src/CMakeLists.txt b/tdenetworkmanager/src/CMakeLists.txt
index cef1cd7..293cfcb 100644
--- a/tdenetworkmanager/src/CMakeLists.txt
+++ b/tdenetworkmanager/src/CMakeLists.txt
@@ -11,8 +11,8 @@
add_definitions( -UQT_NO_ASCII_CAST )
-add_subdirectory( settings )
-add_subdirectory( configwidgets )
+#add_subdirectory( settings )
+#add_subdirectory( configwidgets )
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
@@ -50,26 +50,22 @@ tde_add_tdeinit_executable( knetworkmanager AUTOMOC
SOURCES
connection_editor.ui
vpnauthentication.ui main.cpp knetworkmanager.cpp knetworkmanager-tray.cpp
- knetworkmanager-hal_device_proxy.cpp knetworkmanager-nm_proxy.cpp knetworkmanager-device.cpp
- knetworkmanager-cdma_device.cpp knetworkmanager-cellular_device.cpp knetworkmanager-gsm_device.cpp
- knetworkmanager-wired_device.cpp knetworkmanager-vpn_device.cpp knetworkmanager-vpn_plugin.cpp
- knetworkmanager-wireless_device.cpp knetworkmanager-devicestore.cpp
+ #knetworkmanager-vpn_plugin.cpp
knetworkmanager-cellular_device_tray.cpp knetworkmanager-device_tray.cpp
knetworkmanager-wired_device_tray.cpp knetworkmanager-wireless_device_tray.cpp
- knetworkmanager-accesspoint.cpp knetworkmanager-wireless_menuitem.cpp knetworkmanager-menuitem.cpp
- knetworkmanager-menu_subhead.cpp
- knetworkmanager-connection_dbus.cpp knetworkmanager-connection_secrets_dbus.cpp
- knetworkmanager-connection.cpp knetworkmanager-generic_connection.cpp
+ knetworkmanager-wireless_menuitem.cpp knetworkmanager-menuitem.cpp
+ knetworkmanager-menu_subhead.cpp
+ knetworkmanager-generic_connection.cpp
knetworkmanager-cdma_connection.cpp knetworkmanager-gsm_connection.cpp
knetworkmanager-ppp_connection.cpp knetworkmanager-wireless_connection.cpp
knetworkmanager-wired_connection.cpp knetworkmanager-vpn_connection.cpp
- knetworkmanager-connection_store.cpp knetworkmanager-nmsettings.cpp
- sha1.cpp md5.cpp xmlmarshaller.cpp knetworkmanager-storage.cpp
+ knetworkmanager-nmsettings.cpp
+ sha1.cpp md5.cpp xmlmarshaller.cpp
knetworkmanager-wireless_network.cpp knetworkmanager-wireless_manager.cpp
knetworkmanager-connection_editor.cpp knetworkmanager-plugin.cpp knetworkmanager-vpnplugin.cpp
knetworkmanager-pluginmanager.cpp knetworkmanager-vpnservice.cpp knetworkmanager-vpnmanager.cpp
knetworkmanager-vpnauthenticationdialog.cpp devicetraycomponent.cpp traycomponent.cpp
- vpn_tray_component.cpp secret_storage_plugin.cpp
+ vpn_tray_component.cpp
EMBED tdenetwork-connection-configwidgets-static tdenetwork-connection-settings-static
LINK tdecore-shared tdeui-shared kutils-shared ${DBUS_TQT_LIBRARIES}
)
diff --git a/tdenetworkmanager/src/devicetraycomponent.cpp b/tdenetworkmanager/src/devicetraycomponent.cpp
index d42db60..d0a3f97 100644
--- a/tdenetworkmanager/src/devicetraycomponent.cpp
+++ b/tdenetworkmanager/src/devicetraycomponent.cpp
@@ -27,40 +27,79 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "knetworkmanager-device.h"
#include "knetworkmanager-nm_proxy.h"
+TQString pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) {
+ TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = 0x80000000;
+ while (flag > 0) {
+ if (state & flag) {
+ if (m_pixmaps.contains(flag)) {
+ return m_pixmaps[flag];
+ }
+ }
+ flag = flag >> 1;
+ }
+ return TQString::null;
+}
+
+TQString movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) {
+ TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = 0x80000000;
+ while (flag > 0) {
+ if (state & flag) {
+ if (m_movies.contains(flag)) {
+ return m_movies[flag];
+ }
+ }
+ flag = flag >> 1;
+ }
+ return TQString::null;
+}
+
+TQString tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) {
+ TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = 0x80000000;
+ while (flag > 0) {
+ if (state & flag) {
+ if (m_tooltips.contains(flag)) {
+ return m_tooltips[flag];
+ }
+ }
+ flag = flag >> 1;
+ }
+ return TQString::null;
+}
+
DeviceTrayComponent::DeviceTrayComponent(Device * device, KSystemTray * parent, const char * name )
: TrayComponent(parent, name), m_device(device)
{
- connect( m_device, TQT_SIGNAL(StateChanged(NMDeviceState)), TQT_SLOT(deviceStateChanged(NMDeviceState)));
-
- m_pixmaps[NM_DEVICE_STATE_UNKNOWN] = "nm_no_connection";
- m_pixmaps[NM_DEVICE_STATE_UNMANAGED] = "nm_no_connection";
- m_pixmaps[NM_DEVICE_STATE_UNAVAILABLE] = "nm_no_connection";
- m_pixmaps[NM_DEVICE_STATE_DISCONNECTED] = "nm_no_connection";
- m_pixmaps[NM_DEVICE_STATE_ACTIVATED] = "ok";
- m_pixmaps[NM_DEVICE_STATE_FAILED] = "nm_no_connection";
-
- m_movies[NM_DEVICE_STATE_PREPARE] = "nm_stage01_connecting";
- m_movies[NM_DEVICE_STATE_CONFIG] = "nm_stage02_connecting";
- m_movies[NM_DEVICE_STATE_IP_CONFIG] = "nm_stage03_connecting";
- m_movies[NM_DEVICE_STATE_NEED_AUTH] = m_movies[NM_DEVICE_STATE_CONFIG];
-
- m_tooltips[NM_DEVICE_STATE_UNKNOWN] = i18n("Unknown");
- m_tooltips[NM_DEVICE_STATE_UNAVAILABLE] = i18n("Down");
- m_tooltips[NM_DEVICE_STATE_UNMANAGED] = i18n("Unmanaged");
- m_tooltips[NM_DEVICE_STATE_DISCONNECTED] = i18n("Disconnected");
- m_tooltips[NM_DEVICE_STATE_PREPARE] = i18n("Preparing");
- m_tooltips[NM_DEVICE_STATE_CONFIG] = i18n("Configuration");
- m_tooltips[NM_DEVICE_STATE_NEED_AUTH] = i18n("Awaiting authentication");
- m_tooltips[NM_DEVICE_STATE_IP_CONFIG] = i18n("IP configuration");
- m_tooltips[NM_DEVICE_STATE_ACTIVATED] = i18n("Activated");
- m_tooltips[NM_DEVICE_STATE_FAILED] = i18n("Failed");
+ connect( m_device, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), TQT_SLOT(deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)));
+
+ m_pixmaps[TDENetworkConnectionStatus::Invalid] = "nm_no_connection";
+ m_pixmaps[TDENetworkConnectionStatus::UnManaged] = "nm_no_connection";
+ m_pixmaps[TDENetworkConnectionStatus::LinkUnavailable] = "nm_no_connection";
+ m_pixmaps[TDENetworkConnectionStatus::Disconnected] = "nm_no_connection";
+ m_pixmaps[TDENetworkConnectionStatus::Connected] = "ok";
+ m_pixmaps[TDENetworkConnectionStatus::Failed] = "nm_no_connection";
+
+ m_movies[TDENetworkConnectionStatus::EstablishingLink] = "nm_stage01_connecting";
+ m_movies[TDENetworkConnectionStatus::ConfiguringProtocols] = "nm_stage02_connecting";
+ m_movies[TDENetworkConnectionStatus::VerifyingProtocols] = "nm_stage03_connecting";
+ m_movies[TDENetworkConnectionStatus::NeedAuthorization] = m_movies[TDENetworkConnectionStatus::ConfiguringProtocols];
+
+ m_tooltips[TDENetworkConnectionStatus::Invalid] = i18n("Unknown");
+ m_tooltips[TDENetworkConnectionStatus::LinkUnavailable] = i18n("Down");
+ m_tooltips[TDENetworkConnectionStatus::UnManaged] = i18n("Unmanaged");
+ m_tooltips[TDENetworkConnectionStatus::Disconnected] = i18n("Disconnected");
+ m_tooltips[TDENetworkConnectionStatus::EstablishingLink] = i18n("Preparing");
+ m_tooltips[TDENetworkConnectionStatus::ConfiguringProtocols] = i18n("Configuration");
+ m_tooltips[TDENetworkConnectionStatus::NeedAuthorization] = i18n("Awaiting authentication");
+ m_tooltips[TDENetworkConnectionStatus::VerifyingProtocols] = i18n("IP configuration");
+ m_tooltips[TDENetworkConnectionStatus::Connected] = i18n("Activated");
+ m_tooltips[TDENetworkConnectionStatus::Failed] = i18n("Failed");
}
DeviceTrayComponent::~DeviceTrayComponent()
{
}
-Device* DeviceTrayComponent::device() const
+TDENetworkDevice* DeviceTrayComponent::device() const
{
return m_device;
}
@@ -68,62 +107,62 @@ Device* DeviceTrayComponent::device() const
TQStringList DeviceTrayComponent::getToolTipText()
{
TQStringList list;
- NMDeviceState state = m_device->getState();
- if (m_tooltips.contains(state)) {
+ TDENetworkConnectionStatus::TDENetworkConnectionStatus state = m_device->getState();
+ if (tooltipForConnState(state) != "") {
list.append(i18n("Device: %1").arg(m_device->getInterface()));
- list.append(i18n("State: %1").arg(m_tooltips[state]));
+ list.append(i18n("State: %1").arg(tooltipForConnState(state)));
}
return list;
}
-TQPixmap DeviceTrayComponent::pixmapForState(NMDeviceState state)
+TQPixmap DeviceTrayComponent::pixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state)
{
- if (m_pixmaps.contains(state)) {
- return KSystemTray::loadIcon(m_pixmaps[state]);
+ if (pixmapForConnState(state) != "") {
+ return KSystemTray::loadIcon(pixmapForConnState(state));
} else {
return TQPixmap();
}
}
-TQMovie DeviceTrayComponent::movieForState(NMDeviceState state)
+TQMovie DeviceTrayComponent::movieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state)
{
- if (m_movies.contains(state)) {
- return TQMovie( KGlobal::iconLoader()->moviePath(m_movies[state], KIcon::Panel));
+ if (movieForConnState(state) != "") {
+ return TQMovie( KGlobal::iconLoader()->moviePath(movieForConnState(state), KIcon::Panel));
} else {
return TQMovie();
}
}
-void DeviceTrayComponent::setMovieForState(NMDeviceState state, TQString movie)
+void DeviceTrayComponent::setMovieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state, TQString movie)
{
m_movies[state] = movie;
}
-void DeviceTrayComponent::setPixmapForState(NMDeviceState state, TQString pixmap)
+void DeviceTrayComponent::setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state, TQString pixmap)
{
m_pixmaps[state] = pixmap;
}
-void DeviceTrayComponent::deviceStateChanged(NMDeviceState state)
+void DeviceTrayComponent::deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus state)
{
//check if our device now holds the default active connection
// if it is the default active connection
// or if it is activating. what if 2 devices are activating simultaneously?
NMProxy * nm = 0;
switch (state) {
- case NM_DEVICE_STATE_PREPARE:
+ case TDENetworkConnectionStatus::EstablishingLink:
emit needsCenterStage(this, true);
break;
- case NM_DEVICE_STATE_ACTIVATED:
+ case TDENetworkConnectionStatus::Connected:
nm = NMProxy::getInstance();
if ( m_device == nm->getDefaultDevice() ) {
emit needsCenterStage(this, true);
}
break;
- case NM_DEVICE_STATE_UNAVAILABLE:
- case NM_DEVICE_STATE_DISCONNECTED:
- case NM_DEVICE_STATE_FAILED:
+ case TDENetworkConnectionStatus::LinkUnavailable:
+ case TDENetworkConnectionStatus::Disconnected:
+ case TDENetworkConnectionStatus::Failed:
emit needsCenterStage(this, false);
break;
default:
diff --git a/tdenetworkmanager/src/devicetraycomponent.h b/tdenetworkmanager/src/devicetraycomponent.h
index 729076f..e162020 100644
--- a/tdenetworkmanager/src/devicetraycomponent.h
+++ b/tdenetworkmanager/src/devicetraycomponent.h
@@ -21,16 +21,17 @@ along with this program. If not, see <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 "traycomponent.h"
-class Device;
+class TDENetworkDevice;
class KPopupMenu;
class KSystemTray;
@@ -39,25 +40,25 @@ class DeviceTrayComponent : public TrayComponent
Q_OBJECT
public:
- DeviceTrayComponent(Device * device, KSystemTray * parent, const char * name );
+ DeviceTrayComponent(TDENetworkDevice * device, KSystemTray * parent, const char * name );
virtual ~DeviceTrayComponent();
- TQPixmap pixmapForState(NMDeviceState state);
- TQMovie movieForState(NMDeviceState state);
+ TQPixmap pixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state);
+ TQMovie movieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state);
virtual TQStringList getToolTipText();
- Device* device() const;
+ TDENetworkDevice* device() const;
signals:
void needsCenterStage(TrayComponent *, bool);
public slots:
virtual void newConnection() = 0;
protected slots:
- void deviceStateChanged(NMDeviceState);
+ void deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus);
protected:
- void setMovieForState(NMDeviceState, TQString);
- void setPixmapForState(NMDeviceState, TQString);
+ void setMovieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString);
+ void setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString);
private:
- Device * m_device;
- TQMap<NMDeviceState, TQString> m_movies;
- TQMap<NMDeviceState, TQString> m_pixmaps;
- TQMap<NMDeviceState, TQString> m_tooltips;
+ TDENetworkDevice * 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/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 <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <thoenig@suse.de>, <thoenig@nouse.net>
- * Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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_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 <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <wstephenson@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <wstephenson@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- **************************************************************************/
-
-#ifndef KNETWORKMANAGER_CELLULARDEVICE_H
-#define KNETWORKMANAGER_CELLULARDEVICE_H
-
-// KNM includes
-#include "knetworkmanager-device.h"
-
-class CellularDevice : public Device
-{
- Q_OBJECT
-
- public:
- CellularDevice (const TQString & obj_path );
- ~CellularDevice ();
-};
-
-#endif /* KNETWORKMANAGER_CELLULARDEVICE_H */
diff --git a/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp b/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp
index ea88749..49a3ab2 100644
--- a/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp
+++ b/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.cpp
@@ -62,7 +62,7 @@ class CellularDeviceTrayPrivate
CellularDeviceTrayPrivate() {}
~CellularDeviceTrayPrivate() {}
- CellularDevice* dev;
+ TDENetworkDevice* dev;
};
void CellularDeviceTray::newConnection()
@@ -166,7 +166,7 @@ void CellularDeviceTray::addMenuItems(KPopupMenu* menu)
menu->insertSeparator();
}
-CellularDeviceTray::CellularDeviceTray (CellularDevice* dev, KSystemTray * parent, const char * name)
+CellularDeviceTray::CellularDeviceTray (TDENetworkDevice* dev, KSystemTray * parent, const char * name)
: DeviceTrayComponent (dev, parent, name)
{
d = new CellularDeviceTrayPrivate();
diff --git a/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.h b/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.h
index 282cc3e..323a559 100644
--- a/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.h
+++ b/tdenetworkmanager/src/knetworkmanager-cellular_device_tray.h
@@ -40,7 +40,7 @@ class CellularDeviceTray : public DeviceTrayComponent
Q_OBJECT
public:
- CellularDeviceTray (CellularDevice*, KSystemTray * parent = 0, const char * name = 0);
+ CellularDeviceTray (TDENetworkDevice*, KSystemTray * parent = 0, const char * name = 0);
~CellularDeviceTray ();
void addMenuItems(KPopupMenu* menu);
diff --git a/tdenetworkmanager/src/knetworkmanager-connection.cpp b/tdenetworkmanager/src/knetworkmanager-connection.cpp
deleted file mode 100644
index 2c6ea8b..0000000
--- a/tdenetworkmanager/src/knetworkmanager-connection.cpp
+++ /dev/null
@@ -1,296 +0,0 @@
-/***************************************************************************
- *
- * knetworkmanager-connection.cpp - A NetworkManager frontend for KDE
- *
- * Copyright (C) 2005, 2006 Novell, Inc.
- *
- * Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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>
-
-/* 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 695408c..0000000
--- a/tdenetworkmanager/src/knetworkmanager-connection.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/***************************************************************************
- *
- * knetworkmanager-connection.h - A NetworkManager frontend for KDE
- *
- * Copyright (C) 2005, 2006 Novell, Inc.
- *
- * Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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"
-
-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 <hschaa@suse.de>, <helmut.schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <hschaa@suse.de>, <helmut.schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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_editor.cpp b/tdenetworkmanager/src/knetworkmanager-connection_editor.cpp
index e787a79..a80f014 100644
--- a/tdenetworkmanager/src/knetworkmanager-connection_editor.cpp
+++ b/tdenetworkmanager/src/knetworkmanager-connection_editor.cpp
@@ -50,7 +50,6 @@
#include "knetworkmanager-connection_store.h"
#include "knetworkmanager-connection_editor.h"
#include "knetworkmanager-connection_settings_dialog.h"
-#include "knetworkmanager-storage.h"
#include "knetworkmanager-vpnservice.h"
#include "knetworkmanager-vpnmanager.h"
@@ -63,7 +62,7 @@ class ConnectionListViewItem : public KListViewItem
{
public:
- ConnectionListViewItem(TQListView* parent, GenericConnection* connection)
+ ConnectionListViewItem(TQListView* parent, TDENetworkConnection* connection)
: KListViewItem(parent)
, _conn(connection)
{
@@ -84,7 +83,7 @@ class ConnectionListViewItem : public KListViewItem
}
}
- GenericConnection* _conn;
+ TDENetworkConnection* _conn;
};
/*
@@ -161,10 +160,10 @@ void ConnectionEditorImpl::slotNewVPNConnection()
/*
*
*/
-void ConnectionEditorImpl::slotEditNewConnection(Connection* conn)
+void ConnectionEditorImpl::slotEditNewConnection(TDENetworkConnection* conn)
{
// open a dialog for editing the connection
- ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, this, "connect_something", false, TQt::WDestructiveClose);
+ ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, this, "connect_something", false, TQt::WDestructiveClose);
connect(dlg, TQT_SIGNAL(connectionSaved()), this, TQT_SLOT(slotRefershConnectionList()));
dlg->show();
}
@@ -183,7 +182,7 @@ void ConnectionEditorImpl::slotEditCurrentConnection()
if (!item)
return;
- Connection* conn = item->_conn;
+ TDENetworkConnection* conn = item->_conn;
Storage* storage = Storage::getInstance();
bool hasSecretsStored = storage->hasSecretsStored(conn);
@@ -191,7 +190,7 @@ void ConnectionEditorImpl::slotEditCurrentConnection()
if (hasSecretsStored)
storage->restoreAllSecrets(conn);
- ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, false, NULL, this, "connect_something", false, TQt::WDestructiveClose);
+ ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, false, this, "connect_something", false, TQt::WDestructiveClose);
dlg->show();
// save all connections (if not done already)
@@ -209,7 +208,7 @@ void ConnectionEditorImpl::slotRemoveCurrentConnection()
return;
ConnectionStore* cstore = ConnectionStore::getInstance();
- Connection* conn = item->_conn;
+ TDENetworkConnection* conn = item->_conn;
lvConnections->takeItem(item);
delete item;
@@ -223,14 +222,14 @@ void ConnectionEditorImpl::slotRemoveCurrentConnection()
void ConnectionEditorImpl::fillConnectionList()
{
ConnectionStore* cstore = ConnectionStore::getInstance();
- TQValueList<Connection*> conns = cstore->getConnections();
- TQValueList<Connection*>::Iterator it = conns.begin();
+ TQValueList<TDENetworkConnection*> conns = cstore->getConnections();
+ TQValueList<TDENetworkConnection*>::Iterator it = conns.begin();
lvConnections->clear();
for (; it != conns.end(); ++it)
{
- GenericConnection* conn = dynamic_cast<GenericConnection*>(*it);
+ TDENetworkConnection* conn = *it;
if (conn)
{
Info* info = conn->getInfoSetting();
diff --git a/tdenetworkmanager/src/knetworkmanager-connection_editor.h b/tdenetworkmanager/src/knetworkmanager-connection_editor.h
index a0a7567..e853787 100644
--- a/tdenetworkmanager/src/knetworkmanager-connection_editor.h
+++ b/tdenetworkmanager/src/knetworkmanager-connection_editor.h
@@ -56,7 +56,7 @@ class ConnectionEditorImpl : public ConnectionEditor
void slotEditCurrentConnection();
void slotNewWirelessConnection();
void slotNewWiredConnection();
- void slotEditNewConnection(Connection* conn);
+ void slotEditNewConnection(TDENetworkConnection* conn);
void slotRefershConnectionList();
void slotNewVPNConnection();
diff --git a/tdenetworkmanager/src/knetworkmanager-connection_secrets_dbus.cpp b/tdenetworkmanager/src/knetworkmanager-connection_secrets_dbus.cpp
deleted file mode 100644
index aa64666..0000000
--- a/tdenetworkmanager/src/knetworkmanager-connection_secrets_dbus.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-/***************************************************************************
- *
- * knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
- *
- * Copyright (C) 2005, 2006 Novell, Inc.
- *
- * Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <hschaa@suse.de>, <helmut.schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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_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 <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <thoenig@suse.de>, <thoenig@nouse.net>
- * Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 bd6e863..0000000
--- a/tdenetworkmanager/src/knetworkmanager-device.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/***************************************************************************
- *
- * knetworkmanager-device.h - A NetworkManager frontend for KDE
- *
- * Copyright (C) 2005, 2006 Novell, Inc.
- *
- * Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
- * Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- **************************************************************************/
-
-#ifndef KNETWORKMANAGER_DEVICE_H
-#define KNETWORKMANAGER_DEVICE_H
-
-#include "knetworkmanager.h"
-
-#include <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-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 <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <thoenig@suse.de>, <thoenig@nouse.net>
- * Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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-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 <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <thoenig@suse.de>, <thoenig@nouse.net>
- * Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <thoenig@suse.de>, <thoenig@nouse.net>
- * Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <thoenig@suse.de>, <thoenig@nouse.net>
- * Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <hschaa@suse.de>, <helmut.schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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-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 <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
- * Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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
index 62851ff..7a818cc 100644
--- a/tdenetworkmanager/src/knetworkmanager-tray.cpp
+++ b/tdenetworkmanager/src/knetworkmanager-tray.cpp
@@ -27,8 +27,6 @@
*
**************************************************************************/
-class WirelessDialog;
-
#include <tqsignalmapper.h>
#include <tqevent.h>
#include <tqvbox.h>
@@ -40,7 +38,6 @@ class WirelessDialog;
#include <tqstyle.h>
#include <tqvaluelist.h>
#include <dcopclient.h>
-#include <tqdbusobjectpath.h>
#include <kdebug.h>
#include <kdialogbase.h>
#include <knotifyclient.h>
@@ -59,48 +56,22 @@ class WirelessDialog;
#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-menu_subhead.h"
+
#include "knetworkmanager-wired_device_tray.h"
#include "knetworkmanager-wireless_device_tray.h"
-#include "knetworkmanager-wireless_device.h"
+#include "knetworkmanager-cellular_device_tray.h"
#include <stdio.h>
-#define KDED_NETWORK_NAME "NMNetwork"
-
-#if !defined(NM_CHECK_VERSION)
-#define NM_CHECK_VERSION(x,y,z) 0
-#endif
+TDENetworkConnectionStatus::TDENetworkConnectionStatus nm_device_state_global;
-extern unsigned int current_vpn_state;
-NMDeviceState nm_device_state_global;
-extern unsigned char vpn_new_credentials_needed;
-
-NewSecretsDialog::NewSecretsDialog(ConnectionSettings::Connection *connection, TQWidget * parent, const char * name, bool modal, TQt::WFlags f)
+NewSecretsDialog::NewSecretsDialog(TDENetworkConnection *connection, TQWidget * parent, const char * name, bool modal, TQt::WFlags f)
: TQDialog(parent, name, modal, f)
{
_connection = connection;
@@ -114,20 +85,19 @@ NewSecretsDialog::~NewSecretsDialog ()
void NewSecretsDialog::slotDialogEdit()
{
- ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(_connection, false, NULL, Tray::getInstance(), "Edit connection");
+ ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(_connection, false, Tray::getInstance(), "Edit connection");
dlg->show();
close();
}
void NewSecretsDialog::reject()
{
- _connection->slotSecretsError();
TQDialog::reject();
}
void NewSecretsDialog::init()
{
- ConnectionSettings::GenericConnection* conn = dynamic_cast<ConnectionSettings::GenericConnection*>(_connection);
+ TDENetworkConnection* conn = _connection;
// if we do not have a connection bail out
if (!conn)
@@ -139,7 +109,7 @@ void NewSecretsDialog::init()
// show a message to the user that the connection failed
// and allow edit or cancel
- TQLabel* label = new TQLabel(tqtr(" The connection %1 could not be established ").arg(conn->getInfoSetting()->getName()), this);
+ TQLabel* label = new TQLabel(tqtr(" The connection %1 could not be established ").arg(conn->friendlyName), this);
TQPushButton* buttonEdit = new TQPushButton(tr("&Edit"), this);
TQPushButton* buttonCancel = new TQPushButton(tr("&Cancel"), this);
@@ -171,7 +141,7 @@ class TrayPrivate
TQValueList<TrayComponent*> trayComponents;
DeviceTrayComponent * foregroundTrayComponent;
TQSignalMapper signalMapper;
- TQMap<int, TQPair<ConnectionSettings::Connection*, Device*> > act_conn_map;
+ TQMap<int, TDENetworkConnection*> act_conn_map;
int current_idx;
};
@@ -193,69 +163,44 @@ void Tray::slotEditConnections()
void Tray::slotEnableWireless()
{
- NMProxy* nm = NMProxy::getInstance();
- TQT_DBusError err;
+ TDEGlobalNetworkManager* nm = KGlobal::networkManager();
if (!nm) return;
-
- nm->setWirelessEnabled(true, err);
+ nm->enableWiFi(true);
}
void Tray::slotDisableWireless()
{
- NMProxy* nm = NMProxy::getInstance();
- TQT_DBusError err;
+ TDEGlobalNetworkManager* nm = KGlobal::networkManager();
if (!nm) return;
-
- nm->setWirelessEnabled(false, err);
+ nm->enableWiFi(false);
}
void Tray::slotOfflineMode()
{
- NMProxy* nm = NMProxy::getInstance();
- TQT_DBusError err;
+ TDEGlobalNetworkManager* nm = KGlobal::networkManager();
if (!nm) return;
-
- nm->Sleep(true, err);
+ nm->enableNetworking(false);
}
void Tray::slotOnlineMode()
{
- NMProxy* nm = NMProxy::getInstance();
- TQT_DBusError err;
+ TDEGlobalNetworkManager* nm = KGlobal::networkManager();
if (!nm) return;
-
- nm->Sleep(false, err);
-}
-
-void Tray::slotNewVPNConnection()
-{
- printf("Creating new VPN connection\n\r");
- // create a new VPN connection
- Connection* conn = new VPNConnection();
-
- // edit the new connection
- ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, this, "connect_something", false, TQt::WDestructiveClose);
- dlg->show();
+ nm->enableNetworking(true);
}
void Tray::contextMenuAboutToShow (KPopupMenu* menu)
{
- TQT_DBusError err;
- NMProxy* nm = NMProxy::getInstance();
+ TDEGlobalNetworkManager* nm = KGlobal::networkManager();
// clear menu
menu->clear();
- if (nm->isNMRunning())
- {
-
- // actions for each Device
- for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin();
- it != d->trayComponents.end();
- ++it)
- {
- (*it)->addMenuItems(menu);
- }
+ 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("knetworkmanager_disabled", TQIconSet::Automatic));
@@ -269,16 +214,12 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
KActionMenu* newConnActionMenu = static_cast<KActionMenu*>(newConnAction);
newConnActionMenu->popupMenu()->clear();
TQValueList<TrayComponent*>::Iterator it;
- for (it = d->trayComponents.begin();
- it != d->trayComponents.end();
- ++it)
- {
+ for (it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) {
DeviceTrayComponent* dev_comp = dynamic_cast<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 (dev_comp) {
+ TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->deviceNode());
+ TQString menuCaption = TQString("%1").arg(dev_comp->device()->deviceNode());
if (menuCaption.contains("eth", FALSE) > 0) {
menuCaption = menuCaption.insert(0, "Wired Connection (");
}
@@ -299,14 +240,8 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
newConnActionMenu->insert(deviceNewConnAction);
}
}
- // New VPN connection option
- ++it;
- KAction * deviceNewConnAction = 0;
- TQString menuCaption = "VPN Connection";
- TQString actionName = TQString("new_connection_%1").arg("vpn");
- deviceNewConnAction = new KAction (menuCaption, 0, TQT_TQOBJECT(this), TQT_SLOT(slotNewVPNConnection()), actionCollection(), actionName);
- newConnActionMenu->insert(deviceNewConnAction);
- } else if ( devices == 1 ) {
+ }
+ else if ( devices == 1 ) {
newConnAction = actionCollection ()->action ("new_connection");
TQT_BASE_OBJECT_NAME::disconnect( newConnAction, TQT_SIGNAL(activated()) );
TQT_BASE_OBJECT_NAME::connect( newConnAction, TQT_SIGNAL(activated()), d->trayComponents[0], TQT_SLOT(newConnection()));
@@ -315,42 +250,42 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
newConnAction->plug(menu);
}
- // turn things off
- if (nm)
- {
+ // turn things off
+ if (nm) {
KActionMenu* disableStuffActionMenu = static_cast<KActionMenu*>(actionCollection ()->action ("deactivate_menu") );
disableStuffActionMenu->popupMenu()->clear();
- TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > map = nm->getActiveConnectionsMap();
+ TDENetworkConnectionList* map = nm->connections();
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;
+ for (TDENetworkConnectionList::Iterator it = map->begin(); it != map->end(); ++it) {
+ TDENetworkConnection* conn = (*it);
- if (!conn)
+ if (!conn) {
continue;
+ }
- TQString actionName = TQString("disable_connection_%1_%2").arg(conn->getID()).arg(dev ? dev->getInterface() : "");
+ if ((nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Disconnected)
+ || (nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Invalid)) {
+ continue;
+ }
+
+ TQString actionName = TQString("disable_connection_%1").arg(conn->UUID);
KAction * deviceNewConnAction = actionCollection ()->action (actionName);
- TQString actionText = conn->getInfoSetting()->getName();
- if (dev)
- actionText += TQString(" (%1)").arg(dev->getInterface());
+ TQString actionText = conn->friendlyName;
if (!deviceNewConnAction) {
deviceNewConnAction = new KAction (actionText, 0, &d->signalMapper, TQT_SLOT(map()), actionCollection(), actionName);
}
d->signalMapper.setMapping(deviceNewConnAction, d->current_idx);
- d->act_conn_map.insert(d->current_idx, TQPair<ConnectionSettings::Connection*, Device*> (conn, dev));
+ d->act_conn_map.insert(d->current_idx, conn);
d->current_idx++;
disableStuffActionMenu->insert(deviceNewConnAction);
}
// disable wireless
- if (nm->getWirelessHardwareEnabled(err))
- {
+ if (nm->wiFiHardwareEnabled()) {
KAction* wireless = NULL;
- if (nm->getWirelessEnabled(err)) {
+ if (nm->wiFiEnabled()) {
wireless = actionCollection ()->action ("disable_wireless");
} else {
wireless = actionCollection ()->action ("enable_wireless");
@@ -360,7 +295,7 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
// offline vs. online mode
KAction* switch_mode = NULL;
- if (nm->getState(err) != NM_STATE_ASLEEP) {
+ if (nm->backendStatus() != TDENetworkGlobalManagerFlags::Sleeping) {
switch_mode = actionCollection ()->action ("offline_mode");
}
else {
@@ -371,8 +306,7 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
disableStuffActionMenu->plug(menu);
}
}
- else
- {
+ else {
Subhead* subhead = new Subhead (menu, "subhead", i18n("NetworkManager is not running"), SmallIcon("stop", TQIconSet::Automatic));
menu->insertItem (subhead, -1, -1);
}
@@ -388,28 +322,28 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
// quit
menu->insertSeparator ();
KAction* quitAction = actionCollection ()->action (KStdAction::name (KStdAction::Quit));
- if (quitAction)
+ if (quitAction) {
quitAction->plug (menu);
+ }
}
-
void
-Tray::slotStateChanged(TQ_UINT32 state)
+Tray::slotStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState)
{
- NMState nm_state = (NMState) state;
+ TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags nm_state = newState;
// change tray icon according to NM's state
- switch(nm_state)
- {
- case NM_STATE_UNKNOWN:
- case NM_STATE_ASLEEP:
- case NM_STATE_CONNECTING:
- case NM_STATE_DISCONNECTED:
- setPixmap (loadIcon ("knetworkmanager_disabled"));
- break;
- case NM_STATE_CONNECTED:
- setPixmap (loadIcon ("knetworkmanager"));
- break;
+
+ if ((nm_state & TDENetworkGlobalManagerFlags::Unknown)
+ || (nm_state & TDENetworkGlobalManagerFlags::Sleeping)
+ || (nm_state & TDENetworkGlobalManagerFlags::EstablishingLink)
+ || (nm_state & TDENetworkGlobalManagerFlags::Disconnected)
+ || (nm_state & TDENetworkGlobalManagerFlags::BackendUnavailable)) {
+ setPixmap (loadIcon ("knetworkmanager_disabled"));
}
+ else if (nm_state & TDENetworkGlobalManagerFlags::Connected) {
+ setPixmap (loadIcon ("knetworkmanager"));
+ }
+
printf("NM state: %d\n\r", nm_state);
}
@@ -435,186 +369,19 @@ Tray::enterEvent (TQEvent* /*e*/)
}
void
-Tray::slotVPNSecretsNeeded(ConnectionSettings::Connection* connection, ConnectionSettings::ConnectionSetting* setting, const TQStringList& hints, bool request_new)
+Tray::slotSecretsNeeded(TDENetworkConnection* connection, const TQStringList& hints, bool request_new)
{
-#warning Implement Tray::slotVPNSecretsNeeded to handle parms properly
- Q_UNUSED(hints);
-
- Storage* storage = Storage::getInstance();
- bool hasSecretsStored = storage->hasSecretsStored(connection, setting);
-
- printf("Tray::slotVPNSecretsNeeded\n\r");
- kdDebug() << "Tray::slotVPNSecretsNeeded" << endl;
-
- // default secrets handling for all other connection types
- // 1) if we have secrets stored, restore them and send them back to NM
- // 2) if NM requests new secrets we should allow the user to retry the
- // connection or to edit it
-
- //if (hasSecretsStored && (!request_new))
- if (hasSecretsStored)
- {
- printf("Tray::slotVPNSecretsNeeded: Restoring saved secrets\n\r");
- // We have secrets stored, restore them
-// if (storage->restoreVPNSecrets(connection, setting))
-// {
- int number_of_secrets_found = 0;
- ConnectionSettings::VPNConnection* conn = dynamic_cast<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();
- }
+ // For now assume secrets are already in NM...
}
-void Tray::slotAddDeviceTrayComponent(Device* dev)
+void Tray::slotAddDeviceTrayComponent(TDENetworkDevice* dev)
{
- if (dev)
+ if (dev) {
createDeviceTrayComponent(dev);
+ }
}
-void Tray::slotRemoveDeviceTrayComponent(Device* dev)
+void Tray::slotRemoveDeviceTrayComponent(TDENetworkDevice* dev)
{
for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it)
{
@@ -629,7 +396,7 @@ void Tray::slotRemoveDeviceTrayComponent(Device* dev)
}
// remove the appropriate action
- TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->getInterface());
+ TQString actionName = TQString("new_connection_%1").arg(dev_comp->device()->deviceNode());
KAction * deviceNewConnAction = actionCollection ()->action (actionName);
if (!deviceNewConnAction)
@@ -650,7 +417,7 @@ void Tray::slotRemoveDeviceTrayComponent(Device* dev)
}
}
-void Tray::createDeviceTrayComponent(Device* dev)
+void Tray::createDeviceTrayComponent(TDENetworkDevice* dev)
{
bool trayExists = false;
@@ -672,33 +439,21 @@ void Tray::createDeviceTrayComponent(Device* dev)
if (!trayExists)
{
DeviceTrayComponent* devTray = 0;
+ TDENetworkConnectionManager* deviceConnMan = dev->connectionManager();
// different tray icons for different device types!
- switch (dev->getDeviceType())
+ switch (deviceConnMan->deviceType())
{
-#if NM_CHECK_VERSION(0,8,992)
- case NM_DEVICE_TYPE_ETHERNET:
-#else
- case DEVICE_TYPE_802_3_ETHERNET:
-#endif
- devTray = new WiredDeviceTray(dynamic_cast<WiredDevice*>(dev), this, "wired_device_tray");
+ case TDENetworkDeviceType::WiredEthernet:
+ devTray = new WiredDeviceTray(dev, this, "wired_device_tray");
break;
-#if NM_CHECK_VERSION(0,8,992)
- case NM_DEVICE_TYPE_WIFI:
-#else
- case DEVICE_TYPE_802_11_WIRELESS:
-#endif
- devTray = new WirelessDeviceTray(static_cast<WirelessDevice*>(dev), this, "wireless_device_tray");
+ case TDENetworkDeviceType::WiFi:
+ devTray = new WirelessDeviceTray(dev, this, "wireless_device_tray");
break;
-#if NM_CHECK_VERSION(0,8,992)
- case NM_DEVICE_TYPE_MODEM:
-#else
- case DEVICE_TYPE_GSM:
- case DEVICE_TYPE_CDMA:
-#endif
- devTray = new CellularDeviceTray(static_cast<CellularDevice*>(dev), this, "cellular_device_tray");
+ case TDENetworkDeviceType::Modem:
+ devTray = new CellularDeviceTray(dev, this, "cellular_device_tray");
break;
default:
- kdWarning() << k_funcinfo << "UDI: " << dev->getUdi() << " has unknown devicetype: " << dev->getDeviceType() << endl;
+ kdWarning() << k_funcinfo << "UDI: " << dev->uniqueID() << " has unknown devicetype: " << deviceConnMan->deviceType() << endl;
}
if(devTray)
{
@@ -711,51 +466,25 @@ void Tray::createDeviceTrayComponent(Device* dev)
}
}
-void Tray::createVPNTrayComponent()
-{
- bool trayExists = false;
-
- // check if we have already a trayicon for this device
- for (TQValueList<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();
+ TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices();
+ if (!hwdevices) return;
+
+ // create one tray-icon for each device
+ TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network);
// check for newly added devices
- for (TQValueList<Device*>::iterator it = devices.begin(); it != devices.end(); ++it)
+ for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it)
{
- Device* dev = (*it);
- if (dev)
+ TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(*it);
+ if (dev) {
createDeviceTrayComponent(dev);
- else
+ }
+ else {
kdWarning() << k_funcinfo << "got a NULL-Device" << endl;
+ }
}
-
- // add the VPN componenet as it is not associated with a device
- createVPNTrayComponent();
}
void Tray::mousePressEvent( TQMouseEvent *e )
@@ -776,13 +505,12 @@ void Tray::mousePressEvent( TQMouseEvent *e )
void Tray::slotDeactivateConnection(int index)
{
- ConnectionSettings::Connection* conn = d->act_conn_map[index].first;
- Device* dev = d->act_conn_map[index].second;
- NMProxy* nm = NMProxy::getInstance();
+ TDENetworkConnection* conn = d->act_conn_map[index];
+ TDEGlobalNetworkManager* nm = KGlobal::networkManager();
+ if (!nm) return;
if (conn) {
- TQString actionText = conn->getObjectPath().data();
- nm->deactivateConnection(conn, dev);
+ nm->deactivateConnection(conn->UUID);
}
}
@@ -790,8 +518,8 @@ void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt)
{
DeviceTrayComponent * dtc = dynamic_cast<DeviceTrayComponent*>(component);
if (dtc) {
- kdDebug() << k_funcinfo << dtc->device()->getInterface() << " : " << needsIt << endl;
- Device * device = dtc->device();
+ kdDebug() << k_funcinfo << dtc->device()->deviceNode() << " : " << needsIt << endl;
+ TDENetworkDevice * device = dtc->device();
if (needsIt) {
if (d->foregroundTrayComponent) {
disconnect(d->foregroundTrayComponent->device(), TQT_SIGNAL(StateChanged(NMDeviceState)), this, 0 );
@@ -801,8 +529,11 @@ void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt)
TQT_SLOT(slotUpdateDeviceState(NMDeviceState)));
} else {
disconnect(device, TQT_SIGNAL(StateChanged(NMDeviceState)), this, 0 );
- //use active default
- NMProxy* nm = NMProxy::getInstance();
+ // use active default
+#if 0
+ // FIXME
+ // The TDE network backend has no concept of a default device
+ // Should it?
device = nm->getDefaultDevice();
if ( device ) {
// identify the new foreground
@@ -814,11 +545,12 @@ void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt)
break;
}
}
- kdDebug() << " Device " << dtc->device()->getInterface() << " background, new foreground device: " << device->getInterface() << endl;
+ kdDebug() << " Device " << dtc->device()->deviceNode() << " background, new foreground device: " << device->deviceNode() << endl;
connect(device, TQT_SIGNAL(StateChanged(NMDeviceState)),
TQT_SLOT(slotUpdateDeviceState(NMDeviceState)));
slotUpdateDeviceState(device->getState());
}
+#endif
}
}
}
@@ -828,7 +560,7 @@ void Tray::slotUpdateDeviceState()
// FIXME
}
-void Tray::slotUpdateDeviceState(NMDeviceState state)
+void Tray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state)
{
updateTrayIcon(state);
updateActiveConnection(state);
@@ -838,59 +570,31 @@ void Tray::trayUiChanged()
{
DeviceTrayComponent * dtc = d->foregroundTrayComponent;
if (dtc) {
- updateTrayIcon(dtc->device()->getState());
+ TDENetworkConnectionManager* deviceConnMan = dtc->device()->connectionManager();
+ updateTrayIcon(deviceConnMan->deviceInformation().statusFlags);
}
}
-void Tray::updateTrayIcon(NMDeviceState state)
+void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus state)
{
// Get all active connections
- char active_vpn=0;
char found_any_active_connection=0;
- ConnectionStore* connectionStore = ConnectionStore::getInstance();
- NMProxy* nm = NMProxy::getInstance();
- TQValueList<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;
- }
- }
- }
- }
- }
- }
- }
+ TDEGlobalNetworkManager* nm = KGlobal::networkManager();
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);
+ TDENetworkConnectionList* allconmap = nm->connections();
+ for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) {
+ TDENetworkConnection* conn = (*it);
- if (!conn)
+ if (!conn) {
continue;
+ }
+
+ if ((nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Disconnected)
+ || (nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Invalid)) {
+ continue;
+ }
// Found an active connection
found_any_active_connection = 1;
@@ -900,142 +604,82 @@ void Tray::updateTrayIcon(NMDeviceState state)
// printf("Active connection found\n\r");
// }
- if ((current_vpn_state == NM_VPN_CONNECTION_STATE_FAILED) || (current_vpn_state == NM_VPN_CONNECTION_STATE_DISCONNECTED)) {
- active_vpn = 0;
- }
+ // stop the old movie to avoid unnecessary wakups
+ DeviceTrayComponent * dtc = d->foregroundTrayComponent;
- if (active_vpn == 0) {
- // stop the old movie to avoid unnecessary wakups
- DeviceTrayComponent * dtc = d->foregroundTrayComponent;
-
- if (movie())
- movie()->pause();
-
- if ((dtc) && (found_any_active_connection == 1)) {
-
- if (!dtc->movieForState(state).isNull())
- {
- // animation desired
- int frame = -1;
- if (movie())
- frame = movie()->frameNumber();
-
- // set the movie
- setMovie(dtc->movieForState(state));
-
- // start at the same frame as the movie before
- if (frame > 0)
- movie()->step(frame);
-
- // start the animation
- movie()->unpause();
- }
- else if (!dtc->pixmapForState(state).isNull())
- setPixmap(dtc->pixmapForState(state));
- else
- setPixmap(loadIcon("knetworkmanager"));
+ if (movie())
+ movie()->pause();
+
+ if ((dtc) && (found_any_active_connection == 1)) {
+
+ if (!dtc->movieForState(state).isNull())
+ {
+ // animation desired
+ int frame = -1;
+ if (movie())
+ frame = movie()->frameNumber();
+
+ // set the movie
+ setMovie(dtc->movieForState(state));
+
+ // start at the same frame as the movie before
+ if (frame > 0)
+ movie()->step(frame);
+
+ // start the animation
+ movie()->unpause();
}
- else {
+ else if (!dtc->pixmapForState(state).isNull())
+ setPixmap(dtc->pixmapForState(state));
+ else
setPixmap(loadIcon("knetworkmanager"));
- }
}
else {
- printf("VPN state: %d\n\r", current_vpn_state);
- //printf("Activated is: %d\n\r", NM_VPN_CONNECTION_STATE_ACTIVATED);
- // stop the old movie to avoid unnecessary wakups
- DeviceTrayComponent * dtc = d->foregroundTrayComponent;
-
- if (movie())
- movie()->pause();
-
- if (dtc) {
- if (current_vpn_state == NM_VPN_CONNECTION_STATE_ACTIVATED) {
- setPixmap(loadIcon("nm_device_vpn"));
- }
- if ((current_vpn_state == NM_VPN_CONNECTION_STATE_PREPARE) || (current_vpn_state == NM_VPN_CONNECTION_STATE_NEED_AUTH) || (current_vpn_state == NM_VPN_CONNECTION_STATE_CONNECT) || (current_vpn_state == NM_VPN_CONNECTION_STATE_IP_CONFIG_GET)) {
- int frame = -1;
- if (movie())
- frame = movie()->frameNumber();
-
- // set the movie
- if ((current_vpn_state == NM_VPN_CONNECTION_STATE_PREPARE) || (current_vpn_state == NM_VPN_CONNECTION_STATE_NEED_AUTH)) {
- setMovie(TQMovie(KGlobal::iconLoader()->moviePath("nm_stage02_connecting_vpn", KIcon::Panel)));
- }
- if ((current_vpn_state == NM_VPN_CONNECTION_STATE_CONNECT) || (current_vpn_state == NM_VPN_CONNECTION_STATE_IP_CONFIG_GET)) {
- setMovie(TQMovie(KGlobal::iconLoader()->moviePath("nm_stage03_connecting_vpn", KIcon::Panel)));
- }
-
- // start at the same frame as the movie before
- if (frame > 0)
- movie()->step(frame);
-
- // start the animation
- movie()->unpause();
- }
- }
+ setPixmap(loadIcon("knetworkmanager"));
}
nm_device_state_global = state;
//printf("Device state: %d\n\r", nm_device_state_global);
}
-void Tray::updateActiveConnection(NMDeviceState state)
+void Tray::updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus state)
{
- if (state != NM_DEVICE_STATE_ACTIVATED)
+ if (state != TDENetworkConnectionStatus::Connected) {
return;
-
- NMProxy* nm = NMProxy::getInstance();
- if (d->foregroundTrayComponent) {
- Connection* active_conn = nm->getActiveConnection(d->foregroundTrayComponent->device());
- if (active_conn)
- {
- Info* info = dynamic_cast<Info*>(active_conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME));
- if (info)
- info->setTimestamp(TQDateTime::currentDateTime());
- }
}
}
-void Tray::slotDeviceAddedNotify(Device* dev)
+void Tray::slotDeviceAddedNotify(TDENetworkDevice* dev)
{
kdDebug() << "Tray::slotDeviceAddedNotify" << endl;
- KNotifyClient::event( winId(), "knm-nm-device-added", i18n("New network device %1 found").arg(dev->getInterface()) );
+ KNotifyClient::event( winId(), "knm-nm-device-added", i18n("New network device %1 found").arg(dev->deviceNode()) );
}
-void Tray::slotDeviceRemovedNotify(Device* dev)
+void Tray::slotDeviceRemovedNotify(TDENetworkDevice* dev)
{
kdDebug() << "Tray::slotDeviceRemovedNotify" << endl;
- KNotifyClient::event( winId(), "knm-nm-device-removed", i18n("Network device %1 removed").arg(dev->getInterface()) );
+ KNotifyClient::event( winId(), "knm-nm-device-removed", i18n("Network device %1 removed").arg(dev->deviceNode()) );
}
-void Tray::slotVPNBannerShow(const TQString& vpnbanner)
+void Tray::slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState)
{
- printf("VPN banner: %s\n\r", vpnbanner.ascii());
- KNotifyClient::event(winId(), "knm-nm-vpn-banner", vpnbanner);
-}
+ TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags nm_state = newState;
-void Tray::slotStateChangedNotify(TQ_UINT32 state)
-{
- NMState nm_state = (NMState) state;
// change tray icon according to NM's state
- switch(nm_state)
- {
- case NM_STATE_CONNECTING:
- KNotifyClient::event( winId(), "knm-nm-connecting", i18n("NetworkManager is connecting") );
- break;
- case NM_STATE_DISCONNECTED:
- KNotifyClient::event( winId(), "knm-nm-disconnected", i18n("NetworkManager is now disconnected") );
- break;
- case NM_STATE_CONNECTED:
- KNotifyClient::event( winId(), "knm-nm-connected", i18n("NetworkManager is now connected") );
- break;
- case NM_STATE_ASLEEP:
- KNotifyClient::event( winId(), "knm-nm-sleeping", i18n("KNetworkManager Offline") );
- break;
- case NM_STATE_UNKNOWN:
-
- default:
- break;
+ if (nm_state & TDENetworkGlobalManagerFlags::EstablishingLink) {
+ KNotifyClient::event( winId(), "knm-nm-connecting", i18n("NetworkManager is connecting") );
+ }
+ else if (nm_state & TDENetworkGlobalManagerFlags::Disconnected) {
+ KNotifyClient::event( winId(), "knm-nm-disconnected", i18n("NetworkManager is now disconnected") );
+ }
+ else if (nm_state & TDENetworkGlobalManagerFlags::Connected) {
+ KNotifyClient::event( winId(), "knm-nm-connected", i18n("NetworkManager is now connected") );
+ }
+ else if (nm_state & TDENetworkGlobalManagerFlags::Sleeping) {
+ KNotifyClient::event( winId(), "knm-nm-sleeping", i18n("KNetworkManager Offline") );
+ }
+ else if (nm_state & TDENetworkGlobalManagerFlags::Unknown) {
+ //
}
}
@@ -1092,30 +736,25 @@ Tray::Tray () : KSystemTray ()
actionCollection (), "deactivate_menu");
// get notified when NM's state changes
- NMProxy* nm = NMProxy::getInstance();
- connect(nm, TQT_SIGNAL(StateChange(TQ_UINT32)), this, TQT_SLOT(slotStateChanged(TQ_UINT32)));
-
- // get notifier when NM requests new secrets
- ConnectionStore* cstore = ConnectionStore::getInstance();
- connect(cstore, TQT_SIGNAL(SecretsNeeded(ConnectionSettings::Connection*, ConnectionSettings::ConnectionSetting*, const TQStringList&, bool)), this, TQT_SLOT(slotSecretsNeeded(ConnectionSettings::Connection*, ConnectionSettings::ConnectionSetting*, const TQStringList&, bool)));
+ connect(KGlobal::networkManager(), TQT_SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, TQT_SLOT(slotStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)));
// get notified about new/removed devices
- DeviceStore* store = DeviceStore::getInstance();
- connect(store, TQT_SIGNAL(DeviceStoreChanged()), this, TQT_SLOT(updateDeviceTrays()));
- connect(store, TQT_SIGNAL(DeviceAdded(Device*)), this, TQT_SLOT(slotAddDeviceTrayComponent(Device*)));
- connect(store, TQT_SIGNAL(DeviceRemoved(Device*)), this, TQT_SLOT(slotRemoveDeviceTrayComponent(Device*)));
+ // FIXME
+// DeviceStore* store = DeviceStore::getInstance();
+// connect(store, TQT_SIGNAL(DeviceStoreChanged()), this, TQT_SLOT(updateDeviceTrays()));
+// connect(store, TQT_SIGNAL(DeviceAdded(TDENetworkDevice*)), this, TQT_SLOT(slotAddDeviceTrayComponent(TDENetworkDevice*)));
+// connect(store, TQT_SIGNAL(DeviceRemoved(TDENetworkDevice*)), this, TQT_SLOT(slotRemoveDeviceTrayComponent(TDENetworkDevice*)));
// Notifications
- connect(store, TQT_SIGNAL(DeviceAdded(Device*)), this, TQT_SLOT(slotDeviceAddedNotify(Device*)));
- connect(store, TQT_SIGNAL(DeviceRemoved(Device*)), this, TQT_SLOT(slotDeviceRemovedNotify(Device*)));
- connect(nm, TQT_SIGNAL(StateChange(TQ_UINT32)), this, TQT_SLOT(slotStateChangedNotify(TQ_UINT32)));
+ connect(KGlobal::networkManager(), TQT_SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, TQT_SLOT(slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)));
+// connect(store, TQT_SIGNAL(DeviceAdded(TDENetworkDevice*)), this, TQT_SLOT(slotDeviceAddedNotify(TDENetworkDevice*)));
+// connect(store, TQT_SIGNAL(DeviceRemoved(TDENetworkDevice*)), this, TQT_SLOT(slotDeviceRemovedNotify(TDENetworkDevice*)));
// initial setup of the device-trays
updateDeviceTrays();
- TQT_DBusError err;
- slotStateChanged(nm->getState(err));
+ slotStateChanged(KGlobal::networkManager()->backendStatus(), TDENetworkGlobalManagerFlags::Unknown);
}
Tray::~Tray ()
diff --git a/tdenetworkmanager/src/knetworkmanager-tray.h b/tdenetworkmanager/src/knetworkmanager-tray.h
index cbce02b..6f39948 100644
--- a/tdenetworkmanager/src/knetworkmanager-tray.h
+++ b/tdenetworkmanager/src/knetworkmanager-tray.h
@@ -84,36 +84,31 @@ class Tray : public KSystemTray
void slotDisableWireless();
void slotEditConnections();
- void slotStateChanged(TQ_UINT32 state);
- void slotVPNSecretsNeeded(ConnectionSettings::Connection* connection, ConnectionSettings::ConnectionSetting* setting, const TQStringList& hints, bool request_new);
- void slotSecretsNeeded(ConnectionSettings::Connection* connection, ConnectionSettings::ConnectionSetting* setting, const TQStringList& hints, bool request_new);
+ void slotStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState);
+ void slotSecretsNeeded(TDENetworkConnection* connection, const TQStringList& hints, bool request_new);
- void slotDeviceAddedNotify(Device*);
- void slotDeviceRemovedNotify(Device*);
- void slotStateChangedNotify(TQ_UINT32 state);
+ void slotDeviceAddedNotify(TDENetworkDevice*);
+ void slotDeviceRemovedNotify(TDENetworkDevice*);
+ void slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags newState, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags prevState);
void slotUpdateDeviceState();
- void slotUpdateDeviceState(NMDeviceState);
-
- void slotNewVPNConnection();
- void slotVPNBannerShow(const TQString& vpnbanner);
+ void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus);
protected slots:
void updateDeviceTrays();
- void slotAddDeviceTrayComponent(Device*);
- void slotRemoveDeviceTrayComponent(Device*);
+ void slotAddDeviceTrayComponent(TDENetworkDevice*);
+ void slotRemoveDeviceTrayComponent(TDENetworkDevice*);
void slotDeactivateConnection(int);
void trayComponentNeedsCenterStage(TrayComponent*, bool);
void trayUiChanged();
void slotEditNotifications();
private:
- void updateTrayIcon(NMDeviceState);
- void updateActiveConnection(NMDeviceState);
- void mousePressEvent( TQMouseEvent *e );
- void createVPNTrayComponent();
- void createDeviceTrayComponent(Device*);
- void enterEvent (TQEvent*);
+ void updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus);
+ void updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus);
+ void mousePressEvent(TQMouseEvent *e);
+ void createDeviceTrayComponent(TDENetworkDevice*);
+ void enterEvent(TQEvent*);
TrayPrivate* d;
@@ -125,7 +120,7 @@ class NewSecretsDialog : public TQDialog
public:
- NewSecretsDialog(ConnectionSettings::Connection* connection, TQWidget * parent, const char * name, bool modal = false, TQt::WFlags f = 0);
+ NewSecretsDialog(TDENetworkConnection* connection, TQWidget * parent, const char * name, bool modal = false, TQt::WFlags f = 0);
~NewSecretsDialog();
void init();
@@ -134,7 +129,7 @@ class NewSecretsDialog : public TQDialog
void reject();
private:
- ConnectionSettings::Connection* _connection;
+ TDENetworkConnection* _connection;
};
#endif /* KNETWORKMANAGER_TRAY_H */
diff --git a/tdenetworkmanager/src/knetworkmanager-vpn_device.cpp b/tdenetworkmanager/src/knetworkmanager-vpn_device.cpp
deleted file mode 100644
index 6093ecf..0000000
--- a/tdenetworkmanager/src/knetworkmanager-vpn_device.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/***************************************************************************
- *
- * knetworkmanager-vpn_device.cpp - A NetworkManager frontend for KDE
- *
- * Copyright (C) 2005, 2006 Novell, Inc.
- *
- * Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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-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 <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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
index 7e96886..9f2e9ed 100644
--- a/tdenetworkmanager/src/knetworkmanager-wired_device_tray.cpp
+++ b/tdenetworkmanager/src/knetworkmanager-wired_device_tray.cpp
@@ -66,7 +66,7 @@ class WiredDeviceTrayPrivate
WiredDeviceTrayPrivate() {}
~WiredDeviceTrayPrivate() {}
- WiredDevice* dev;
+ TDENetworkDevice* dev;
};
void WiredDeviceTray::newConnection()
@@ -144,7 +144,7 @@ void WiredDeviceTray::addMenuItems(KPopupMenu* menu)
}
}
-WiredDeviceTray::WiredDeviceTray (WiredDevice* dev, KSystemTray * parent, const char * name )
+WiredDeviceTray::WiredDeviceTray (TDENetworkDevice* dev, KSystemTray * parent, const char * name )
: DeviceTrayComponent (dev, parent, name)
{
d = new WiredDeviceTrayPrivate();
diff --git a/tdenetworkmanager/src/knetworkmanager-wired_device_tray.h b/tdenetworkmanager/src/knetworkmanager-wired_device_tray.h
index 7fcab3b..b2a2f7d 100644
--- a/tdenetworkmanager/src/knetworkmanager-wired_device_tray.h
+++ b/tdenetworkmanager/src/knetworkmanager-wired_device_tray.h
@@ -42,7 +42,7 @@ class WiredDeviceTray : public DeviceTrayComponent
public:
- WiredDeviceTray (WiredDevice*, KSystemTray * parent = 0, const char * name = 0);
+ WiredDeviceTray (TDENetworkDevice*, KSystemTray * parent = 0, const char * name = 0);
~WiredDeviceTray ();
void addMenuItems(KPopupMenu* menu);
diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_device.cpp b/tdenetworkmanager/src/knetworkmanager-wireless_device.cpp
deleted file mode 100644
index 554f797..0000000
--- a/tdenetworkmanager/src/knetworkmanager-wireless_device.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/***************************************************************************
- *
- * knetworkmanager-device.cpp - A NetworkManager frontend for KDE
- *
- * Copyright (C) 2005, 2006 Novell, Inc.
- *
- * Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
- * Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <thoenig@suse.de>, <thoenig@nouse.net>
- * Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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
index 443fdec..b56cb00 100644
--- a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp
+++ b/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.cpp
@@ -73,15 +73,15 @@ class WirelessDeviceTrayPrivate
WirelessDeviceTrayPrivate() :dev(0), activeAccessPoint(0) { }
~WirelessDeviceTrayPrivate() {}
- WirelessDevice* dev;
- TQGuardedPtr<AccessPoint> activeAccessPoint;
+ TDENetworkDevice* dev;
+ TQGuardedPtr<TDENetworkWiFiAPInfo> activeAccessPoint;
};
TQStringList WirelessDeviceTray::getToolTipText()
{
TQStringList tooltip = DeviceTrayComponent::getToolTipText();
- AccessPoint * ap = d->dev->getActiveAccessPoint();
+ TDENetworkWiFiAPInfo * ap = d->dev->getActiveAccessPoint();
if (ap)
tooltip.append(i18n("Network: %1").arg(ap->getDisplaySsid()));
@@ -91,7 +91,7 @@ TQStringList WirelessDeviceTray::getToolTipText()
void WirelessDeviceTray::newConnection()
{
// create a new wireless connection
- Connection* conn = new WirelessConnection();
+ Connection* conn = new TDEWiFiConnection();
// open a dialog for editing the connection
use_new_wireless_essid = 0; // deactivate autofill for now
@@ -99,7 +99,7 @@ void WirelessDeviceTray::newConnection()
dlg->show();
}
-bool WirelessDeviceTray::findMatchingNetwork(const WirelessConnection* conn, const TQValueList<WirelessNetwork>& nets, WirelessNetwork& net)
+bool WirelessDeviceTray::findMatchingNetwork(const TDEWiFiConnection* conn, const TQValueList<WirelessNetwork>& nets, WirelessNetwork& net)
{
Wireless* wireless = conn->getWirelessSetting();
WirelessSecurity* security = conn->getWirelessSecuritySetting();
@@ -118,10 +118,10 @@ bool WirelessDeviceTray::findMatchingNetwork(const WirelessConnection* conn, con
return false;
}
-WirelessConnection* WirelessDeviceTray::findMatchingConnection(const WirelessNetwork& net, const TQValueList<WirelessConnection*>& connections)
+TDEWiFiConnection* WirelessDeviceTray::findMatchingConnection(const WirelessNetwork& net, const TQValueList<TDEWiFiConnection*>& connections)
{
// try to find a connection matching this network
- for (TQValueList<WirelessConnection*>::ConstIterator it = connections.begin(); it != connections.end(); ++it)
+ for (TQValueList<TDEWiFiConnection*>::ConstIterator it = connections.begin(); it != connections.end(); ++it)
{
Wireless* wireless = (*it)->getWirelessSetting();
WirelessSecurity* security = (*it)->getWirelessSecuritySetting();
@@ -147,7 +147,7 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu)
TQValueList<WirelessNetwork> nets = WirelessManager::getWirelessNetworks(d->dev);
// get all wireless connections
- TQValueList<WirelessConnection*> conns = WirelessManager::getWirelessConnections();
+ TQValueList<TDEWiFiConnection*> conns = WirelessManager::getWirelessConnections();
// get the currently active connection
NMProxy* nm = NMProxy::getInstance();
@@ -157,7 +157,7 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu)
// add all wireless connections in range
// (we may have more then one connection per network)
- for (TQValueList<WirelessConnection*>::iterator it = conns.begin(); it != conns.end(); ++it)
+ for (TQValueList<TDEWiFiConnection*>::iterator it = conns.begin(); it != conns.end(); ++it)
{
WirelessNetworkItem* wirelessNetworkItem;
WirelessNetwork net;
@@ -180,7 +180,7 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu)
TQPopupMenu* popup = new TQPopupMenu(menu);
uint networkItemsAdded = 0;
- for (TQValueList<WirelessConnection*>::iterator it = conns.begin(); it != conns.end(); ++it)
+ for (TQValueList<TDEWiFiConnection*>::iterator it = conns.begin(); it != conns.end(); ++it)
{
WirelessNetworkItem* wirelessNetworkItem;
WirelessNetwork net;
@@ -213,7 +213,7 @@ void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu)
// // List available unsaved networks
TQPopupMenu* newpopup = new TQPopupMenu(menu);
- WirelessConnection* newconn;
+ TDEWiFiConnection* newconn;
uint newnetworkItemsAdded = 0;
TQValueList<WirelessNetwork> newnets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID);
@@ -281,27 +281,27 @@ void WirelessDeviceTray::addMenuItems(KPopupMenu* menu)
menu->insertSeparator();
}
-void WirelessDeviceTray::slotUpdateDeviceState(NMDeviceState state)
+void WirelessDeviceTray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state)
{
slotCheckActiveAccessPoint();
if (state == NM_DEVICE_STATE_ACTIVATED)
{
// trigger an update of the connections seen bssids property
- AccessPoint * ap = d->dev->getActiveAccessPoint();
+ TDENetworkWiFiAPInfo * ap = d->dev->getActiveAccessPoint();
if (ap) {
int strength = ap->getStrength();
if (strength > 80)
- setPixmapForState((NMDeviceState)state, "nm_signal_100");
+ setPixmapForState((TDENetworkConnectionStatus::TDENetworkConnectionStatus)state, "nm_signal_100");
else if (strength > 55)
- setPixmapForState((NMDeviceState)state, "nm_signal_75");
+ setPixmapForState((TDENetworkConnectionStatus::TDENetworkConnectionStatus)state, "nm_signal_75");
else if (strength > 30)
- setPixmapForState((NMDeviceState)state, "nm_signal_50");
+ setPixmapForState((TDENetworkConnectionStatus::TDENetworkConnectionStatus)state, "nm_signal_50");
else if (strength > 5)
- setPixmapForState((NMDeviceState)state, "nm_signal_25");
+ setPixmapForState((TDENetworkConnectionStatus::TDENetworkConnectionStatus)state, "nm_signal_25");
else
- setPixmapForState((NMDeviceState)state, "nm_signal_00");
+ setPixmapForState((TDENetworkConnectionStatus::TDENetworkConnectionStatus)state, "nm_signal_00");
}
}
}
@@ -314,7 +314,7 @@ void WirelessDeviceTray::slotCheckActiveAccessPoint()
if (!nm)
return;
- WirelessConnection* active_conn = dynamic_cast<WirelessConnection*>(nm->getActiveConnection(d->dev));
+ TDEWiFiConnection* active_conn = dynamic_cast<TDEWiFiConnection*>(nm->getActiveConnection(d->dev));
if (active_conn && d->dev->getState() == NM_DEVICE_STATE_ACTIVATED)
{
if ( d->dev->getActiveAccessPoint() != d->activeAccessPoint) {
@@ -334,7 +334,7 @@ void WirelessDeviceTray::slotCheckActiveAccessPoint()
void WirelessDeviceTray::apStrengthChanged(TQ_UINT8 strength)
{
kdDebug() << k_funcinfo << (uint)strength << endl;
- NMDeviceState state = device()->getState();
+ TDENetworkConnectionStatus::TDENetworkConnectionStatus state = device()->getState();
if (strength > 80)
setPixmapForState(state, "nm_signal_100");
else if (strength > 55)
@@ -348,7 +348,7 @@ void WirelessDeviceTray::apStrengthChanged(TQ_UINT8 strength)
emit uiUpdated();
}
-void WirelessDeviceTray::slotAccessPointAdded(AccessPoint* ap)
+void WirelessDeviceTray::slotAccessPointAdded(TDENetworkWiFiAPInfo* ap)
{
KNotifyClient::event( tray()->winId(), "knm-nm-network-found", i18n("KNetworkManager New Wireless Network Found") );
}
@@ -358,7 +358,7 @@ void WirelessDeviceTray::slotAccessPointRemoved(const TQString&)
KNotifyClient::event( tray()->winId(), "knm-nm-network-gone", i18n("KNetworkManager Wireless Network Disappeared") );
}
-WirelessDeviceTray::WirelessDeviceTray (WirelessDevice* dev, KSystemTray * parent, const char * name)
+WirelessDeviceTray::WirelessDeviceTray (TDENetworkDevice* dev, KSystemTray * parent, const char * name)
: DeviceTrayComponent (dev, parent, name)
{
d = new WirelessDeviceTrayPrivate();
@@ -372,13 +372,13 @@ WirelessDeviceTray::WirelessDeviceTray (WirelessDevice* dev, KSystemTray * paren
setPixmapForState(NM_DEVICE_STATE_ACTIVATED, "nm_signal_50");
// get notified when the device state changes
- connect(dev, TQT_SIGNAL(StateChanged(NMDeviceState)), this, TQT_SLOT(slotUpdateDeviceState(NMDeviceState)));
+ connect(dev, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), this, TQT_SLOT(slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus)));
// if the active access point changed but not the connection we roamed to a new AP
connect(dev, TQT_SIGNAL(propertiesChanged()), this, TQT_SLOT(slotCheckActiveAccessPoint()));
// get notified of all AP changes
- connect(dev, TQT_SIGNAL(accessPointAdded(AccessPoint*)), this, TQT_SLOT(slotAccessPointAdded(AccessPoint*)));
+ connect(dev, TQT_SIGNAL(accessPointAdded(TDENetworkWiFiAPInfo*)), this, TQT_SLOT(slotAccessPointAdded(TDENetworkWiFiAPInfo*)));
connect(dev, TQT_SIGNAL(accessPointRemoved(const TQString&)), this, TQT_SLOT(slotAccessPointRemoved(const TQString&)));
}
diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h b/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h
index 46b25f1..4a13548 100644
--- a/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h
+++ b/tdenetworkmanager/src/knetworkmanager-wireless_device_tray.h
@@ -36,20 +36,14 @@
class WirelessDevice;
class WirelessDeviceTrayPrivate;
-namespace ConnectionSettings
-{
- class Connection;
- class WirelessConnection;
-}
-
class WirelessDeviceTray : public DeviceTrayComponent
{
Q_OBJECT
public:
- WirelessDeviceTray (WirelessDevice*, KSystemTray * parent = 0, const char * name = 0);
- ~WirelessDeviceTray ();
+ WirelessDeviceTray (TDENetworkDevice*, KSystemTray * parent = 0, const char * name = 0);
+ ~WirelessDeviceTray ();
void addMenuItems(KPopupMenu* menu);
@@ -60,20 +54,20 @@ class WirelessDeviceTray : public DeviceTrayComponent
TQStringList getToolTipText();
public slots:
- void slotUpdateDeviceState(NMDeviceState);
+ void slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus);
void slotCheckActiveAccessPoint();
void newConnection();
protected slots:
void apStrengthChanged(TQ_UINT8 strength);
- void slotAccessPointAdded(AccessPoint*);
+ void slotAccessPointAdded(TDENetworkWiFiAPInfo*);
void slotAccessPointRemoved(const TQString&);
private:
- void addWirelessNetworks (KPopupMenu* menu);
+ void addWirelessNetworks(KPopupMenu* menu);
TQValueList<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);
WirelessDeviceTrayPrivate* d;
diff --git a/tdenetworkmanager/src/knetworkmanager-wireless_network.h b/tdenetworkmanager/src/knetworkmanager-wireless_network.h
index addce7a..9fcf809 100644
--- a/tdenetworkmanager/src/knetworkmanager-wireless_network.h
+++ b/tdenetworkmanager/src/knetworkmanager-wireless_network.h
@@ -26,7 +26,6 @@
#define KNETWORKMANAGER_WIRELESS_NETWORK_H
#include "knetworkmanager.h"
-#include "knetworkmanager-device.h"
#include <stdint.h>
@@ -34,11 +33,6 @@ class KNetworkManager;
class AccessPoint;
class WirelessNetworkPrivate;
-namespace ConnectionSettings
-{
- class WirelessConnection;
-}
-
/*
A wireless network represents multiple accesspoints
that share the same essid and security-caps
diff --git a/tdenetworkmanager/src/knetworkmanager.cpp b/tdenetworkmanager/src/knetworkmanager.cpp
index 81532e0..5a3d281 100644
--- a/tdenetworkmanager/src/knetworkmanager.cpp
+++ b/tdenetworkmanager/src/knetworkmanager.cpp
@@ -22,43 +22,15 @@
*
**************************************************************************/
-// KDE includes
+// TDE includes
#include <kdebug.h>
#include <klocale.h>
-
-// NM includes
-#include <NetworkManager.h>
-#include <NetworkManagerVPN.h>
-
-// TQDBus includes
-#include <tqdbusdata.h>
+#include <tdehardwaredevices.h>
+#include <tdenetworkconnections.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>
@@ -70,9 +42,7 @@
#include <kglobal.h>
#include <kiconloader.h>
-char active_vpn_prev = 0;
-extern NMDeviceState nm_device_state_global;
-VPNDBUSPlugin* vpnproxy;
+extern TDENetworkConnectionStatus::TDENetworkConnectionStatus nm_device_state_global;
class KNetworkManagerPrivate
{
@@ -92,11 +62,7 @@ KNetworkManager* KNetworkManager::getInstance()
void
KNetworkManager::slotShutDown()
{
- // cleanup code
- Storage* storage = Storage::getInstance();
-
- // save all connections (if not done already)
- storage->saveConnections();
+ //
}
void KNetworkManager::timerEvent( TQTimerEvent *e )
@@ -113,28 +79,14 @@ KNetworkManager::KNetworkManager () : KUniqueApplication ()
// we need to get informed when shutting down
connect(this, TQT_SIGNAL(shutDown()), this, TQT_SLOT(slotShutDown()));
- // Start the VPN icon timer
- // startTimer( 1000 ); // 1-second timer
-
- // Connect to the VPN bus
- vpnproxy = new VPNDBUSPlugin();
-
// create the main-tray-icon
Tray* tray = Tray::getInstance();
tray->show();
setMainWidget(tray);
-
- // create the settings interface
- NMSettings::getInstance();
-
- // restore all known connections first
- Storage* storage = Storage::getInstance();
- storage->restoreConnections();
}
KNetworkManager::~KNetworkManager()
{
- delete vpnproxy;
delete d;
}
diff --git a/tdenetworkmanager/src/main.cpp b/tdenetworkmanager/src/main.cpp
index 0355bad..fd11c11 100644
--- a/tdenetworkmanager/src/main.cpp
+++ b/tdenetworkmanager/src/main.cpp
@@ -37,16 +37,17 @@
static const char* knm_version = I18N_NOOP(KNETWORKMANAGER_VERSION_STRING);
static const char* knm_descr = I18N_NOOP("A NetworkManager front-end for TDE");
-static const char* knm_copy = I18N_NOOP("Copyright (C) 2005, 2006 Novell, Inc.");
-static const char* knm_webpage = I18N_NOOP("http://opensuse.org/Projects/KNetworkManager");
+static const char* knm_copy = I18N_NOOP("Copyright (C) 2012 Trinity Destop Project");
+static const char* knm_webpage = I18N_NOOP("http://www.trinitydesktop.org");
extern "C" KDE_EXPORT int
kdemain (int argc, char* argv[])
{
- KAboutData aboutData ("knetworkmanager", I18N_NOOP("KNetworkManager"),
+ KAboutData aboutData ("tdenetworkmanager", I18N_NOOP("TDENetworkManager"),
knm_version, knm_descr, KAboutData::License_GPL,
knm_copy, 0, knm_webpage );
+ aboutData.addAuthor ("Timothy Pearson", I18N_NOOP("TDE Rewrite"), "kb9vqf@pearsoncomputing.net");
aboutData.addAuthor ("Helmut Schaa", I18N_NOOP("Maintainer"), "hschaa@suse.de");
aboutData.addAuthor ("Timo Hoenig", I18N_NOOP("Maintainer"), "thoenig@suse.de");
aboutData.addAuthor ("Will Stephenson", I18N_NOOP("Additional code"), "wstephenson@suse.de");
diff --git a/tdenetworkmanager/src/secret_storage_plugin.cpp b/tdenetworkmanager/src/secret_storage_plugin.cpp
deleted file mode 100644
index db051c4..0000000
--- a/tdenetworkmanager/src/secret_storage_plugin.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/***************************************************************************
- *
- * secret_storage_plugin.cpp - A NetworkManager frontend for KDE
- *
- * Copyright (C) 2006 Novell, Inc.
- *
- * Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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 <hschaa@suse.de>, <helmut.schaa@gmx.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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/knetworkmanager-connection_settings_dialog.cpp b/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp
index 97f8350..cc3b8f7 100644
--- a/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp
+++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.cpp
@@ -76,17 +76,12 @@
#include "knetworkmanager-wireless_network.h"
#include "knetworkmanager-wireless_manager.h"
-#if !defined(NM_CHECK_VERSION)
-#define NM_CHECK_VERSION(x,y,z) 0
-#endif
-
char use_new_wireless_essid = 0;
TQByteArray new_wireless_essid;
-ConnectionSettingsDialogImpl::ConnectionSettingsDialogImpl(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting, TQWidget* parent, const char* name, bool modal, WFlags fl)
+ConnectionSettingsDialogImpl::ConnectionSettingsDialogImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, bool modal, WFlags fl)
: ConnectionSettingsDialog(parent, name, modal, fl)
, _conn(conn)
- , _setting(setting)
, _new_conn(new_conn)
{
updateDialogForDeviceType();
@@ -115,7 +110,7 @@ ConnectionSettingsDialogImpl::~ConnectionSettingsDialogImpl()
}
TQValueList<WidgetInterface*>
-ConnectionSettingsDialogImpl::createWidgetsForWireless(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
+ConnectionSettingsDialogImpl::createWidgetsForWireless(TDENetworkConnection* conn, bool new_conn)
{
TQValueList<WidgetInterface*> ret;
@@ -135,7 +130,7 @@ ConnectionSettingsDialogImpl::createWidgetsForWireless(ConnectionSettings::Conne
}
TQValueList<WidgetInterface*>
-ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting, const TQByteArray& essid)
+ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(TDENetworkConnection* conn, bool new_conn, const TQByteArray& essid)
{
TQValueList<WidgetInterface*> ret;
@@ -164,7 +159,7 @@ ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(ConnectionSetti
}
TQValueList<WidgetInterface*>
-ConnectionSettingsDialogImpl::createWidgetsForWired(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
+ConnectionSettingsDialogImpl::createWidgetsForWired(TDENetworkConnection* conn, bool new_conn)
{
TQValueList<WidgetInterface*> ret;
@@ -176,7 +171,7 @@ ConnectionSettingsDialogImpl::createWidgetsForWired(ConnectionSettings::Connecti
}
TQValueList<WidgetInterface*>
-ConnectionSettingsDialogImpl::createWidgetsForVPN(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
+ConnectionSettingsDialogImpl::createWidgetsForVPN(TDENetworkConnection* conn, bool new_conn)
{
TQValueList<WidgetInterface*> ret;
@@ -188,7 +183,7 @@ ConnectionSettingsDialogImpl::createWidgetsForVPN(ConnectionSettings::Connection
}
TQValueList<WidgetInterface*>
-ConnectionSettingsDialogImpl::createWidgetsForCDMA(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
+ConnectionSettingsDialogImpl::createWidgetsForCDMA(TDENetworkConnection* conn, bool new_conn)
{
TQValueList<WidgetInterface*> ret;
@@ -203,7 +198,7 @@ ConnectionSettingsDialogImpl::createWidgetsForCDMA(ConnectionSettings::Connectio
}
TQValueList<WidgetInterface*>
-ConnectionSettingsDialogImpl::createWidgetsForGSM(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
+ConnectionSettingsDialogImpl::createWidgetsForGSM(TDENetworkConnection* conn, bool new_conn)
{
TQValueList<WidgetInterface*> ret;
@@ -218,7 +213,7 @@ ConnectionSettingsDialogImpl::createWidgetsForGSM(ConnectionSettings::Connection
}
void
-ConnectionSettingsDialogImpl::createWidgetsForConnection(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
+ConnectionSettingsDialogImpl::createWidgetsForConnection(TDENetworkConnection* conn, bool new_conn)
{
/*
Currently two modes:
@@ -283,7 +278,7 @@ ConnectionSettingsDialogImpl::updateDialogForDeviceType()
if (_conn)
{
connect(_conn, TQT_SIGNAL(validityChanged()), this, TQT_SLOT(slotEnableButtons()));
- createWidgetsForConnection(_conn, _new_conn, _setting);
+ createWidgetsForConnection(_conn, _new_conn);
}
else
{
diff --git a/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.h b/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.h
index 9cedc69..251ad33 100644
--- a/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.h
+++ b/tdenetworkmanager/src/settings/knetworkmanager-connection_settings_dialog.h
@@ -48,7 +48,7 @@ class ConnectionSettingsDialogImpl : public ConnectionSettingsDialog
Q_OBJECT
public:
- ConnectionSettingsDialogImpl(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting = NULL, TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
+ ConnectionSettingsDialogImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~ConnectionSettingsDialogImpl();
public slots:
@@ -64,21 +64,20 @@ class ConnectionSettingsDialogImpl : public ConnectionSettingsDialog
private:
void updateDialogForDeviceType();
- void createWidgetsForConnection(ConnectionSettings::Connection*, bool new_conn, ConnectionSettings::ConnectionSetting* setting);
+ void createWidgetsForConnection(TDENetworkConnection*, bool new_conn);
void activateWidget(ConnectionSettings::WidgetInterface* widget);
void deactivateWidget(ConnectionSettings::WidgetInterface* widget);
- int getDeviceTypeFromConnection(ConnectionSettings::Connection* conn);
+ int getDeviceTypeFromConnection(TDENetworkConnection* conn);
// TODO: To be moved to a factory class
- TQValueList<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;
};
diff --git a/tdenetworkmanager/src/traycomponent.h b/tdenetworkmanager/src/traycomponent.h
index 4128f11..2a4da49 100644
--- a/tdenetworkmanager/src/traycomponent.h
+++ b/tdenetworkmanager/src/traycomponent.h
@@ -21,8 +21,6 @@ along with this program. If not, see <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>