]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix small problem when building categories and sorting by name. Better readable code.
authorRafael Fernández López <ereslibre@kde.org>
Mon, 18 Jun 2007 12:44:00 +0000 (12:44 +0000)
committerRafael Fernández López <ereslibre@kde.org>
Mon, 18 Jun 2007 12:44:00 +0000 (12:44 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=677087

src/dolphinsortfilterproxymodel.cpp

index 598705d137f4c6d5a1b6dc341e1db06174823bb2..891626c361f00c6b0a3e88c04314dd603523b26f 100644 (file)
@@ -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;