digiKam
mediawiki_edit.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 Alexandre Mendes <alex dot mendes1988 at gmail dot com>
11  * Copyright (C) 2011 by Hormiere Guillaume <hormiere dot guillaume at gmail dot com>
12  * Copyright (C) 2011 by Manuel Campomanes <campomanes dot manuel at gmail dot com>
13  *
14  * This program is free software; you can redistribute it
15  * and/or modify it under the terms of the GNU General
16  * Public License as published by the Free Software Foundation;
17  * either version 2, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_MEDIAWIKI_EDIT_H
27 #define DIGIKAM_MEDIAWIKI_EDIT_H
28 
29 // Qt includes
30 
31 #include <QDateTime>
32 #include <QString>
33 #include <QUrl>
34 #include <QVariant>
35 #include <QNetworkCookieJar>
36 
37 // Local includes
38 
39 #include "mediawiki_job.h"
40 #include "mediawiki_queryinfo.h"
41 
42 namespace MediaWiki
43 {
44 
45 class Iface;
46 class EditPrivate;
47 
53 class Edit : public Job
54 {
55  Q_OBJECT
56  Q_DECLARE_PRIVATE(Edit)
57 
58 public:
59 
63  enum
64  {
68  TextMissing = Job::UserDefinedError+1,
69 
73  InvalidSection,
74 
78  TitleProtected,
79 
83  CreatePagePermissionMissing,
84 
88  AnonymousCreatePagePermissionMissing,
89 
93  ArticleDuplication,
94 
98  AnonymousCreateImagePermissionMissing,
99 
103  CreateImagePermissionMissing,
104 
108  SpamDetected,
109 
113  Filtered,
114 
118  ArticleSizeExceed,
119 
123  AnonymousEditPagePermissionMissing,
124 
128  EditPagePermissionMissing,
129 
133  PageDeleted,
134 
138  EmptyPage,
139 
143  EmptySection,
144 
148  EditConflict,
149 
153  RevWrongPage,
154 
158  UndoFailed
159  };
160 
164  enum Watchlist
165  {
169  watch,
170 
174  unwatch,
175 
179  preferences,
180 
184  nochange
185  };
186 
187 public:
188 
193  explicit Edit(Iface& media, QObject* const parent = nullptr);
194 
198  ~Edit() override;
199 
203  void start() override;
204 
209  void setWatchList(Edit::Watchlist watchlist);
210 
215  void setRecreate(bool recreate);
216 
221  void setCreateonly(bool createonly);
222 
227  void setNocreate(bool norecreate);
228 
233  void setMinor(bool minor);
234 
239  void setSection(const QString& section);
240 
245  void setSummary(const QString& summary);
246 
251  void setUndoAfter(int undoafter);
252 
257  void setUndo(int undo);
258 
263  void setPrependText(const QString& prependText);
264 
269  void setAppendText(const QString& appendText);
270 
275  void setPageName(const QString& pageName);
276 
281  void setToken(const QString& token);
282 
287  void setBaseTimestamp(const QDateTime& baseTimestamp);
288 
293  void setStartTimestamp(const QDateTime& startTimestamp);
294 
299  void setText(const QString& text);
300 
301 Q_SIGNALS:
302 
307  void resultCaptcha(const QVariant& captcha);
308 
309 private Q_SLOTS:
310 
311  void doWorkSendRequest(const Page& page);
312  void finishedEdit();
313 
314 public Q_SLOTS:
315 
320  void finishedCaptcha(const QString& captcha);
321 };
322 
323 } // namespace MediaWiki
324 
325 #endif // DIGIKAM_MEDIAWIKI_EDIT_H