diff --git a/interfaces/dbushelpers.h b/interfaces/dbushelpers.h index 088abffde..00401ee64 100644 --- a/interfaces/dbushelpers.h +++ b/interfaces/dbushelpers.h @@ -31,4 +31,15 @@ void blockOnReply(QDBusPendingReply reply) } } +template +static void setWhenAvailable(const QDBusPendingReply &pending, W func, QObject *parent) +{ + QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pending, parent); + QObject::connect(watcher, &QDBusPendingCallWatcher::finished, parent, [func](QDBusPendingCallWatcher *watcher) { + watcher->deleteLater(); + QDBusPendingReply reply = *watcher; + func(reply.value()); + }); +} + #endif diff --git a/interfaces/dbusinterfaces.cpp b/interfaces/dbusinterfaces.cpp index 3ca0f54b5..3b0ff0c51 100644 --- a/interfaces/dbusinterfaces.cpp +++ b/interfaces/dbusinterfaces.cpp @@ -5,7 +5,6 @@ */ #include "dbusinterfaces.h" -#include QString DaemonDbusInterface::activatedService() { diff --git a/interfaces/dbusinterfaces.h b/interfaces/dbusinterfaces.h index 6a2bf61ab..fd6c2f735 100644 --- a/interfaces/dbusinterfaces.h +++ b/interfaces/dbusinterfaces.h @@ -265,17 +265,6 @@ public: ~VirtualmonitorDbusInterface() override; }; -template -static void setWhenAvailable(const QDBusPendingReply &pending, W func, QObject *parent) -{ - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pending, parent); - QObject::connect(watcher, &QDBusPendingCallWatcher::finished, parent, [func](QDBusPendingCallWatcher *watcher) { - watcher->deleteLater(); - QDBusPendingReply reply = *watcher; - func(reply.value()); - }); -} - class KDECONNECTINTERFACES_EXPORT ClipboardDbusInterface : public OrgKdeKdeconnectDeviceClipboardInterface { Q_OBJECT diff --git a/kcm/kcm.cpp b/kcm/kcm.cpp index 3cec6c5e9..cad83c7d6 100644 --- a/kcm/kcm.cpp +++ b/kcm/kcm.cpp @@ -14,6 +14,7 @@ #include #include +#include "dbushelpers.h" #include "dbusinterfaces.h" #include "devicesmodel.h" #include "devicessortproxymodel.h" diff --git a/smsapp/conversationlistmodel.cpp b/smsapp/conversationlistmodel.cpp index 1d284fdc6..a5eea3e27 100644 --- a/smsapp/conversationlistmodel.cpp +++ b/smsapp/conversationlistmodel.cpp @@ -12,6 +12,7 @@ #include +#include "dbushelpers.h" #include "interfaces/conversationmessage.h" #include "interfaces/dbusinterfaces.h" #include "sms_conversations_list_debug.h"