┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dolphinitemcategorizer.cpp19
-rw-r--r--src/dolphinsortfilterproxymodel.cpp2
2 files changed, 19 insertions, 2 deletions
diff --git a/src/dolphinitemcategorizer.cpp b/src/dolphinitemcategorizer.cpp
index 8d9405dda..88e6733c9 100644
--- a/src/dolphinitemcategorizer.cpp
+++ b/src/dolphinitemcategorizer.cpp
@@ -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;
diff --git a/src/dolphinsortfilterproxymodel.cpp b/src/dolphinsortfilterproxymodel.cpp
index 17880e5a8..aec5cd86e 100644
--- a/src/dolphinsortfilterproxymodel.cpp
+++ b/src/dolphinsortfilterproxymodel.cpp
@@ -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