File indexing completed on 2024-04-28 16:53:08

0001 /*
0002  *   SPDX-FileCopyrightText: 2016 Ivan Cukic <ivan.cukic(at)kde.org>
0003  *
0004  *   SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 #ifndef ASYNQT_CONS_KJOBFUTURE_H
0008 #define ASYNQT_CONS_KJOBFUTURE_H
0009 
0010 #include <KJob>
0011 
0012 #include <QFuture>
0013 #include <QFutureInterface>
0014 #include <QObject>
0015 
0016 #include <memory>
0017 
0018 #include "../private/wrappers/kjob_p.h"
0019 
0020 namespace AsynQt
0021 {
0022 /**
0023  * Creates a future from the specified dbus reply
0024  */
0025 template<typename _Result>
0026 QFuture<_Result> makeFuture(KJob *job)
0027 {
0028     using namespace detail;
0029 
0030     return (new KJobFutureInterface<_Result>(job))->start();
0031 }
0032 
0033 } // namespace AsynQt
0034 
0035 #endif // ASYNQT_CONS_DBUSFUTURE_H