┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/statusbarspaceinfo.cpp
diff options
context:
space:
mode:
authorRafael Fernández López <[email protected]>2008-07-18 22:22:33 +0000
committerRafael Fernández López <[email protected]>2008-07-18 22:22:33 +0000
commitdc4827579d919034b06063075ef3b22f4a3cbc5e (patch)
tree4672fa574a971eb9c24fb8841c2074ad0cb379bc /src/statusbarspaceinfo.cpp
parent08989d295c6499e6f9e40211d0c76e66800ee25a (diff)
The space info widget now inherits KCapacityBar. Two things to check:
- Align vertically the text correctly - Minimum width of the widget (not forcing it to 200) CCMAIL: [email protected] svn path=/trunk/KDE/kdebase/apps/; revision=834445
Diffstat (limited to 'src/statusbarspaceinfo.cpp')
-rw-r--r--src/statusbarspaceinfo.cpp29
1 files changed, 9 insertions, 20 deletions
diff --git a/src/statusbarspaceinfo.cpp b/src/statusbarspaceinfo.cpp
index c674a387a..20266e1a0 100644
--- a/src/statusbarspaceinfo.cpp
+++ b/src/statusbarspaceinfo.cpp
@@ -29,15 +29,12 @@
#include <QKeyEvent>
StatusBarSpaceInfo::StatusBarSpaceInfo(QWidget* parent) :
- QProgressBar(parent),
+ KCapacityBar(KCapacityBar::DrawTextInline, parent),
m_gettingSize(false),
- m_foundMountPoint(false),
- m_text()
+ m_foundMountPoint(false)
{
- setMinimum(0);
- setMaximum(0);
-
setMaximumWidth(200);
+ setMinimumWidth(200); // something to fix on kcapacitybar (ereslibre)
// Update the space information each 10 seconds. Polling is useful
// here, as files can be deleted/added outside the scope of Dolphin.
@@ -56,11 +53,6 @@ void StatusBarSpaceInfo::setUrl(const KUrl& url)
refresh();
}
-QString StatusBarSpaceInfo::text() const
-{
- return m_text;
-}
-
void StatusBarSpaceInfo::slotFoundMountPoint(const QString& mountPoint,
quint64 kBSize,
quint64 kBUsed,
@@ -70,13 +62,11 @@ void StatusBarSpaceInfo::slotFoundMountPoint(const QString& mountPoint,
m_gettingSize = false;
m_foundMountPoint = true;
- const bool valuesChanged = (kBUsed != static_cast<quint64>(value())) ||
- (kBSize != static_cast<quint64>(maximum()));
+ const bool valuesChanged = (kBUsed != static_cast<quint64>(value()));
if (valuesChanged) {
- m_text = i18nc("@info:status Free disk space", "%1 free", KIO::convertSize(kBAvailable * 1024));
+ setText(i18nc("@info:status Free disk space", "%1 free", KIO::convertSize(kBAvailable * 1024)));
setUpdatesEnabled(false);
- setMaximum(kBSize);
- setValue(kBUsed);
+ setValue((kBUsed * 100) / kBSize);
setUpdatesEnabled(true);
update();
}
@@ -89,7 +79,7 @@ void StatusBarSpaceInfo::slotDiskFreeSpaceDone()
}
m_gettingSize = false;
- m_text = i18nc("@info:status", "Unknown size");
+ setText(i18nc("@info:status", "Unknown size"));
setValue(0);
update();
}
@@ -98,7 +88,7 @@ void StatusBarSpaceInfo::refresh()
{
// KDiskFreeSpace is for local paths only
if (!m_url.isLocalFile()) {
- m_text = i18nc("@info:status", "Unknown size");
+ setText(i18nc("@info:status", "Unknown size"));
setValue(0);
update();
return;
@@ -134,8 +124,7 @@ void StatusBarSpaceInfo::refresh()
void StatusBarSpaceInfo::showGettingSizeInfo()
{
if (m_gettingSize) {
- m_text = i18nc("@info:status", "Getting size...");
- setMaximum(0);
+ setText(i18nc("@info:status", "Getting size..."));
update();
}
}