Separate directories and archives when sorting by date
ClosedPublic

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

Details

Summary

In general, Gwenview sorts directories first, then groups all archives
behind those and finally displays images. While the separation of images
worked fine when sorting by Date, directories and archives were
mistakenly mixed within a single group for that sorting order.

This is because the special handling for KDirModel::ModifiedTime in
SortedDirModel::lessThan does not take into account
KDirSortFilterProxyModel::sortFoldersFirst(). As directories cannot
come with a shooting date, we can delegate sorting to
KDirSortFilterProxyModel::lessThan which handles the separation of
directories just fine.

For SemanticInfoDirModel::RatingRole the problem could not be
observed, because Gwenview did not pass on the rating of directories,
so both directories being compared had a zero rating and we fell back to
KDirSortFilterProxyModel::lessThan. Nevertheless, for clarity we make
the fallback for sorting by rating explicit too.

Depends on D13727

Test Plan

In Browse mode, sort a directory containing directories, archives
and images by Date and check the correct grouping (also for
Descending).

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:49 PM
rkflx created this revision.
muhlenpfordt accepted this revision.Jun 27 2018, 8:05 AM
muhlenpfordt added a subscriber: muhlenpfordt.

Looks good to me and works perfect for all sort options. 👍

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