Mailcommon

filteractiondict.cpp
1/*
2 * SPDX-FileCopyrightText: 1996-1998 Stefan Taferner <taferner@kde.org>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 *
6 */
7
8#include "filteractiondict.h"
9
10#include "filteractionaddheader.h"
11#include "filteractionaddtag.h"
12#include "filteractionaddtoaddressbook.h"
13#include "filteractioncopy.h"
14#include "filteractiondecrypt.h"
15#include "filteractiondelete.h"
16#include "filteractionencrypt.h"
17#include "filteractionexec.h"
18#include "filteractionmove.h"
19#include "filteractionpipethrough.h"
20#include "filteractionplaysound.h"
21#include "filteractionredirect.h"
22#include "filteractionremoveheader.h"
23#include "filteractionreplyto.h"
24#include "filteractionrewriteheader.h"
25#include "filteractionsendfakedisposition.h"
26#include "filteractionsendreceipt.h"
27#include "filteractionsetidentity.h"
28#include "filteractionsetstatus.h"
29#include "filteractionsettransport.h"
30#include "filteractionunsetstatus.h"
31
32using namespace MailCommon;
33
34//=============================================================================
35//
36// Filter Action Dictionary
37//
38//=============================================================================
40{
41 qDeleteAll(mList);
42}
43
45{
46 insert(FilterActionMove::newAction);
47 insert(FilterActionCopy::newAction);
48 insert(FilterActionSetIdentity::newAction);
49 insert(FilterActionSetStatus::newAction);
50 insert(FilterActionAddTag::newAction);
51 insert(FilterActionSendFakeDisposition::newAction);
52 insert(FilterActionSetTransport::newAction);
53 insert(FilterActionReplyTo::newAction);
54 // Laurent disable for the moment as async doesn't work
55 // PORT TO ASYNC insert(FilterActionForward::newAction);
56 insert(FilterActionRedirect::newAction);
57 insert(FilterActionSendReceipt::newAction);
58 insert(FilterActionExec::newAction);
59 insert(FilterActionPipeThrough::newAction);
60 insert(FilterActionRemoveHeader::newAction);
61 insert(FilterActionAddHeader::newAction);
62 insert(FilterActionRewriteHeader::newAction);
63 insert(FilterActionPlaySound::newAction);
64 insert(FilterActionAddToAddressBook::newAction);
65 insert(FilterActionDelete::newAction);
66 insert(FilterActionUnsetStatus::newAction);
67 insert(FilterActionEncrypt::newAction);
68 insert(FilterActionDecrypt::newAction);
69 // Register custom filter actions below this line.
70}
71
72// The int in the QDict constructor (41) must be a prime
73// and should be greater than the double number of FilterAction types
79
80void FilterActionDict::insert(FilterActionNewFunc aNewFunc)
81{
82 FilterAction *action = aNewFunc();
83 auto desc = new FilterActionDesc;
84 desc->name = action->name();
85 desc->label = action->label();
86 desc->create = aNewFunc;
87
90 mList.append(desc);
91
92 delete action;
93}
94
96{
97 return mList;
98}
virtual void init()
Populate the dictionary with all known FilterAction types.
MAILCOMMON_EXPORT void insert(FilterActionNewFunc aNewFunc)
Overloaded member function, provided for convenience.
MAILCOMMON_EXPORT FilterActionDict()
Creates the filter action dictionary.
virtual MAILCOMMON_EXPORT ~FilterActionDict()
Destroys the filter action dictionary.
MAILCOMMON_EXPORT const QList< FilterActionDesc * > & list() const
Provides read-only access to a list of all known filter actions.
Abstract base class for mail filter actions.
QString name() const
Returns identifier name, ie.
QString label() const
Returns i18n'd label, ie.
The filter dialog.
iterator insert(const Key &key, const T &value)
Auxiliary struct for FilterActionDict.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 14 2024 11:59:39 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.