File indexing completed on 2025-02-16 04:55:56

0001 /*
0002    SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "sieveaction.h"
0008 #include "libksieveui_debug.h"
0009 
0010 #include <KLocalizedString>
0011 
0012 #include "autocreatescripts/sieveeditorgraphicalmodewidget.h"
0013 #include <QWidget>
0014 #include <QXmlStreamReader>
0015 
0016 using namespace KSieveUi;
0017 
0018 SieveAction::SieveAction(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, const QString &name, const QString &label, QObject *parent)
0019     : SieveCommonActionCondition(sieveGraphicalModeWidget, name, label, parent)
0020 {
0021 }
0022 
0023 SieveAction::~SieveAction() = default;
0024 
0025 QStringList SieveAction::listOfIncludeFile() const
0026 {
0027     if (mSieveGraphicalModeWidget) {
0028         return mSieveGraphicalModeWidget->listOfIncludeFile();
0029     }
0030     qCWarning(LIBKSIEVEUI_LOG) << "SieveAction::listOfIncludeFile Problem during initialize mSieveGraphicalModeWidget ";
0031     return {};
0032 }
0033 
0034 void SieveAction::setParamWidgetValue(QXmlStreamReader &n, QWidget *, QString &)
0035 {
0036     n.skipCurrentElement();
0037 }
0038 void SieveAction::unknownTag(const QStringView &tag, QString &error)
0039 {
0040     const QString result = tag.toString();
0041     error += i18n("An unknown tag \"%1\" was found during parsing action \"%2\".", result, name()) + QLatin1Char('\n');
0042 }
0043 
0044 void SieveAction::tooManyArguments(const QStringView &tagName, int index, int maxValue, QString &error)
0045 {
0046     const QString result = tagName.toString();
0047 
0048     error += i18n("Too many arguments found for \"%1\", max value is %2, number of value found %3 for %4", name(), maxValue, index, result) + QLatin1Char('\n');
0049 }
0050 
0051 void SieveAction::unknownTagValue(const QString &tagValue, QString &error)
0052 {
0053     error += i18n("An unknown tag value \"%1\" was found during parsing action \"%2\".", tagValue, name()) + QLatin1Char('\n');
0054 }
0055 
0056 void SieveAction::serverDoesNotSupportFeatures(const QString &feature, QString &error)
0057 {
0058     error += i18n("A feature \"%1\" in condition \"%2\" is not supported by server", feature, name()) + QLatin1Char('\n');
0059 }
0060 
0061 #include "moc_sieveaction.cpp"