Fix dbus type registration
This commit is contained in:
parent
309f0b6c93
commit
ff35e2d152
@ -30,9 +30,6 @@ NetworkConnection::NetworkConnection(const QDBusObjectPath &objectPath, QObject
|
|||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_objectPath(objectPath)
|
m_objectPath(objectPath)
|
||||||
{
|
{
|
||||||
qRegisterMetaType<ConnectionSettings>("ConnectionSettings");
|
|
||||||
qDBusRegisterMetaType<ConnectionSettings>();
|
|
||||||
|
|
||||||
m_connectionInterface = new QDBusInterface(NetworkManagerUtils::networkManagerServiceString(), m_objectPath.path(), NetworkManagerUtils::connectionsInterfaceString(), QDBusConnection::systemBus(), this);
|
m_connectionInterface = new QDBusInterface(NetworkManagerUtils::networkManagerServiceString(), m_objectPath.path(), NetworkManagerUtils::connectionsInterfaceString(), QDBusConnection::systemBus(), this);
|
||||||
if(!m_connectionInterface->isValid()) {
|
if(!m_connectionInterface->isValid()) {
|
||||||
qCWarning(dcNetworkManager()) << "Invalid connection dbus interface";
|
qCWarning(dcNetworkManager()) << "Invalid connection dbus interface";
|
||||||
@ -65,6 +62,12 @@ void NetworkConnection::deleteConnection()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NetworkConnection::registerTypes()
|
||||||
|
{
|
||||||
|
qRegisterMetaType<ConnectionSettings>("ConnectionSettings");
|
||||||
|
qDBusRegisterMetaType<ConnectionSettings>();
|
||||||
|
}
|
||||||
|
|
||||||
/*! Returns the dbus object path of this \l{NetworkConnection}. */
|
/*! Returns the dbus object path of this \l{NetworkConnection}. */
|
||||||
QDBusObjectPath NetworkConnection::objectPath() const
|
QDBusObjectPath NetworkConnection::objectPath() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -42,6 +42,8 @@ public:
|
|||||||
|
|
||||||
void deleteConnection();
|
void deleteConnection();
|
||||||
|
|
||||||
|
static void registerTypes();
|
||||||
|
|
||||||
QDBusObjectPath objectPath() const;
|
QDBusObjectPath objectPath() const;
|
||||||
ConnectionSettings connectionSettings() const;
|
ConnectionSettings connectionSettings() const;
|
||||||
|
|
||||||
|
|||||||
@ -30,11 +30,12 @@
|
|||||||
NetworkManager::NetworkManager(QObject *parent) :
|
NetworkManager::NetworkManager(QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
|
NetworkConnection::registerTypes();
|
||||||
|
|
||||||
// Get notification when network-manager appears/disappears on DBus
|
// Get notification when network-manager appears/disappears on DBus
|
||||||
m_serviceWatcher = new QDBusServiceWatcher(NetworkManagerUtils::networkManagerServiceString(), QDBusConnection::systemBus(), QDBusServiceWatcher::WatchForRegistration | QDBusServiceWatcher::WatchForUnregistration, this);
|
m_serviceWatcher = new QDBusServiceWatcher(NetworkManagerUtils::networkManagerServiceString(), QDBusConnection::systemBus(), QDBusServiceWatcher::WatchForRegistration | QDBusServiceWatcher::WatchForUnregistration, this);
|
||||||
connect(m_serviceWatcher, &QDBusServiceWatcher::serviceRegistered, this, &NetworkManager::onServiceRegistered);
|
connect(m_serviceWatcher, &QDBusServiceWatcher::serviceRegistered, this, &NetworkManager::onServiceRegistered);
|
||||||
connect(m_serviceWatcher, &QDBusServiceWatcher::serviceUnregistered, this, &NetworkManager::onServiceUnregistered);
|
connect(m_serviceWatcher, &QDBusServiceWatcher::serviceUnregistered, this, &NetworkManager::onServiceUnregistered);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkManager::~NetworkManager()
|
NetworkManager::~NetworkManager()
|
||||||
|
|||||||
Reference in New Issue
Block a user