Commit 143a62dd authored by blam's avatar blam

[systemsettings] Add DiskUsage result property. Contributes to JB#36290

parent 473bd43e
...@@ -217,5 +217,14 @@ void DiskUsage::finished(QVariantMap usage, QJSValue *callback) ...@@ -217,5 +217,14 @@ void DiskUsage::finished(QVariantMap usage, QJSValue *callback)
delete callback; delete callback;
} }
// the result has been set, so emit resultChanged() even if result was not valid
m_result = usage;
emit resultChanged();
setWorking(false); setWorking(false);
} }
QVariantMap DiskUsage::result() const
{
return m_result;
}
...@@ -48,9 +48,9 @@ class SYSTEMSETTINGS_EXPORT DiskUsage : public QObject ...@@ -48,9 +48,9 @@ class SYSTEMSETTINGS_EXPORT DiskUsage : public QObject
Q_DECLARE_PRIVATE(DiskUsage) Q_DECLARE_PRIVATE(DiskUsage)
// True while calculation takes place // True while calculation takes place
Q_PROPERTY(bool working Q_PROPERTY(bool working READ working NOTIFY workingChanged)
READ working
NOTIFY workingChanged) Q_PROPERTY(QVariantMap result READ result NOTIFY resultChanged)
public: public:
explicit DiskUsage(QObject *parent=0); explicit DiskUsage(QObject *parent=0);
...@@ -60,8 +60,11 @@ public: ...@@ -60,8 +60,11 @@ public:
// callback with a QVariantMap (mapping paths to usages in bytes) // callback with a QVariantMap (mapping paths to usages in bytes)
Q_INVOKABLE void calculate(const QStringList &paths, QJSValue callback); Q_INVOKABLE void calculate(const QStringList &paths, QJSValue callback);
QVariantMap result() const;
signals: signals:
void workingChanged(); void workingChanged();
void resultChanged();
signals: signals:
void submit(QStringList paths, QJSValue *callback); void submit(QStringList paths, QJSValue *callback);
...@@ -81,6 +84,7 @@ private: ...@@ -81,6 +84,7 @@ private:
private: private:
QScopedPointer<DiskUsagePrivate> const d_ptr; QScopedPointer<DiskUsagePrivate> const d_ptr;
QVariantMap m_result;
bool m_working; bool m_working;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment