[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Review Request 113293: Restore the tree state in Details View if a top-level folder is collapsed and
From: "Frank Reininghaus" <frank78ac () googlemail ! com>
Date: 2013-10-16 20:58:08
Message-ID: 20131016205808.26807.68029 () vidsolbach ! de
[Download RAW message or body]
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/113293/
-----------------------------------------------------------
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 affected 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
[Attachment #3 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://git.reviewboard.kde.org/r/113293/">http://git.reviewboard.kde.org/r/113293/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;"> <tr>
<td>
<div>Review request for Dolphin.</div>
<div>By Frank Reininghaus.</div>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="http://bugs.kde.org/show_bug.cgi?id=304363">304363</a>
</div>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
kde-baseapps
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">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 affected \
functions.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">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.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>dolphin/src/kitemviews/kfileitemmodel.cpp <span style="color: \
grey">(ea7ac2f)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/113293/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic