Libksieve

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

KDE's Doxygen guidelines are available online.