Commit 26d94bf5 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

We need to update filter when we remove account

parent 81a4d83d
......@@ -359,6 +359,16 @@ void FilterManager::mailCollectionRemoved(const Akonadi::Collection &collection)
}
}
void FilterManager::agentRemoved(const QString &identifier)
{
QList<MailCommon::MailFilter *>::const_iterator end(d->mFilters.constEnd());
for (QList<MailCommon::MailFilter *>::const_iterator it = d->mFilters.constBegin();
it != end; ++it) {
//TODO remove identifier in list of account
//(*it)->agentRemoved(identifier);
}
}
void FilterManager::filter(const Akonadi::Item &item, FilterManager::FilterSet set, const QString &resourceId)
{
Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(item, this);
......
......@@ -126,6 +126,7 @@ public:
MailCommon::SearchRule::RequiredPart requiredPart(const QString &id) const;
void mailCollectionRemoved(const Akonadi::Collection &collection);
void agentRemoved(const QString &identifier);
#ifndef NDEBUG
/**
......
......@@ -89,6 +89,7 @@ MailFilterAgent::MailFilterAgent(const QString &id)
this, SLOT(mailCollectionChanged(Akonadi::Collection)));
connect(collectionMonitor, &Akonadi::Monitor::collectionRemoved, this, &MailFilterAgent::mailCollectionRemoved);
connect(Akonadi::AgentManager::self(), &Akonadi::AgentManager::instanceRemoved, this, &MailFilterAgent::slotInstanceRemoved);
QTimer::singleShot(0, this, &MailFilterAgent::initializeCollections);
......@@ -355,5 +356,10 @@ void MailFilterAgent::expunge(qint64 collectionId)
mMailFilterKernel->expunge(collectionId, false);
}
void MailFilterAgent::slotInstanceRemoved(const Akonadi::AgentInstance &instance)
{
m_filterManager->agentRemoved(instance.identifier());
}
AKONADI_AGENT_MAIN(MailFilterAgent)
......@@ -26,6 +26,8 @@
#include <Collection>
#include <AkonadiCore/item.h>
#include <AkonadiCore/AgentInstance>
class FilterLogDialog;
class FilterManager;
class KJob;
......@@ -66,8 +68,8 @@ private Q_SLOTS:
void emitProgress(int percent = 0);
void emitProgressMessage(const QString &message);
void itemsReceiviedForFiltering(const Akonadi::Item::List &items);
void clearMessage();
void clearMessage();
void slotInstanceRemoved(const Akonadi::AgentInstance &instance);
public Q_SLOTS:
void configure(WId windowId) Q_DECL_OVERRIDE;
......
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