]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/statusbarspaceinfo.cpp
Fix the reproducible problem after the fix:
[dolphin.git] / src / statusbarspaceinfo.cpp
index bb0ed712a55ca14c42a1bb8d6450ab329629007e..84436813608728d4af814adc631e949c338aab02 100644 (file)
 
 #include "statusbarspaceinfo.h"
 
-#include <QtCore/QTimer>
-#include <QtGui/QPainter>
-#include <QtGui/QKeyEvent>
-
-#include <kglobalsettings.h>
+#include <kcolorscheme.h>
 #include <kdiskfreespace.h>
 #include <kmountpoint.h>
 #include <klocale.h>
 #include <kio/job.h>
 
+#include <QTimer>
+#include <QPainter>
+#include <QKeyEvent>
+
 StatusBarSpaceInfo::StatusBarSpaceInfo(QWidget* parent) :
     QWidget(parent),
     m_gettingSize(false),
@@ -75,7 +75,7 @@ void StatusBarSpaceInfo::paintEvent(QPaintEvent* /* event */)
     frameColor.setAlpha(128);
     painter.setPen(frameColor);
 
-    const QColor backgrColor = KGlobalSettings::baseColor();
+    const QColor backgrColor = KColorScheme(QPalette::Active, KColorScheme::View).background().color();
     painter.setBrush(backgrColor);
 
     painter.drawRect(QRect(0, barTop + 1 , barWidth - widthDec, barHeight));
@@ -93,28 +93,28 @@ void StatusBarSpaceInfo::paintEvent(QPaintEvent* /* event */)
         }
         painter.drawRect(QRect(left, barTop + 2, right, barHeight - 1));
 
-        text = i18n("%1 free", KIO::convertSizeFromKiB(m_kBAvailable));
+        text = i18nc("@info:status", "%1 free", KIO::convertSizeFromKiB(m_kBAvailable));
     } else {
         if (m_gettingSize) {
-            text = i18n("Getting size...");
+            text = i18nc("@info:status", "Getting size...");
         } else {
             text = QString();
-            QTimer::singleShot(0, this, SLOT(hide()));
+            QMetaObject::invokeMethod(this, "hide", Qt::QueuedConnection);
         }
     }
 
     // draw text
-    painter.setPen(KGlobalSettings::textColor());
+    painter.setPen(KColorScheme(QPalette::Active, KColorScheme::View).foreground().color());
     painter.drawText(QRect(1, 1, barWidth - 2, barHeight + 6),
                      Qt::AlignCenter | Qt::TextWordWrap,
                      text);
 }
 
 
-void StatusBarSpaceInfo::slotFoundMountPoint(const unsigned long& kBSize,
-                                             const unsigned long& kBUsed,
-                                             const unsigned long& kBAvailable,
-                                             const QString& mountPoint)
+void StatusBarSpaceInfo::slotFoundMountPoint(const QString& mountPoint,
+                                             quint64 kBSize,
+                                             quint64 kBUsed,
+                                             quint64 kBAvailable)
 {
     Q_UNUSED(kBUsed);
     Q_UNUSED(mountPoint);
@@ -138,8 +138,9 @@ void StatusBarSpaceInfo::refresh()
     m_kBAvailable = 0;
 
     // KDiskFreeSpace is for local paths only
-    if (!m_url.isLocalFile())
+    if (!m_url.isLocalFile()) {
         return;
+    }
 
     m_gettingSize = true;
     KMountPoint::Ptr mp = KMountPoint::currentMountPoints().findByPath(m_url.path());
@@ -147,14 +148,14 @@ void StatusBarSpaceInfo::refresh()
         return;
 
     KDiskFreeSpace* job = new KDiskFreeSpace(this);
-    connect(job, SIGNAL(foundMountPoint(const unsigned long&,
-                                        const unsigned long&,
-                                        const unsigned long&,
-                                        const QString&)),
-            this, SLOT(slotFoundMountPoint(const unsigned long&,
-                                           const unsigned long&,
-                                           const unsigned long&,
-                                           const QString&)));
+    connect(job, SIGNAL(foundMountPoint(const QString&,
+                                        quint64,
+                                        quint64,
+                                        quint64)),
+            this, SLOT(slotFoundMountPoint(const QString&,
+                                           quint64,
+                                           quint64,
+                                           quint64)));
     connect(job, SIGNAL(done()),
             this, SLOT(showResult()));
 
@@ -163,7 +164,7 @@ void StatusBarSpaceInfo::refresh()
 
 QColor StatusBarSpaceInfo::progressColor(const QColor& bgColor) const
 {
-    QColor color = KGlobalSettings::buttonBackground();
+    QColor color = KColorScheme(QPalette::Active, KColorScheme::Button).background().color();
 
     // assure that enough contrast is given between the background color
     // and the progressbar color