[PATCH] KFilePropsPlugin

Pascal Létourneau pletourn at iname.com
Thu May 9 20:28:01 BST 2002


Hi

This small patch fix how the used space on a partition is computed.

Right now one could see this line in the file property dialog:
Free space on /home:  0 B/1.2 GB (95% used)

After the patch it will be:
Free space on /home:  0 B/1.2 GB (100% used)

(some disk space being reserved for root cause the discrepancy)

Pascal Létourneau

Index: kpropertiesdialog.cpp
===================================================================
RCS file: /cvs/kdelibs/kio/kfile/kpropertiesdialog.cpp,v
retrieving revision 1.221
diff -u -3 -p -r1.221 kpropertiesdialog.cpp
--- kpropertiesdialog.cpp       2002/05/06 02:48:19     1.221
+++ kpropertiesdialog.cpp       2002/05/09 19:04:41
@@ -958,7 +958,7 @@ void KFilePropsPlugin::slotFoundMountPoi
     d->m_freeSpaceLabel->setText( i18n("Available space out of total 
partition size (percent used)", "%1/%2 (%3% used)")
                                .arg(KIO::convertSizeFromKB(kBAvail))
                                .arg(KIO::convertSizeFromKB(kBSize))
-                               .arg( (int)(100.0 * kBUsed / kBSize) ) );
+                               .arg( 100 - (int)(100.0 * kBAvail / kBSize) ) 
);
 }

 // attention: copy&paste below, due to compiler bug
@@ -968,7 +968,7 @@ void KFilePropsPlugin::slotFoundMountPoi
     d->m_freeSpaceLabel->setText( i18n("Available space out of total 
partition size (percent used)", "%1/%2 (%3% used)")
                                .arg(KIO::convertSizeFromKB(kBAvail))
                                .arg(KIO::convertSizeFromKB(kBSize))
-                               .arg( (int)(100.0 * kBUsed / kBSize) ) );
+                               .arg( 100 - (int)(100.0 * kBAvail / kBSize) ) 
);
 }

 void KFilePropsPlugin::slotDirSizeFinished( KIO::Job * job )





More information about the kfm-devel mailing list