File indexing completed on 2025-01-05 03:53:35

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2011-03-22
0007  * Description : a Iface C++ interface
0008  *
0009  * SPDX-FileCopyrightText: 2011-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2011      by Paolo de Vathaire <paolo dot devathaire at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_MEDIAWIKI_JOB_H
0017 #define DIGIKAM_MEDIAWIKI_JOB_H
0018 
0019 // KDE includes
0020 
0021 #include <kjob.h>
0022 
0023 namespace MediaWiki
0024 {
0025 
0026 class Iface;
0027 class JobPrivate;
0028 
0029 /**
0030  * @brief The base class for all Iface jobs.
0031  */
0032 class Job : public KJob
0033 {
0034     Q_OBJECT
0035     Q_DECLARE_PRIVATE(Job)
0036 
0037 public:
0038 
0039     /**
0040      * @brief Indicates all possible error conditions found during the processing of the job.
0041      */
0042     enum
0043     {
0044         NetworkError            = KJob::UserDefinedError + 1,
0045         XmlError,
0046         UserRequestDefinedError = KJob::UserDefinedError + 100,
0047         MissingMandatoryParameter
0048     };
0049 
0050 public:
0051 
0052     /**
0053      * @brief Destructs the Job.
0054      */
0055     ~Job() override;
0056 
0057     /**
0058      * @brief Aborts this job quietly.
0059      */
0060     bool doKill() override;
0061 
0062 protected:
0063 
0064     /**
0065      * @brief Constructs a Job by a private class.
0066      * @param dd a private class
0067      * @param parent the QObject parent
0068      */
0069     explicit Job(JobPrivate& dd, QObject* const parent = nullptr);
0070 
0071     /**
0072      * @brief Connects signals of the reply object (in the private object) to
0073      * slots of this base class.
0074      */
0075     void connectReply();
0076 
0077     /**
0078      * @brief The private d pointer.
0079      */
0080     JobPrivate* const d_ptr;
0081 
0082 private Q_SLOTS:
0083 
0084     void processUploadProgress(qint64 bytesReceived, qint64 bytesTotal);
0085 };
0086 
0087 } // namespace MediaWiki
0088 
0089 #endif // DIGIKAM_MEDIAWIKI_JOB_H