digiKam
mediawiki_queryrevision.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2011-03-22
7  * Description : a Iface C++ interface
8  *
9  * Copyright (C) 2011-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2011 by Hormiere Guillaume <hormiere dot guillaume at gmail dot com>
11  * Copyright (C) 2011 by Manuel Campomanes <campomanes dot manuel at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_MEDIAWIKI_QUERYREVISION_H
26 #define DIGIKAM_MEDIAWIKI_QUERYREVISION_H
27 
28 // Qt includes
29 
30 #include <QDateTime>
31 #include <QList>
32 #include <QString>
33 
34 // Local includes
35 
36 #include "mediawiki_job.h"
37 #include "mediawiki_revision.h"
38 
39 namespace MediaWiki
40 {
41 
42 class Iface;
43 class QueryRevisionPrivate;
44 
50 class QueryRevision : public Job
51 {
52  Q_OBJECT
53  Q_DECLARE_PRIVATE(QueryRevision)
54 
55 public:
56 
60  enum Direction
61  {
65  Older,
66 
70  Newer
71  };
72 
76  enum Token
77  {
81  Rollback
82  };
83 
87  enum
88  {
92  WrongRevisionId = Job::UserDefinedError + 1,
93 
97  MultiPagesNotAllowed,
98 
102  TitleAccessDenied,
103 
107  TooManyParams,
108 
112  SectionNotFound
113  };
114 
118  enum Property
119  {
120  Ids = 0x01,
121  Flags = 0x02,
122  Timestamp = 0x04,
123  User = 0x08,
124  Comment = 0x10,
125  Size = 0x20,
126  Content = 0x40
127  };
128  Q_DECLARE_FLAGS(Properties, Property)
129 
130 public:
131 
137  explicit QueryRevision(Iface& MediaWiki, QObject* const parent = nullptr);
138 
142  ~QueryRevision() override;
143 
147  void start() override;
148 
153  void setPageId(unsigned int pageId);
154 
159  void setRevisionId(unsigned int revisionId);
160 
165  void setPageName(const QString& pageName);
166 
171  void setProperties(Properties properties);
172 
177  void setLimit(int limit);
178 
183  void setStartId(int startId);
184 
189  void setEndId(int endId);
190 
195  void setStartTimestamp(const QDateTime& start);
196 
201  void setEndTimestamp(const QDateTime& end);
202 
210  void setUser(const QString& user);
211 
219  void setExcludeUser(const QString& excludeUser);
220 
225  void setDirection(QueryRevision::Direction direction);
226 
231  void setGenerateXML(bool generateXML);
232 
240  void setSection(int section);
241 
246  void setToken(QueryRevision::Token token);
247 
255  void setExpandTemplates(bool expandTemplates);
256 
257 Q_SIGNALS:
258 
263  void revision(const QList<Revision>& revision);
264 
265 private Q_SLOTS:
266 
267  void doWorkSendRequest();
268  void doWorkProcessReply();
269 };
270 
271 Q_DECLARE_OPERATORS_FOR_FLAGS(QueryRevision::Properties)
272 
273 } // namespace MediaWiki
274 
275 #endif // DIGIKAM_MEDIAWIKI_QUERYREVISION_H
Definition: piwigotalker.h:48
@ Comment
Definition: coredbconstants.h:139