File indexing completed on 2024-04-21 15:32:08

0001 /** ===========================================================
0002  * @file
0003  *
0004  * This file is a part of KDE project
0005  * <a href="https://commits.kde.org/libmediawiki">libmediawiki</a>
0006  *
0007  * @date   2011-03-22
0008  * @brief  a MediaWiki C++ interface for KDE
0009  *
0010  * @author Copyright (C) 2011-2012 by Gilles Caulier
0011  *         <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
0012  * @author Copyright (C) 2010 by Alexandre Mendes
0013  *         <a href="mailto:alex dot mendes1988 at gmail dot com">alex dot mendes1988 at gmail dot com</a>
0014  *
0015  * This program is free software; you can redistribute it
0016  * and/or modify it under the terms of the GNU General
0017  * Public License as published by the Free Software Foundation;
0018  * either version 2, or (at your option)
0019  * any later version.
0020  *
0021  * This program is distributed in the hope that it will be useful,
0022  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0023  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0024  * GNU General Public License for more details.
0025  *
0026  * ============================================================ */
0027 
0028 #ifndef QUERYINFO_H
0029 #define QUERYINFO_H
0030 
0031 // Qt includes
0032 
0033 #include <QList>
0034 #include <QString>
0035 #include <QUrl>
0036 #include <QDateTime>
0037 
0038 // Local includes
0039 
0040 #include "page.h"
0041 #include "protection.h"
0042 #include "mediawiki_export.h"
0043 #include "job.h"
0044 
0045 namespace mediawiki
0046 {
0047 
0048 class MediaWiki;
0049 class QueryInfoPrivate;
0050 
0051 /**
0052  * @brief QueryInfo job.
0053  *
0054  * Uses to send a request to get basic page information.
0055  */
0056 class MEDIAWIKI_EXPORT QueryInfo : public Job
0057 {
0058     Q_OBJECT
0059     Q_DECLARE_PRIVATE(QueryInfo)
0060 
0061 public:
0062 
0063     /**
0064      * @brief Constructs a QueryInfo job.
0065      * @param mediawiki the mediawiki concerned by the job
0066      * @param parent the QObject parent
0067      */
0068     explicit QueryInfo(MediaWiki& mediawiki, QObject* const parent = nullptr);
0069 
0070     /**
0071      * @brief Destroys the QuerySiteInfoGeneral job.
0072      */
0073     ~QueryInfo() override;
0074 
0075     /**
0076      * @brief Starts the job asynchronously.
0077      */
0078     void start() override;
0079 
0080     /**
0081      * @brief Set the page name.
0082      * @param title the page name
0083      */
0084     void setPageName(const QString& title);
0085 
0086     /**
0087      * @brief Set the token to perform a data-modifying action on a page
0088      * @param token the token
0089      */
0090     void setToken(const QString& token);
0091 
0092     /**
0093      * @brief Set the page id.
0094      * @param id the page id
0095      */
0096     void setPageId(unsigned int id);
0097 
0098     /**
0099      * @brief Set the page revision
0100      * @param id the page revision
0101      */
0102     void setRevisionId(unsigned int id);
0103 
0104 Q_SIGNALS:
0105 
0106     /**
0107      * @brief Provides a page
0108      * @param
0109      */
0110     void page(const Page& p);
0111     void protection(const QVector<Protection>& protect);
0112 
0113 private Q_SLOTS:
0114 
0115     /**
0116      * @brief Send a request.
0117      */
0118     void doWorkSendRequest();
0119 
0120     void doWorkProcessReply();
0121 };
0122 
0123 } // namespace mediawiki
0124 
0125 #endif // QUERYINFO_H