set total amount later
Otherwise the kwidgetjobtracker wouldn't notice it and it wouldn't be reported properly.
This commit is contained in:
parent
d1d84bc464
commit
364ab02aad
2 changed files with 6 additions and 5 deletions
|
@ -37,6 +37,7 @@ FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, qint64
|
|||
, mDestination(destination)
|
||||
, mSpeedBytes(0)
|
||||
, mWritten(0)
|
||||
, mSize(size)
|
||||
{
|
||||
Q_ASSERT(mOrigin);
|
||||
Q_ASSERT(mOrigin->isReadable());
|
||||
|
@ -45,10 +46,6 @@ FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, qint64
|
|||
mDestination.setScheme(QStringLiteral("file"));
|
||||
}
|
||||
|
||||
if (size >= 0) {
|
||||
setTotalAmount(Bytes, size);
|
||||
}
|
||||
|
||||
setCapabilities(Killable);
|
||||
qCDebug(KDECONNECT_CORE) << "FileTransferJob Downloading payload to" << destination << "size:" << size;
|
||||
}
|
||||
|
@ -89,7 +86,10 @@ void FileTransferJob::startTransfer()
|
|||
{ i18nc("File transfer destination", "To"), mDestination.toLocalFile() });
|
||||
|
||||
QNetworkRequest req(mDestination);
|
||||
req.setHeader(QNetworkRequest::ContentLengthHeader, totalAmount(Bytes));
|
||||
if (mSize >= 0) {
|
||||
setTotalAmount(Bytes, mSize);
|
||||
req.setHeader(QNetworkRequest::ContentLengthHeader, mSize);
|
||||
}
|
||||
mReply = Daemon::instance()->networkAccessManager()->put(req, mOrigin.data());
|
||||
|
||||
connect(mReply, &QNetworkReply::uploadProgress, this, [this](qint64 bytesSent, qint64 /*bytesTotal*/) {
|
||||
|
|
|
@ -72,6 +72,7 @@ private:
|
|||
QElapsedTimer mTimer;
|
||||
qulonglong mSpeedBytes;
|
||||
qint64 mWritten;
|
||||
qint64 mSize;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue