Commit bd93e98a authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Add xdg activation support to captive portal notification

Forward activation token to the job so that the browser window can raise itself
parent ac32bd98
Pipeline #180182 passed with stage
in 1 minute and 54 seconds
......@@ -64,6 +64,7 @@ target_link_libraries(kded_networkmanagement
KF5::Solid
KF5::Wallet
KF5::WindowSystem
KF5::KIOGui
)
if (WITH_MODEMMANAGER_SUPPORT)
......
......@@ -11,6 +11,7 @@
#include <QDBusPendingReply>
#include <QDesktopServices>
#include <KIO/OpenUrlJob>
#include <KLocalizedString>
#include <NetworkManagerQt/ActiveConnection>
......@@ -68,8 +69,10 @@ void ConnectivityMonitor::connectivityChanged(NetworkManager::Connectivity conne
m_notification->setComponentName(QStringLiteral("networkmanagement"));
m_notification->setTitle(title);
m_notification->setText(i18n("You need to log in to this network"));
connect(m_notification, &KNotification::action1Activated, this, []() {
QDesktopServices::openUrl(QUrl(QStringLiteral("http://networkcheck.kde.org")));
connect(m_notification, &KNotification::action1Activated, this, [this]() {
auto *job = new KIO::OpenUrlJob(QUrl(QStringLiteral("http://networkcheck.kde.org")));
job->setStartupId(m_notification->xdgActivationToken().toUtf8());
job->start();
});
m_notification->sendEvent();
}
......
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