Created attachment 141451 [details]
Parent folder "a" is not displayed, despite being expanded and its child folders "b" and "b2" being displayed.
While filtering on expanded details view mode, if we create a folder that satisfies the filter as a child of an expanded folder, Dolphin will mess up the file listing, making the parent folder disappear and the childs appear in a buggy state without their parent being display (see screenshot).
This is a very specific bug, very difficult to explain and difficult to trigger in normal use, but it exists and I have successfully devised a simple recipe to reproduce it consistently. It is really difficult to explain in words, its better to just do the steps below and you will see the bug for yourself.
STEPS TO REPRODUCE
1. Create an empty folder anywhere, named "test" (or whatever name you desire). Open it on Dolphin.
2. Make sure you are on Details View mode with expandable folders.
3. Create a folder named "a" inside "test".
4. Right click "a", Create New -> Folder, and name it "b".
5. Expand folder "a", you should see the tree: "a" as parent and "b" as child.
6. Filter for the string "b". It should not change the view at all, since folder "b" passes the filter and "a" is shown because it is its parent.
7. Now, with the filter activated, right click "a" and create another folder named "b2" (a sibling of "b").
8. The bug is now triggered: after 1 second, folder "a" will disappear, and you will only see folders "b" and "b2", weirdly linked to no parent (screenshot).
Folders "b" and "b2" are displayed linked to an invisible parent.
Folder "a" should remain on display, with folders "b" and "b2" as its children passing the filter.
Operating System: Arch Linux
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
Kernel Version: 5.14.2-arch1-2 (64-bit)
Graphics Platform: Wayland
I discovered this bug while testing my solution for bug #411878. I thought I had introduced the bug, bug then I found out it was already there before my changes.
I mentioned this in this MR, although it doesn't solve it:
I intend to investigate this bug, assigning to myself.
Git commit ed83f37f06bd5c4b38c100503c3ad4dec2a87912 by Méven Car, on behalf of Eduardo Cruz.
Committed on 04/10/2021 at 07:13.
Pushed by meven into branch 'master'.
Rewrite filter algorithm to properly support filtering with expanded folders under Detail View mode.
Related: bug 411878
M +63 -21 src/kitemviews/kfileitemmodel.cpp
M +26 -12 src/tests/kfileitemmodeltest.cpp
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/283
Git commit 3d49996615a094df8fc2cb613955abb740a0463a by Felix Ernst, on behalf of Eduardo Cruz.
Committed on 28/11/2021 at 13:24.
Pushed by felixernst into branch 'master'.
Properly display parent folders when filtering is active and items are added or refreshed
The methods slotRefreshItems(), slotItemsAdded() and slotItemsDeleted()
are adapted so they are now compatible with the new behavior of
filtering expanded folders achieved in
ed83f37f06bd5c4b38c100503c3ad4dec2a87912. The new behavior is that
expanded folders are hidden from view if neither the folder itself
nor any of its contents passes the filter. Previously expanded folders
would always stay visible no matter the filter.
A bug where the parent expanded folder would disappear after adding
or refreshing an item while filtering is also fixed.
Tests are added to make sure these behavior changes won't regress.
M +145 -17 src/kitemviews/kfileitemmodel.cpp
M +11 -1 src/kitemviews/kfileitemmodel.h
M +218 -2 src/tests/kfileitemmodeltest.cpp