From ab8abd14a4dfbe46ab1d6fac094b14d6ba4416f6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafael=20Fern=C3=A1ndez=20L=C3=B3pez?= Date: Mon, 18 Jun 2007 12:44:00 +0000 Subject: [PATCH] Fix small problem when building categories and sorting by name. Better readable code. svn path=/trunk/KDE/kdebase/apps/; revision=677087 --- src/dolphinsortfilterproxymodel.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dolphinsortfilterproxymodel.cpp b/src/dolphinsortfilterproxymodel.cpp index 598705d13..891626c36 100644 --- a/src/dolphinsortfilterproxymodel.cpp +++ b/src/dolphinsortfilterproxymodel.cpp @@ -122,12 +122,15 @@ bool DolphinSortFilterProxyModel::lessThanGeneralPurpose(const QModelIndex &left const KFileItem *rightFileItem = dirModel->itemForIndex(right); if (sortRole() == DolphinView::SortByName) { // If we are sorting by name - const QVariant leftData = dirModel->data(left, sortRole()); - const QVariant rightData = dirModel->data(right, sortRole()); + const QVariant leftData = dirModel->data(left, KDirModel::Name); + const QVariant rightData = dirModel->data(right, KDirModel::Name); QString leftStr = leftData.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 // want here to compare by a natural comparation return QString::compare(leftStr, rightStr, Qt::CaseInsensitive) < 0; -- 2.47.3