Review Request 114266: Update the "roles" for items that become visible again after filtering

Frank Reininghaus frank78ac at googlemail.com
Sat Dec 14 10:54:17 GMT 2013


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

(Updated Dec. 14, 2013, 10:54 a.m.)


Status
------

This change has been marked as submitted.


Review request for Dolphin.


Repository: kde-baseapps


Description
-------

Since Dolphin 4.11, we store not only KFileItems, but also the corresponding ItemData struct for filtered items. This is required for keeping track of the parent-child relationships, and has the nice side effect that the ItemData need not be re-determined when the items are shown again.

However, this can become a problem if the visible roles or the sort role change while some items are filtered:


Problem A:

1. Open a folder in Details View.
2. Press Ctrl+I, add a filter that removes some items.
3. Enable the "Permissions" column.
4. Clear the filter.
5. Note that the previously filtered items have an empty "Permissions" field.


Problem B (more difficult to reproduce in the GUI, but easily unit-testable):

1. Open a large folder in Details View.
2. Enable the "Permissions" column ("User" and "Group" will also do, but it is important that there are files for which these fields differ).
3. Hide some items with the filter bar.
4. Switch to "Sort by Permissions/User/Group".
5. Clear the filter.
6. Note the incorrect sort order.


I think that there are no bug reports for these problems yet.

Problem A is fixed simply by clearing the QHash "values" for the filtered items if the visible roles change. The hash will be re-populated with all requested data as soon as the items are shown again and the data(int) method of the model is called.

Problem B requires a bit more work - before the items are inserted into the model after filtering, we have to make sure that the sort role "Permissions"/"User"/etc. is present in the hash "values". I think the easiest way to ensure that is to factor out the code that currently does this job for new items in createItemDataList() into a new function, and calling this in insertItems(), because the same treatment is required for the previously filtered files.


Diffs
-----

  dolphin/src/kitemviews/kfileitemmodel.h c57329f 
  dolphin/src/kitemviews/kfileitemmodel.cpp 4c85775 
  dolphin/src/tests/kfileitemmodeltest.cpp 62ff4fa 

Diff: http://git.reviewboard.kde.org/r/114266/diff/


Testing
-------

Fixes the problems for me. Old and new tests pass (and the new tests fail with current KDE/4.12 and master). I have not found any regressions yet.


Thanks,

Frank Reininghaus

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


More information about the kfm-devel mailing list