File indexing completed on 2025-01-05 03:53:35
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2011-03-22 0007 * Description : a Iface C++ interface 0008 * 0009 * SPDX-FileCopyrightText: 2011-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2011 by Paolo de Vathaire <paolo dot devathaire at gmail dot com> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #include "mediawiki_job_p.h" 0017 0018 // Qt includes 0019 0020 #include <QNetworkReply> 0021 0022 // Local include 0023 0024 #include "mediawiki_iface.h" 0025 0026 namespace MediaWiki 0027 { 0028 0029 Job::Job(JobPrivate& dd, QObject* const parent) 0030 : KJob (parent), 0031 d_ptr(&dd) 0032 { 0033 setCapabilities(Job::Killable); 0034 } 0035 0036 Job::~Job() 0037 { 0038 delete d_ptr; 0039 } 0040 0041 bool Job::doKill() 0042 { 0043 Q_D(Job); 0044 0045 if (d->reply != nullptr) 0046 { 0047 d->reply->abort(); 0048 } 0049 0050 return true; 0051 } 0052 0053 void Job::connectReply() 0054 { 0055 Q_D(Job); 0056 0057 connect(d->reply, SIGNAL(uploadProgress(qint64,qint64)), 0058 this, SLOT(processUploadProgress(qint64,qint64))); 0059 } 0060 0061 void Job::processUploadProgress(qint64 bytesReceived, qint64 bytesTotal) 0062 { 0063 setTotalAmount(Job::Bytes, bytesTotal); 0064 setProcessedAmount(Job::Bytes, bytesReceived); 0065 } 0066 0067 } // namespace MediaWiki 0068 0069 #include "moc_mediawiki_job.cpp"