Bug 287829 - inline rename multiple files does not honour sort order
Summary: inline rename multiple files does not honour sort order
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 2.1
Platform: OpenSUSE Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Dolphin Bug Assignee
Keywords: reproducible
Depends on:
Reported: 2011-11-29 11:53 UTC by Sebastian Frei
Modified: 2012-12-17 13:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.5


Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Frei 2011-11-29 11:53:51 UTC
Version:           unspecified (using KDE 4.7.3) 
OS:                Linux

When renaming multiple files with dolphin and the sort order is set to "sort by date", the generated numbers are increasing the wrong way. The numbers increase sorted by (previous) file name.

Reproducible: Always

Steps to Reproduce:
1. put some files into a directory with different name and date
2. select sort by date
3. select all files
4. hit F2 (or select rename)
5. enter a new name including ###

Actual Results:  
the numbers in the new filenames are not increasing by date, they are increasing alphabetically sorted by the previous file name

Expected Results:  
the numbers in the new filenames should increase by date
Comment 1 Peter Penz 2011-11-29 12:18:57 UTC
Thanks for the report, I agree.

(internal note: might be already resolved in Dolphin 2.0 due to working with indexes in the new view-engine -> check whether the issue is already resolved)
Comment 2 Jeroen van Meeuwen (Kolab Systems) 2012-08-24 16:20:04 UTC
Resetting assignee to default as per bug #305719
Comment 3 Adrián Chaves (Gallaecio) 2012-11-01 19:39:36 UTC
I can reproduce it with Dolphin 2.1 (KDE 4.9.2).

To create the files for the test, you can run:

    touch -d 2012-01-01 c; touch -d 2012-02-01 e; touch -d 2012-03-01 a; touch -d 2012-04-01 d; touch -d 2012-05-01 b
Comment 4 Frank Reininghaus 2012-11-29 22:44:16 UTC
Thanks Adrían for the nice test case ;-)

To fix this, we must do two things:

a) Remove the qSort() call in RenameDialog::renameItems().
b) Make sure that DolphinView::selectedItems() returns a list of items sorted by index. Right now, the order in this list is undefined because it is generated from a set of indices. I think that this should better be fixed inside the SelectionManager though (which could return a sorted list, rather than a set, from its selectedItems() method).
Comment 5 Emmanuel Pescosta 2012-12-14 13:47:28 UTC
Review-Request: https://git.reviewboard.kde.org/r/107718/
Comment 6 Emmanuel Pescosta 2012-12-17 13:33:40 UTC
Git commit 3a9b327196a5bfad9ac85dfac310e0e3ab7e573c by Emmanuel Pescosta.
Committed on 17/12/2012 at 14:02.
Pushed by emmanuelp into branch 'KDE/4.9'.

Fix Bug 287829 - inline rename multiple files does not honour
 sort order
FIXED-IN: 4.9.5
REVIEW: 107718

M  +4    -2    dolphin/src/views/dolphinview.cpp
M  +0    -5    dolphin/src/views/renamedialog.cpp