|
--- a/src/backends/polkit-1/Polkit1Backend.cpp |
|
+++ b/src/backends/polkit-1/Polkit1Backend.cpp |
|
@@ -11,7 +11,6 @@ |
|
#include "Polkit1Backend.h" |
|
#include "kauthdebug.h" |
|
|
|
-#include <KWaylandExtras> |
|
#include <KWindowSystem> |
|
|
|
#include <QCoreApplication> |
|
@@ -66,22 +65,6 @@ void Polkit1Backend::preAuthAction(const QString &action, QWindow *parentWindow) |
|
|
|
// Are we running our KDE auth agent? |
|
if (QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String("org.kde.polkit-kde-authentication-agent-1"))) { |
|
- if (KWindowSystem::isPlatformWayland()) { |
|
- KWaylandExtras::exportWindow(parentWindow); |
|
- connect( |
|
- KWaylandExtras::self(), |
|
- &KWaylandExtras::windowExported, |
|
- this, |
|
- [this, action, parentWindow](QWindow *window, const QString &handle) { |
|
- if (window == parentWindow) { |
|
- sendWindowHandle(action, handle); |
|
- } |
|
- }, |
|
- Qt::SingleShotConnection); |
|
- |
|
- // Generate and send an XDG Activation token. |
|
- sendActivationToken(action, parentWindow); |
|
- } else { |
|
// Retrieve the dialog root window Id |
|
const qulonglong wId = parentWindow->winId(); |
|
|
|
@@ -97,7 +80,6 @@ void Polkit1Backend::preAuthAction(const QString &action, QWindow *parentWindow) |
|
if (reply.type() != QDBusMessage::ReplyMessage) { |
|
qWarning() << "Failed to set window id" << wId << "for" << action << reply.errorMessage(); |
|
} |
|
- } |
|
} else { |
|
qCDebug(KAUTH) << "KDE polkit agent appears too old or not registered on the bus"; |
|
} |
|
@@ -124,33 +106,6 @@ void Polkit1Backend::sendWindowHandle(const QString &action, const QString &hand |
|
|
|
void Polkit1Backend::sendActivationToken(const QString &action, QWindow *window) |
|
{ |
|
- const auto requestedSerial = KWaylandExtras::lastInputSerial(window); |
|
- connect( |
|
- KWaylandExtras::self(), |
|
- &KWaylandExtras::xdgActivationTokenArrived, |
|
- this, |
|
- [this, requestedSerial, action](quint32 serial, const QString &token) { |
|
- if (serial != requestedSerial || token.isEmpty()) { |
|
- return; |
|
- } |
|
- QDBusMessage methodCall = |
|
- QDBusMessage::createMethodCall(c_kdeAgentService, c_kdeAgentPath, c_kdeAgentInterface, QLatin1String("setActivationTokenForAction")); |
|
- methodCall << action; |
|
- methodCall << token; |
|
- |
|
- const auto reply = QDBusConnection::sessionBus().asyncCall(methodCall); |
|
- auto *watcher = new QDBusPendingCallWatcher(reply, this); |
|
- connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, watcher, token, action] { |
|
- watcher->deleteLater(); |
|
- |
|
- QDBusPendingReply<> reply = *watcher; |
|
- if (reply.isError()) { |
|
- qCWarning(KAUTH) << "Failed to set activation token" << token << "for" << action << reply.error().message(); |
|
- } |
|
- }); |
|
- }, |
|
- Qt::SingleShotConnection); |
|
- KWaylandExtras::requestXdgActivationToken(window, requestedSerial, {}); |
|
} |
|
|
|
Action::AuthStatus Polkit1Backend::authorizeAction(const QString &action) |