]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Update disk space info on refresh
authorKai Uwe Broulik <kde@privat.broulik.de>
Wed, 19 Sep 2018 08:20:14 +0000 (10:20 +0200)
committerKai Uwe Broulik <kde@privat.broulik.de>
Wed, 19 Sep 2018 08:20:14 +0000 (10:20 +0200)
When explicitly refreshing the view (e.g. F5) also refresh disk space info.
This would also allow us to raise the refresh interval somewhat.

CCBUG: 398612

Differential Revision: https://phabricator.kde.org/D15508

src/dolphinmainwindow.cpp
src/statusbar/dolphinstatusbar.cpp
src/statusbar/dolphinstatusbar.h
src/statusbar/spaceinfoobserver.cpp
src/statusbar/spaceinfoobserver.h
src/statusbar/statusbarspaceinfo.cpp
src/statusbar/statusbarspaceinfo.h

index b603b8cfa5fa324c1753957e0e769c84e2d20370..6576e1b0e74093ba00e7c17f2e879fe0aa695a67 100644 (file)
@@ -590,6 +590,7 @@ void DolphinMainWindow::reloadView()
 {
     clearStatusBar();
     m_activeViewContainer->reload();
 {
     clearStatusBar();
     m_activeViewContainer->reload();
+    m_activeViewContainer->statusBar()->updateSpaceInfo();
 }
 
 void DolphinMainWindow::stopLoading()
 }
 
 void DolphinMainWindow::stopLoading()
index 34916830eaa666e92ebb8125d72c5f929f7e7c7f..b3fddba10825ba58164d183d405f5e43cb501bd8 100644 (file)
@@ -252,6 +252,11 @@ void DolphinStatusBar::readSettings()
     setExtensionsVisible(true);
 }
 
     setExtensionsVisible(true);
 }
 
+void DolphinStatusBar::updateSpaceInfo()
+{
+    m_spaceInfo->update();
+}
+
 void DolphinStatusBar::contextMenuEvent(QContextMenuEvent* event)
 {
     Q_UNUSED(event);
 void DolphinStatusBar::contextMenuEvent(QContextMenuEvent* event)
 {
     Q_UNUSED(event);
index 8b872ace58325a161d6370d15ec94a960164bfb8..7461d1d7d3fcecc707bfd3af2cd1edddfb6425fd 100644 (file)
@@ -88,6 +88,11 @@ public:
      */
     void readSettings();
 
      */
     void readSettings();
 
+    /**
+     * Refreshes the disk space information.
+     */
+    void updateSpaceInfo();
+
 public slots:
     void setText(const QString& text);
     void setUrl(const QUrl& url);
 public slots:
     void setText(const QString& text);
     void setUrl(const QUrl& url);
index 6cf695d5508d6c011577fd9604dc5b44df3099cc..692eba7e7a781d52aa5e59acf13426c3cb951cf8 100644 (file)
@@ -71,6 +71,13 @@ void SpaceInfoObserver::setUrl(const QUrl& url)
     }
 }
 
     }
 }
 
+void SpaceInfoObserver::update()
+{
+    if (m_mountPointObserver) {
+        m_mountPointObserver->update();
+    }
+}
+
 void SpaceInfoObserver::spaceInfoChanged(quint64 size, quint64 available)
 {
     // Make sure that the size has actually changed
 void SpaceInfoObserver::spaceInfoChanged(quint64 size, quint64 available)
 {
     // Make sure that the size has actually changed
index 1e74caef475777089cdc9272ae8ca02368cc869c..93f4c8c9146b6122be489264c58d7e04907b8111 100644 (file)
@@ -40,6 +40,9 @@ public:
 
     void setUrl(const QUrl& url);
 
 
     void setUrl(const QUrl& url);
 
+public slots:
+    void update();
+
 signals:
     /**
      * This signal is emitted when the size or available space changes.
 signals:
     /**
      * This signal is emitted when the size or available space changes.
index 65af174909097c2d82833174234964c9e64754e1..8822495766b799d8bbb4e7ce10cf38b3015b181f 100644 (file)
@@ -54,6 +54,13 @@ QUrl StatusBarSpaceInfo::url() const
     return m_url;
 }
 
     return m_url;
 }
 
+void StatusBarSpaceInfo::update()
+{
+    if (m_observer) {
+        m_observer->update();
+    }
+}
+
 void StatusBarSpaceInfo::showEvent(QShowEvent* event)
 {
     KCapacityBar::showEvent(event);
 void StatusBarSpaceInfo::showEvent(QShowEvent* event)
 {
     KCapacityBar::showEvent(event);
index 4f36517aeab5a21ace8a5ee5ef1eac1241d5198e..24f8b7f29fb6b910c4fd0c9564eed7d207daead5 100644 (file)
@@ -45,6 +45,8 @@ public:
     void setUrl(const QUrl& url);
     QUrl url() const;
 
     void setUrl(const QUrl& url);
     QUrl url() const;
 
+    void update();
+
 protected:
     void showEvent(QShowEvent* event) override;
     void hideEvent(QHideEvent* event) override;
 protected:
     void showEvent(QShowEvent* event) override;
     void hideEvent(QHideEvent* event) override;