[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: Elvis Angelaccio <elvis.angelaccio () kde ! org>
Date: 2017-04-27 21:53:28
Message-ID: 20170427215328.5759.71681 () mimi ! kde ! org
[Download RAW message or body]
--===============8954836073655807061==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
> On Nov. 27, 2016, 7:17 p.m., Konstantinos Smanis wrote:
> > I can confirm that the patch indeed resolves the natural sorting issue in \
> > KDirSortFilterProxyModel, which is a logical bug (an omission) introduced at some \
> > point during the KF5 kio port. It's been there since the initial git import of \
> > KF5 kio (as per [1]).
> > However, the patch is a half-measure as it doesn't fully address the issue at \
> > hand. Essentially it enforces natural sorting in the KDirSortFilterProxyModel \
> > class, as the relevant configuration option (kdeglobals config file -> [KDE] \
> > config group -> "NaturalSorting" config entry) is not accessible (i.e. editable) \
> > to the user by means of a GUI. It used to, but this is no longer case (as per \
> > commit [2]). See, back in KDE 4.x, Dolphin and Gwenview (and essentially any code \
> > relying on KDirSortFilterProxyModel) shared the same natural sorting \
> > configuration (by means of KGlobalSettings::naturalSorting() [3], which btw has \
> > been moved to kdelibs4support in KF5 [4]) and this was, for better or worse, \
> > configurable through Dolphin. Per the above mentioned commit though ([2]), \
> > Dolphin went a different way, so the "NaturalSorting" config entry in kdeglobals \
> > is only configurable by hand editing the config file.
> > On a side note, it's also worth mentioning that Dolphin never made use of \
> > KDirSortFilterProxyModel, it performs its own natural sorting.
> > tl;dr: In KDE 4.x everyone relied on KGlobalSettings::naturalSorting() for \
> > natural sorting configuration, which allowed for uniform sorting behaviour in \
> > different applications. This is no longer the case, so from a casual user's \
> > perspective, this patch would only hardcode natural sorting in Gwenview (the main \
> > user of KDirSortFilterProxyModel natural sorting). The patch as it stands is not \
> > wrong, but the underlying issue is broader.
> > I hope I didn't omit anything, I have been juggling with pre- and post-KF5 code \
> > trying to find out what went wrong in the way. A design decision has to be made \
> > on the issue. For more info check the related bug report.
> > [1] https://cgit.kde.org/kio.git/log/src/filewidgets/kdirsortfilterproxymodel.cpp
> > [2] https://cgit.kde.org/dolphin.git/commit/?id=fdb5c0d33e38e9d5fedc821c586bbb5ca8a0d2a5
> > [3] https://lxr.kde.org/source/kde/kdelibs/kdeui/kernel/kglobalsettings.cpp?v=stable-qt4#0775
> > [4] https://lxr.kde.org/source/frameworks/kdelibs4support/src/kdeui/kglobalsettings.cpp#0552
> >
Let's track the broader issue here: https://phabricator.kde.org/T5970
- Elvis
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128574/#review101143
-----------------------------------------------------------
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
>
>
--===============8954836073655807061==
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 November 27th, 2016, 7:17 p.m. UTC, \
<b>Konstantinos Smanis</b> wrote:</p> <blockquote style="margin-left: 1em; \
border-left: 2px solid #d0d0d0; padding-left: 10px;"> <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;">I can confirm that the \
patch indeed resolves the natural sorting issue in KDirSortFilterProxyModel, which is \
a logical bug (an omission) introduced at some point during the KF5 kio port. It's \
been there since the initial git import of KF5 kio (as per [1]).</p> <p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">However, the patch is a half-measure as it doesn't fully address the issue \
at hand. Essentially it enforces natural sorting in the KDirSortFilterProxyModel \
class, as the relevant configuration option (kdeglobals config file -> [KDE] \
config group -> "NaturalSorting" config entry) is not accessible (i.e. editable) \
to the user by means of a GUI. It used to, but this is no longer case (as per commit \
[2]). See, back in KDE 4.x, Dolphin and Gwenview (and essentially any code relying on \
KDirSortFilterProxyModel) shared the same natural sorting configuration (by means of \
KGlobalSettings::naturalSorting() [3], which btw has been moved to kdelibs4support in \
KF5 [4]) and this was, for better or worse, configurable through Dolphin. Per the \
above mentioned commit though ([2]), Dolphin went a different way, so the \
"NaturalSorting" config entry in kdeglobals is only configurable by hand editing \
the config file.</p> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">On a side note, it's also worth \
mentioning that Dolphin never made use of KDirSortFilterProxyModel, it performs its \
own natural sorting.</p> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">tl;dr: In KDE 4.x everyone relied on \
KGlobalSettings::naturalSorting() for natural sorting configuration, which allowed \
for uniform sorting behaviour in different applications. This is no longer the case, \
so from a casual user's perspective, this patch would only hardcode natural sorting \
in Gwenview (the main user of KDirSortFilterProxyModel natural sorting). The patch as \
it stands is not wrong, but the underlying issue is broader.</p> <p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I \
hope I didn't omit anything, I have been juggling with pre- and post-KF5 code trying \
to find out what went wrong in the way. A design decision has to be made on the \
issue. For more info check the related bug report.</p> <p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">[1] \
https://cgit.kde.org/kio.git/log/src/filewidgets/kdirsortfilterproxymodel.cpp [2] \
https://cgit.kde.org/dolphin.git/commit/?id=fdb5c0d33e38e9d5fedc821c586bbb5ca8a0d2a5 \
[3] https://lxr.kde.org/source/kde/kdelibs/kdeui/kernel/kglobalsettings.cpp?v=stable-qt4#0775
[4] https://lxr.kde.org/source/frameworks/kdelibs4support/src/kdeui/kglobalsettings.cpp#0552</p></pre>
</blockquote>
</blockquote>
<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;">Let's \
track the broader issue here: https://phabricator.kde.org/T5970</p></pre> <br />
<p>- Elvis</p>
<br />
<p>On January 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>
--===============8954836073655807061==--
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic