┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views
diff options
context:
space:
mode:
authorMéven Car <[email protected]>2020-04-14 07:11:59 +0200
committerMéven Car <[email protected]>2020-04-14 07:42:39 +0200
commitac234a9c55aed509b385ef03835a6d0f563e6a22 (patch)
tree81ce7a29b9588475f4eee76063076c1c5ac94a35 /src/views
parentfa3f3a475dd5e522acd40b7a31ec3aeb87400c69 (diff)
Allow to display UDS_RECURSIVE_SIZE in status bar
Summary: Useful for trash:/ in particular Test Plan: {F8233980} Reviewers: #dolphin, dfaure, elvisangelaccio, ngraham Reviewed By: #dolphin, ngraham Subscribers: kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D28794
Diffstat (limited to 'src/views')
-rw-r--r--src/views/dolphinview.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index d8f2aab93..69309fcad 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -1493,13 +1493,27 @@ void DolphinView::calculateItemCount(int& fileCount,
KIO::filesize_t& totalFileSize) const
{
const int itemCount = m_model->count();
+
+ bool countFileSize = true;
+
+ // In case we have a precomputed value
+ const auto job = KIO::stat(m_model->rootItem().url());
+ job->exec();
+ const auto entry = job->statResult();
+ if (entry.contains(KIO::UDSEntry::UDS_RECURSIVE_SIZE)) {
+ totalFileSize = static_cast<KIO::filesize_t>(entry.numberValue(KIO::UDSEntry::UDS_RECURSIVE_SIZE));
+ countFileSize = false;
+ }
+
for (int i = 0; i < itemCount; ++i) {
const KFileItem item = m_model->fileItem(i);
if (item.isDir()) {
++folderCount;
} else {
++fileCount;
- totalFileSize += item.size();
+ if (countFileSize) {
+ totalFileSize += item.size();
+ }
}
}
}