Index: kio/kfile/kpropertiesdialog.cpp
===================================================================
--- kio/kfile/kpropertiesdialog.cpp	(revisión: 801379)
+++ kio/kfile/kpropertiesdialog.cpp	(copia de trabajo)
@@ -120,6 +120,7 @@
 #include <kacl.h>
 #include <kconfiggroup.h>
 #include <kshell.h>
+#include <kcapacitybar.h>
 #ifndef Q_OS_WIN
 #include "kfilesharedialog.h"
 #endif
@@ -686,7 +687,7 @@
     dirSizeJob = 0L;
     dirSizeUpdateTimer = 0L;
     m_lined = 0;
-    m_freeSpaceLabel = 0;
+    m_capacityBar = 0;
   }
   ~KFilePropsPluginPrivate()
   {
@@ -701,7 +702,7 @@
   bool bIconChanged;
   bool bKDesktopMode;
   bool bDesktopFile;
-  QLabel *m_freeSpaceLabel;
+  KCapacityBar *m_capacityBar;
   QString mimeType;
   QString oldFileName;
   KLineEdit* m_lined;
@@ -1092,11 +1093,11 @@
           grid->addWidget( l, curRow++, 2 );
       }
 
-      l = new QLabel(i18n("Free disk space:"), d->m_frame );
+      l = new QLabel(i18n("Device usage level:"), d->m_frame );
       grid->addWidget(l, curRow, 0);
 
-      d->m_freeSpaceLabel = new QLabel( d->m_frame );
-      grid->addWidget( d->m_freeSpaceLabel, curRow++, 2 );
+      d->m_capacityBar = new KCapacityBar( KCapacityBar::DrawTextOutline, d->m_frame );
+      grid->addWidget( d->m_capacityBar, curRow++, 2);
 
       KDiskFreeSpace * job = new KDiskFreeSpace;
       connect(job, SIGNAL(foundMountPoint(QString, quint64, quint64, quint64)),
@@ -1179,11 +1180,13 @@
 					    quint64 /*kibUsed*/,
 					    quint64 kibAvail )
 {
-    d->m_freeSpaceLabel->setText(
+    d->m_capacityBar->setText(
 	i18nc("Available space out of total partition size (percent used)", "%1 out of %2 (%3% used)",
 	 KIO::convertSizeFromKiB(kibAvail),
 	 KIO::convertSizeFromKiB(kibSize),
 	  100 - (int)(100.0 * kibAvail / kibSize) ));
+
+    d->m_capacityBar->setValue(100 - (int)(100.0 * kibAvail / kibSize));
 }
 
 void KFilePropsPlugin::slotDirSizeUpdate()
@@ -1240,7 +1243,7 @@
   d->m_sizeDetermineButton->setEnabled(false);
 
   // also update the "Free disk space" display
-  if ( d->m_freeSpaceLabel )
+  if ( d->m_capacityBar )
   {
     bool isLocal;
     const KFileItem item = properties->item();
@@ -2731,7 +2734,7 @@
   layout->addWidget(d->mountpoint, 3, 1);
 
   // show disk free
-  d->m_freeSpaceText = new QLabel(i18n("Free disk space:"), d->m_frame );
+  d->m_freeSpaceText = new QLabel(i18n("Device usage level:"), d->m_frame );
   layout->addWidget(d->m_freeSpaceText, 4, 0);
 
   d->m_freeSpaceLabel = new QLabel( d->m_frame );
Index: kdeui/widgets/kcapacitybar.h
===================================================================
--- kdeui/widgets/kcapacitybar.h	(revisión: 0)
+++ kdeui/widgets/kcapacitybar.h	(revisión: 0)
@@ -0,0 +1,70 @@
+/**
+  * This file is part of the KDE project
+  * Copyright (C) 2008 Rafael Fernández López <ereslibre@kde.org>
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Library General Public
+  * License as published by the Free Software Foundation; either
+  * version 2 of the License, or (at your option) any later version.
+  *
+  * This library is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  * Library General Public License for more details.
+  *
+  * You should have received a copy of the GNU Library General Public License
+  * along with this library; see the file COPYING.LIB.  If not, write to
+  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+  * Boston, MA 02110-1301, USA.
+  */
+
+#ifndef KCAPACITYBAR_H
+#define KCAPACITYBAR_H
+
+#include <QtGui/QWidget>
+
+#include <kdeui_export.h>
+
+class QPaintEvent;
+
+class KDEUI_EXPORT KCapacityBar
+    : public QWidget
+{
+public:
+    enum DrawTextMode {
+        DrawTextInline = 0,
+        DrawTextOutline
+    };
+
+    KCapacityBar(DrawTextMode drawTextMode = DrawTextOutline, QWidget *parent = 0);
+    ~KCapacityBar();
+
+    void setValue(int value);
+    int value() const;
+
+    void setText(const QString &text);
+    QString text() const;
+
+    void setFillFullBlocks(bool fillFullBlocks);
+    bool fillFullBlocks() const;
+
+    void setContinuous(bool continuous);
+    bool continuous() const;
+
+    void setBarHeight(int barHeight);
+    int barHeight() const;
+
+    void setHorizontalTextAlignment(Qt::Alignment textAlignment);
+    Qt::Alignment horizontalTextAlignment() const;
+
+    virtual QSize minimumSizeHint() const;
+
+protected:
+    virtual void paintEvent(QPaintEvent *event);
+
+private:
+    class Private;
+    Private *const d;
+};
+
+#endif
Index: kdeui/widgets/kcapacitybar.cpp
===================================================================
--- kdeui/widgets/kcapacitybar.cpp	(revisión: 0)
+++ kdeui/widgets/kcapacitybar.cpp	(revisión: 0)
@@ -0,0 +1,341 @@
+/**
+  * This file is part of the KDE project
+  * Copyright (C) 2008 Rafael Fernández López <ereslibre@kde.org>
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Library General Public
+  * License as published by the Free Software Foundation; either
+  * version 2 of the License, or (at your option) any later version.
+  *
+  * This library is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  * Library General Public License for more details.
+  *
+  * You should have received a copy of the GNU Library General Public License
+  * along with this library; see the file COPYING.LIB.  If not, write to
+  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+  * Boston, MA 02110-1301, USA.
+  */
+
+#include "kcapacitybar.h"
+
+#include <math.h>
+
+#include <QtGui/QApplication>
+#include <QtGui/QLabel>
+#include <QtGui/QStyle>
+#include <QtGui/QPainter>
+#include <QtGui/QBoxLayout>
+#include <QtGui/QPaintEvent>
+#include <QtGui/QPainterPath>
+#include <QtGui/QLinearGradient>
+#include <QtGui/QStyleOptionFrame>
+
+#include <kcolorscheme.h>
+
+#define ROUND_MARGIN     10
+#define VERTICAL_SPACING  3
+
+class KCapacityBar::Private
+{
+public:
+    Private(KCapacityBar::DrawTextMode drawTextMode)
+        : value(0)
+        , fillFullBlocks(true)
+        , continuous(true)
+        , barHeight(12)
+        , horizontalTextAlignment(Qt::AlignCenter)
+        , drawTextMode(drawTextMode) {}
+
+    ~Private() {}
+
+    int value;
+    QString text;
+    bool fillFullBlocks;
+    bool continuous;
+    int barHeight;
+    Qt::Alignment horizontalTextAlignment;
+
+    const KCapacityBar::DrawTextMode drawTextMode;
+};
+
+KCapacityBar::KCapacityBar(KCapacityBar::DrawTextMode drawTextMode, QWidget *parent)
+    : QWidget(parent)
+    , d(new Private(drawTextMode))
+{
+}
+
+KCapacityBar::~KCapacityBar()
+{
+    delete d;
+}
+
+void KCapacityBar::setValue(int value)
+{
+    d->value = value;
+}
+
+int KCapacityBar::value() const
+{
+    return d->value;
+}
+
+void KCapacityBar::setText(const QString &text)
+{
+    d->text = text;
+}
+
+QString KCapacityBar::text() const
+{
+    return d->text;
+}
+
+void KCapacityBar::setFillFullBlocks(bool fillFullBlocks)
+{
+    d->fillFullBlocks = fillFullBlocks;
+}
+
+bool KCapacityBar::fillFullBlocks() const
+{
+    return d->fillFullBlocks;
+}
+
+void KCapacityBar::setContinuous(bool continuous)
+{
+    d->continuous = continuous;
+}
+
+bool KCapacityBar::continuous() const
+{
+    return d->continuous;
+}
+
+void KCapacityBar::setBarHeight(int barHeight)
+{
+    d->barHeight = (barHeight % 2) ? barHeight + 1 : barHeight;
+}
+
+int KCapacityBar::barHeight() const
+{
+    return d->barHeight;
+}
+
+void KCapacityBar::setHorizontalTextAlignment(Qt::Alignment horizontalTextAlignment)
+{
+    Qt::Alignment alignment = horizontalTextAlignment;
+
+    alignment &= ~Qt::AlignTop;
+    alignment &= ~Qt::AlignBottom;
+    alignment &= ~Qt::AlignVCenter;
+
+    d->horizontalTextAlignment = alignment;
+}
+
+Qt::Alignment KCapacityBar::horizontalTextAlignment() const
+{
+    return d->horizontalTextAlignment;
+}
+
+QSize KCapacityBar::minimumSizeHint() const
+{
+    int width = (d->drawTextMode == KCapacityBar::DrawTextInline) ?
+                fontMetrics().width(d->text) + ROUND_MARGIN * 2 :
+                fontMetrics().width(d->text);
+
+    int height = (d->drawTextMode == KCapacityBar::DrawTextInline) ?
+                 fontMetrics().height() :
+                 (d->text.isEmpty() ? 0 : fontMetrics().height() + VERTICAL_SPACING / 2) + d->barHeight;
+
+    if (height % 2) {
+        height++;
+    }
+
+    return QSize(width, height);
+}
+
+void KCapacityBar::paintEvent(QPaintEvent *event)
+{
+    QPainter p(this);
+    p.setRenderHint(QPainter::Antialiasing);
+
+    p.save();
+
+    QRect drawRect = event->rect();
+
+    drawRect.setHeight(d->barHeight);
+
+    QPainterPath outline;
+    outline.moveTo(ROUND_MARGIN / 4 + 1, 0);
+    outline.lineTo(drawRect.width() - ROUND_MARGIN / 4 - 1, 0);
+    outline.quadTo(drawRect.width() + ROUND_MARGIN / 2, drawRect.height() / 2, drawRect.width() - ROUND_MARGIN / 4 - 1, drawRect.height());
+    outline.lineTo(ROUND_MARGIN / 4 + 1, drawRect.height());
+    outline.quadTo(-ROUND_MARGIN / 2, drawRect.height() / 2, ROUND_MARGIN / 4 + 1, 0);
+    const QColor fillColor = KColorScheme::shade(palette().window().color(), KColorScheme::DarkShade);
+    p.fillPath(outline, QColor(fillColor.red(), fillColor.green(), fillColor.blue(), 50));
+
+    QRadialGradient bottomGradient(QPointF(event->rect().width() / 2, drawRect.bottom() + 1), event->rect().width() / 2);
+    bottomGradient.setColorAt(0, KColorScheme::shade(palette().window().color(), KColorScheme::LightShade));
+    bottomGradient.setColorAt(1, Qt::transparent);
+    p.fillRect(QRect(0, drawRect.bottom() + 1, event->rect().width(), 1), bottomGradient);
+
+    p.translate(2, 1);
+
+    drawRect.setWidth(drawRect.width() - 4);
+#if 0
+    drawRect.setHeight(drawRect.height() - 3);
+#else
+    drawRect.setHeight(drawRect.height() - 2);
+#endif
+
+    QPainterPath path;
+    path.moveTo(ROUND_MARGIN / 4, 0);
+    path.lineTo(drawRect.width() - ROUND_MARGIN / 4, 0);
+    path.quadTo(drawRect.width() + ROUND_MARGIN / 2, drawRect.height() / 2, drawRect.width() - ROUND_MARGIN / 4, drawRect.height());
+    path.lineTo(ROUND_MARGIN / 4, drawRect.height());
+    path.quadTo(-ROUND_MARGIN / 2, drawRect.height() / 2, ROUND_MARGIN / 4, 0);
+
+    QLinearGradient linearGradient(0, 0, 0, drawRect.height());
+    linearGradient.setColorAt(0.5, KColorScheme::shade(palette().window().color(), KColorScheme::MidShade));
+    linearGradient.setColorAt(1, KColorScheme::shade(palette().window().color(), KColorScheme::LightShade));
+    p.fillPath(path, linearGradient);
+
+    p.setBrush(Qt::NoBrush);
+    p.setPen(Qt::NoPen);
+
+    int spacing = 4;
+    int verticalSpacing = VERTICAL_SPACING;
+    int slotWidth = 6;
+    int start = ROUND_MARGIN / 2;
+
+    QLinearGradient fill(0, verticalSpacing, 0, drawRect.height() - verticalSpacing);
+    fill.setColorAt(0, QColor(191, 217, 255));
+    fill.setColorAt(1, QColor(0, 102, 255));
+
+    if (d->continuous || !d->fillFullBlocks) {
+        int start = (layoutDirection() == Qt::LeftToRight) ? -1
+                                                           : (drawRect.width() + 2) - (drawRect.width() + 2) * (d->value / 100.0);
+
+        p.setClipRect(QRect(start, 0, (drawRect.width() + 2) * (d->value / 100.0), drawRect.height()), Qt::IntersectClip);
+    }
+
+    if (!d->continuous) {
+        int numSlots = (drawRect.width() - (ROUND_MARGIN + spacing / 2) - ((slotWidth + spacing) * 2)) / (slotWidth + spacing);
+        int stopSlot = floor((numSlots + 2) * (d->value / 100.0));
+
+        if (!d->fillFullBlocks || stopSlot) {
+            QPainterPath firstSlot;
+            firstSlot.moveTo(start + spacing / 2, verticalSpacing);
+            firstSlot.lineTo(start + slotWidth + spacing / 2, verticalSpacing);
+            firstSlot.lineTo(start + slotWidth + spacing / 2, verticalSpacing + (16 - verticalSpacing * 2));
+            firstSlot.lineTo(start + spacing / 2, verticalSpacing + (16 - verticalSpacing * 2));
+            firstSlot.quadTo(start, verticalSpacing + ((16.0 - verticalSpacing * 2.0) / 2.0), start + spacing / 2, verticalSpacing);
+            p.fillPath(firstSlot, fill);
+            start += slotWidth + spacing + spacing / 2;
+
+            bool stopped = false;
+            for (int i = 0; i < numSlots - 1; i++) {
+                if (d->fillFullBlocks && (i == (stopSlot - 1))) {
+                    stopped = true;
+                    break;
+                }
+                p.fillRect(QRect(start, verticalSpacing, slotWidth, 16 - verticalSpacing * 2), fill);
+                start += slotWidth + spacing;
+            }
+
+            if (!d->fillFullBlocks || (!stopped && (stopSlot != (numSlots + 1)) && (stopSlot != numSlots))) {
+                QPainterPath lastSlot;
+                lastSlot.moveTo(start, verticalSpacing);
+                lastSlot.lineTo(start, verticalSpacing + (16 - verticalSpacing * 2));
+                lastSlot.lineTo(start + slotWidth, verticalSpacing + (16 - verticalSpacing * 2));
+                lastSlot.quadTo(start + slotWidth + spacing / 2, verticalSpacing + ((16.0 - verticalSpacing * 2.0) / 2.0), start + slotWidth, verticalSpacing);
+                lastSlot.lineTo(start, verticalSpacing);
+                p.fillPath(lastSlot, fill);
+            }
+        }
+    } else {
+        KColorScheme colorScheme(QPalette::Active);
+
+        if (d->drawTextMode == KCapacityBar::DrawTextInline) {
+            p.save();
+            p.setOpacity(0.5);
+        }
+
+#if 0
+        p.save();
+        QLinearGradient linearGradient(0, 0, 0, drawRect.height());
+        linearGradient.setColorAt(0, KColorScheme::shade(palette().window().color(), KColorScheme::MidShade));
+        linearGradient.setColorAt(1, KColorScheme::shade(palette().window().color(), KColorScheme::LightShade));
+        QPainterPath spacingLine;
+        spacingLine.moveTo(ROUND_MARGIN / 4, 0);
+        spacingLine.lineTo(drawRect.width() - ROUND_MARGIN / 4, 0);
+        spacingLine.quadTo(drawRect.width() + ROUND_MARGIN / 2, drawRect.height() / 2, drawRect.width() - ROUND_MARGIN / 4, drawRect.height());
+        spacingLine.lineTo(ROUND_MARGIN / 4, drawRect.height());
+        spacingLine.quadTo(-ROUND_MARGIN / 2, drawRect.height() / 2, ROUND_MARGIN / 4, 0);
+        p.fillPath(spacingLine, linearGradient);
+        p.restore();
+
+        QPainterPath internalBar;
+        internalBar.moveTo(ROUND_MARGIN / 4 + 1, 0);
+        internalBar.lineTo(drawRect.width() - ROUND_MARGIN / 4, 0);
+        internalBar.quadTo(drawRect.width() + ROUND_MARGIN / 2, drawRect.height() / 2, drawRect.width() - ROUND_MARGIN / 4, drawRect.height() - 1);
+        internalBar.lineTo(ROUND_MARGIN / 4 + 1, drawRect.height() - 1);
+        internalBar.quadTo(-ROUND_MARGIN / 2, drawRect.height() / 2, ROUND_MARGIN / 4 + 1, 0);
+        p.fillPath(internalBar, palette().highlight().color());
+#else
+        int left = (layoutDirection() == Qt::LeftToRight) ? 0
+                                                          : drawRect.width();
+
+        int right = (layoutDirection() == Qt::LeftToRight) ? drawRect.width()
+                                                           : 0;
+
+        QLinearGradient fillInternalBar(left, 0, right, 0);
+        fillInternalBar.setColorAt(0, KColorScheme::shade(palette().highlight().color(), KColorScheme::MidShade));
+        fillInternalBar.setColorAt(0.5, KColorScheme::shade(palette().highlight().color(), KColorScheme::LightShade));
+        fillInternalBar.setColorAt(1, KColorScheme::shade(palette().highlight().color(), KColorScheme::MidShade));
+
+        int roundMargin = (layoutDirection() == Qt::LeftToRight) ? ROUND_MARGIN
+                                                                 : -ROUND_MARGIN;
+
+        QPainterPath internalBar;
+        internalBar.moveTo(left + roundMargin / 4, 0);
+        internalBar.lineTo(right - roundMargin / 4, 0);
+        internalBar.quadTo(right + roundMargin / 2, drawRect.height() / 2, right - roundMargin / 4, drawRect.height());
+        internalBar.lineTo(left + roundMargin / 4, drawRect.height());
+        internalBar.quadTo(left - roundMargin / 2, drawRect.height() / 2, left + roundMargin / 4, 0);
+        p.fillPath(internalBar, fillInternalBar);
+#endif
+
+        p.save();
+        p.setClipping(false);
+        QRadialGradient topGradient(QPointF(event->rect().width() / 2, drawRect.top()), event->rect().width() / 2);
+        const QColor fillTopColor = KColorScheme::shade(palette().window().color(), KColorScheme::LightShade);
+        topGradient.setColorAt(0, QColor(fillTopColor.red(), fillTopColor.green(), fillTopColor.blue(), 127));
+        topGradient.setColorAt(1, Qt::transparent);
+        p.fillRect(QRect(0, drawRect.top(), event->rect().width(), 2), topGradient);
+        p.restore();
+
+        p.save();
+        p.setClipRect(QRect(-1, 0, event->rect().width(), drawRect.height() / 2), Qt::ReplaceClip);
+        QLinearGradient glassGradient(0, -5, 0, drawRect.height());
+        const QColor fillColor = palette().highlightedText().color();
+        glassGradient.setColorAt(0, QColor(fillColor.red(), fillColor.green(), fillColor.blue(), 255));
+        glassGradient.setColorAt(1, Qt::transparent);
+        p.fillPath(internalBar, glassGradient);
+        p.restore();
+
+        if (d->drawTextMode == KCapacityBar::DrawTextInline) {
+            p.restore();
+        }
+    }
+
+    p.restore();
+
+    if (d->drawTextMode == KCapacityBar::DrawTextInline) {
+        p.drawText(drawRect, Qt::AlignCenter, fontMetrics().elidedText(d->text, Qt::ElideRight, drawRect.width() - 2 * ROUND_MARGIN));
+    } else {
+        p.drawText(event->rect(), Qt::AlignBottom | d->horizontalTextAlignment, fontMetrics().elidedText(d->text, Qt::ElideRight, drawRect.width()));
+    }
+
+    p.end();
+}
Index: kdeui/CMakeLists.txt
===================================================================
--- kdeui/CMakeLists.txt	(revisión: 801379)
+++ kdeui/CMakeLists.txt	(copia de trabajo)
@@ -169,6 +169,7 @@
  widgets/karrowbutton.cpp
  widgets/kdialogbuttonbox.cpp
  widgets/kbuttongroup.cpp
+ widgets/kcapacitybar.cpp
  widgets/kcharselect.cpp
  widgets/kcharselectdata.cpp
  widgets/kcmodule.cpp
@@ -436,6 +437,7 @@
  widgets/kanimatedbutton.h
  widgets/karrowbutton.h
  widgets/kdatepicker.h
+ widgets/kcapacitybar.h
  widgets/kcmodule.h
  widgets/kcombobox.h
  widgets/kcompletionbox.h
