]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/statusbarspaceinfo.cpp
Fix for show_filter_bar action of tools-menu, which is not correctly set (when the...
[dolphin.git] / src / statusbarspaceinfo.cpp
index 20266e1a0e7e086e978758313714b81e02dfb6ec..79a1169e58dc610c6fb08ce77120e384165751a9 100644 (file)
@@ -31,7 +31,8 @@
 StatusBarSpaceInfo::StatusBarSpaceInfo(QWidget* parent) :
     KCapacityBar(KCapacityBar::DrawTextInline, parent),
     m_gettingSize(false),
-    m_foundMountPoint(false)
+    m_foundMountPoint(false),
+    m_kBSize(0)
 {
     setMaximumWidth(200);
     setMinimumWidth(200); // something to fix on kcapacitybar (ereslibre)
@@ -62,11 +63,12 @@ void StatusBarSpaceInfo::slotFoundMountPoint(const QString& mountPoint,
 
     m_gettingSize = false;
     m_foundMountPoint = true;
-    const bool valuesChanged = (kBUsed != static_cast<quint64>(value()));
+    const bool valuesChanged = (kBUsed != static_cast<quint64>(value())) || (kBSize != m_kBSize);
     if (valuesChanged) {
         setText(i18nc("@info:status Free disk space", "%1 free", KIO::convertSize(kBAvailable * 1024)));
         setUpdatesEnabled(false);
-        setValue((kBUsed * 100) / kBSize);
+        m_kBSize = kBSize;
+        setValue(kBSize > 0 ? (kBUsed * 100) / kBSize : 0);
         setUpdatesEnabled(true);
         update();
     }
@@ -124,6 +126,7 @@ void StatusBarSpaceInfo::refresh()
 void StatusBarSpaceInfo::showGettingSizeInfo()
 {
     if (m_gettingSize) {
+        m_kBSize = 0;
         setText(i18nc("@info:status", "Getting size..."));
         update();
     }