Fix Quota progress bar for quota limit of 2GB and more
ClosedPublic

Authored by gkowal on Aug 5 2018, 12:45 AM.

Details

Summary

Both functions of QProgressBar, setMaximum() and setValue(), accept arguments of int type, however arguments current and maxValue of setQuotaInfo() are of qint64 type. If any of these arguments exceeds the upper limit of int type (around 2GB) the progress bar is displayed incorrectly.

Fix this by directly calculating the percentage of used quota and passing it to setValue() and dropping the setting of maximum (which by default is 100).

Also, correctly round the percentage and make sure it is always in the correct range.

Diff Detail

Repository
R206 KMail
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
gkowal created this revision.Aug 5 2018, 12:45 AM
Restricted Application added a project: KDE PIM. · View Herald TranscriptAug 5 2018, 12:45 AM
Restricted Application added a subscriber: kde-pim. · View Herald Transcript
gkowal requested review of this revision.Aug 5 2018, 12:45 AM
gkowal updated this revision to Diff 39095.Aug 5 2018, 2:06 AM

Typo in variable declaration.

vkrause accepted this revision.Aug 5 2018, 9:38 AM
This revision is now accepted and ready to land.Aug 5 2018, 9:38 AM
This revision was automatically updated to reflect the committed changes.