[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-frameworks-devel
Subject: Re: Review Request 128574: Enable natural sorting on QCollator in KDirSortFilterProxyModel
From: Mark Gaiser <markg85 () gmail ! com>
Date: 2017-04-27 23:29:37
Message-ID: 20170427232937.5759.44345 () mimi ! kde ! org
[Download RAW message or body]
--===============0066692421664005392==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
> On apr 27, 2017, 7:58 p.m., Elvis Angelaccio wrote:
> > src/filewidgets/kdirsortfilterproxymodel.cpp, lines 79-81
> > <https://git.reviewboard.kde.org/r/128574/diff/1/?file=472751#file472751line79>
> >
> > Please use `m_collator.setNumericMode(m_naturalSorting);` instead. It would also \
> > take care of disabling the natural sorting, if necessary.
What Elvis said. Just replace the if block with that line and it's imho good to go.
+1
- Mark
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128574/#review103143
-----------------------------------------------------------
On jan 8, 2017, 4:13 p.m., Mathis Beer wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/128574/
> -----------------------------------------------------------
>
> (Updated jan 8, 2017, 4:13 p.m.)
>
>
> Review request for KDE Frameworks, David Faure, Nick Shaforostoff, and Harald \
> Sitter.
>
> Bugs: 343452
> https://bugs.kde.org/show_bug.cgi?id=343452
>
>
> Repository: kio
>
>
> Description
> -------
>
> KDirSortFilterProxyModel is advertised in the header as performing a "natural \
> sort", ie. "7 8 9 10 11", instead of a lexical "10 11 7 8 9". However, as far as I \
> can tell this was never true from the start, since the collator responsible for the \
> actual sorting did not have the requisite numeric mode enabled, and this setting \
> has always been off by default as far back as I can find docs for it (Qt 5.2).
> (Dolphin, which offers "natural sort", did not run into this issue because it does \
> not actually use KDirSortFilterProxyModel.)
>
> Diffs
> -----
>
> src/filewidgets/kdirsortfilterproxymodel.cpp 89505ac
>
> Diff: https://git.reviewboard.kde.org/r/128574/diff/
>
>
> Testing
> -------
>
> Create a folder with three images, "File 1.png", "File 10.png", "File 2.png".
> View the folder in Gwenview with sort order set to "Name". The sort order is "File \
> 1.png, File 10.png, File 2.png". Apply patch.
> View the folder in Gwenview with sort order set to "Name". The sort order is "File \
> 1.png, File 2.png, File 10.png".
>
> Thanks,
>
> Mathis Beer
>
>
--===============0066692421664005392==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 \
solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;"> \
<tr> <td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://git.reviewboard.kde.org/r/128574/">https://git.reviewboard.kde.org/r/128574/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On april 27th, 2017, 7:58 p.m. UTC, <b>Elvis \
Angelaccio</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px \
solid #d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://git.reviewboard.kde.org/r/128574/diff/1/?file=472751#file472751line79" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/filewidgets/kdirsortfilterproxymodel.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">79</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">if</span> <span class="p">(</span><span \
class="n">m_naturalSorting</span><span class="p">)</span> <span \
class="p">{</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">80</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">m_collator</span><span class="p">.</span><span \
class="n">setNumericMode</span><span class="p">(</span><span \
class="nb">true</span><span class="p">);</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">81</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="p">}</span></pre></td> </tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">Please use <code style="text-rendering: inherit;color: #4444cc;padding: \
0;white-space: normal;margin: 0;line-height: \
inherit;">m_collator.setNumericMode(m_naturalSorting);</code> instead. It would also \
take care of disabling the natural sorting, if necessary.</p></pre> </blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">What Elvis said. Just replace the if block with that line and it's imho \
good to go. +1</p></pre>
<br />
<p>- Mark</p>
<br />
<p>On januari 8th, 2017, 4:13 p.m. UTC, Mathis Beer wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: \
1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; \
-webkit-border-radius: 6px;"> <tr>
<td>
<div>Review request for KDE Frameworks, David Faure, Nick Shaforostoff, and Harald \
Sitter.</div> <div>By Mathis Beer.</div>
<p style="color: grey;"><i>Updated jan 8, 2017, 4:13 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://bugs.kde.org/show_bug.cgi?id=343452">343452</a>
</div>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
kio
</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;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">KDirSortFilterProxyModel is advertised in the header \
as performing a "natural sort", ie. "7 8 9 10 11", instead of a lexical "10 11 7 8 \
9". However, as far as I can tell this was never true from the start, since the \
collator responsible for the actual sorting did not have the requisite numeric mode \
enabled, and this setting has always been off by default as far back as I can find \
docs for it (Qt 5.2).</p> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">(Dolphin, which offers "natural sort", \
did not run into this issue because it does not actually use \
KDirSortFilterProxyModel.)</p></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;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">Create a folder with three images, "File 1.png", "File \
10.png", "File 2.png". View the folder in Gwenview with sort order set to "Name". The \
sort order is "File 1.png, File 10.png, File 2.png". Apply patch.
View the folder in Gwenview with sort order set to "Name". The sort order is "File \
1.png, File 2.png, File 10.png".</p></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>src/filewidgets/kdirsortfilterproxymodel.cpp <span style="color: \
grey">(89505ac)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/128574/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
--===============0066692421664005392==--
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic