Fix sorting by date in some situations
ClosedPublic

Authored by rkflx on Jun 25 2018, 9:48 PM.

Details

Summary

There are two problems when sorting images by Date:

Since 05f7e069c858 Gwenview sorts images by shooting date. However, in
case two images have the same date or when there is no shooting date
available for a file, no appropriate secondary sorting criterion is
provided, leading to unexpected sorting results.

8f1283065235 enabled sorting in Descending order, but toggling the
option does not invert the sorting order for images with the same
shooting date.

Both problems can be fixed by falling back to a secondary sorting
criterion in case of equal shooting dates. For
KDirSortFilterProxyModel::lessThan, this means sorting by
KDirModel::ModifiedTime and finally by KDirModel::Name.

Test Plan

Prepare files containing the same shooting date in their metadata, but
having different filesystem timestamps. ViewSort ByDate
should work correctly and toggling Descending should invert the
sorting order.

Diff Detail

Repository
R260 Gwenview
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
rkflx requested review of this revision.Jun 25 2018, 9:48 PM
rkflx created this revision.
muhlenpfordt accepted this revision.Jun 27 2018, 8:04 AM
muhlenpfordt added a subscriber: muhlenpfordt.

No issues found with any timestamp combinations I tested. :)

This revision is now accepted and ready to land.Jun 27 2018, 8:04 AM
This revision was automatically updated to reflect the committed changes.