Fix handling of cut collections.
ClosedPublic

Authored by dfaure on Apr 18 2018, 7:47 AM.

Details

Summary

For many years I would randomly see one of my email folders become
unselectable, often my inbox, for no apparent reason. And if it was
actually selected when this happened, then switching to another folder
would select both (not being able to unselect the now-unselectable one),
showing the merged view in the messagelist.
Only apparent solution was a kmail restart.
I finally found what triggered all this: Ctrl+X !
Cut collections were marked as selectable, but not enabled, which
effectively made them unselectable.

New solution: leaving flags untouched in the model, and simply changing
the text color in the delegate, for cut collections.
This makes cut collections still fully work, just like you can fully
interact with cut files in a file manager.

I wonder if we want to do the same with cut items, but I'm not sure where
the delegate(s) are, and how to catch them all. The risk of accidentally
cutting is much lower with items anyway (Ctrl+Alt+X).
Also, this code came from the fix for bug 213466, which was about items
in the first place (not collections).

Test Plan

click on email folder, Ctrl+X. Try it, it's fun.

Diff Detail

Repository
R165 Akonadi
Branch
Applications/18.04
Lint
No Linters Available
Unit
No Unit Test Coverage
dfaure created this revision.Apr 18 2018, 7:47 AM
Restricted Application added a project: KDE PIM. · View Herald TranscriptApr 18 2018, 7:47 AM
dfaure requested review of this revision.Apr 18 2018, 7:47 AM
dvratil accepted this revision.Apr 18 2018, 7:58 AM

Looks good, thanks. For emails the relevant delegate would be messagelib/messagelib/src/core/{theme,}delegate.cpp, Contact and event delegates would've to be checked/adjusted too (if KAddressbook/KOrganizer support Cutting entities)

This revision is now accepted and ready to land.Apr 18 2018, 7:58 AM

kaddressbook does support cutting entities, that's in fact exactly what the initial bug report is about (which led to this code).

Cutting out a contact makes it unselectable indeed, and it's not that bad there. It doesn't trigger bugs like the selected-but-unselectable folder that leads to merged contents in the kmail messagelist, for instance.
So I'm tempted to leave it like this, it seems useable for items, just not for collections.

dfaure closed this revision.Apr 20 2018, 7:52 AM