KIO

transferjob.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2000 Stephan Kulow <[email protected]>
4  SPDX-FileCopyrightText: 2000-2013 David Faure <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #ifndef KIO_TRANSFERJOB_H
10 #define KIO_TRANSFERJOB_H
11 
12 #include "simplejob.h"
13 
14 namespace KIO
15 {
16 
17 class TransferJobPrivate;
26 class KIOCORE_EXPORT TransferJob : public SimpleJob
27 {
28  Q_OBJECT
29 
30 public:
31  ~TransferJob() override;
32 
37  void setModificationTime(const QDateTime &mtime);
38 
46  bool isErrorPage() const;
47 
54  void setAsyncDataEnabled(bool enabled);
55 
61  void sendAsyncData(const QByteArray &data);
62 
63 #if KIOCORE_ENABLE_DEPRECATED_SINCE(4, 3)
64 
72  KIOCORE_DEPRECATED_VERSION(4, 3, "No longer needed")
73  void setReportDataSent(bool enabled);
74 #endif
75 
76 #if KIOCORE_ENABLE_DEPRECATED_SINCE(4, 3)
77 
84  KIOCORE_DEPRECATED_VERSION(4, 3, "No longer needed")
85  bool reportDataSent() const;
86 #endif
87 
93  QString mimetype() const;
94 
101  QUrl redirectUrl() const;
102 
108  void setTotalSize(KIO::filesize_t bytes);
109 
110 protected:
115  void slotResult(KJob *job) override;
116 
120  bool doResume() override;
121 
122 Q_SIGNALS:
132  void data(KIO::Job *job, const QByteArray &data);
133 
145  void dataReq(KIO::Job *job, QByteArray &data);
146 
154  void redirection(KIO::Job *job, const QUrl &url);
155 
163  void permanentRedirection(KIO::Job *job, const QUrl &fromUrl, const QUrl &toUrl);
164 
170  void mimetype(KIO::Job *job, const QString &type);
171 
179  void canResume(KIO::Job *job, KIO::filesize_t offset);
180 
181 protected Q_SLOTS:
182  virtual void slotRedirection(const QUrl &url);
183  void slotFinished() override;
184  virtual void slotData(const QByteArray &data);
185  virtual void slotDataReq();
186  virtual void slotMimetype(const QString &mimetype);
187  void slotMetaData(const KIO::MetaData &_metaData) override;
188 
189 protected:
190  TransferJob(TransferJobPrivate &dd);
191 private:
192  Q_PRIVATE_SLOT(d_func(), void slotPostRedirection())
193  Q_PRIVATE_SLOT(d_func(), void slotIODeviceClosed())
194  Q_PRIVATE_SLOT(d_func(), void slotIODeviceClosedBeforeStart())
195  Q_DECLARE_PRIVATE(TransferJob)
196 
197  // A FileCopyJob may control one or more TransferJobs
198  friend class FileCopyJob;
199  friend class FileCopyJobPrivate;
200 };
201 
226 KIOCORE_EXPORT TransferJob *get(const QUrl &url, LoadType reload = NoReload, JobFlags flags = DefaultFlags);
227 
238 KIOCORE_EXPORT TransferJob *put(const QUrl &url, int permissions,
239  JobFlags flags = DefaultFlags);
240 
269 KIOCORE_EXPORT TransferJob *http_post(const QUrl &url, const QByteArray &postData,
270  JobFlags flags = DefaultFlags);
271 
288 KIOCORE_EXPORT TransferJob *http_post(const QUrl &url, QIODevice *device,
289  qint64 size = -1, JobFlags flags = DefaultFlags);
290 
303 KIOCORE_EXPORT TransferJob *http_delete(const QUrl &url, JobFlags flags = DefaultFlags);
304 
305 }
306 
307 #endif
qulonglong filesize_t
64-bit file size
Definition: global.h:40
A namespace for KIO globals.
Definition: authinfo.h:21
MetaData is a simple map of key/value strings.
Definition: metadata.h:23
Show the progress info GUI, no Resume and no Overwrite.
Definition: job_base.h:270
KIOCORE_EXPORT MimetypeJob * mimetype(const QUrl &url, JobFlags flags=DefaultFlags)
Find mimetype for one file or directory.
Definition: mimetypejob.cpp:81
KIOCORE_EXPORT SimpleJob * setModificationTime(const QUrl &url, const QDateTime &mtime)
Changes the modification time on a file or directory.
Definition: simplejob.cpp:353
KIOCORE_EXPORT TransferJob * http_delete(const QUrl &url, JobFlags flags=DefaultFlags)
HTTP DELETE.
KIOCORE_EXPORT TransferJob * put(const QUrl &url, int permissions, JobFlags flags=DefaultFlags)
Put (means: write)
The FileCopyJob copies data from one place to another.
Definition: filecopyjob.h:26
The base class for all jobs.
Definition: job_base.h:45
KIOCORE_EXPORT TransferJob * http_post(const QUrl &url, const QByteArray &postData, JobFlags flags=DefaultFlags)
HTTP POST (for form data).
The transfer job pumps data into and/or out of a Slave.
Definition: transferjob.h:26
A simple job (one url and one command).
Definition: simplejob.h:27
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 23:01:47 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.