Commit ed48c4de authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Don't forget to activate a connection if we show a dialog when activating

addAndActivate in some cases will show the connection editor dialog. In
that case, once the dialog is confirmed, we would call "addConnection"
rather than "addAndActivateConnection", so one would need to manually
connect to the now correctly configured network again. Instead, move the
"addAndActivate" dbus call to its own method so we can call it in the
signal handler rather than calling only addConnection.
parent 4b3a002e
Pipeline #196443 passed with stage
in 3 minutes and 33 seconds
......@@ -287,8 +287,8 @@ void Handler::addAndActivateConnection(const QString &device, const QString &spe
editor->show();
KWindowSystem::setState(editor->winId(), NET::KeepAbove);
KWindowSystem::forceActiveWindow(editor->winId());
connect(editor.data(), &ConnectionEditorDialog::accepted, [editor, this]() {
addConnection(editor->setting());
connect(editor.data(), &ConnectionEditorDialog::accepted, [editor, device, specificObject, this]() { //
addAndActivateConnectionDBus(editor->setting(), device, specificObject);
});
editor->setModal(true);
editor->show();
......@@ -310,11 +310,7 @@ void Handler::addAndActivateConnection(const QString &device, const QString &spe
wifiSecurity->setPskFlags(NetworkManager::Setting::AgentOwned);
}
}
QDBusPendingReply<QDBusObjectPath> reply = NetworkManager::addAndActivateConnection(settings->toMap(), device, specificObject);
auto watcher = new QDBusPendingCallWatcher(reply, this);
watcher->setProperty("action", Handler::AddAndActivateConnection);
watcher->setProperty("connection", settings->name());
connect(watcher, &QDBusPendingCallWatcher::finished, this, &Handler::replyFinished);
addAndActivateConnectionDBus(settings->toMap(), device, specificObject);
}
settings.clear();
......@@ -329,6 +325,15 @@ void Handler::addConnection(const NMVariantMapMap &map)
connect(watcher, &QDBusPendingCallWatcher::finished, this, &Handler::replyFinished);
}
void Handler::addAndActivateConnectionDBus(const NMVariantMapMap &map, const QString &device, const QString &specificObject)
{
QDBusPendingReply<QDBusObjectPath> reply = NetworkManager::addAndActivateConnection(map, device, specificObject);
auto watcher = new QDBusPendingCallWatcher(reply, this);
watcher->setProperty("action", AddAndActivateConnection);
watcher->setProperty("connection", map.value(QStringLiteral("connection")).value(QStringLiteral("id")));
connect(watcher, &QDBusPendingCallWatcher::finished, this, &Handler::replyFinished);
}
void Handler::deactivateConnection(const QString &connection, const QString &device)
{
NetworkManager::Connection::Ptr con = NetworkManager::findConnection(connection);
......
......@@ -129,6 +129,8 @@ Q_SIGNALS:
void hotspotSupportedChanged(bool hotspotSupported);
private:
void addAndActivateConnectionDBus(const NMVariantMapMap &map, const QString &device, const QString &specificObject);
bool m_hotspotSupported;
bool m_runningLiveImage;
bool m_tmpWirelessEnabled;
......
Supports Markdown
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