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
This commit is contained in:
Peter Penz 2008-07-19 09:24:46 +00:00
parent dc4827579d
commit 8fc4bc196a
2 changed files with 6 additions and 2 deletions

View 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,10 +63,11 @@ 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);
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();
}

View file

@ -61,6 +61,7 @@ private slots:
private:
bool m_gettingSize;
bool m_foundMountPoint;
quint64 m_kBSize;
KUrl m_url;
};