In Details view, when moving a file into an empty directory OR when moving a file from a subdirectory to the current folder and back again, the file doesn't appear under the subfolder.
Steps to Reproduce:
1. Create a folder with some files and two subfolders: one with some files and one empty, switch to the Details view.
2. Move a file into the empty folder.
3. As you can see, no expansion icon has appeared, clicking on the left of the folder has no effect and the Size column still shows "0 items". The moved file is shown only after Reload'ing the view.
4. Expand the subfolder which contains files (more than 1) and move one of the files into the current folder. Note that the expansion icon has changed from "−" ("v") to "+" (">").
5. Now move any file to the subfolder from which we have moved a file in previous step. The file looks to have just disappeared: it doesn't appear under the subfolder though it is expanded and the item counter has not changed.
6. Click the "+" icon on the left of the expanded subfolder. Note that the item counter has changed but no file appeared under the subfolder.
7. After collapsing the subfolder and expanding it again its contents are now shown properly.
On the item counter: if one moves a file into an expanded directory with a "−" sign on the left, the file does appear under the folder but the counter (the Size column) is not updated.
Resetting assignee to default as per bug #305719
I can't reproduce this bug in Dolphin 2.2 / KDE 4.10.1
I can't reproduce steps 1–3 with the latest version, but steps 4–7 are still reproducible.
Created attachment 79627 [details]
The problem is that KFileItemModel::slotRefreshItems() resets the data using retrieveData(), which sets "isExpanded" to false.
My proposed patch fixes this by not setting this role explicitly in retrieveData() and simply assuming that its value is false if it does not exist.
I'll work on a unit test before committing this though. It would be a shame to see this subtle bug reappear at some point.
Git commit a79c3a391c278f58cd5ec69e56cfb3b6dec9ea17 by Frank Reininghaus.
Committed on 22/05/2013 at 18:14.
Pushed by freininghaus into branch 'KDE/4.10'.
Do not reset the 'isExpanded' state when an expanded folder is refreshed
If an item is moved out of an expanded folder, the model receives the
dir lister's refreshItems signal for the folder. The method
retrieveData() then updates the folder's properties. This commit makes
sure that the 'isExpanded' state is not touched by retrieveData(). A
side-effect is that the 'isExpanded' role is not initialized to 'false',
but this does not matter because trying to read a non-existing role from
the QHash<QByteArray, QVariant> yields a default-constructed QVariant,
which evaluates to 'false'.
M +0 -4 dolphin/src/kitemviews/kfileitemmodel.cpp
M +34 -0 dolphin/src/tests/kfileitemmodeltest.cpp