From 065244fac9c581379d62a7ca12c4e9ce4a39af9b Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Thu, 15 Dec 2011 00:22:48 +0100 Subject: [PATCH] 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. --- src/kitemviews/kfileitemmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 2.47.3