13class KIO::FileJobPrivate :
public KIO::SimpleJobPrivate
17 : SimpleJobPrivate(url, CMD_OPEN, packedArgs)
27 void slotRedirection(
const QUrl &url);
43 void start(Worker *worker)
override;
57FileJob::FileJob(FileJobPrivate &dd)
74 d->m_worker->send(CMD_READ, packedArgs);
84 d->m_worker->send(CMD_WRITE, _data);
95 d->m_worker->send(CMD_SEEK, packedArgs);
106 d->m_worker->send(CMD_TRUNCATE, packedArgs);
116 d->m_worker->send(CMD_CLOSE);
131void FileJobPrivate::slotData(
const QByteArray &_data)
134 Q_EMIT q_func()->data(q, _data);
137void FileJobPrivate::slotRedirection(
const QUrl &url)
141 Q_EMIT q->redirection(q, url);
144void FileJobPrivate::slotMimetype(
const QString &type)
148 Q_EMIT q->mimeTypeFound(q, m_mimetype);
154 Q_EMIT q->position(q, pos);
160 Q_EMIT q->truncated(q, length);
170void FileJobPrivate::slotOpen()
180 Q_EMIT q->written(q, t_written);
183void FileJobPrivate::slotFinished()
189 Q_EMIT q->fileClosed(q);
197void FileJobPrivate::start(Worker *worker)
200 q->connect(worker, &KIO::WorkerInterface::data, q, [
this](
const QByteArray &ba) {
204 q->connect(worker, &KIO::WorkerInterface::redirection, q, [
this](
const QUrl &url) {
205 slotRedirection(url);
208 q->connect(worker, &KIO::WorkerInterface::mimeType, q, [
this](
const QString &mimeType) {
209 slotMimetype(mimeType);
212 q->connect(worker, &KIO::WorkerInterface::open, q, [
this]() {
216 q->connect(worker, &KIO::WorkerInterface::finished, q, [
this]() {
220 q->connect(worker, &KIO::WorkerInterface::position, q, [
this](
KIO::filesize_t pos) {
224 q->connect(worker, &KIO::WorkerInterface::truncated, q, [
this](
KIO::filesize_t length) {
225 slotTruncated(length);
228 q->connect(worker, &KIO::WorkerInterface::written, q, [
this](
KIO::filesize_t dataWritten) {
229 slotWritten(dataWritten);
232 q->connect(worker, &KIO::WorkerInterface::totalSize, q, [
this](
KIO::filesize_t size) {
236 SimpleJobPrivate::start(worker);
242 KIO_ARGS << url << mode;
243 return FileJobPrivate::newJob(url, packedArgs);
246#include "moc_filejob.cpp"
The file-job is an asynchronous version of normal file handling.
KIO::filesize_t size()
Size.
void read(KIO::filesize_t size)
This function attempts to read up to size bytes from the URL passed to KIO::open() and returns the by...
void write(const QByteArray &data)
This function attempts to write all the bytes in data to the URL passed to KIO::open() and returns th...
void seek(KIO::filesize_t offset)
Seek.
void truncate(KIO::filesize_t length)
Truncate.
void close()
Closes the file KIO worker.
A simple job (one url and one command).
void setUiDelegate(KJobUiDelegate *delegate)
Q_SCRIPTABLE Q_NOREPLY void start()
Type type(const QSqlDatabase &db)
A namespace for KIO globals.
KIOCORE_EXPORT FileJob * open(const QUrl &url, QIODevice::OpenMode mode)
Open ( random access I/O )
KIOCORE_EXPORT KJobUiDelegate * createDefaultJobUiDelegate()
Convenience method: use default factory, if there's one, to create a delegate and return it.
KIOCORE_EXPORT MimetypeJob * mimetype(const QUrl &url, JobFlags flags=DefaultFlags)
Find MIME type for one file or directory.
qulonglong filesize_t
64-bit file size