File indexing completed on 2024-04-14 14:55:11
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) 2009 by Paolo de Vathaire 0013 * <a href="mailto:paolo dot devathaire at gmail dot com">paolo dot devathaire 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 MEDIAWIKIJOB_H 0029 #define MEDIAWIKIJOB_H 0030 0031 // KF includes 0032 0033 #include <KJob> 0034 0035 // Local includes 0036 0037 #include "mediawiki_export.h" 0038 0039 namespace mediawiki 0040 { 0041 0042 class MediaWiki; 0043 class JobPrivate; 0044 0045 /** 0046 * @brief The base class for all MediaWiki jobs. 0047 */ 0048 class MEDIAWIKI_EXPORT Job : public KJob 0049 { 0050 Q_OBJECT 0051 Q_DECLARE_PRIVATE(Job) 0052 0053 public: 0054 0055 /** 0056 * @brief Indicates all possible error conditions found during the processing of the job. 0057 */ 0058 enum 0059 { 0060 NetworkError = KJob::UserDefinedError + 1, 0061 XmlError, 0062 UserRequestDefinedError = KJob::UserDefinedError + 100, 0063 MissingMandatoryParameter 0064 }; 0065 0066 public: 0067 0068 /** 0069 * @brief Destructs the Job. 0070 */ 0071 ~Job() override; 0072 0073 /** 0074 * @brief Aborts this job quietly. 0075 */ 0076 bool doKill() override; 0077 0078 protected: 0079 0080 /** 0081 * @brief Constructs a Job by a private class. 0082 * @param dd a private class 0083 * @param parent the QObject parent 0084 */ 0085 Job(JobPrivate& dd, QObject* const parent = nullptr); 0086 0087 /** 0088 * @brief Connects signals of the reply object (in the private object) to 0089 * slots of this base class. 0090 */ 0091 void connectReply(); 0092 0093 /** 0094 * @brief The private d pointer. 0095 */ 0096 JobPrivate* const d_ptr; 0097 0098 private Q_SLOTS: 0099 0100 void processUploadProgress(qint64 bytesReceived, qint64 bytesTotal); 0101 }; 0102 0103 } // namespace mediawiki 0104 0105 #endif // MEDIAWIKIJOB_H