Commit eec18ad4 authored by Nicolas Fella's avatar Nicolas Fella

Save unneeded DBus roundtrip

Summary: When the module is loaded the handler is notified over DBus just to go back to the module to init it. Skip the roundtrip and init directly.

Test Plan: Restarted plasmashell and kded5. (dis)connected wifi. Got notifications about it

Reviewers: #plasma, jgrulich

Reviewed By: jgrulich

Subscribers: davidedmundson, broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D28698
parent b9d6a400
......@@ -52,7 +52,7 @@ NetworkManagementService::NetworkManagementService(QObject * parent, const QVari
{
Q_D(NetworkManagementService);
connect(this, &KDEDModule::moduleRegistered, this, &NetworkManagementService::slotRegistered);
connect(this, &KDEDModule::moduleRegistered, this, &NetworkManagementService::init);
d->agent = new SecretAgent(this);
connect(d->agent, &SecretAgent::secretsError, this, &NetworkManagementService::secretsError);
......@@ -80,11 +80,4 @@ void NetworkManagementService::init()
}
}
void NetworkManagementService::slotRegistered(const QDBusObjectPath &path)
{
if (path.path() == QLatin1String("/modules/networkmanagement")) {
Q_EMIT registered();
}
}
#include "service.moc"
......@@ -44,13 +44,9 @@ public Q_SLOTS:
Q_SCRIPTABLE void init();
Q_SIGNALS:
Q_SCRIPTABLE void registered();
Q_SCRIPTABLE
void secretsError(const QString &connectionPath, const QString &message);
private Q_SLOTS:
void slotRegistered(const QDBusObjectPath &path);
private:
NetworkManagementServicePrivate * const d_ptr;
};
......
......@@ -72,13 +72,6 @@ Handler::Handler(QObject *parent)
, m_tmpWirelessEnabled(NetworkManager::isWirelessEnabled())
, m_tmpWwanEnabled(NetworkManager::isWwanEnabled())
{
initKdedModule();
QDBusConnection::sessionBus().connect(QStringLiteral(AGENT_SERVICE),
QStringLiteral(AGENT_PATH),
QStringLiteral(AGENT_IFACE),
QStringLiteral("registered"),
this, SLOT(initKdedModule()));
QDBusConnection::sessionBus().connect(QStringLiteral(AGENT_SERVICE),
QStringLiteral(AGENT_PATH),
QStringLiteral(AGENT_IFACE),
......@@ -736,15 +729,6 @@ void Handler::scanRequestFailed(const QString &interface)
scheduleRequestScan(interface, 2000);
}
void Handler::initKdedModule()
{
QDBusMessage initMsg = QDBusMessage::createMethodCall(QStringLiteral(AGENT_SERVICE),
QStringLiteral(AGENT_PATH),
QStringLiteral(AGENT_IFACE),
QStringLiteral("init"));
QDBusConnection::sessionBus().send(initMsg);
}
void Handler::secretAgentError(const QString &connectionPath, const QString &message)
{
// If the password was wrong, forget it
......
......@@ -125,7 +125,6 @@ public Q_SLOTS:
void stopHotspot();
private Q_SLOTS:
void initKdedModule();
void secretAgentError(const QString &connectionPath, const QString &message);
void replyFinished(QDBusPendingCallWatcher *watcher);
void hotspotCreated(QDBusPendingCallWatcher *watcher);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment