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

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 Alexandre Mendes <alex dot mendes1988 at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_MEDIAWIKI_QUERYINFO_H
0017 #define DIGIKAM_MEDIAWIKI_QUERYINFO_H
0018 
0019 // Qt includes
0020 
0021 #include <QList>
0022 #include <QString>
0023 #include <QUrl>
0024 #include <QDateTime>
0025 
0026 // Local includes
0027 
0028 #include "mediawiki_page.h"
0029 #include "mediawiki_protection.h"
0030 #include "mediawiki_job.h"
0031 
0032 
0033 namespace MediaWiki
0034 {
0035 
0036 class Iface;
0037 class QueryInfoPrivate;
0038 
0039 /**
0040  * @brief QueryInfo job.
0041  *
0042  * Uses to send a request to get basic page information.
0043  */
0044 class QueryInfo : public Job
0045 {
0046     Q_OBJECT
0047     Q_DECLARE_PRIVATE(QueryInfo)
0048 
0049 public:
0050 
0051     /**
0052      * @brief Constructs a QueryInfo job.
0053      * @param MediaWiki the MediaWiki concerned by the job
0054      * @param parent the QObject parent
0055      */
0056     explicit QueryInfo(Iface& MediaWiki, QObject* const parent = nullptr);
0057 
0058     /**
0059      * @brief Destroys the QuerySiteInfoGeneral job.
0060      */
0061     ~QueryInfo() override;
0062 
0063     /**
0064      * @brief Starts the job asynchronously.
0065      */
0066     void start() override;
0067 
0068     /**
0069      * @brief Set the page name.
0070      * @param title the page name
0071      */
0072     void setPageName(const QString& title);
0073 
0074     /**
0075      * @brief Set the token to perform a data-modifying action on a page
0076      * @param token the token
0077      */
0078     void setToken(const QString& token);
0079 
0080     /**
0081      * @brief Set the page id.
0082      * @param id the page id
0083      */
0084     void setPageId(unsigned int id);
0085 
0086     /**
0087      * @brief Set the page revision
0088      * @param id the page revision
0089      */
0090     void setRevisionId(unsigned int id);
0091 
0092 Q_SIGNALS:
0093 
0094     /**
0095      * @brief Provides a page
0096      * @param
0097      */
0098     void page(const Page& p);
0099     void protection(const QVector<Protection>& protect);
0100 
0101 private Q_SLOTS:
0102 
0103     /**
0104      * @brief Send a request.
0105      */
0106     void doWorkSendRequest();
0107 
0108     void doWorkProcessReply();
0109 };
0110 
0111 } // namespace MediaWiki
0112 
0113 #endif // DIGIKAM_MEDIAWIKI_QUERYINFO_H