]> cloud.milkyroute.net Git - dolphin.git/commit
natural sort: exclude extension when comparing filenames
authorEren Karakas <erenkarakas202@hotmail.com>
Tue, 19 Nov 2024 09:08:45 +0000 (09:08 +0000)
committerMéven Car <meven@kde.org>
Tue, 19 Nov 2024 09:08:45 +0000 (09:08 +0000)
commite4cc6e69430049366434e3383b1d2ef283ed22cc
treebd7e42cc1413a368545027ba23bbb2ed355e5bd0
parente893ceebb5a7295268ecf0ae2be5fb3fe07dfdbd
natural sort: exclude extension when comparing filenames

Currently natural sort compares the entire filenames
(basename.extension) when sorting. This causes eg.
"a 2.txt" to appear before "a.txt" when sorted by ascending.
This is unintuitive since people prioritize basenames more
than file extensions.

Instead, change natural sort to compare by basename only and
fallback to comparing extensions if basenames were equal.
This change causes "a.txt" to appear before "a 2.txt" and
matches how other platforms such as GNOME and Windows behave.

BUG: 416025
BUG: 470538
BUG: 421869
BUG: 312027
src/kitemviews/kfileitemmodel.cpp
src/kitemviews/kfileitemmodel.h
src/tests/kfileitemmodeltest.cpp