Fix selection when navigating back, with size sorting.
ClosedPublic

Authored by thsurrel on Nov 20 2018, 11:14 AM.

Details

Summary

KItemListSelectionManager::itemsMoved (called when sorting by size)
was re-activating anchor selection regardless if we actually were
doing an anchored selection. This was leading to an incorrect
selection when navigating back.

BUG: 352296

Test Plan

In any folder, sort by size then move to a subfolder. Navigate back
to the parent folder: only the parent folder should be selected.

Diff Detail

Repository
R318 Dolphin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
thsurrel created this revision.Nov 20 2018, 11:14 AM
Restricted Application added a project: Dolphin. · View Herald TranscriptNov 20 2018, 11:14 AM
Restricted Application added a subscriber: kfm-devel. · View Herald Transcript
thsurrel requested review of this revision.Nov 20 2018, 11:14 AM
thsurrel updated this revision to Diff 45876.Nov 20 2018, 11:15 AM

Fix removed empty line

Nice! I've always wondered why that happens but couldn't reliably reproduce it

Thanks, patch looks good and kitemlistselectionmanagertest still passes.

I don't understand though why the bug only happens with size sorting...

thsurrel added a comment.EditedNov 30 2018, 3:10 PM

That happens only with size sorting because we modify the "size" of folders by setting the number of items in them. That triggers a re-sort once this is done, that in turns call itemsMoved and triggers the bug.
See the special case in KFileItemModelRolesUpdater::applySortRole for details.

It took me a while to figure this out, but it looks like there is no other root cause to this bug.

elvisangelaccio accepted this revision.Dec 1 2018, 4:13 PM

I think we can land this on the stable branch too (Applications/18.12).

This revision is now accepted and ready to land.Dec 1 2018, 4:13 PM
This revision was automatically updated to reflect the committed changes.