Bug 328791 - Filtered items are not updated if additional columns in Details View are enabled, or the "sort role" changes
Summary: Filtered items are not updated if additional columns in Details View are enab...
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: view-engine: general (show other bugs)
Version: 4.11.97
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-14 10:50 UTC by Frank Reininghaus
Modified: 2013-12-14 10:54 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 4.12.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-12-14 10:50:45 UTC
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.

There is a patch at https://git.reviewboard.kde.org/r/114266/.

Reproducible: Always

Steps to Reproduce:
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.

There is a patch at https://git.reviewboard.kde.org/r/114266/.
Comment 1 Frank Reininghaus 2013-12-14 10:54:13 UTC
Git commit 2260d70e21ad8ff49dc62bc096c7e5bbce9f0efe by Frank Reininghaus.
Committed on 14/12/2013 at 10:51.
Pushed by freininghaus into branch 'KDE/4.12'.

Update the roles for filtered items if necessary

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.

This is fixed by is fixed 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.

Moreover, 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". This is achieved by factoring 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.
FIXED-IN: 4.12.1
REVIEW: 114266

M  +24   -7    dolphin/src/kitemviews/kfileitemmodel.cpp
M  +7    -0    dolphin/src/kitemviews/kfileitemmodel.h
M  +99   -0    dolphin/src/tests/kfileitemmodeltest.cpp

http://commits.kde.org/kde-baseapps/2260d70e21ad8ff49dc62bc096c7e5bbce9f0efe