Optimization in KDE-PIM
Separated referencing of collections from the selection in FavoriteCollectionsModel.
The FavoritCollectionsModel used an internal selection model (that isn't used in any GUI),
to reuse the referencing of the Akonadi::SelectionProxyModel that corresponds to the current selection.
However, the selection is frequently cleared and restored during
layoutChanged signals, resulting in the collections frequently getting
dereferenced and rereferenced.
Since this happens for each favorite collection, this resultet in the
complete buffer getting cleared on every layoutChanged result, essentially
killing the buffering
(if 10 favorite collections get dereferenced, each of them ends up in the
buffer pushing other buffered collections out of the buffer).
Since a QSortProxyModel that filters dynamically translates each dataChanged
signal into a layoutChanged, the buffer was more or less constantly cleared.
We could try to avoid clearing the selection on layoutChanged signals in KSelectionProxyModel,
but not relying on the internal selection in the first place seem much more
robust and straightforward. The FavoriteCollectionsModel remains a subclass
of SelectionProxyModel for binary compatibility only, and should eventually be
turned into a KRecursiveFilterModel.