7#include "filecopyworker.h"
9#include <KLocalizedString>
12using namespace KNSCore;
14class KNSCore::FileCopyWorkerPrivate
17 FileCopyWorkerPrivate()
24FileCopyWorker::FileCopyWorker(
const QUrl &source,
const QUrl &destination,
QObject *parent)
26 , d(new FileCopyWorkerPrivate)
29 d->destination.setFileName(destination.
toLocalFile());
32FileCopyWorker::~FileCopyWorker() =
default;
34void FileCopyWorker::run()
38 const qint64 totalSize = d->source.size();
40 for (qint64 i = 0; i < totalSize; i += 1024) {
41 d->destination.write(d->source.read(1024));
43 d->destination.seek(i);
45 Q_EMIT progress(i, totalSize / 1024);
49 Q_EMIT error(
i18n(
"Could not open %1 for writing", d->destination.fileName()));
52 Q_EMIT error(
i18n(
"Could not open %1 for reading", d->source.fileName()));
56#include "moc_filecopyworker.cpp"
QString i18n(const char *text, const TYPE &arg...)
QString toLocalFile() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:12:42 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.