Mailcommon

filteractiondelete.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 "filteractiondelete.h"
9 
10 #include <KColorScheme>
11 #include <KLocalizedString>
12 
13 #include <QLabel>
14 
15 using namespace MailCommon;
16 
17 FilterActionDelete::FilterActionDelete(QObject *parent)
18  : FilterActionWithNone(QStringLiteral("delete"), i18n("Delete Message"), parent)
19 {
20 }
21 
22 FilterAction::ReturnCode FilterActionDelete::process(ItemContext &context, bool) const
23 {
24  context.setDeleteItem();
25  return GoOn;
26 }
27 
28 SearchRule::RequiredPart FilterActionDelete::requiredPart() const
29 {
30  return SearchRule::Envelope;
31 }
32 
33 QWidget *FilterActionDelete::createParamWidget(QWidget *parent) const
34 {
35  auto lab = new QLabel(parent);
36  lab->setObjectName(QStringLiteral("label_delete"));
37  QPalette pal = lab->palette();
39  pal.setColor(QPalette::WindowText, scheme.foreground(KColorScheme::NegativeText).color());
40  lab->setPalette(pal);
41  lab->setText(i18n("Be careful, mails will be removed."));
42  return lab;
43 }
44 
45 FilterAction *FilterActionDelete::newAction()
46 {
47  return new FilterActionDelete;
48 }
49 
50 QString FilterActionDelete::sieveCode() const
51 {
52  return QStringLiteral("discard;");
53 }
54 
55 #include "moc_filteractiondelete.cpp"
Abstract base class for filter actions with no parameter.
Abstract base class for mail filter actions.
Definition: filteraction.h:38
QString i18n(const char *text, const TYPE &arg...)
RequiredPart
Possible required parts.
Definition: searchrule.h:68
void setColor(QPalette::ColorGroup group, QPalette::ColorRole role, const QColor &color)
A helper class for the filtering process.
Definition: itemcontext.h:26
ReturnCode
Describes the possible return codes of filter processing:
Definition: filteraction.h:45
The filter dialog.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Oct 1 2023 04:00:19 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.