The problem is that KFileItemModel::setData() only re-sorts the model if the "sort role" is changed. However, in some cases, also the name matters.
Steps to Reproduce:
1. mkdir test && cd test && touch a b c && dolphin .
2. Sort by size -> the order of the items is "a b c" because the name is used as a fallback (all files have zero size).
3. Rename "a" -> "d".
Note that the items are not resorted: "d b c"
The items should be resorted: "b c d"
Git commit 6b375d2e26312ff032da072d93e92a8e080a1361 by Frank Reininghaus.
Committed on 14/08/2013 at 22:07.
Pushed by freininghaus into branch 'KDE/4.11'.
Make sure that the sort order is correct after renaming
KFileItemModel::setData() should not only cause a resorting when the
sort role is changed. The name is always used as a fallback if the sort
role of multiple files is equal, therefore, renaming a file can change
the correct order of the files even if the files are not sorted by
Unit test included.
M +24 -2 dolphin/src/kitemviews/kfileitemmodel.cpp
M +25 -0 dolphin/src/tests/kfileitemmodeltest.cpp