Review Request 117603: Do not change the selection when re-sorting the view

Frank Reininghaus frank78ac at googlemail.com
Sat Apr 26 11:41:36 BST 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/117603/
-----------------------------------------------------------

(Updated April 26, 2014, 10:41 a.m.)


Status
------

This change has been marked as submitted.


Review request for Dolphin.


Bugs: 333457
    http://bugs.kde.org/show_bug.cgi?id=333457


Repository: kde-baseapps


Description
-------

The user can select a range of items in the view by holding the Shift key and then pressing the arrow keys, or by shift-clicking an item. In that case, we keep track not only of the "current item", which is underlined in the view, but also the "anchor item", which is the item where the selection was started. The entire range between those two items is selected then.

If the order of the items changes, e.g., because the user switches from "Sort by Name" to "Sort by Date", then both the current and the "anchor" index are updated. However, the items between those two are not necessarily the items that were between them before the re-sorting, i.e., the selected items might change, which is unexpected, of course.

This can be fixed by finishing the "anchored selection" if the items are resorted.

A new anchored selection is then started, where the current item is the new anchor item. Without this detail, re-sorting and then pressing Shift+Arrow would not select any items. This is also why I added the new unit test, which verifies that this still works.


Diffs
-----

  dolphin/src/kitemviews/kitemlistselectionmanager.cpp ebff1a3 
  dolphin/src/tests/kitemlistselectionmanagertest.cpp af2610d 

Diff: https://git.reviewboard.kde.org/r/117603/diff/


Testing
-------

Fixes the bug for me. Old and new unit tests pass.


Thanks,

Frank Reininghaus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20140426/76409a5d/attachment.htm>


More information about the kfm-devel mailing list