diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-10-17 17:38:53 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-10-17 17:38:53 +0000 |
commit | 1e0dd58661c9097fb41218ee7e3515f2d8ba8dac (patch) | |
tree | a263b4ad0c1f7fba6013f5d9854db4cb4962df82 /knetworkmanager-0.8/src/knetworkmanager-device.cpp | |
download | knetworkmanager8-1e0dd58661c9097fb41218ee7e3515f2d8ba8dac.tar.gz knetworkmanager8-1e0dd58661c9097fb41218ee7e3515f2d8ba8dac.zip |
Add dead-ended knetworkmanager 0.8 source
Add copy of same for knetworkmanager 0.9 starting point
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knetworkmanager8@1259314 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'knetworkmanager-0.8/src/knetworkmanager-device.cpp')
-rw-r--r-- | knetworkmanager-0.8/src/knetworkmanager-device.cpp | 166 |
1 files changed, 166 insertions, 0 deletions
diff --git a/knetworkmanager-0.8/src/knetworkmanager-device.cpp b/knetworkmanager-0.8/src/knetworkmanager-device.cpp new file mode 100644 index 0000000..585ce8d --- /dev/null +++ b/knetworkmanager-0.8/src/knetworkmanager-device.cpp @@ -0,0 +1,166 @@ +/*************************************************************************** + * + * knetworkmanager-device.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2005, 2006 Novell, Inc. + * + * Author: Timo Hoenig <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" |