File indexing completed on 2024-09-22 04:50:02
0001 /* 0002 * SPDX-FileCopyrightText: 1996-1998 Stefan Taferner <taferner@kde.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 * 0006 */ 0007 0008 #pragma once 0009 0010 #include "filteraction.h" 0011 0012 namespace MailCommon 0013 { 0014 /** 0015 * @short Abstract base class for filter actions with a free-form string as parameter. 0016 * 0017 * Abstract base class for mail filter actions that need a 0018 * free-form parameter, e.g. 'set transport' or 'set reply to'. Can 0019 * create a QLineEdit as parameter widget. A subclass of this 0020 * must provide at least implementations for the following methods: 0021 * 0022 * @li virtual FilterAction::ReturnCodes FilterAction::process 0023 * @li static FilterAction::newAction 0024 * 0025 * @author Marc Mutz <mutz@kde.org>, based upon work by Stefan Taferner <taferner@kde.org> 0026 * @see FilterAction Filter 0027 */ 0028 class FilterActionWithString : public FilterAction 0029 { 0030 Q_OBJECT 0031 public: 0032 /** 0033 * @copydoc FilterAction::FilterAction 0034 */ 0035 FilterActionWithString(const QString &name, const QString &label, QObject *parent = nullptr); 0036 0037 /** 0038 * @copydoc FilterAction::isEmpty 0039 */ 0040 [[nodiscard]] bool isEmpty() const override; 0041 0042 /** 0043 * @copydoc FilterAction::createParamWidget 0044 */ 0045 [[nodiscard]] QWidget *createParamWidget(QWidget *parent) const override; 0046 0047 /** 0048 * @copydoc FilterAction::applyParamWidgetValue 0049 */ 0050 void applyParamWidgetValue(QWidget *paramWidget) override; 0051 0052 /** 0053 * @copydoc FilterAction::setParamWidgetValue 0054 */ 0055 void setParamWidgetValue(QWidget *paramWidget) const override; 0056 0057 /** 0058 * @copydoc FilterAction::clearParamWidget 0059 */ 0060 void clearParamWidget(QWidget *paramWidget) const override; 0061 0062 /** 0063 * @copydoc FilterAction::argsFromString 0064 */ 0065 void argsFromString(const QString &argsStr) override; 0066 0067 /** 0068 * @copydoc FilterAction::argsAsString 0069 */ 0070 [[nodiscard]] QString argsAsString() const override; 0071 0072 /** 0073 * @copydoc FilterAction::displayString 0074 */ 0075 [[nodiscard]] QString displayString() const override; 0076 0077 protected: 0078 QString mParameter; 0079 }; 0080 }