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

Méven Car noreply at phabricator.kde.org
Wed Dec 18 21:23:26 GMT 2019


meven added a comment.


  In D25741#579933 <https://phabricator.kde.org/D25741#579933>, @gvgeo wrote:
  
  > As for the multicase, the are still these cases that don't benefit (if I'm not wrong) from the natural sorting and case insensitive:
  >
  >   AccessTimeRole
  >   PermissionsRole
  >   ImageDateTimeRole
  >   OrientationRole
  >   WordCountRole
  >   DurationRole
  >   BitrateRole
  >   AspectRatioRole
  >   FrameRateRole
  >
  >
  > The rest should not matter.
  >
  >   NoRole
  >   IsDirRole
  >   IsLinkRole
  >   IsHiddenRole
  >   IsExpandedRole
  >   IsExpandableRole
  >   ExpandedParentsCountRole
  >   RolesCount
  >
  >
  > It is possible to use `stringRolesTrue`, but already have the switch.
  >
  >   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 if (stringRolesTrue(m_sortRole)) {                      <------------
  >           result = stringCompare(roleValueA, roleValueB);  
  >       } else {
  >           result = QString::compare(roleValueA, roleValueB);
  >       }
  >       break;
  >   }
  >
  
  
  Fair enough
  
  I would be in favor of merging this but I would like to give @elvisangelaccio a chance to review this.
  
  (You can mark the comments you treated as done so that next reviewer will see your progress)

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

To: gvgeo, #dolphin, nicolasfella, meven, elvisangelaccio, ngraham
Cc: 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/20191218/212b81fd/attachment.htm>


More information about the kfm-devel mailing list