From: Rafael Fernández López Date: Fri, 22 Jun 2007 13:58:21 +0000 (+0000) Subject: If we are sorting by rating, we won't apply the general rule: folders before regular... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/b22d9b7b9c72749ec245ff55d8d90989428067fc If we are sorting by rating, we won't apply the general rule: folders before regular files. The user said that was more interesting for him/her, so we respect his/her decision. In this case folders and files are citizens of the same class. CCMAIL: peter.penz@gmx.at svn path=/trunk/KDE/kdebase/apps/; revision=678894 --- diff --git a/src/dolphinsortfilterproxymodel.cpp b/src/dolphinsortfilterproxymodel.cpp index 21194f66e..648b6133b 100644 --- a/src/dolphinsortfilterproxymodel.cpp +++ b/src/dolphinsortfilterproxymodel.cpp @@ -188,11 +188,16 @@ bool DolphinSortFilterProxyModel::lessThan(const QModelIndex& left, const KFileItem* leftFileItem = dirModel->itemForIndex(left); const KFileItem* rightFileItem = dirModel->itemForIndex(right); - // On our priority, folders go above regular files. - if (leftFileItem->isDir() && !rightFileItem->isDir()) { - return true; - } else if (!leftFileItem->isDir() && rightFileItem->isDir()) { - return false; + // If we are sorting by rating, folders and files are citizens of the same + // class + if (sortRole() != DolphinView::SortByRating) + { + // On our priority, folders go above regular files. + if (leftFileItem->isDir() && !rightFileItem->isDir()) { + return true; + } else if (!leftFileItem->isDir() && rightFileItem->isDir()) { + return false; + } } // Hidden elements go before visible ones, if they both are @@ -312,6 +317,13 @@ bool DolphinSortFilterProxyModel::lessThan(const QModelIndex& left, const quint32 rightRating = ratingForIndex(right); if (leftRating == rightRating) { + // On our priority, folders go above regular files. + if (leftFileItem->isDir() && !rightFileItem->isDir()) { + return true; + } else if (!leftFileItem->isDir() && rightFileItem->isDir()) { + return false; + } + return sortCaseSensitivity() ? (naturalCompare(leftFileItem->name(), rightFileItem->name()) < 0) : (naturalCompare(leftFileItem->name().toLower(), rightFileItem->name().toLower()) < 0);