Before this patch when !m_sortDirsFirst and DetailsModeSettings::directorySizeCount() == true, the ordering of folders before files would be affected by the sortOrder. I.e descending order would put the folders after the files.
+ if (m_sortDirsFirst || (DetailsModeSettings::directorySizeCount() && m_sortRole == SizeRole)) {
const bool isDirA = a->item.isDir();
const bool isDirB = b->item.isDir();
if (isDirA && !isDirB) {
const bool isDirA = a->item.isDir();
const bool isDirB = b->item.isDir();
if (isDirA && !isDirB) {
- if (DetailsModeSettings::directorySizeCount() && (itemA.isDir() || itemB.isDir())) {
+ if (DetailsModeSettings::directorySizeCount() && itemA.isDir()) {
- if (itemA.isDir() && itemB.isDir()) {
- auto valueA = a->values.value("count");
- auto valueB = b->values.value("count");
- if (valueA.isNull()) {
- if (valueB.isNull()) {
- return 0;
- } else {
- return -1;
- }
- } else if (valueB.isNull()) {
- return +1;
+ // items A and B are folders thanks to lessThan checks
+ auto valueA = a->values.value("count");
+ auto valueB = b->values.value("count");
+ if (valueA.isNull()) {
+ if (valueB.isNull()) {
+ return 0;
- if (valueA.toLongLong() < valueB.toLongLong()) {
- return -1;
- } else {
- return +1;
- }
- } else if (itemA.isDir()) {
- return 1;
+ } else if (valueB.isNull()) {
+ return +1;
+ if (valueA.toLongLong() < valueB.toLongLong()) {
+ return -1;
+ } else {
+ return +1;
+ }
}
}
KIO::filesize_t sizeA = 0;
}
}
KIO::filesize_t sizeA = 0;