Review Request 113293: Restore the tree state in Details View if a top-level folder is collapsed and then expanded again

Emmanuel Pescosta emmanuelpescosta099 at gmail.com
Fri Oct 25 13:07:26 BST 2013


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

Ship it!


Code looks good!

I can't test your patch because of the lack of time, but I'm sure it works as expected ;)

- Emmanuel Pescosta


On Oct. 16, 2013, 10:58 p.m., Frank Reininghaus wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/113293/
> -----------------------------------------------------------
> 
> (Updated Oct. 16, 2013, 10:58 p.m.)
> 
> 
> Review request for Dolphin.
> 
> 
> Bugs: 304363
>     http://bugs.kde.org/show_bug.cgi?id=304363
> 
> 
> Repository: kde-baseapps
> 
> 
> Description
> -------
> 
> This patch actually does two things when collapsing an expanded folder with expanded children:
> 
> (a) It removes all expanded children (which are removed from the model) from m_expandedDirs. This fixes some very subtle issues (to reproduce, e.g., expand a/ and a/a/, collapse and re-expand a/, note that a/a/ is not expanded, go to another folder and then go back, and see that a/a/ is now expanded, i.e., that the view state is actually not restored correctly).
> 
> (b) It remembers the expanded children and restores them if the top-level folder is re-expanded.
> 
> Storing the information in the "values" hash is sort of a hack, because this is information that is, unlike the other data stored in this hash, not supposed to be shown in the view. However, I still think that this approach is probably cleaner than all alternatives because it requires changes only in one function. If we stored this information in a new member in KFileItemModel (like a QHash<KUrl, QSet<KUrl> >, where the key is the previously expanded folder, and the value the set of expanded children), we would have to update this member whenever the parent folder is removed from the model (because it is deleted, its own parent gets collapsed, the model is cleared, etc.), so we would need new code in many different places, and remember to update it whenever there is a change in the affec
 ted functions.
> 
> 
> Diffs
> -----
> 
>   dolphin/src/kitemviews/kfileitemmodel.cpp ea7ac2f 
> 
> Diff: http://git.reviewboard.kde.org/r/113293/diff/
> 
> 
> Testing
> -------
> 
> If I expand a top-level folder and then some of its children, then collapse the top-level folder and re-expand it, the previous state is restored correctly.
> 
> 
> Thanks,
> 
> Frank Reininghaus
> 
>

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


More information about the kfm-devel mailing list