From 936aeab315ded1f993ea6a8bb1c4d25d07320bc4 Mon Sep 17 00:00:00 2001 From: wangfei Date: Thu, 5 Sep 2024 21:19:22 +0800 Subject: [PATCH] Revert "fix: Stuck in dbus data acquisition" This reverts commit 70a2ea31b8f72d2732ff906e7f5ba8be14eaa369. --- panels/dock/clipboarditem/clipboarditem.cpp | 25 +++------------------ 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/panels/dock/clipboarditem/clipboarditem.cpp b/panels/dock/clipboarditem/clipboarditem.cpp index 8be7967e9..cfb31a260 100644 --- a/panels/dock/clipboarditem/clipboarditem.cpp +++ b/panels/dock/clipboarditem/clipboarditem.cpp @@ -13,8 +13,6 @@ #include #include -#include -#include DGUI_USE_NAMESPACE @@ -31,9 +29,6 @@ static DDBusSender clipboardDbus() .interface(clipboardInterface); } -static QDBusServiceWatcher dbusWatcher(clipboardService, QDBusConnection::sessionBus(), - QDBusServiceWatcher::WatchForOwnerChange); - ClipboardItem::ClipboardItem(QObject *parent) : DApplet(parent) , m_visible(true) @@ -41,24 +36,10 @@ ClipboardItem::ClipboardItem(QObject *parent) { QDBusConnection::sessionBus().connect(clipboardService, clipboardPath, clipboardInterface, "clipboardVisibleChanged", this, SLOT(onClipboardVisibleChanged(bool))); - - auto func = [this](){ - QDBusInterface clipboardInter(clipboardService, clipboardPath, clipboardInterface, QDBusConnection::sessionBus()); - if (clipboardInter.isValid()) { - m_clipboardVisible = clipboardInter.property("clipboardVisible").toBool(); - } - }; - if (QDBusConnection::sessionBus().interface()->isServiceRegistered(clipboardService)) { - func(); + QDBusInterface clipboardInter(clipboardService, clipboardPath, clipboardInterface, QDBusConnection::sessionBus()); + if (clipboardInter.isValid()) { + m_clipboardVisible = clipboardInter.property("clipboardVisible").toBool(); } - - connect(&dbusWatcher, &QDBusServiceWatcher::serviceRegistered, this, [this, func](){ - func(); - }); - - connect(&dbusWatcher, &QDBusServiceWatcher::serviceUnregistered, this, [this](){ - m_clipboardVisible = false; - }); } void ClipboardItem::toggleClipboard()