Commit a2855606 authored by Kevin Ottens's avatar Kevin Ottens
Browse files

Get rid of the reset/layoutChanged storm

Advertisement:
Are you tired of loosing your selection in the message list when a
filter moves a mail from your inbox to its final destination? Are you
getting blind due to the favorite folders list flickering when a bulk of
emails are moved around? Are you seeing strange crashes and kmail
getting unresponsive when you move a big chunk of emails from one folder
to another? Then this patch is made for you!

Further explanations:
Don't use the itemMoved() signals in the ETM for items anymore. It is
the right solution long term, but short term it is not usable if all
the proxy models around the ETM don't support the feature properly.

Right now most (if not all) of our proxy models transform itemMoved()
signals into layoutChanged() signals, and for instance when that
reaches the message list it simply resets the whole message list model.

Such a reset then happen for each of the item moved, potentially
flooding the system with computations for threading, but also generating
flickers in the favorite folders list or loosing the selection for the
less dramatic cases.

Downside:
Because of the move speed up, you actually see the changes now, so the
mails progressively disappearing from the source collection to appear in
the destination collection. For this to disappear we need to compress
the changes in bulks, which is ongoing work. But at least now it's
faster and more usable.
parent b5c376b0
......@@ -1079,8 +1079,18 @@ void EntityTreeModelPrivate::monitoredItemMoved( const Akonadi::Item& item,
} else if ( isHidden( destCollection ) ) {
monitoredItemRemoved( item );
return;
} else {
monitoredItemRemoved( item );
monitoredItemAdded( item, destCollection );
return;
}
// "Temporarily" commented out as it's likely the best course to
// avoid the dreaded "reset storm" (or layoutChanged storm). The
// whole itemMoved idea is great but not practical until all the
// other proxy models play nicely with it, right now they just
// transform moved signals in layout changed, which explodes into
// a reset of the source model inside of the message list (ouch!)
#if 0
if ( !m_items.contains( item.id() ) ) {
kWarning() << "Got a stale notification for an item which was already removed." << item.id() << item.remoteId();
return;
......@@ -1112,6 +1122,7 @@ void EntityTreeModelPrivate::monitoredItemMoved( const Akonadi::Item& item,
node->parent = destCollection.id();
m_childEntities[ destCollection.id() ].append( node );
q->endMoveRows();
#endif
}
void EntityTreeModelPrivate::monitoredItemLinked( const Akonadi::Item& item, const Akonadi::Collection& collection )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment