mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-19 16:31:21 +00:00
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
This commit is contained in:
parent
1304e17f34
commit
b22d9b7b9c
|
@ -188,12 +188,17 @@ bool DolphinSortFilterProxyModel::lessThan(const QModelIndex& left,
|
|||
const KFileItem* leftFileItem = dirModel->itemForIndex(left);
|
||||
const KFileItem* rightFileItem = dirModel->itemForIndex(right);
|
||||
|
||||
// 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
|
||||
// folders or files.
|
||||
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue