Mailcommon

filteractionwithstring.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 "filteractionwithstring.h"
9 
10 #include <KLineEdit>
11 
12 using namespace MailCommon;
13 
15  : FilterAction(name, label, parent)
16 {
17 }
18 
20 {
21  return mParameter.trimmed().isEmpty();
22 }
23 
25 {
26  auto lineEdit = new KLineEdit(parent);
27  lineEdit->setClearButtonEnabled(true);
28  lineEdit->setObjectName(QLatin1StringView("lineedit"));
29  lineEdit->setTrapReturnKey(true);
30  lineEdit->setText(mParameter);
31 
33 
34  return lineEdit;
35 }
36 
38 {
39  mParameter = static_cast<KLineEdit *>(paramWidget)->text();
40 }
41 
43 {
44  static_cast<KLineEdit *>(paramWidget)->setText(mParameter);
45 }
46 
48 {
49  static_cast<KLineEdit *>(paramWidget)->clear();
50 }
51 
53 {
54  mParameter = argsStr;
55 }
56 
58 {
59  return mParameter;
60 }
61 
63 {
64  return label() + QLatin1String(" \"") + argsAsString().toHtmlEscaped() + QLatin1String("\"");
65 }
66 
67 #include "moc_filteractionwithstring.cpp"
QString displayString() const override
Returns a translated string describing this filter for visualization purposes, e.g.
QString toHtmlEscaped() const const
QString trimmed() const const
void clearParamWidget(QWidget *paramWidget) const override
The filter action shall clear it's parameter widget's contents.
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void argsFromString(const QString &argsStr) override
Read extra arguments from given string.
Abstract base class for mail filter actions.
Definition: filteraction.h:38
void textChanged(const QString &text)
QString label() const
Returns i18n'd label, ie.
bool isEmpty() const const
void filterActionModified()
Called to notify that the current FilterAction has had some value modification.
FilterActionWithString(const QString &name, const QString &label, QObject *parent=nullptr)
Creates a new filter action.
QString argsAsString() const override
Return extra arguments as string.
void applyParamWidgetValue(QWidget *paramWidget) override
The filter action shall set it's parameter from the widget's contents.
void setParamWidgetValue(QWidget *paramWidget) const override
The filter action shall set it's widget's contents from it's parameter.
QWidget * createParamWidget(QWidget *parent) const override
Creates a widget for setting the filter action parameter.
bool isEmpty() const override
Determines whether this action is valid.
QObject * parent() const const
The filter dialog.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Dec 8 2023 04:02:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.