]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinitemcategorizer.cpp
Dolphin has to react as Konqueror on KDE3. If we find files containing symbols, we...
[dolphin.git] / src / dolphinitemcategorizer.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;