1 | /* |
2 | SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.1-or-later |
5 | */ |
6 | |
7 | #ifndef PURPOSEJOB_H |
8 | #define PURPOSEJOB_H |
9 | |
10 | #include <KJob> |
11 | #include <QJsonArray> |
12 | #include <QJsonObject> |
13 | #include <QMimeData> |
14 | #include <QUrl> |
15 | #include <purpose/purpose_export.h> |
16 | |
17 | namespace Purpose |
18 | { |
19 | class JobPrivate; |
20 | |
21 | /** |
22 | * @brief Job that will actually perform the sharing |
23 | * |
24 | * When start is called, the sharing process will start and when the job |
25 | * emits finished, we'll know it's over. |
26 | * |
27 | * The start method called shouldn't be called before all data has been |
28 | * filled in. isReady can be used to check whether it's all ready to go, |
29 | * these arguments will have to be filled by the file provided by |
30 | * configSourceCode() and should end up defining all the arguments defined |
31 | * by neededArguments. |
32 | */ |
33 | class PURPOSE_EXPORT Job : public KJob |
34 | { |
35 | Q_OBJECT |
36 | /** |
37 | * Represents the data the job will have available to perform its task |
38 | */ |
39 | Q_PROPERTY(QJsonObject data READ data CONSTANT) |
40 | |
41 | /** |
42 | * Returns the output generated by the plugin |
43 | * |
44 | * The information offered will depend on the plugin type. |
45 | */ |
46 | Q_PROPERTY(QJsonObject output READ output WRITE setOutput NOTIFY outputChanged) |
47 | public: |
48 | explicit Job(QObject *parent = nullptr); |
49 | ~Job() override; |
50 | |
51 | /** |
52 | * Should only be called after constructing |
53 | * |
54 | * @internal |
55 | */ |
56 | void setData(const QJsonObject &data); |
57 | QJsonObject data() const; |
58 | |
59 | QJsonObject output() const; |
60 | void setOutput(const QJsonObject &output); |
61 | |
62 | Q_SIGNALS: |
63 | void outputChanged(const QJsonObject &output); |
64 | |
65 | private: |
66 | Q_DECLARE_PRIVATE(Job) |
67 | QScopedPointer<JobPrivate> const d_ptr; |
68 | }; |
69 | |
70 | } |
71 | |
72 | #endif |
73 | |