digiKam
mediawiki_upload.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  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_MEDIAWIKI_UPLOAD_H
25 #define DIGIKAM_MEDIAWIKI_UPLOAD_H
26 
27 // Qt includes
28 
29 #include <QIODevice>
30 #include <QString>
31 #include <QDateTime>
32 #include <QNetworkCookieJar>
33 #include <QUrl>
34 
35 // Local includes
36 
37 
38 #include "mediawiki_job.h"
39 #include "mediawiki_queryinfo.h"
40 
41 namespace MediaWiki
42 {
43 
44 class Iface;
45 class UploadPrivate;
46 
52 class Upload : public Job
53 {
54  Q_OBJECT
55  Q_DECLARE_PRIVATE(Upload)
56 
57 public:
58 
59  enum
60  {
64  InternalError= Job::UserDefinedError+1,
68  UploadDisabled,
69 
73  InvalidSessionKey,
74 
78  BadAccess,
79 
83  ParamMissing,
84 
88  MustBeLoggedIn,
89 
93  FetchFileError,
94 
98  NoModule,
99 
103  EmptyFile,
104 
108  ExtensionMissing,
109 
113  TooShortFilename,
114 
118  OverWriting,
119 
123  StashFailed
124  };
125 
126 public:
127 
132  explicit Upload(Iface& MediaWiki, QObject* const parent = nullptr);
133 
137  ~Upload() override;
138 
142  void start() override;
143 
148  void setFilename(const QString&);
149 
154  void setFile(QIODevice* const);
155 
160  void setComment(const QString&);
161 
166  void setText(const QString&);
167 
168 private Q_SLOTS:
169 
170  void doWorkSendRequest(const Page& page);
171  void doWorkProcessReply();
172 };
173 
174 } // namespace MediaWiki
175 
176 #endif // UPLOAD_H