File indexing completed on 2024-04-21 04:00:35

0001 /*
0002     SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #ifndef PURPOSEJOB_H
0008 #define PURPOSEJOB_H
0009 
0010 #include <KJob>
0011 #include <QJsonArray>
0012 #include <QJsonObject>
0013 #include <QMimeData>
0014 #include <QUrl>
0015 #include <purpose/purpose_export.h>
0016 
0017 namespace Purpose
0018 {
0019 class JobPrivate;
0020 
0021 /**
0022  * @brief Job that will actually perform the sharing
0023  *
0024  * When start is called, the sharing process will start and when the job
0025  * emits finished, we'll know it's over.
0026  *
0027  * The start method called shouldn't be called before all data has been
0028  * filled in. isReady can be used to check whether it's all ready to go,
0029  * these arguments will have to be filled by the file provided by
0030  * configSourceCode() and should end up defining all the arguments defined
0031  * by neededArguments.
0032  */
0033 class PURPOSE_EXPORT Job : public KJob
0034 {
0035     Q_OBJECT
0036     /**
0037      * Represents the data the job will have available to perform its task
0038      */
0039     Q_PROPERTY(QJsonObject data READ data CONSTANT)
0040 
0041     /**
0042      * Returns the output generated by the plugin
0043      *
0044      * The information offered will depend on the plugin type.
0045      */
0046     Q_PROPERTY(QJsonObject output READ output WRITE setOutput NOTIFY outputChanged)
0047 public:
0048     explicit Job(QObject *parent = nullptr);
0049     ~Job() override;
0050 
0051     /**
0052      * Should only be called after constructing
0053      *
0054      * @internal
0055      */
0056     void setData(const QJsonObject &data);
0057     QJsonObject data() const;
0058 
0059     QJsonObject output() const;
0060     void setOutput(const QJsonObject &output);
0061 
0062 Q_SIGNALS:
0063     void outputChanged(const QJsonObject &output);
0064 
0065 private:
0066     Q_DECLARE_PRIVATE(Job)
0067     QScopedPointer<JobPrivate> const d_ptr;
0068 };
0069 
0070 }
0071 
0072 #endif