Commit d3306c63 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

Fix explicitly applying filters on collections

parent a170c937
......@@ -596,7 +596,10 @@ void FilterManager::dump() const
#endif
void FilterManager::applySpecificFilters(const Akonadi::Item::List &selectedMessages, SearchRule::RequiredPart requiredPart, const QStringList &listFilters)
void FilterManager::applySpecificFilters(const Akonadi::Item::List &selectedMessages,
SearchRule::RequiredPart requiredPart,
const QStringList &listFilters,
FilterSet filterSet)
{
Q_EMIT progressMessage(i18n("Filtering messages"));
d->mTotalProgressCount = selectedMessages.size();
......@@ -613,6 +616,7 @@ void FilterManager::applySpecificFilters(const Akonadi::Item::List &selectedMess
itemFetchJob->fetchScope().setAncestorRetrieval(Akonadi::ItemFetchScope::Parent);
itemFetchJob->setProperty("listFilters", QVariant::fromValue(listFilters));
itemFetchJob->setProperty("filterSet", QVariant::fromValue(static_cast<int>(filterSet)));
itemFetchJob->setProperty("needsFullPayload", requiredPart != SearchRule::Envelope);
connect(itemFetchJob, SIGNAL(itemsReceived(Akonadi::Item::List)),
......
......@@ -110,7 +110,8 @@ public:
void filter(const Akonadi::Item &item, FilterManager::FilterSet set, const QString &resourceId);
void filter(const Akonadi::Item &item, const QString &filterId, const QString &resourceId);
void applySpecificFilters(const Akonadi::Item::List &selectedMessages, MailCommon::SearchRule::RequiredPart requiredPart, const QStringList &listFilters);
void applySpecificFilters(const Akonadi::Item::List &selectedMessages, MailCommon::SearchRule::RequiredPart requiredPart,
const QStringList &listFilters, FilterSet set = Explicit);
/**
* Applies the filters on the given @p messages.
......
......@@ -341,7 +341,7 @@ void MailFilterAgent::applySpecificFilters(const QList< qint64 > &itemIds, int r
m_filterManager->applySpecificFilters(items, static_cast<MailCommon::SearchRule::RequiredPart>(requires), listFilters);
}
void MailFilterAgent::applySpecificFiltersOnCollections(const QList<qint64> &colIds, const QStringList &listFilters)
void MailFilterAgent::applySpecificFiltersOnCollections(const QList<qint64> &colIds, const QStringList &listFilters, int filterSet)
{
// TODO: Actually calculate this based on the listFilters' requirements
const auto requires = MailCommon::SearchRule::CompleteMessage;
......@@ -355,7 +355,7 @@ void MailFilterAgent::applySpecificFiltersOnCollections(const QList<qint64> &col
ifj->setDeliveryOption(Akonadi::ItemFetchJob::EmitItemsInBatches);
connect(ifj, &Akonadi::ItemFetchJob::itemsReceived,
this, [=](const Akonadi::Item::List &items) {
m_filterManager->applySpecificFilters(items, requires, listFilters);
m_filterManager->applySpecificFilters(items, requires, listFilters, static_cast<FilterManager::FilterSet>(filterSet));
});
}
}
......
......@@ -52,7 +52,7 @@ public:
void filter(qint64 item, const QString &filterIdentifier, const QString &resourceId);
void filterCollections(const QList<qint64> &collections, int filterSet);
void applySpecificFilters(const QList< qint64 > &itemIds, int requires, const QStringList &listFilters);
void applySpecificFiltersOnCollections(const QList<qint64> &colIds, const QStringList &listFilters);
void applySpecificFiltersOnCollections(const QList<qint64> &colIds, const QStringList &listFilters, int filterSet);
void reload();
......
......@@ -34,6 +34,7 @@
<method name="applySpecificFiltersOnCollections">
<arg name="collections" type="ax" direction="in"/>
<arg name="listFilters" type="as" direction="in"/>
<arg name="filterSet" type="i" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="const QList&lt;qint64&gt; &amp;"/>
</method>
<method name="reload"/>
......
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