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()