MailCommon::FilterActionDict Class
class MailCommon::FilterActionDictList of known FilterAction-types. More...
| Header: | #include <MailCommon/FilterActionDict> |
| CMake: | find_package(KPim6MailCommon REQUIRED)target_link_libraries(mytarget PRIVATE KPim6::MailCommon) |
| Inherits: | QMultiHash |
Public Functions
| FilterActionDict() | |
| virtual | ~FilterActionDict() |
| void | insert(MailCommon::FilterActionNewFunc aNewFunc) |
| const QList<MailCommon::FilterActionDesc *> & | list() const |
Protected Functions
| virtual void | init() |
Detailed Description
Dictionary that contains a list of all registered filter actions with their creation functions. They are hard-coded into the constructor. If you want to add a new FilterAction, make sure you add the details of it in init, too.
You will be able to find a description of a FilterAction by looking up either it's (english) name or it's (i18n) label: <pre> FilterActionDict dict; // get name of the action with label "move into folder": dict[i18n("move into folder")]->name; // == "transfer" // create one such action: FilterAction *action = dict["transfer"]->create(); </pre>
You can iterate over all known filter actions by using list.
Author: Marc Mutz <mutz@kde.org>, based on work by Stefan Taferner <taferner@kde.org>
See also FilterAction, FilterActionDesc, and MailFilter.
Member Function Documentation
FilterActionDict::FilterActionDict()
Creates the filter action dictionary.
[virtual noexcept] FilterActionDict::~FilterActionDict()
Destroys the filter action dictionary.
[virtual protected] void FilterActionDict::init()
Populate the dictionary with all known FilterAction types. Called automatically from the constructor.
void FilterActionDict::insert(MailCommon::FilterActionNewFunc aNewFunc)
Overloaded member function, provided for convenience. Thin wrapper around QDict::insert and QPtrList::insert. Creates an action with aNewFunc and inserts the resulting FilterActionDesc thrice: First with the name, then with the label as key into the QDict, then into the QPtrList. For that, it creates an instance of the action internally and deletes it again after querying it for name and label.
const QList<MailCommon::FilterActionDesc *> &FilterActionDict::list() const
Provides read-only access to a list of all known filter actions.