Commit 08978264 authored by Yoann Laissus's avatar Yoann Laissus

Round disk percentage in the ListView and make it translatable.

The decimal limitation was lost with the KF5 port.
parent 92278583
......@@ -318,11 +318,11 @@ void DiskEntry::receivedSysStdErrOut()
sysStringErrOut.append( stdErr );
}
float DiskEntry::percentFull() const
int DiskEntry::percentFull() const
{
if (size != 0)
{
return 100 - ( ((float)avail / (float)size) * 100 );
return 100 - qRound((qreal(avail) / qreal(size)) * 100);
}
else
{
......
......@@ -77,7 +77,7 @@ class KDFPRIVATE_EXPORT DiskEntry : public QObject
QString prettyKBUsed() const { return KIO::convertSizeFromKiB(used); }
qulonglong kBAvail() const { return avail; }
QString prettyKBAvail() const { return KIO::convertSizeFromKiB(avail); }
float percentFull() const;
int percentFull() const;
// == comparison
bool operator==( const DiskEntry & s2 ) const
{
......
......@@ -303,7 +303,7 @@ void KDFWidget::updateDFDone( void ){
QString size,percent;
if( disk->kBSize() > 0 )
{
percent = QLocale().toString(disk->percentFull()) + QLatin1Char('%');
percent = i18nc("Disk percentage", "%1%", QString::number(disk->percentFull()));
size = disk->prettyKBSize();
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment