Commit 2d4155c7 authored by Rafael Fernández López's avatar Rafael Fernández López
Browse files

Fix small problem when building categories and sorting by name. Better readable code.

svn path=/trunk/KDE/kdebase/apps/; revision=677087
parent 552894c8
...@@ -122,12 +122,15 @@ bool DolphinSortFilterProxyModel::lessThanGeneralPurpose(const QModelIndex &left ...@@ -122,12 +122,15 @@ bool DolphinSortFilterProxyModel::lessThanGeneralPurpose(const QModelIndex &left
const KFileItem *rightFileItem = dirModel->itemForIndex(right); const KFileItem *rightFileItem = dirModel->itemForIndex(right);
if (sortRole() == DolphinView::SortByName) { // If we are sorting by name if (sortRole() == DolphinView::SortByName) { // If we are sorting by name
const QVariant leftData = dirModel->data(left, sortRole()); const QVariant leftData = dirModel->data(left, KDirModel::Name);
const QVariant rightData = dirModel->data(right, sortRole()); const QVariant rightData = dirModel->data(right, KDirModel::Name);
QString leftStr = leftData.toString(); QString leftStr = leftData.toString();
QString rightStr = rightData.toString(); QString rightStr = rightData.toString();
leftStr = leftStr.at(0) == '.' ? leftStr.mid(1) : leftStr;
rightStr = rightStr.at(0) == '.' ? rightStr.mid(1) : rightStr;
// We don't care about case for building categories. We also don't // We don't care about case for building categories. We also don't
// want here to compare by a natural comparation // want here to compare by a natural comparation
return QString::compare(leftStr, rightStr, Qt::CaseInsensitive) < 0; return QString::compare(leftStr, rightStr, Qt::CaseInsensitive) < 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