Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 2d413420 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

FilterManager: add support for per-Collection filtering

Add API to pass a Collection ID and filter ID to MailFilterAgent to perform
filtering on top of entire Collection (or even list of Collections).
parent 11eef2f6
cmake_minimum_required(VERSION 3.0)
set(PIM_VERSION "5.6.41")
set(PIM_VERSION "5.6.42")
project(mailcommon VERSION ${PIM_VERSION})
......
......@@ -26,6 +26,16 @@
<arg name="filterSet" type="i" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="const QList&lt;qint64&gt; &amp;"/>
</method>
<method name="filterCollections">
<arg name="collections" type="ax" 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="applySpecificFiltersOnCollections">
<arg name="collections" type="ax" direction="in"/>
<arg name="listFilters" type="as" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="const QList&lt;qint64&gt; &amp;"/>
</method>
<method name="reload"/>
<method name="showFilterLogDialog">
<arg direction="in" type="x" name="windowId" />
......@@ -33,6 +43,9 @@
<method name="printCollectionMonitored">
<arg direction="out" type="s"/>
</method>
<method name="expunge">
<arg name="collectionId" type="x" direction="in"/>
</method>
<signal name="filtersChanged"/>
</interface>
</node>
......@@ -240,6 +240,40 @@ void FilterManager::filter(const Akonadi::Item &item, FilterSet set, bool accoun
d->mMailFilterAgentInterface->filterItem(item.id(), static_cast<int>(set), account ? resourceId : QString());
}
void FilterManager::filter(const Akonadi::Collection &collection, MailCommon::FilterManager::FilterSet set) const
{
filter({ collection }, set);
}
void FilterManager::filter(const Akonadi::Collection::List &collections, FilterManager::FilterSet set) const
{
QList<qint64> colIds;
colIds.reserve(collections.size());
for (const auto col : collections) {
colIds << col.id();
}
d->mMailFilterAgentInterface->filterCollections(colIds, static_cast<int>(set));
}
void FilterManager::filter(const Akonadi::Collection &collection, const QStringList &listFilters) const
{
filter({ collection }, listFilters);
}
void FilterManager::filter(const Akonadi::Collection::List &collections, const QStringList &listFilters) const
{
QList<qint64> colIds;
colIds.reserve(collections.size());
for (const auto col : collections) {
colIds << col.id();
}
d->mMailFilterAgentInterface->applySpecificFiltersOnCollections(colIds, listFilters);
}
void FilterManager::filter(const Akonadi::Item::List &messages, FilterManager::FilterSet set) const
{
QList<qint64> itemIds;
......
......@@ -103,6 +103,30 @@ public:
*/
void filter(const Akonadi::Item &item, FilterSet set = Inbound, bool account = false, const QString &resourceId = QString()) const;
/**
* Process all messages in given collection by applying the filters rules one
* by one. You can select which set of filters (incoming or outgoing)
* should be used.
*/
void filter(const Akonadi::Collection &collection, FilterSet set = Inbound) const;
/**
* Apply specified filters on all messages in given collection
*/
void filter(const Akonadi::Collection &collection, const QStringList &listFilters) const;
/**
* Process all messages in given collections by applying the filters rules one
* by one. You can select which set of filters (incoming or outgoing)
* should be used.
*/
void filter(const Akonadi::Collection::List &collections, FilterSet set = Inbound) const;
/**
* Apply specified filters on all messages in given collection
*/
void filter(const Akonadi::Collection::List &collections, const QStringList &listFilters) const;
/**
* Process given @p messages by applying the filter rules one by
* one. You can select which set of filters (incoming or outgoing)
......
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