Bug 299675 - Newly moved files are not displayed under their respective folders in Dolphin's details view under certain conditions
Summary: Newly moved files are not displayed under their respective folders in Dolphin...
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: view-engine: details mode (show other bugs)
Version: 2.0.95
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords: investigated, reproducible
Depends on:
Blocks:
 
Reported: 2012-05-09 08:05 UTC by Alexander Kandaurov
Modified: 2013-05-22 16:19 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.10.4


Attachments
Patch (1.03 KB, patch)
2013-05-02 15:01 UTC, Frank Reininghaus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Kandaurov 2012-05-09 08:05:57 UTC
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.

Reproducible: Always

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.
Comment 1 Jeroen van Meeuwen (Kolab Systems) 2012-08-24 16:21:37 UTC
Resetting assignee to default as per bug #305719
Comment 2 Emmanuel Pescosta 2013-03-13 22:08:41 UTC
I can't reproduce this bug in Dolphin 2.2 / KDE 4.10.1
Comment 3 Alexander Kandaurov 2013-03-20 05:07:44 UTC
I can't reproduce steps 1–3 with the latest version, but steps 4–7 are still reproducible.
Comment 4 Frank Reininghaus 2013-05-02 15:01:47 UTC
Created attachment 79627 [details]
Patch

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.
Comment 5 Frank Reininghaus 2013-05-02 15:02:46 UTC
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.
Comment 6 Frank Reininghaus 2013-05-22 16:19:14 UTC
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'.
FIXED-IN: 4.10.4
REVIEW: 110401

M  +0    -4    dolphin/src/kitemviews/kfileitemmodel.cpp
M  +34   -0    dolphin/src/tests/kfileitemmodeltest.cpp

http://commits.kde.org/kde-baseapps/a79c3a391c278f58cd5ec69e56cfb3b6dec9ea17