D25741: Add natural sorting and case-insensitive sorting for all role-types

Elvis Angelaccio noreply at phabricator.kde.org
Sun Jan 19 21:09:22 GMT 2020


elvisangelaccio requested changes to this revision.
elvisangelaccio added a comment.
This revision now requires changes to proceed.


  Sorry for the delay, patch looks good but needs some polish.

INLINE COMMENTS

> meven wrote in kfileitemmodel.cpp:1855
> Since this block is very close to the default case.
> 
> Maybe we could just have (and remove this added multicase) :
> 
>   default: {
>       const QByteArray role = roleForType(m_sortRole);
>       const QString roleValueA = a->values.value(role).toString();
>       const QString roleValueB = b->values.value(role).toString();
>       if (!roleValueA.isEmpty() && roleValueB.isEmpty()) {
>           result = -1;
>       } else if (roleValueA.isEmpty() && !roleValueB.isEmpty()) {
>           result = +1;
>       } else {
>           result = stringCompare(roleValueA, roleValueB); // <- only line changed
>       }
>       break;
>   }

+1

Also, we should use the new `isRoleValueNatural()` function also here, instead of hardcoding again the list of roles.

REVISION DETAIL
  https://phabricator.kde.org/D25741

To: gvgeo, #dolphin, nicolasfella, meven, elvisangelaccio, ngraham
Cc: cfeck, meven, kfm-devel, pberestov, iasensio, fprice, MrPepe, fbampaloukas, alexde, Codezela, feverfew, spoorun, navarromorales, firef, ngraham, andrebarros, emmanuelp, mikesomov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20200119/baa2b675/attachment.htm>


More information about the kfm-devel mailing list