[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kio/kfile
From:       David Faure <faure () kde ! org>
Date:       2010-10-22 20:08:52
Message-ID: 20101022200852.1EF94AC89A () svn ! kde ! org
[Download RAW message or body]

SVN commit 1188643 by dfaure:

Only show the "% of use" on a device when the device is actually mounted.
Otherwise we were showing the data for the parent device (e.g. "/", for unmounted \
"/mnt/foo"), which made no sense.


 M  +7 -3      kpropertiesdialog.cpp  


--- trunk/KDE/kdelibs/kio/kfile/kpropertiesdialog.cpp #1188642:1188643
@@ -2706,6 +2706,11 @@
     {
     }
 
+    bool isMounted() const {
+        const QString dev = device->currentText();
+        return !dev.isEmpty() && \
KMountPoint::currentMountPoints().findByDevice(dev); +    }
+
     QFrame *m_frame;
     QStringList mountpointlist;
     QLabel *m_freeSpaceText;
@@ -2875,8 +2880,7 @@
     d->m_freeSpaceLabel->hide();
     d->m_freeSpaceBar->hide();
 
-    if ( !d->mountpoint->text().isEmpty() )
-    {
+    if (!d->mountpoint->text().isEmpty() && d->isMounted()) {
         KDiskFreeSpaceInfo info = KDiskFreeSpaceInfo::freeSpaceInfo( \
                d->mountpoint->text() );
         slotFoundMountPoint( info.mountPoint(), info.size()/1024, info.used()/1024, \
info.available()/1024);  }
@@ -2915,7 +2919,7 @@
     d->m_freeSpaceText->show();
     d->m_freeSpaceLabel->show();
 
-    int percUsed = kibSize != 0 ? (100 - (int)(100.0 * kibAvail / kibSize)) : 100;
+    const int percUsed = kibSize != 0 ? (100 - (int)(100.0 * kibAvail / kibSize)) : \
100;  
     d->m_freeSpaceLabel->setText(
             i18nc("Available space out of total partition size (percent used)", "%1 \
free of %2 (%3% used)",


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic