diff options
| author | Nico Kreipke <[email protected]> | 2024-03-02 17:44:41 +0100 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2024-03-07 15:11:34 +0000 |
| commit | 815bb8d514d70d79ef5f3fd7fffa95850f761d55 (patch) | |
| tree | 0fb58af1cf4960d7f23b0219b46daa9763c0581e /src/kitemviews/kfileitemmodel.cpp | |
| parent | 67910325b5768143a9e35e8e5cd75af705dcbd4c (diff) | |
Add option to completely disable directory size counting
Dolphin shows the size of directories by listing their contents, which
for some users might cause unwanted load on the file system.
Depending on the size of the subdirectories in question and how the
storage is accessed, this might cause noticeable delays and even
freezing.
This commit adds a new option under "View -> Content Display" that
enables users to set "Folder size:" to "No size", completely disabling
directory size counting. Directory size counting is still enabled by
default.
As a third option for "Folder size" is added, the DirectorySizeCount
boolean setting is replaced with a DirectorySizeMode enum setting. The
old setting is migrated using a kconf_update script.
FEATURE: 477187
GUI:
Diffstat (limited to 'src/kitemviews/kfileitemmodel.cpp')
| -rw-r--r-- | src/kitemviews/kfileitemmodel.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 99a3d163f..9ef66d6b8 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -2019,7 +2019,8 @@ bool KFileItemModel::lessThan(const ItemData *a, const ItemData *b, const QColla } } - if (m_sortDirsFirst || (ContentDisplaySettings::directorySizeCount() && m_sortRole == SizeRole)) { + if (m_sortDirsFirst + || (ContentDisplaySettings::directorySizeMode() == ContentDisplaySettings::EnumDirectorySizeMode::ContentCount && m_sortRole == SizeRole)) { const bool isDirA = a->item.isDir(); const bool isDirB = b->item.isDir(); if (isDirA && !isDirB) { @@ -2071,7 +2072,7 @@ int KFileItemModel::sortRoleCompare(const ItemData *a, const ItemData *b, const break; case SizeRole: { - if (ContentDisplaySettings::directorySizeCount() && itemA.isDir()) { + if (ContentDisplaySettings::directorySizeMode() == ContentDisplaySettings::EnumDirectorySizeMode::ContentCount && itemA.isDir()) { // folders first then // items A and B are folders thanks to lessThan checks auto valueA = a->values.value("count"); @@ -2331,7 +2332,7 @@ QList<QPair<int, QVariant>> KFileItemModel::sizeRoleGroups() const KIO::filesize_t fileSize = !item.isNull() ? item.size() : ~0U; QString newGroupValue; if (!item.isNull() && item.isDir()) { - if (ContentDisplaySettings::directorySizeCount() || m_sortDirsFirst) { + if (ContentDisplaySettings::directorySizeMode() == ContentDisplaySettings::EnumDirectorySizeMode::ContentCount || m_sortDirsFirst) { newGroupValue = i18nc("@title:group Size", "Folders"); } else { fileSize = m_itemData.at(i)->values.value("size").toULongLong(); |
