Commit 84403b63 authored by Rafael Fernández López's avatar Rafael Fernández López
Browse files

If we are sorting by rating, we won't apply the general rule: folders before...

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
parent 09f8902c
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment