Mailcommon

filteractiondict.cpp
1 /*
2  * SPDX-FileCopyrightText: 1996-1998 Stefan Taferner <[email protected]>
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 "filteractionforward.h"
19 #include "filteractionmove.h"
20 #include "filteractionpipethrough.h"
21 #include "filteractionplaysound.h"
22 #include "filteractionredirect.h"
23 #include "filteractionremoveheader.h"
24 #include "filteractionreplyto.h"
25 #include "filteractionrewriteheader.h"
26 #include "filteractionsendfakedisposition.h"
27 #include "filteractionsendreceipt.h"
28 #include "filteractionsetidentity.h"
29 #include "filteractionsetstatus.h"
30 #include "filteractionsettransport.h"
31 #include "filteractionunsetstatus.h"
32 
33 using namespace MailCommon;
34 
35 //=============================================================================
36 //
37 // Filter Action Dictionary
38 //
39 //=============================================================================
41 {
42  qDeleteAll(mList);
43 }
44 
46 {
47  insert(FilterActionMove::newAction);
48  insert(FilterActionCopy::newAction);
49  insert(FilterActionSetIdentity::newAction);
50  insert(FilterActionSetStatus::newAction);
51  insert(FilterActionAddTag::newAction);
52  insert(FilterActionSendFakeDisposition::newAction);
53  insert(FilterActionSetTransport::newAction);
54  insert(FilterActionReplyTo::newAction);
55  // Laurent disable for the moment as async doesn't work
56  // PORT TO ASYNC insert(FilterActionForward::newAction);
57  insert(FilterActionRedirect::newAction);
58  insert(FilterActionSendReceipt::newAction);
59  insert(FilterActionExec::newAction);
60  insert(FilterActionPipeThrough::newAction);
61  insert(FilterActionRemoveHeader::newAction);
62  insert(FilterActionAddHeader::newAction);
63  insert(FilterActionRewriteHeader::newAction);
64  insert(FilterActionPlaySound::newAction);
65  insert(FilterActionAddToAddressBook::newAction);
66  insert(FilterActionDelete::newAction);
67  insert(FilterActionUnsetStatus::newAction);
68  insert(FilterActionEncrypt::newAction);
69  insert(FilterActionDecrypt::newAction);
70  // Register custom filter actions below this line.
71 }
72 
73 // The int in the QDict constructor (41) must be a prime
74 // and should be greater than the double number of FilterAction types
77 {
78  init();
79 }
80 
81 void FilterActionDict::insert(FilterActionNewFunc aNewFunc)
82 {
83  FilterAction *action = aNewFunc();
84  auto desc = new FilterActionDesc;
85  desc->name = action->name();
86  desc->label = action->label();
87  desc->create = aNewFunc;
88 
91  mList.append(desc);
92 
93  delete action;
94 }
95 
97 {
98  return mList;
99 }
typename QHash< Key, T >::iterator insert(const Key &key, const T &value)
MAILCOMMON_EXPORT void insert(FilterActionNewFunc aNewFunc)
Overloaded member function, provided for convenience.
QString name() const
Returns identifier name, ie.
Abstract base class for mail filter actions.
Definition: filteraction.h:38
QString label() const
Returns i18n'd label, ie.
MAILCOMMON_EXPORT FilterActionDict()
Creates the filter action dictionary.
Auxiliary struct for FilterActionDict.
virtual MAILCOMMON_EXPORT ~FilterActionDict()
Destroys the filter action dictionary.
const MAILCOMMON_EXPORT QVector< FilterActionDesc * > & list() const
Provides read-only access to a list of all known filter actions.
The filter dialog.
virtual void init()
Populate the dictionary with all known FilterAction types.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Sep 24 2022 03:58:14 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.