+
+ m_mountPointObserver = newObserver;
+ m_mountPointObserver->ref();
+ connect(m_mountPointObserver, &MountPointObserver::spaceInfoChanged, this, &SpaceInfoObserver::spaceInfoChanged);
+
+ // If newObserver is cached it won't call update until the next timer update,
+ // so update the observer now.
+ m_mountPointObserver->update();
+ }
+}
+
+void SpaceInfoObserver::update()
+{
+ if (m_mountPointObserver) {
+ m_mountPointObserver->update();
+ }
+}
+
+void SpaceInfoObserver::spaceInfoChanged(quint64 size, quint64 available)
+{
+ // Make sure that the size has actually changed
+ if (m_dataSize != size || m_dataAvailable != available || !m_hasData) {
+ m_hasData = true;
+ m_dataSize = size;
+ m_dataAvailable = available;
+
+ emit valuesChanged();