Merge lp:~laney/ubuntu-system-settings/storageinfo-5.4 into lp:ubuntu-system-settings

Proposed by Timo Jyrinki
Status: Merged
Merged at revision: 1312
Proposed branch: lp:~laney/ubuntu-system-settings/storageinfo-5.4
Merge into: lp:ubuntu-system-settings
Diff against target: 43 lines (+11/-1)
3 files modified
plugins/about/PageComponent.qml (+1/-1)
plugins/about/storageabout.cpp (+9/-0)
plugins/about/storageabout.h (+1/-0)
To merge this branch: bzr merge lp:~laney/ubuntu-system-settings/storageinfo-5.4
Reviewer Review Type Date Requested Status
Timo Jyrinki (community) Approve
Review via email: mp+249630@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Got functional as the bandaid solution by:

- Add #include <QtCore/QStorageInfo> to plugins/about/storageabout.cpp
- Instead of "storageInfo.availableDiskSpace", use "backendInfos.getFreeSpace" in plugins/about/PageComponent.qml line 172

review: Needs Fixing
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

(plus for the actual bandaid made the item non-clickable because I needed to comment out the StorageInfo { } in PageComponent.qml as long as such QML class is not available)

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Landed with the mentioned fixes together with Qt 5.4.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/about/PageComponent.qml'
2--- plugins/about/PageComponent.qml 2015-01-14 00:00:41 +0000
3+++ plugins/about/PageComponent.qml 2015-02-13 12:09:58 +0000
4@@ -169,7 +169,7 @@
5 objectName: "storageItem"
6 text: i18n.tr("Storage")
7 /* TRANSLATORS: that's the free disk space, indicated in the most appropriate storage unit */
8- value: i18n.tr("%1 free").arg(Utilities.formatSize(storageInfo.availableDiskSpace("/home")))
9+ value: i18n.tr("%1 free").arg(Utilities.formatSize(storageInfo.getFreeSpace("/home")))
10 progression: true
11 onClicked: pageStack.push(Qt.resolvedUrl("Storage.qml"))
12 }
13
14=== modified file 'plugins/about/storageabout.cpp'
15--- plugins/about/storageabout.cpp 2014-10-24 20:04:30 +0000
16+++ plugins/about/storageabout.cpp 2015-02-13 12:09:58 +0000
17@@ -344,6 +344,15 @@
18 return s_mount_point;
19 }
20
21+qint64 StorageAbout::getFreeSpace(const QString mount_point)
22+{
23+ QStorageInfo si(mount_point);
24+ if (si.isValid())
25+ return si.bytesFree();
26+
27+ return -1;
28+}
29+
30 StorageAbout::~StorageAbout() {
31 if (m_cancellable) {
32 g_cancellable_cancel(m_cancellable);
33
34=== modified file 'plugins/about/storageabout.h'
35--- plugins/about/storageabout.h 2014-10-24 20:04:30 +0000
36+++ plugins/about/storageabout.h 2015-02-13 12:09:58 +0000
37@@ -111,6 +111,7 @@
38 quint64 getHomeSize();
39 Q_INVOKABLE void populateSizes();
40 Q_INVOKABLE QString getDevicePath (const QString mount_point);
41+ Q_INVOKABLE qint64 getFreeSpace (const QString mount_point);
42 bool getDeveloperMode();
43 void setDeveloperMode(bool newMode);
44

Subscribers

People subscribed via source and target branches