]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Allow to display UDS_RECURSIVE_SIZE in status bar
authorMéven Car <meven29@gmail.com>
Tue, 14 Apr 2020 05:11:59 +0000 (07:11 +0200)
committerMéven Car <meven29@gmail.com>
Tue, 14 Apr 2020 05:42:39 +0000 (07:42 +0200)
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

CMakeLists.txt
src/views/dolphinview.cpp

index 0eb61277eacb3d638e7d90cb03a1151335251dac..3a30b69836ecea5199bc78e9ab62332ad807bf90 100644 (file)
@@ -8,7 +8,7 @@ set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE
 project(Dolphin VERSION ${RELEASE_SERVICE_VERSION})
 
 set(QT_MIN_VERSION "5.11.0")
 project(Dolphin VERSION ${RELEASE_SERVICE_VERSION})
 
 set(QT_MIN_VERSION "5.11.0")
-set(KF5_MIN_VERSION "5.69.0")
+set(KF5_MIN_VERSION "5.70.0")
 
 # ECM setup
 find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
 
 # ECM setup
 find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
index d8f2aab937bc84f33f8e93a95fb5e1ffee80b892..69309fcadea45737082581872a21e9825bd51925 100644 (file)
@@ -1493,13 +1493,27 @@ void DolphinView::calculateItemCount(int& fileCount,
                                      KIO::filesize_t& totalFileSize) const
 {
     const int itemCount = m_model->count();
                                      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;
     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();
+            }
         }
     }
 }
         }
     }
 }