From 849cb5f88fdaac367010bc99c5342b7a21effdc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonah=20Br=C3=BCchert?= Date: Thu, 1 Oct 2020 13:49:32 +0200 Subject: [PATCH] Use generated DBus interface --- containments/panel/phonepanel.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/containments/panel/phonepanel.cpp b/containments/panel/phonepanel.cpp index ce59c6ec..e61d567c 100644 --- a/containments/panel/phonepanel.cpp +++ b/containments/panel/phonepanel.cpp @@ -168,20 +168,19 @@ void PhonePanel::takeScreenshot() qWarning() << "Could not take screenshot"; return; } - QDBusInterface lInterface(QStringLiteral("org.kde.KWin"), QStringLiteral("/Screenshot"), QStringLiteral("org.kde.kwin.Screenshot")); // Take fullscreen screenshot, and no pointer - QDBusPendingCall pcall = lInterface.asyncCall("screenshotFullscreen", QVariant::fromValue(QDBusUnixFileDescriptor(lPipeFds[1])), false); + QDBusPendingCall pcall = m_screenshotInterface->screenshotFullscreen(QDBusUnixFileDescriptor(lPipeFds[1]), false); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pcall, this); - QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher* watcher) { + QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [](QDBusPendingCallWatcher* watcher) { if (watcher->isError()) { const auto error = watcher->error(); qWarning() << "Error calling KWin DBus interface:" << error.name() << error.message(); } watcher->deleteLater(); }); - auto lWatcher = new QFutureWatcher(this); + const auto lWatcher = new QFutureWatcher(this); QObject::connect(lWatcher, &QFutureWatcher::finished, this, - [lWatcher, filePath, this] () { + [lWatcher, filePath] () { lWatcher->deleteLater(); const QImage lImage = lWatcher->result(); qDebug() << lImage;