Libksieve

sievecommonactioncondition.cpp
1/*
2 SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6#include "sievecommonactioncondition.h"
7#include "libksieveui_debug.h"
8
9#include <KLocalizedString>
10
11#include "autocreatescripts/sieveeditorgraphicalmodewidget.h"
12#include <QUrl>
13#include <QWidget>
14
15using namespace KSieveUi;
16
17SieveCommonActionCondition::SieveCommonActionCondition(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget,
18 const QString &name,
19 const QString &label,
20 QObject *parent)
21 : QObject(parent)
22 , mSieveGraphicalModeWidget(sieveGraphicalModeWidget)
23 , mName(name)
24 , mLabel(label)
25{
26}
27
28SieveCommonActionCondition::~SieveCommonActionCondition() = default;
29
30QWidget *SieveCommonActionCondition::createParamWidget(QWidget *parent) const
31{
32 return new QWidget(parent);
33}
34
35KSieveCore::SieveImapAccountSettings SieveCommonActionCondition::sieveImapAccountSettings() const
36{
37 if (mSieveGraphicalModeWidget) {
38 return mSieveGraphicalModeWidget->sieveImapAccountSettings();
39 }
40 qCWarning(LIBKSIEVEUI_LOG) << "SieveCommonActionCondition::sieveImapAccountSettings Problem during initialize mSieveGraphicalModeWidget ";
41 return {};
42}
43
44QStringList SieveCommonActionCondition::sieveCapabilities() const
45{
46 if (mSieveGraphicalModeWidget) {
47 return mSieveGraphicalModeWidget->sieveCapabilities();
48 }
49 qCWarning(LIBKSIEVEUI_LOG) << "SieveCommonActionCondition::sieveCapabilities Problem during initialize mSieveGraphicalModeWidget ";
50 return {};
51}
52
53QString SieveCommonActionCondition::name() const
54{
55 return mName;
56}
57
58QString SieveCommonActionCondition::label() const
59{
60 return mLabel;
61}
62
63QString SieveCommonActionCondition::code(QWidget *) const
64{
65 return {};
66}
67
68QStringList SieveCommonActionCondition::needRequires(QWidget *parent) const
69{
70 Q_UNUSED(parent)
71 return {};
72}
73
74bool SieveCommonActionCondition::needCheckIfServerHasCapability() const
75{
76 return false;
77}
78
79QString SieveCommonActionCondition::serverNeedsCapability() const
80{
81 return {};
82}
83
84QString SieveCommonActionCondition::help() const
85{
86 return {};
87}
88
89QString SieveCommonActionCondition::comment() const
90{
91 return mComment;
92}
93
94void SieveCommonActionCondition::setComment(const QString &comment)
95{
96 mComment = comment;
97}
98
99void SieveCommonActionCondition::unknownTagValue(const QString &tagValue, QString &error)
100{
101 error += i18n("An unknown tag value \"%1\" was found during parsing action \"%2\".", tagValue, name()) + QLatin1Char('\n');
102}
103void SieveCommonActionCondition::unknownTag(const QStringView &tag, QString &error)
104{
105 const QString result = tag.toString();
106 error += i18n("An unknown tag \"%1\" was found during parsing action \"%2\".", result, name()) + QLatin1Char('\n');
107}
108
109void SieveCommonActionCondition::tooManyArguments(const QStringView &tagName, int index, int maxValue, QString &error)
110{
111 const QString result = tagName.toString();
112 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');
113}
114
115void SieveCommonActionCondition::serverDoesNotSupportFeatures(const QString &feature, QString &error)
116{
117 error += i18n("A feature \"%1\" in condition \"%2\" is not supported by server", feature, name()) + QLatin1Char('\n');
118}
119
120QUrl SieveCommonActionCondition::href() const
121{
122 return {};
123}
124
125#include "moc_sievecommonactioncondition.cpp"
The SieveImapAccountSettings class.
QString i18n(const char *text, const TYPE &arg...)
void error(QWidget *parent, const QString &text, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
QString name(StandardAction id)
QString label(StandardShortcut id)
QObject * parent() const const
QString toString() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:14:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.