Commit 9e9ce4f3 authored by Milian Wolff's avatar Milian Wolff

Use the proper source model for the SystemTray unread count.

This used to iterate over mails as well (i.e. all contents of the
ETM), which is pretty useless _and_ slow. I detected this with
heaptrack, as it triggered hundred thousands of temporary allocations
of invalid Collections and those in turn allocated CachePolicies.
Turned out, the model did not check whether it can convert the source
data to a Collection, but just blindly converted it. Thus, a default
constructed Collection was returned for non-collection items. Which
is slow.

Now, we just iterate over the collection model, which will always
return valid Collections for us - much better!

REVIEW: 121403
parent 9597adca
......@@ -42,6 +42,7 @@
#include <Akonadi/ChangeRecorder>
#include <Akonadi/EntityTreeModel>
#include <Akonadi/CollectionModel>
#include <Akonadi/EntityMimeTypeFilterModel>
using namespace MailCommon;
......@@ -367,7 +368,7 @@ void KMSystemTray::hideKMail()
void KMSystemTray::initListOfCollection()
{
mCount = 0;
const QAbstractItemModel *model = kmkernel->entityTreeModel();
const QAbstractItemModel *model = kmkernel->collectionModel();
if (model->rowCount() == 0) {
QTimer::singleShot(1000,this,SLOT(initListOfCollection()));
return;
......
Markdown is supported
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