[DownloadJob] Report total size only if known
ClosedPublic

Authored by broulik on Mar 18 2019, 3:24 PM.

Details

Summary

In case the download size isn't known, the browser reports -1

Test Plan

It now shows "xyz MiB of 0 B" so we don't handle that in notifications but it's better than -1 B
Or should I explicitly setTotalAmount(0) in this case?

Diff Detail

Repository
R856 Plasma Browser Integration
Lint
Lint Skipped
Unit
Unit Tests Skipped
broulik created this revision.Mar 18 2019, 3:24 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMar 18 2019, 3:24 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Mar 18 2019, 3:24 PM
bshah added a subscriber: bshah.Mar 18 2019, 3:54 PM

Other download managers show the downloaded amount as total amount, so it is e.g 25 MiB out of 25 MiB.

It should just hide the total if unknown but that's an issue in the notification view

fvogt requested changes to this revision.Apr 2 2019, 9:50 AM
fvogt added a subscriber: fvogt.

Additionally, the bytesReceived > totalAmount case is currently not handled at all, but I'm not sure whether that's something for KJob or here.

host/downloadjob.cpp
111–114

To avoid casting and rounding errors later on, I suggest to use const qlonglong totalAmount = it->toDouble(); here.

This revision now requires changes to proceed.Apr 2 2019, 9:50 AM
broulik updated this revision to Diff 56318.Apr 15 2019, 6:00 PM
fvogt accepted this revision.Apr 15 2019, 6:04 PM
This revision is now accepted and ready to land.Apr 15 2019, 6:04 PM
This revision was automatically updated to reflect the committed changes.