From 8fc4bc196ac55f30e22113ab44b404e641679301 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 19 Jul 2008 09:24:46 +0000 Subject: [PATCH] remember the maximum size, so that an update is also done for the (rare) case when two partitions have a different size but an equal used size (no backport to KDE 4.1 necessary, as there QProgressBar is used instead of KCapacityBar) CCMAIL: ereslibre@kde.org svn path=/trunk/KDE/kdebase/apps/; revision=834550 --- src/statusbarspaceinfo.cpp | 7 +++++-- src/statusbarspaceinfo.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/statusbarspaceinfo.cpp b/src/statusbarspaceinfo.cpp index 20266e1a0e..059a55094e 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,10 +63,11 @@ 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); + m_kBSize = kBSize; setValue((kBUsed * 100) / kBSize); 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(); } diff --git a/src/statusbarspaceinfo.h b/src/statusbarspaceinfo.h index d6caaa79e9..93ea3fe9f3 100644 --- a/src/statusbarspaceinfo.h +++ b/src/statusbarspaceinfo.h @@ -61,6 +61,7 @@ private slots: private: bool m_gettingSize; bool m_foundMountPoint; + quint64 m_kBSize; KUrl m_url; };