Mailcommon

filterconverttosieve.cpp
1/*
2 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "filterconverttosieve.h"
8#include "filter/mailfilter.h"
9#include "filterconverttosieveresultdialog.h"
10
11#include <QPointer>
12
13using namespace MailCommon;
14
15FilterConvertToSieve::FilterConvertToSieve(const QList<MailFilter *> &filters)
16 : mListFilters(filters)
17{
18}
19
20FilterConvertToSieve::~FilterConvertToSieve() = default;
21
22void FilterConvertToSieve::convert()
23{
24 QString result;
25 if (!mListFilters.isEmpty()) {
26 QStringList requiresModule;
27 QString code;
28 for (MailFilter *filter : std::as_const(mListFilters)) {
29 filter->generateSieveScript(requiresModule, code);
30 code += QLatin1Char('\n');
31 }
32 QString requireStr;
33 for (const QString &require : std::as_const(requiresModule)) {
34 requireStr += QStringLiteral("require \"%1\";").arg(require);
35 requireStr += QLatin1Char('\n');
36 }
37 result = requireStr + code;
38 }
39 FilterConvertToSieveResultDialog dlg;
40 dlg.setCode(result);
41 dlg.exec();
42}
The MailFilter class.
Definition mailfilter.h:29
The filter dialog.
virtual int exec()
QString arg(Args &&... args) const const
QFuture< void > filter(QThreadPool *pool, Sequence &sequence, KeepFunctor &&filterFunction)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.