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 Ludovic Delfau
0013  *         <a href="mailto:ludovicdelfau at gmail dot com">ludovicdelfau 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 MEDIAWIKI_QUERYSITEINFOUSERGROUPS_H
0029 #define MEDIAWIKI_QUERYSITEINFOUSERGROUPS_H
0030 
0031 // Local includes
0032 
0033 #include "job.h"
0034 #include "mediawiki_export.h"
0035 #include "usergroup.h"
0036 
0037 namespace mediawiki
0038 {
0039 
0040 class MediaWiki;
0041 class QuerySiteinfoUsergroupsPrivate;
0042 
0043 /**
0044  * @brief UserGroups job.
0045  *
0046  * Uses for fetch a list of all user groups and their permissions.
0047  */
0048 class MEDIAWIKI_EXPORT QuerySiteinfoUsergroups : public Job
0049 {
0050     Q_OBJECT
0051     Q_DECLARE_PRIVATE(QuerySiteinfoUsergroups)
0052 
0053 public:
0054 
0055     /**
0056      * @brief Constructs a UserGroups job.
0057      * @param mediawiki the mediawiki concerned by the job
0058      * @param parent the QObject parent
0059      */
0060     explicit QuerySiteinfoUsergroups(MediaWiki& mediawiki, QObject* const parent = nullptr);
0061 
0062     /**
0063      * @brief Destroys the UserGroups job.
0064      */
0065     ~QuerySiteinfoUsergroups() override;
0066 
0067     /**
0068      * @brief If true number of users of each user group is included
0069      * @param includeNumber if true number of users of each user group is included
0070      */
0071     void setIncludeNumber(bool includeNumber);
0072 
0073     /**
0074      * @brief Starts the job asynchronously.
0075      */
0076     void start() override;
0077 
0078 Q_SIGNALS:
0079 
0080     /**
0081      * @brief Provides a list of all user groups.
0082      * @param usergroups list of all user groups
0083      * @see QuerySiteinfoUsergroups::Result
0084      */
0085     void usergroups(const QList<UserGroup>& usergroups);
0086 
0087 private Q_SLOTS:
0088 
0089     void doWorkSendRequest();
0090     void doWorkProcessReply();
0091 };
0092 
0093 } // namespace mediawiki
0094 
0095 #endif // MEDIAWIKI_QUERYSITEINFOUSERGROUPS_H