Move setWhenAvailable from dbusinterfaces to dbushelpers
This commit is contained in:
parent
7860280158
commit
bd72602875
5 changed files with 13 additions and 12 deletions
|
@ -31,4 +31,15 @@ void blockOnReply(QDBusPendingReply<void> reply)
|
|||
}
|
||||
}
|
||||
|
||||
template<typename T, typename W>
|
||||
static void setWhenAvailable(const QDBusPendingReply<T> &pending, W func, QObject *parent)
|
||||
{
|
||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pending, parent);
|
||||
QObject::connect(watcher, &QDBusPendingCallWatcher::finished, parent, [func](QDBusPendingCallWatcher *watcher) {
|
||||
watcher->deleteLater();
|
||||
QDBusPendingReply<T> reply = *watcher;
|
||||
func(reply.value());
|
||||
});
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
#include "dbusinterfaces.h"
|
||||
#include <dbushelper.h>
|
||||
|
||||
QString DaemonDbusInterface::activatedService()
|
||||
{
|
||||
|
|
|
@ -265,17 +265,6 @@ public:
|
|||
~VirtualmonitorDbusInterface() override;
|
||||
};
|
||||
|
||||
template<typename T, typename W>
|
||||
static void setWhenAvailable(const QDBusPendingReply<T> &pending, W func, QObject *parent)
|
||||
{
|
||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pending, parent);
|
||||
QObject::connect(watcher, &QDBusPendingCallWatcher::finished, parent, [func](QDBusPendingCallWatcher *watcher) {
|
||||
watcher->deleteLater();
|
||||
QDBusPendingReply<T> reply = *watcher;
|
||||
func(reply.value());
|
||||
});
|
||||
}
|
||||
|
||||
class KDECONNECTINTERFACES_EXPORT ClipboardDbusInterface : public OrgKdeKdeconnectDeviceClipboardInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <KPluginMetaData>
|
||||
#include <kcmutils_version.h>
|
||||
|
||||
#include "dbushelpers.h"
|
||||
#include "dbusinterfaces.h"
|
||||
#include "devicesmodel.h"
|
||||
#include "devicessortproxymodel.h"
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include "dbushelpers.h"
|
||||
#include "interfaces/conversationmessage.h"
|
||||
#include "interfaces/dbusinterfaces.h"
|
||||
#include "sms_conversations_list_debug.h"
|
||||
|
|
Loading…
Reference in a new issue