┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/places/placesitemlistwidget.h
diff options
context:
space:
mode:
authorChris Holland <[email protected]>2020-06-12 16:06:59 -0400
committerElvis Angelaccio <[email protected]>2020-11-04 23:16:13 +0000
commit89ede4b9a170ffd2f3f155f081630edf3f2998ab (patch)
tree7bd3631e867d40d84bfbb6b11a81661e39cf7309 /src/panels/places/placesitemlistwidget.h
parent8f76df41da41f012697c8bb9d6ebcddb9b315c4f (diff)
Refactor capacity by to use async KIO FreeSpaceJob.
Based on this kio filepicker patch: https://github.com/KDE/kio/commit/933887dc334f3498505af7a86d25db7faae91019
Diffstat (limited to 'src/panels/places/placesitemlistwidget.h')
-rw-r--r--src/panels/places/placesitemlistwidget.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/panels/places/placesitemlistwidget.h b/src/panels/places/placesitemlistwidget.h
index a82616ff3..f33f2f2c8 100644
--- a/src/panels/places/placesitemlistwidget.h
+++ b/src/panels/places/placesitemlistwidget.h
@@ -9,6 +9,24 @@
#include "kitemviews/kstandarditemlistwidget.h"
+#include <QDateTime>
+#include <QPointer>
+
+#include <KIO/FileSystemFreeSpaceJob>
+
+
+// The free space / capacity bar is based on KFilePlacesView.
+// https://github.com/KDE/kio/commit/933887dc334f3498505af7a86d25db7faae91019
+struct PlaceFreeSpaceInfo
+{
+ QDateTime lastUpdated;
+ KIO::filesize_t used = 0;
+ KIO::filesize_t size = 0;
+ qreal usedRatio = 0;
+ QPointer<KIO::FileSystemFreeSpaceJob> job;
+};
+
+
/**
* @brief Extends KStandardItemListWidget to interpret the hidden
* property of the PlacesModel and use the right text color.
@@ -31,9 +49,8 @@ protected:
void resetCapacityBar();
private:
- bool m_isMountPoint;
bool m_drawCapacityBar;
- qreal m_capacityBarRatio;
+ PlaceFreeSpaceInfo m_freeSpaceInfo;
};
#endif