parent
3f5288877b
commit
c5bbf78c1b
@ -1,162 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* knetworkmanager-nminfo_dbus.cpp - A NetworkManager frontend for KDE
|
|
||||||
*
|
|
||||||
* Copyright (C) 2005, 2006 Novell, Inc.
|
|
||||||
*
|
|
||||||
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
|
|
||||||
* Valentine Sinitsyn <e_val@inbox.ru>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <kdebug.h>
|
|
||||||
|
|
||||||
#include <NetworkManager.h>
|
|
||||||
|
|
||||||
#include <tqdbusobjectpath.h>
|
|
||||||
#include <tqdbusconnection.h>
|
|
||||||
|
|
||||||
#include "knetworkmanager.h"
|
|
||||||
#include "knetworkmanager-nmsettings.h"
|
|
||||||
#include "knetworkmanager-connection_setting.h"
|
|
||||||
#include "knetworkmanager-connection_store.h"
|
|
||||||
#include "knetworkmanager-connection.h"
|
|
||||||
|
|
||||||
#if !defined(NM_CHECK_VERSION)
|
|
||||||
#define NM_CHECK_VERSION(x,y,z) 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class NMSettingsPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NMSettingsPrivate()
|
|
||||||
: obj_path_index(0)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
~NMSettingsPrivate()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int obj_path_index;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
NMSettings* NMSettings::_instance = NULL;
|
|
||||||
|
|
||||||
NMSettings* NMSettings::getInstance()
|
|
||||||
{
|
|
||||||
// return singleton instance
|
|
||||||
if (_instance)
|
|
||||||
return _instance;
|
|
||||||
return (_instance = new NMSettings());
|
|
||||||
}
|
|
||||||
|
|
||||||
NMSettings::NMSettings()
|
|
||||||
{
|
|
||||||
d = new NMSettingsPrivate();
|
|
||||||
TQT_DBusConnection conn = TQT_DBusConnection::systemBus();
|
|
||||||
|
|
||||||
kdDebug() << "NMSettings::NMSettings" << endl;
|
|
||||||
|
|
||||||
#if NM_CHECK_VERSION(0,8,992)
|
|
||||||
if (!conn.requestName("org.freedesktop.NetworkManagerUserSettings"))
|
|
||||||
kdError() << "req name failed for " << "org.freedesktop.NetworkManagerUserSettings" << endl;
|
|
||||||
#else
|
|
||||||
// request the name for the settings interface
|
|
||||||
if (!conn.requestName(NM_DBUS_SERVICE_USER_SETTINGS))
|
|
||||||
kdError() << "req name failed for " << NM_DBUS_SERVICE_USER_SETTINGS << endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// request the name for the connections here too
|
|
||||||
if (!conn.requestName(NM_DBUS_IFACE_SETTINGS_CONNECTION))
|
|
||||||
kdError() << "req name failed for " << NM_DBUS_IFACE_SETTINGS_CONNECTION << endl;
|
|
||||||
|
|
||||||
// request the name for the connections here too
|
|
||||||
if (!conn.requestName(NM_DBUS_IFACE_SETTINGS_CONNECTION_SECRETS))
|
|
||||||
kdError() << "req name failed for " << NM_DBUS_IFACE_SETTINGS_CONNECTION_SECRETS << endl;
|
|
||||||
|
|
||||||
// register on the DBus
|
|
||||||
if (!conn.registerObject(objectPath(), this))
|
|
||||||
kdError() << "registerobjectpath failed" << endl;
|
|
||||||
|
|
||||||
|
|
||||||
ConnectionStore* cstore = ConnectionStore::getInstance();
|
|
||||||
|
|
||||||
// we need to get informed about new connections...
|
|
||||||
connect(cstore, TQT_SIGNAL(signalConnectionAdded(ConnectionSettings::Connection*)), this, TQT_SLOT(slotNewConnection(ConnectionSettings::Connection*)));
|
|
||||||
}
|
|
||||||
|
|
||||||
NMSettings::~NMSettings()
|
|
||||||
{
|
|
||||||
delete d;
|
|
||||||
TQT_DBusConnection conn = TQT_DBusConnection::systemBus();
|
|
||||||
conn.unregisterObject(NM_DBUS_PATH_SETTINGS);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool NMSettings::handleSignalSend(const TQT_DBusMessage& reply)
|
|
||||||
{
|
|
||||||
TQT_DBusConnection::systemBus().send(reply);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
TQString NMSettings::objectPath() const
|
|
||||||
{
|
|
||||||
return TQString(NM_DBUS_PATH_SETTINGS);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NMSettings::ListConnections(TQValueList<TQT_DBusObjectPath>& connections, TQT_DBusError& /*error*/)
|
|
||||||
{
|
|
||||||
// return connections
|
|
||||||
ConnectionStore* cstore = ConnectionStore::getInstance();
|
|
||||||
TQValueList<ConnectionSettings::Connection*> conns = cstore->getConnections();
|
|
||||||
|
|
||||||
for (TQValueList<ConnectionSettings::Connection*>::Iterator it = conns.begin(); it != conns.end(); ++it)
|
|
||||||
{
|
|
||||||
ConnectionSettings::Connection* conn = (*it);
|
|
||||||
connections.append(conn->getObjectPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NMSettings::handleMethodReply(const TQT_DBusMessage& reply)
|
|
||||||
{
|
|
||||||
TQT_DBusConnection::systemBus().send(reply);
|
|
||||||
}
|
|
||||||
|
|
||||||
TQT_DBusObjectPath
|
|
||||||
NMSettings::getObjPathForConnection()
|
|
||||||
{
|
|
||||||
// just increase the number for this connection
|
|
||||||
TQT_DBusObjectPath obj_path(NM_DBUS_PATH_SETTINGS_CONNECTION"/");
|
|
||||||
obj_path += TQString::number(d->obj_path_index++);
|
|
||||||
return obj_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
NMSettings::slotNewConnection(ConnectionSettings::Connection* conn)
|
|
||||||
{
|
|
||||||
emitNewConnection(conn->getObjectPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#include "knetworkmanager-nmsettings.moc"
|
|
@ -1,77 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* knetworkmanager-nminfo_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_NMSETTINGS_H
|
|
||||||
#define KNETWORKMANAGER_NMSETTINGS_H
|
|
||||||
|
|
||||||
#include <tqobject.h>
|
|
||||||
|
|
||||||
#include "knetworkmanager-connection_setting.h"
|
|
||||||
#include "dbus/networkmanagersettings.h"
|
|
||||||
|
|
||||||
class Network;
|
|
||||||
class TQT_DBusObjectPath;
|
|
||||||
class NMSettingsPrivate;
|
|
||||||
|
|
||||||
class NMSettings : public TQObject, DBus::SettingsInterface
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
/* get singleton */
|
|
||||||
static NMSettings* getInstance();
|
|
||||||
|
|
||||||
~NMSettings();
|
|
||||||
/* request the required interface from the DBus */
|
|
||||||
// void requestName (DBusMessage*);
|
|
||||||
|
|
||||||
/* functions for handling method calls sended _by_ NetworkManager */
|
|
||||||
// void getConnections (DBusMessage*);
|
|
||||||
bool handleSignalSend(const TQT_DBusMessage& reply);
|
|
||||||
TQString objectPath() const;
|
|
||||||
bool ListConnections(TQValueList<TQT_DBusObjectPath>& connections, TQT_DBusError& error);
|
|
||||||
void handleMethodReply(const TQT_DBusMessage& reply);
|
|
||||||
|
|
||||||
/* get Connection from obj_path */
|
|
||||||
TQT_DBusObjectPath getObjPathForConnection();
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
/* notification about new connections */
|
|
||||||
void slotNewConnection (ConnectionSettings::Connection*);
|
|
||||||
|
|
||||||
private:
|
|
||||||
NMSettingsPrivate* d;
|
|
||||||
|
|
||||||
/* private constructor -> singleton */
|
|
||||||
NMSettings();
|
|
||||||
|
|
||||||
/* functions for sending signals/methodcalls _to_ NetworkManager */
|
|
||||||
void signalNewConnection (const char*);
|
|
||||||
|
|
||||||
/* pointer to the singleton class */
|
|
||||||
static NMSettings* _instance;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* KNETWORKMANAGER_NMSETTINGS_H */
|
|
File diff suppressed because it is too large
Load Diff
@ -1,42 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008 by Kevin Krammer <k.krammer@gmx.at>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#ifndef XMLMARSHALLER_H
|
|
||||||
#define XMLMARSHALLER_H
|
|
||||||
|
|
||||||
class TQT_DBusData;
|
|
||||||
class TQDomDocument;
|
|
||||||
class TQDomElement;
|
|
||||||
class TQString;
|
|
||||||
|
|
||||||
class XMLMarshaller
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static TQDomElement fromTQT_DBusData(const TQT_DBusData& data, const TQDomDocument& ownerDoc);
|
|
||||||
|
|
||||||
static TQT_DBusData toTQT_DBusData(const TQDomElement& element);
|
|
||||||
|
|
||||||
static TQString fromTQT_DBusData(const TQT_DBusData& data);
|
|
||||||
|
|
||||||
static TQT_DBusData toTQT_DBusData(const TQString& xmlString);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in new issue