X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/dc4827579d919034b06063075ef3b22f4a3cbc5e..817f3952e2bed820ea3b50dfdfe91ccb99dcb748:/src/statusbarspaceinfo.cpp diff --git a/src/statusbarspaceinfo.cpp b/src/statusbarspaceinfo.cpp index 20266e1a0..79a1169e5 100644 --- a/src/statusbarspaceinfo.cpp +++ b/src/statusbarspaceinfo.cpp @@ -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(value())); + const bool valuesChanged = (kBUsed != static_cast(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(); }