Bug 323518 - 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
Summary: When sorting files by "Size", the name is used as a fallback for sorting file...
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: view-engine: general (show other bugs)
Version: 4.11.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-14 22:05 UTC by Frank Reininghaus
Modified: 2013-08-14 22:10 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 4.11.1
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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