File indexing completed on 2024-12-29 04:54:41

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 "sievecondition.h"
0008 #include "autocreatescripts/sieveeditorgraphicalmodewidget.h"
0009 
0010 #include <KLocalizedString>
0011 
0012 #include <QWidget>
0013 
0014 using namespace KSieveUi;
0015 
0016 SieveCondition::SieveCondition(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, const QString &name, const QString &label, QObject *parent)
0017     : SieveCommonActionCondition(sieveGraphicalModeWidget, name, label, parent)
0018 {
0019 }
0020 
0021 SieveCondition::~SieveCondition() = default;
0022 
0023 void SieveCondition::setParamWidgetValue(QXmlStreamReader & /*element*/, QWidget * /*parent*/, bool /*notCondition*/, QString & /*error*/)
0024 {
0025 }
0026 
0027 void SieveCondition::unknownTag(const QStringView &tag, QString &error)
0028 {
0029     const QString result = tag.toString();
0030 
0031     error += i18n("Unknown tag \"%1\" during parsing condition \"%2\"", result, name()) + QLatin1Char('\n');
0032 }
0033 
0034 void SieveCondition::tooManyArguments(const QStringView &tagName, int index, int maxValue, QString &error)
0035 {
0036     tooManyArguments(tagName.toString(), index, maxValue, error);
0037 }
0038 
0039 void SieveCondition::tooManyArguments(const QString &tagName, int index, int maxValue, QString &error)
0040 {
0041     error += i18n("Too many argument found for \"%1\", max value is %2, number of value found %3 for %4", name(), maxValue, (index + 1), tagName)
0042         + QLatin1Char('\n');
0043 }
0044 
0045 void SieveCondition::unknownTagValue(const QString &tagValue, QString &error)
0046 {
0047     error += i18n("An unknown tag value \"%1\" was found during parsing condition \"%2\".", tagValue, name()) + QLatin1Char('\n');
0048 }
0049 
0050 void SieveCondition::serverDoesNotSupportFeatures(const QString &feature, QString &error)
0051 {
0052     error += i18n("A feature \"%1\" in condition \"%2\" is not supported by server", feature, name()) + QLatin1Char('\n');
0053 }
0054 
0055 #include "moc_sievecondition.cpp"