File indexing completed on 2024-09-22 04:50:01

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 "filteractionwithurl.h"
0011 #include <QList>
0012 class QTemporaryFile;
0013 
0014 namespace MailCommon
0015 {
0016 class FilterActionWithCommand : public FilterActionWithUrl
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     /**
0022      * @copydoc FilterAction::FilterAction
0023      */
0024     FilterActionWithCommand(const QString &name, const QString &label, QObject *parent = nullptr);
0025 
0026     /**
0027      * @copydoc FilterAction::createParamWidget
0028      */
0029     QWidget *createParamWidget(QWidget *parent) const override;
0030 
0031     /**
0032      * @copydoc FilterAction::applyParamWidgetValue
0033      */
0034     void applyParamWidgetValue(QWidget *paramWidget) override;
0035 
0036     /**
0037      * @copydoc FilterAction::setParamWidgetValue
0038      */
0039     void setParamWidgetValue(QWidget *paramWidget) const override;
0040 
0041     /**
0042      * @copydoc FilterAction::clearParamWidget
0043      */
0044     void clearParamWidget(QWidget *paramWidget) const override;
0045 
0046     /**
0047      * Substitutes various placeholders for data from the message
0048      * resp. for filenames containing that data. Currently, only %n is
0049      * supported, where n in an integer >= 0. %n gets substituted for
0050      * the name of a tempfile holding the n'th message part, with n=0
0051      * meaning the body of the message.
0052      */
0053     [[nodiscard]] virtual QString substituteCommandLineArgsFor(const KMime::Message::Ptr &aMsg, QList<QTemporaryFile *> &aTempFileList) const;
0054 
0055     [[nodiscard]] virtual ReturnCode genericProcess(ItemContext &context, bool filtering) const;
0056 };
0057 }