MailCommon::FilterManager Class
class MailCommon::FilterManagerA wrapper class that allows easy access to the mail filters. More...
| Header: | #include <MailCommon/FilterManager> |
| CMake: | find_package(KPim6MailCommon REQUIRED)target_link_libraries(mytarget PRIVATE KPim6::MailCommon) |
| Inherits: | QObject |
Public Types
| enum | FilterSet { NoSet, Inbound, Outbound, Explicit, BeforeOutbound, …, All } |
Public Functions
| virtual | ~FilterManager() override |
| void | appendFilters(const QList<MailCommon::MailFilter *> &filters, bool replaceIfNameExists = false) |
| void | beginUpdate() |
| QString | createUniqueFilterName(const QString &name) const |
| void | endUpdate() |
| void | filter(const Akonadi::Collection &collection, MailCommon::FilterManager::FilterSet set = Explicit) const |
| void | filter(const Akonadi::Collection &collection, const QStringList &listFilters) const |
| void | filter(const Akonadi::Collection::List &collections, MailCommon::FilterManager::FilterSet set = Explicit) const |
| void | filter(const Akonadi::Item::List &messages, MailCommon::FilterManager::FilterSet set = Explicit) const |
| void | filter(const Akonadi::Collection::List &collections, const QStringList &listFilters, MailCommon::FilterManager::FilterSet set = Explicit) const |
| void | filter(const Akonadi::Item &item, const QString &identifier, const QString &resourceId) const |
| void | filter(const Akonadi::Item::List &messages, MailCommon::SearchRule::RequiredPart requiredPart, const QStringList &listFilters) const |
| void | filter(const Akonadi::Item &item, MailCommon::FilterManager::FilterSet set = Inbound, bool account = false, const QString &resourceId = QString()) const |
| QList<MailCommon::MailFilter *> | filters() const |
| bool | isValid() const |
| void | removeFilter(MailCommon::MailFilter *filter) |
| void | setFilters(const QList<MailCommon::MailFilter *> &filters) |
| void | showFilterLogDialog(qlonglong windowId) |
Signals
| void | filtersChanged() |
| void | loadingFiltersDone() |
| void | tagListingFinished() |
Static Public Members
| MailCommon::FilterActionDict * | filterActionDict() |
| MailCommon::FilterManager * | instance() |
Private Slots
| void | slotFinishedTagListing(KJob *) |
| void | slotReadConfig() |
| void | slotServerStateChanged(Akonadi::ServerManager::State) |
| void | slotTagAdded(const Akonadi::Tag &) |
| void | slotTagChanged(const Akonadi::Tag &) |
| void | slotTagRemoved(const Akonadi::Tag &) |
| void | updateTagList() |
Detailed Description
This class communicates with the mailfilter agent via DBus.
Member Type Documentation
enum FilterManager::FilterSet
Describes the list of filters.
| Constant | Value | Description |
|---|---|---|
MailCommon::FilterManager::NoSet | 0 | No filter set |
MailCommon::FilterManager::Inbound | 1 | Filters applied on incoming messages |
MailCommon::FilterManager::Outbound | 2 | Filters applied on sent messages |
MailCommon::FilterManager::Explicit | 4 | Filters applied manually by the user |
MailCommon::FilterManager::BeforeOutbound | 8 | Filters applied on messages before they are sent |
MailCommon::FilterManager::AllFolders | 16 | Apply the filter on all folders, not just inbox |
MailCommon::FilterManager::All | Inbound | BeforeOutbound | Outbound | Explicit | AllFolders | All filter sets |
Member Function Documentation
[override virtual noexcept] FilterManager::~FilterManager()
Destroys the filter manager.
void FilterManager::appendFilters(const QList<MailCommon::MailFilter *> &filters, bool replaceIfNameExists = false)
Appends the list of filters to the current list of filters and write everything back into the configuration. The filter manager takes ownership of the filters in the list. If replaceIfNameExists is true, existing filters with the same name are replaced.
void FilterManager::beginUpdate()
Should be called at the beginning of an filter list update.
QString FilterManager::createUniqueFilterName(const QString &name) const
Checks for existing filters with the name and extend the "name" to "name (i)" until no match is found for i=1..n
void FilterManager::endUpdate()
Should be called at the end of an filter list update.
void FilterManager::filter(const Akonadi::Collection &collection, MailCommon::FilterManager::FilterSet set = Explicit) const
Process all messages in the given collection by applying the filters rules one by one. You can select which set of filters (incoming or outgoing) should be used.
void FilterManager::filter(const Akonadi::Collection &collection, const QStringList &listFilters) const
Apply the filters listFilters on all messages in the given collection.
void FilterManager::filter(const Akonadi::Collection::List &collections, MailCommon::FilterManager::FilterSet set = Explicit) const
Process all messages in the given collections by applying the filters rules one by one. You can select which set of filters (incoming or outgoing) should be used.
void FilterManager::filter(const Akonadi::Item::List &messages, MailCommon::FilterManager::FilterSet set = Explicit) const
Process given messages by applying the filter rules one by one. You can select which set of filters (incoming or outgoing) should be used.
set Select the filter set to use.
void FilterManager::filter(const Akonadi::Collection::List &collections, const QStringList &listFilters, MailCommon::FilterManager::FilterSet set = Explicit) const
Apply the filters listFilters of the given set on all messages in the given collections.
void FilterManager::filter(const Akonadi::Item &item, const QString &identifier, const QString &resourceId) const
Applies filter with the given identifier on the message item retrieved from the resource resourceId.
void FilterManager::filter(const Akonadi::Item::List &messages, MailCommon::SearchRule::RequiredPart requiredPart, const QStringList &listFilters) const
Apply the filters listFilters on the given messages, fetching the requiredPart of the messages.
void FilterManager::filter(const Akonadi::Item &item, MailCommon::FilterManager::FilterSet set = Inbound, bool account = false, const QString &resourceId = QString()) const
Process given message item by applying the filter rules one by one. You can select which set of filters (incoming or outgoing) should be used.
item The message item to process. set Select the filter set to use. account true if an account id is specified else false resourceId The id of the resource that the message was retrieved from
[static] MailCommon::FilterActionDict *FilterManager::filterActionDict()
Returns the global filter action dictionary.
QList<MailCommon::MailFilter *> FilterManager::filters() const
Returns the filter list of the manager.
See also setFilters().
[signal] void FilterManager::filtersChanged()
This signal is emitted whenever the filter list has been updated.
[static] MailCommon::FilterManager *FilterManager::instance()
Returns the global filter manager object.
bool FilterManager::isValid() const
Returns whether the filter manager is in a usable state.
[signal] void FilterManager::loadingFiltersDone()
void FilterManager::removeFilter(MailCommon::MailFilter *filter)
Removes the given filter from the list. The filter object is not deleted.
void FilterManager::setFilters(const QList<MailCommon::MailFilter *> &filters)
Replace the list of filters of the filter manager with the given list of filters. The manager takes ownership of the filters.
See also filters().
void FilterManager::showFilterLogDialog(qlonglong windowId)
Shows the filter log dialog, using windowId as the parent window.
This is used to debug problems with filters.