From: Peter Penz Date: Wed, 14 Dec 2011 23:22:48 +0000 (+0100) Subject: Fix descending sort order issue X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/065244fac9c581379d62a7ca12c4e9ce4a39af9b Fix descending sort order issue If the sort order is descending and directories and files are shown on the same hierarchy level, the sorting was partly wrong. --- diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 04e3c8ca7..e3b61d475 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -1484,9 +1484,9 @@ int KFileItemModel::expansionLevelsCompare(const ItemData* a, const ItemData* b) const QString subPathB = subPath(b->item, pathB, index, &isDirB); if (isDirA && !isDirB) { - return -1; + return (sortOrder() == Qt::AscendingOrder) ? -1 : +1; } else if (!isDirA && isDirB) { - return +1; + return (sortOrder() == Qt::AscendingOrder) ? +1 : -1; } // Compare the items of the parents that represent the first