]> cloud.milkyroute.net Git - dolphin.git/commitdiff
If KDiskFreeSpace doesn't work for some reason it never emits foundMountPoint, and...
authorJeff Mitchell <mitchell@kde.org>
Thu, 27 Mar 2008 20:36:05 +0000 (20:36 +0000)
committerJeff Mitchell <mitchell@kde.org>
Thu, 27 Mar 2008 20:36:05 +0000 (20:36 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=790923

src/statusbarspaceinfo.cpp
src/statusbarspaceinfo.h

index 8da3dc9472c3f0a283b0be17109cc228419bee99..6ccedd77dc4b0a0a8929c98373484fa01e8aef52 100644 (file)
@@ -31,6 +31,7 @@
 StatusBarSpaceInfo::StatusBarSpaceInfo(QWidget* parent) :
     QProgressBar(parent),
     m_gettingSize(false),
+    m_foundMountPoint(false),
     m_text()
 {
     setMinimum(0);
@@ -69,6 +70,7 @@ void StatusBarSpaceInfo::slotFoundMountPoint(const QString& mountPoint,
     Q_UNUSED(mountPoint);
 
     m_gettingSize = false;
+    m_foundMountPoint = true;
     const bool valuesChanged = (kBUsed != static_cast<quint64>(value())) ||
                                (kBAvailable != static_cast<quint64>(maximum()));
     if (valuesChanged) {
@@ -78,6 +80,17 @@ void StatusBarSpaceInfo::slotFoundMountPoint(const QString& mountPoint,
     }
 }
 
+void StatusBarSpaceInfo::slotKDFSDone()
+{
+    if( m_foundMountPoint )
+        return;
+    m_gettingSize = false;
+    m_text = i18n("Free disk space could not be determined");
+    setMinimum(0);
+    setMaximum(0);
+    setValue(0);
+}
+
 void StatusBarSpaceInfo::refresh()
 {
     // KDiskFreeSpace is for local paths only
@@ -93,6 +106,7 @@ void StatusBarSpaceInfo::refresh()
     }
 
     m_gettingSize = true;
+    m_foundMountPoint = false;
     KDiskFreeSpace* job = new KDiskFreeSpace(this);
     connect(job, SIGNAL(foundMountPoint(const QString&,
                                         quint64,
@@ -102,6 +116,7 @@ void StatusBarSpaceInfo::refresh()
                                            quint64,
                                            quint64,
                                            quint64)));
+    connect(job, SIGNAL(done()), this, SLOT(slotKDFSDone()));
 
     job->readDF(mp->mountPoint());
 
index b50d14c4dd715f3a2f1f8581d29b99565c1ac965..99a0c78b50e47c4742d8e38d4f7837ae9aa91942 100644 (file)
@@ -53,6 +53,8 @@ private slots:
                              quint64 kBUsed,
                              quint64 kBAvailable);
 
+    void slotKDFSDone();
+
     /** Refreshes the space information for the current set URL. */
     void refresh();
 
@@ -60,6 +62,7 @@ private slots:
 
 private:
     bool m_gettingSize;
+    bool m_foundMountPoint;
     KUrl m_url;
     QString m_text;
 };