Review Request: Use UDS_NAME as a fallback when sorting via UDS_DISPLAY_NAME
Peter Penz
peter.penz19 at gmail.com
Mon Jan 10 10:43:40 GMT 2011
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://svn.reviewboard.kde.org/r/6322/#review9602
-----------------------------------------------------------
trunk/KDE/kdelibs/kfile/kdirsortfilterproxymodel.cpp
<http://svn.reviewboard.kde.org/r/6322/#comment10597>
For performance reasons I'd suggest to implement it this way:
const int result = d->compare(leftFileItem.text(), rightFileItem.text(), sortCaseSensitivity());
if (result == 0) {
return d->compare(leftFileItem.name(sortCaseSensitivity() == Qt::CaseInsensitive), rightFileItem.name(sortCaseSensitivity() == Qt::CaseInsensitive), sortCaseSensitivity()) < 0;
} else {
return result < 0;
}
By this we prevent doing another string comparison for equality for the default case.
Otherwise I'm fine with the change!
- Peter
On Jan. 10, 2011, 10:24 a.m., Sebastian Trueg wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://svn.reviewboard.kde.org/r/6322/
> -----------------------------------------------------------
>
> (Updated Jan. 10, 2011, 10:24 a.m.)
>
>
> Review request for kdelibs and Peter Penz.
>
>
> Summary
> -------
>
> When sorting by name KDirSortFilterProxyModel uses UDS_DISPLAY_NAME. The latter, however, is not unique. This results in strange GUI behaviour like swapping items. This patch makes the model fall back to UDS_NAME to ensure a fixed sort order.
> I also propose to backport it to 4.6.
>
>
> Diffs
> -----
>
> trunk/KDE/kdelibs/kfile/kdirsortfilterproxymodel.cpp 1211983
>
> Diff: http://svn.reviewboard.kde.org/r/6322/diff
>
>
> Testing
> -------
>
>
> Thanks,
>
> Sebastian
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20110110/07b1bbcf/attachment.htm>
More information about the kde-core-devel
mailing list