]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Dolphin has to react as Konqueror on KDE3. If we find files containing symbols, we...
authorRafael Fernández López <ereslibre@kde.org>
Mon, 18 Jun 2007 17:58:25 +0000 (17:58 +0000)
committerRafael Fernández López <ereslibre@kde.org>
Mon, 18 Jun 2007 17:58:25 +0000 (17:58 +0000)
goes on category "Others".

svn path=/trunk/KDE/kdebase/apps/; revision=677225

src/dolphinitemcategorizer.cpp
src/dolphinsortfilterproxymodel.cpp

index 8d9405ddab773063211f6eea715c57c36f8fdade..88e6733c9eaa3dff0c7886753f5130e8ae4de959 100644 (file)
@@ -111,7 +111,24 @@ QString DolphinItemCategorizer::categoryForItem(const QModelIndex& index,
                 else if (item->isHidden())
                     retString = data.toString().toUpper().at(0);
                 else
-                    retString = i18n("Others");
+                {
+                    bool validCategory = false;
+
+                    const QChar* currA = data.toString().toUpper().unicode(); // iterator over a
+                    while (!currA->isNull() && !validCategory) {
+                        if (currA->isLetter())
+                            validCategory = true;
+                        else if (currA->isDigit())
+                            return i18n("Others");
+                        else
+                            ++currA;
+                    }
+
+                    if (!validCategory)
+                        retString = i18n("Others");
+                    else
+                        retString = *currA;
+                }
             }
             break;
 
index 17880e5a89a68f1c2cbf2741d2408fc715632b92..aec5cd86e2d7c62858a8ce59ccef486808835d6f 100644 (file)
@@ -133,7 +133,7 @@ bool DolphinSortFilterProxyModel::lessThanGeneralPurpose(const QModelIndex &left
 
         // We don't care about case for building categories. We also don't
         // want here to compare by a natural comparation
-        return QString::compare(leftFileName, rightFileName, Qt::CaseInsensitive) < 0;
+        return naturalCompare(leftFileName, rightFileName) < 0;
     }
     else if (sortRole() == DolphinView::SortBySize) { // If we are sorting by size
         // If we are sorting by size, show folders first. We will sort them