]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kfileitemmodel.h
Merge remote-tracking branch 'fork/work/zakharafoniam/useful-groups'
[dolphin.git] / src / kitemviews / kfileitemmodel.h
index 980efe66b26c1108a06996c36683d4d75ed83a50..13554d8c7fa1999dc62e8fd355c71967096ca9e5 100644 (file)
@@ -380,7 +380,7 @@ private:
         QHash<QByteArray, QVariant> values;
         ItemData *parent;
     };
-
+    
     struct ItemGroupInfo {
         int comparable;
         QString text;
@@ -639,7 +639,9 @@ inline bool KFileItemModel::isRoleValueNatural(RoleType roleType)
 
 inline bool KFileItemModel::nameLessThan(const ItemData *a, const ItemData *b)
 {
-    return a->item.text() < b->item.text();
+    // Split extension, taking into account it can be empty
+    constexpr QString::SectionFlags flags = QString::SectionSkipEmpty | QString::SectionIncludeLeadingSep;
+    return a->item.text().section('.', 0, 0, flags) < b->item.text().section('.', 0, 0, flags);
 }
 
 inline bool KFileItemModel::isChildItem(int index) const