[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Review Request 111004: When switching to "Sort by Type", really do sort by type
From:       "Frank Reininghaus" <frank78ac () googlemail ! com>
Date:       2013-06-13 20:22:15
Message-ID: 20130613202215.10439.17807 () vidsolbach ! de
[Download RAW message or body]

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

Review request for Dolphin.


Description
-------

Emmanuel looked into this issue already in https://git.reviewboard.kde.org/r/109471/, \
but with this patch, the issue was for some reason not fixed on my system.

But I think I have found the root cause of the bug now. When switching to "Sort by \
Type", KFileItemModel::onSortRoleChanged() resorts the items, but it doesn't work \
because the "type" role isn't known yet. It only gets added later to the model when \
KFileItemListView::slotSortRoleChanged() calls applyRolesToModel(), which calls

KFileItemModel::setRoles(const QSet<QByteArray>& roles)

This function does set the "type" role (via retrieveData() - note that \
item.isMimeTypeKnown() is true because KFileItemModelRolesUpdater has determined the \
mime type in the mean time), but it does not trigger a resorting.

Fixed by adding the new role in KFileItemModel::onSortRoleChanged(), *before* the \
resorting is triggered.


This addresses bugs 310705 and 312014.
    http://bugs.kde.org/show_bug.cgi?id=310705
    http://bugs.kde.org/show_bug.cgi?id=312014


Diffs
-----

  dolphin/src/tests/kfileitemmodeltest.cpp e636bcd 
  dolphin/src/kitemviews/kfileitemmodel.cpp c78fdc3 

Diff: http://git.reviewboard.kde.org/r/111004/diff/


Testing
-------

Works for me, old unit tests pass (I had to modify one of them slightly though), \
added a new test.


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/111004/">http://git.reviewboard.kde.org/r/111004/</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>







<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;">Emmanuel looked into this issue already in \
https://git.reviewboard.kde.org/r/109471/, but with this patch, the issue was for \
some reason not fixed on my system.

But I think I have found the root cause of the bug now. When switching to &quot;Sort \
by Type&quot;, KFileItemModel::onSortRoleChanged() resorts the items, but it \
doesn&#39;t work because the &quot;type&quot; role isn&#39;t known yet. It only gets \
added later to the model when KFileItemListView::slotSortRoleChanged() calls \
applyRolesToModel(), which calls

KFileItemModel::setRoles(const QSet&lt;QByteArray&gt;&amp; roles)

This function does set the &quot;type&quot; role (via retrieveData() - note that \
item.isMimeTypeKnown() is true because KFileItemModelRolesUpdater has determined the \
mime type in the mean time), but it does not trigger a resorting.

Fixed by adding the new role in KFileItemModel::onSortRoleChanged(), *before* the \
resorting is triggered.</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;">Works for me, old unit tests pass (I had to modify one of them slightly \
though), added a new test.</pre>  </td>
 </tr>
</table>



<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=310705">310705</a>, 

 <a href="http://bugs.kde.org/show_bug.cgi?id=312014">312014</a>


</div>


<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/tests/kfileitemmodeltest.cpp <span style="color: \
grey">(e636bcd)</span></li>

 <li>dolphin/src/kitemviews/kfileitemmodel.cpp <span style="color: \
grey">(c78fdc3)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/111004/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