Bug 323518

Summary: When sorting files by "Size", the name is used as a fallback for sorting files with equal size, but renaming files does not cause a resorting
Product: [Applications] dolphin Reporter: Frank Reininghaus <frank78ac>
Component: view-engine: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 4.11.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 4.11.1

Description Frank Reininghaus 2013-08-14 22:05:44 UTC
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.

Reproducible: Always

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".


Actual Results:  
Note that the items are not resorted: "d b c"

Expected Results:  
The items should be resorted: "b c d"
Comment 1 Frank Reininghaus 2013-08-14 22:10:29 UTC
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
"name".

Unit test included.
FIXED-IN: 4.11.1
REVIEW: 111721

M  +24   -2    dolphin/src/kitemviews/kfileitemmodel.cpp
M  +25   -0    dolphin/src/tests/kfileitemmodeltest.cpp

http://commits.kde.org/kde-baseapps/6b375d2e26312ff032da072d93e92a8e080a1361