diff --git a/src/core/models/entitytreemodel_p.h b/src/core/models/entitytreemodel_p.h --- a/src/core/models/entitytreemodel_p.h +++ b/src/core/models/entitytreemodel_p.h @@ -93,7 +93,7 @@ const Akonadi::Collection &destCollection); void monitoredItemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection); - void monitoredItemRemoved(const Akonadi::Item &item); + void monitoredItemRemoved(const Akonadi::Item &item, const Akonadi::Collection &collection = Akonadi::Collection()); void monitoredItemChanged(const Akonadi::Item &item, const QSet &); void monitoredItemMoved(const Akonadi::Item &item, const Akonadi::Collection &, const Akonadi::Collection &); diff --git a/src/core/models/entitytreemodel_p.cpp b/src/core/models/entitytreemodel_p.cpp --- a/src/core/models/entitytreemodel_p.cpp +++ b/src/core/models/entitytreemodel_p.cpp @@ -143,7 +143,7 @@ q->connect(monitor, SIGNAL(itemChanged(Akonadi::Item,QSet)), SLOT(monitoredItemChanged(Akonadi::Item,QSet))); q->connect(monitor, SIGNAL(itemRemoved(Akonadi::Item)), - SLOT(monitoredItemRemoved(Akonadi::Item))); + SLOT(monitoredItemRemoved(Akonadi::Item,Akonadi::Collection))); q->connect(monitor, SIGNAL(itemMoved(Akonadi::Item,Akonadi::Collection,Akonadi::Collection)), SLOT(monitoredItemMoved(Akonadi::Item,Akonadi::Collection,Akonadi::Collection))); @@ -1104,7 +1104,7 @@ q->endInsertRows(); } -void EntityTreeModelPrivate::monitoredItemRemoved(const Akonadi::Item &item) +void EntityTreeModelPrivate::monitoredItemRemoved(const Akonadi::Item &item, const Akonadi::Collection &parentCollection) { Q_Q(EntityTreeModel); @@ -1112,7 +1112,8 @@ return; } - if ((m_itemPopulation == EntityTreeModel::LazyPopulation) && !m_populatedCols.contains(item.parentCollection().id())) { + if ((m_itemPopulation == EntityTreeModel::LazyPopulation) && + !m_populatedCols.contains(parentCollection.isValid() ? parentCollection.id() : item.parentCollection().id())) { return; } @@ -1197,10 +1198,10 @@ monitoredItemAdded(item, destCollection); return; } else if (isHidden(destCollection)) { - monitoredItemRemoved(item); + monitoredItemRemoved(item, sourceCollection); return; } else { - monitoredItemRemoved(item); + monitoredItemRemoved(item, sourceCollection); monitoredItemAdded(item, destCollection); return; }