diff --git a/kioslave/doc/sieve/index.docbook b/kioslave/doc/sieve/index.docbook
index d269a68..976e4a8 100644
--- a/kioslave/doc/sieve/index.docbook
+++ b/kioslave/doc/sieve/index.docbook
@@ -1,30 +1,30 @@
]>
sieve
DanielBlack
daniel.subs@internode.on.net
2009-11-05
Sieve is a protocol that is used to manage filters for email.
The filters are stored and run on the email server.
-IETF
+IETF
RF5228 provides more information.
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactionaddheader.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactionaddheader.cpp
index 8d960f1..2e266bf 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactionaddheader.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactionaddheader.cpp
@@ -1,131 +1,131 @@
/*
Copyright (C) 2013-2018 Laurent Montel
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "sieveactionaddheader.h"
#include "autocreatescripts/autocreatescriptutil_p.h"
#include "widgets/selectaddheaderpositioncombobox.h"
#include
#include
#include
#include
#include
#include "libksieve_debug.h"
#include
using namespace KSieveUi;
SieveActionAddHeader::SieveActionAddHeader(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QObject *parent)
: SieveActionAbstractEditHeader(sieveGraphicalModeWidget, QStringLiteral("addheader"), i18n("Add header"), parent)
{
}
QWidget *SieveActionAddHeader::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QGridLayout *grid = new QGridLayout;
grid->setMargin(0);
w->setLayout(grid);
SelectAddHeaderPositionCombobox *combo = new SelectAddHeaderPositionCombobox;
combo->setObjectName(QStringLiteral("selectposition"));
connect(combo, &SelectAddHeaderPositionCombobox::valueChanged, this, &SieveActionAddHeader::valueChanged);
grid->addWidget(combo, 0, 0);
QLabel *lab = new QLabel(i18n("header:"));
grid->addWidget(lab, 0, 1);
QLineEdit *headerEdit = new QLineEdit;
connect(headerEdit, &QLineEdit::textChanged, this, &SieveActionAddHeader::valueChanged);
headerEdit->setObjectName(QStringLiteral("headeredit"));
grid->addWidget(headerEdit, 0, 2);
lab = new QLabel(i18n("value:"));
grid->addWidget(lab, 1, 1);
QLineEdit *valueEdit = new QLineEdit;
connect(valueEdit, &QLineEdit::textChanged, this, &SieveActionAddHeader::valueChanged);
valueEdit->setObjectName(QStringLiteral("valueedit"));
grid->addWidget(valueEdit, 1, 2);
return w;
}
bool SieveActionAddHeader::setParamWidgetValue(QXmlStreamReader &element, QWidget *w, QString &error)
{
int index = 0;
while (element.readNextStartElement()) {
const QStringRef tagName = element.name();
if (tagName == QLatin1String("tag")) {
SelectAddHeaderPositionCombobox *combo = w->findChild(QStringLiteral("selectposition"));
combo->setCode(AutoCreateScriptUtil::tagValue(element.readElementText()), name(), error);
} else if (tagName == QLatin1String("str")) {
if (index == 0) {
QLineEdit *edit = w->findChild(QStringLiteral("headeredit"));
edit->setText(element.readElementText());
} else if (index == 1) {
QLineEdit *value = w->findChild(QStringLiteral("valueedit"));
value->setText(AutoCreateScriptUtil::quoteStr(element.readElementText()));
} else {
tooManyArgument(tagName, index, 2, error);
qCDebug(LIBKSIEVE_LOG) << " SieveActionAddHeader::setParamWidgetValue too many argument :" << index;
}
++index;
} else if (tagName == QLatin1String("crlf")) {
element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
element.skipCurrentElement();
//implement in the future ?
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << "SieveActionAddHeader::setParamWidgetValue unknown tag " << tagName;
}
}
return true;
}
QString SieveActionAddHeader::code(QWidget *w) const
{
const SelectAddHeaderPositionCombobox *combo = w->findChild(QStringLiteral("selectposition"));
const QString position = combo->code();
const QLineEdit *edit = w->findChild(QStringLiteral("headeredit"));
const QString headerStr = edit->text();
const QLineEdit *value = w->findChild(QStringLiteral("valueedit"));
const QString valueStr = value->text();
if (position.isEmpty()) {
return QStringLiteral("addheader \"%1\" \"%2\";").arg(headerStr, valueStr);
} else {
return QStringLiteral("addheader %1 \"%2\" \"%3\";").arg(position, headerStr, valueStr);
}
}
QString SieveActionAddHeader::help() const
{
return i18n("The addheader action adds a header field to the existing message header.");
}
QUrl SieveActionAddHeader::href() const
{
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5293"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5293"));
}
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactionconvert.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactionconvert.cpp
index 01e67f0..c0e71e4 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactionconvert.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactionconvert.cpp
@@ -1,149 +1,149 @@
/*
Copyright (C) 2013-2018 Laurent Montel
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "sieveactionconvert.h"
#include "autocreatescripts/autocreatescriptutil_p.h"
#include "autocreatescripts/commonwidgets/selectconvertparameterwidget.h"
#include "autocreatescripts/commonwidgets/selectmimetypecombobox.h"
#include
#include
#include "libksieve_debug.h"
#include
#include
using namespace KSieveUi;
SieveActionConvert::SieveActionConvert(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QObject *parent)
: SieveAction(sieveGraphicalModeWidget, QStringLiteral("convert"), i18n("Convert"), parent)
{
}
QWidget *SieveActionConvert::createParamWidget(QWidget *parent) const
{
QWidget *w = new QWidget(parent);
QGridLayout *lay = new QGridLayout;
lay->setMargin(0);
w->setLayout(lay);
QLabel *lab = new QLabel(i18n("From:"));
lay->addWidget(lab, 0, 0);
SelectMimeTypeComboBox *fromMimeType = new SelectMimeTypeComboBox;
connect(fromMimeType, &SelectMimeTypeComboBox::valueChanged, this, &SieveActionConvert::valueChanged);
fromMimeType->setObjectName(QStringLiteral("from"));
lay->addWidget(fromMimeType, 0, 1);
lab = new QLabel(i18n("To:"));
lay->addWidget(lab, 0, 2);
SelectMimeTypeComboBox *toMimeType = new SelectMimeTypeComboBox;
connect(toMimeType, &SelectMimeTypeComboBox::valueChanged, this, &SieveActionConvert::valueChanged);
toMimeType->setObjectName(QStringLiteral("to"));
lay->addWidget(toMimeType, 0, 3);
lab = new QLabel(i18n("Parameters:"));
lay->addWidget(lab, 1, 0);
SelectConvertParameterWidget *params = new SelectConvertParameterWidget;
connect(params, &SelectConvertParameterWidget::valueChanged, this, &SieveActionConvert::valueChanged);
params->setObjectName(QStringLiteral("params"));
lay->addWidget(params, 1, 1, 2, 3);
return w;
}
bool SieveActionConvert::setParamWidgetValue(QXmlStreamReader &element, QWidget *w, QString &error)
{
int index = 0;
while (element.readNextStartElement()) {
const QStringRef tagName = element.name();
if (tagName == QLatin1String("str")) {
if (index == 0) {
SelectMimeTypeComboBox *fromMimeType = w->findChild(QStringLiteral("from"));
fromMimeType->setCode(element.readElementText(), name(), error);
} else if (index == 1) {
SelectMimeTypeComboBox *toMimeType = w->findChild(QStringLiteral("to"));
toMimeType->setCode(element.readElementText(), name(), error);
} else {
tooManyArgument(tagName, index, 2, error);
qCDebug(LIBKSIEVE_LOG) << " SieveActionConvert::setParamWidgetValue too many argument :" << index;
}
++index;
} else if (tagName == QLatin1String("list")) {
SelectConvertParameterWidget *params = w->findChild(QStringLiteral("params"));
params->setCode(AutoCreateScriptUtil::listValue(element), error);
} else if (tagName == QLatin1String("crlf")) {
element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
element.skipCurrentElement();
//implement in the future ?
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << "SieveActionConvert::setParamWidgetValue unknown tag " << tagName;
}
}
return true;
}
QString SieveActionConvert::code(QWidget *w) const
{
QString result = QStringLiteral("convert ");
const SelectMimeTypeComboBox *fromMimeType = w->findChild(QStringLiteral("from"));
const QString fromMimeTypeStr = fromMimeType->code();
result += QStringLiteral("%1 ").arg(fromMimeTypeStr);
const SelectMimeTypeComboBox *toMimeType = w->findChild(QStringLiteral("to"));
const QString toMimeTypeStr = toMimeType->code();
result += QStringLiteral("%1 ").arg(toMimeTypeStr);
const SelectConvertParameterWidget *params = w->findChild(QStringLiteral("params"));
const QString paramsStr = params->code();
if (!paramsStr.isEmpty()) {
result += paramsStr;
}
result += QLatin1Char(';');
return result;
}
QStringList SieveActionConvert::needRequires(QWidget *) const
{
return QStringList() << QStringLiteral("convert");
}
bool SieveActionConvert::needCheckIfServerHasCapability() const
{
return true;
}
QString SieveActionConvert::serverNeedsCapability() const
{
return QStringLiteral("convert");
}
QString SieveActionConvert::help() const
{
return i18n("The \"convert\" action specifies that all body parts with a media type equal to \"media-type\" be converted to the media type in \"media-type\" using conversion parameters.");
}
QUrl SieveActionConvert::href() const
{
- return QUrl(QStringLiteral("http://tools.ietf.org/html/draft-ietf-sieve-convert-06"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/draft-ietf-sieve-convert-06"));
}
diff --git a/src/ksieveui/autocreatescripts/sieveincludewidget.cpp b/src/ksieveui/autocreatescripts/sieveincludewidget.cpp
index d12e1ed..8f6b414 100644
--- a/src/ksieveui/autocreatescripts/sieveincludewidget.cpp
+++ b/src/ksieveui/autocreatescripts/sieveincludewidget.cpp
@@ -1,362 +1,362 @@
/*
Copyright (C) 2013-2018 Laurent Montel
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "sieveincludewidget.h"
#include "sievescriptblockwidget.h"
#include "autocreatescriptutil_p.h"
#include "commonwidgets/sievehelpbutton.h"
#include "autocreatescripts/autocreatescriptutil_p.h"
#include "editor/sieveeditorutil.h"
#include "widgets/includefilelineedit.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include "libksieve_debug.h"
using namespace KSieveUi;
static const int MINIMUMINCLUDEACTION = 1;
static const int MAXIMUMINCLUDEACTION = 20;
SieveIncludeLocation::SieveIncludeLocation(QWidget *parent)
: KComboBox(parent)
{
initialize();
connect(this, QOverload::of(&SieveIncludeLocation::activated), this, &SieveIncludeLocation::valueChanged);
}
SieveIncludeLocation::~SieveIncludeLocation()
{
}
void SieveIncludeLocation::initialize()
{
addItem(i18n("personal"), QStringLiteral(":personal"));
addItem(i18n("global"), QStringLiteral(":global"));
}
QString SieveIncludeLocation::code() const
{
return itemData(currentIndex()).toString();
}
void SieveIncludeLocation::setCode(const QString &code, QString &error)
{
const int index = findData(code);
if (index != -1) {
setCurrentIndex(index);
} else {
error += i18n("Unknown location type \"%1\" during parsing includes", code) + QLatin1Char('\n');
setCurrentIndex(0);
}
}
SieveIncludeActionWidget::SieveIncludeActionWidget(QWidget *parent)
: QWidget(parent)
{
initWidget();
}
SieveIncludeActionWidget::~SieveIncludeActionWidget()
{
}
void SieveIncludeActionWidget::clear()
{
mOptional->setChecked(false);
mOnce->setChecked(false);
mLocation->setCurrentIndex(0);
mIncludeFileName->clear();
}
void SieveIncludeActionWidget::setListOfIncludeFile(const QStringList &listOfIncludeFile)
{
mIncludeFileName->setListOfIncludeFile(listOfIncludeFile);
}
void SieveIncludeActionWidget::loadScript(QXmlStreamReader &element, QString &error)
{
while (element.readNextStartElement()) {
const QStringRef tagName = element.name();
if (tagName == QLatin1String("tag")) {
const QString tagValue = element.readElementText();
if (tagValue == QLatin1String("personal")
|| tagValue == QLatin1String("global")) {
mLocation->setCode(AutoCreateScriptUtil::tagValue(tagValue), error);
} else if (tagValue == QLatin1String("optional")) {
mOptional->setChecked(true);
} else if (tagValue == QLatin1String("once")) {
mOnce->setChecked(true);
} else {
qCDebug(LIBKSIEVE_LOG) << " SieveIncludeActionWidget::loadScript unknown tagValue " << tagValue;
}
} else if (tagName == QLatin1String("str")) {
mIncludeFileName->setText(element.readElementText());
} else {
qCDebug(LIBKSIEVE_LOG) << " SieveIncludeActionWidget::loadScript unknown tagName " << tagName;
}
}
}
void SieveIncludeActionWidget::generatedScript(QString &script)
{
const QString includeName = mIncludeFileName->text();
if (includeName.trimmed().isEmpty()) {
return;
}
script += QLatin1String("include ");
script += mLocation->code() + QLatin1Char(' ');
if (mOptional->isChecked()) {
script += QLatin1String(":optional ");
}
if (mOnce->isChecked()) {
script += QLatin1String(":once ");
}
script += QStringLiteral("\"%1\";\n").arg(includeName);
}
void SieveIncludeActionWidget::initWidget()
{
mLayout = new QGridLayout(this);
mLayout->setContentsMargins(0, 0, 0, 0);
QLabel *lab = new QLabel(i18n("Include:"));
mLayout->addWidget(lab, 1, 0);
mLocation = new SieveIncludeLocation(this);
connect(mLocation, &SieveIncludeLocation::valueChanged, this, &SieveIncludeActionWidget::valueChanged);
mLayout->addWidget(mLocation, 1, 1);
lab = new QLabel(i18n("Name:"));
mLayout->addWidget(lab, 1, 2);
mIncludeFileName = new IncludeFileLineEdit(this);
mIncludeFileName->setClearButtonEnabled(true);
connect(mIncludeFileName, &QLineEdit::textChanged, this, &SieveIncludeActionWidget::valueChanged);
mLayout->addWidget(mIncludeFileName, 1, 3);
mOptional = new QCheckBox(i18n("Optional"));
connect(mOptional, &QCheckBox::toggled, this, &SieveIncludeActionWidget::valueChanged);
mLayout->addWidget(mOptional, 1, 4);
mOnce = new QCheckBox(i18n("Once"));
connect(mOnce, &QCheckBox::toggled, this, &SieveIncludeActionWidget::valueChanged);
mLayout->addWidget(mOnce, 1, 5);
mAdd = new QPushButton(this);
mAdd->setIcon(QIcon::fromTheme(QStringLiteral("list-add")));
mAdd->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
mRemove = new QPushButton(this);
mRemove->setIcon(QIcon::fromTheme(QStringLiteral("list-remove")));
mRemove->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
mLayout->addWidget(mAdd, 1, 6);
mLayout->addWidget(mRemove, 1, 7);
connect(mAdd, &QPushButton::clicked, this, &SieveIncludeActionWidget::slotAddWidget);
connect(mRemove, &QPushButton::clicked, this, &SieveIncludeActionWidget::slotRemoveWidget);
}
void SieveIncludeActionWidget::slotAddWidget()
{
Q_EMIT valueChanged();
Q_EMIT addWidget(this);
}
void SieveIncludeActionWidget::slotRemoveWidget()
{
Q_EMIT valueChanged();
Q_EMIT removeWidget(this);
}
bool SieveIncludeActionWidget::isInitialized() const
{
return !mIncludeFileName->text().isEmpty();
}
void SieveIncludeActionWidget::updateAddRemoveButton(bool addButtonEnabled, bool removeButtonEnabled)
{
mAdd->setEnabled(addButtonEnabled);
mRemove->setEnabled(removeButtonEnabled);
}
SieveIncludeWidget::SieveIncludeWidget(QWidget *parent)
: SieveWidgetPageAbstract(parent)
{
QVBoxLayout *lay = new QVBoxLayout(this);
mHelpButton = new SieveHelpButton(this);
lay->addWidget(mHelpButton);
connect(mHelpButton, &SieveHelpButton::clicked, this, &SieveIncludeWidget::slotHelp);
mIncludeLister = new SieveIncludeWidgetLister(this);
connect(mIncludeLister, &SieveIncludeWidgetLister::valueChanged, this, &SieveIncludeWidget::valueChanged);
lay->addWidget(mIncludeLister, 0, Qt::AlignTop);
setPageType(KSieveUi::SieveScriptBlockWidget::Include);
}
SieveIncludeWidget::~SieveIncludeWidget()
{
}
void SieveIncludeWidget::setListOfIncludeFile(const QStringList &lst)
{
mIncludeLister->setListOfIncludeFile(lst);
}
void SieveIncludeWidget::slotHelp()
{
const QString help = i18n(
"The \"include\" command takes an optional \"location\" parameter, an optional \":once\" parameter, an optional \":optional\" parameter, and a single string argument representing the name of the script to include for processing at that point.");
- const QString href = QStringLiteral("http://tools.ietf.org/html/rfc6609#page-4");
+ const QString href = QStringLiteral("https://tools.ietf.org/html/rfc6609#page-4");
const QString fullWhatsThis = AutoCreateScriptUtil::createFullWhatsThis(help, href);
QWhatsThis::showText(QCursor::pos(), fullWhatsThis, mHelpButton);
}
void SieveIncludeWidget::generatedScript(QString &script, QStringList &requireModules, bool inForEveryPartLoop)
{
Q_UNUSED(inForEveryPartLoop);
QString result;
QStringList lst;
mIncludeLister->generatedScript(result, lst);
if (!result.isEmpty()) {
script += result;
requireModules << lst;
}
}
void SieveIncludeWidget::loadScript(QXmlStreamReader &element, QString &error)
{
mIncludeLister->loadScript(element, error);
}
SieveIncludeWidgetLister::SieveIncludeWidgetLister(QWidget *parent)
: KPIM::KWidgetLister(false, MINIMUMINCLUDEACTION, MAXIMUMINCLUDEACTION, parent)
{
slotClear();
updateAddRemoveButton();
}
SieveIncludeWidgetLister::~SieveIncludeWidgetLister()
{
}
void SieveIncludeWidgetLister::slotAddWidget(QWidget *w)
{
addWidgetAfterThisWidget(w);
updateAddRemoveButton();
}
void SieveIncludeWidgetLister::slotRemoveWidget(QWidget *w)
{
removeWidget(w);
updateAddRemoveButton();
}
void SieveIncludeWidgetLister::updateAddRemoveButton()
{
QList widgetList = widgets();
const int numberOfWidget(widgetList.count());
bool addButtonEnabled = false;
bool removeButtonEnabled = false;
if (numberOfWidget <= widgetsMinimum()) {
addButtonEnabled = true;
removeButtonEnabled = false;
} else if (numberOfWidget >= widgetsMaximum()) {
addButtonEnabled = false;
removeButtonEnabled = true;
} else {
addButtonEnabled = true;
removeButtonEnabled = true;
}
QList::ConstIterator wIt = widgetList.constBegin();
QList::ConstIterator wEnd = widgetList.constEnd();
for (; wIt != wEnd; ++wIt) {
SieveIncludeActionWidget *w = qobject_cast(*wIt);
w->updateAddRemoveButton(addButtonEnabled, removeButtonEnabled);
}
}
void SieveIncludeWidgetLister::setListOfIncludeFile(const QStringList &listOfIncludeFile)
{
mListOfIncludeFile = listOfIncludeFile;
//Update all lineedit
const QList widgetList = widgets();
QList::ConstIterator wIt = widgetList.constBegin();
QList::ConstIterator wEnd = widgetList.constEnd();
for (; wIt != wEnd; ++wIt) {
SieveIncludeActionWidget *w = qobject_cast(*wIt);
w->setListOfIncludeFile(mListOfIncludeFile);
}
}
void SieveIncludeWidgetLister::generatedScript(QString &script, QStringList &requireModules)
{
requireModules << QStringLiteral("include");
const QList widgetList = widgets();
QList::ConstIterator wIt = widgetList.constBegin();
QList::ConstIterator wEnd = widgetList.constEnd();
for (; wIt != wEnd; ++wIt) {
SieveIncludeActionWidget *w = qobject_cast(*wIt);
w->generatedScript(script);
}
}
void SieveIncludeWidgetLister::reconnectWidget(SieveIncludeActionWidget *w)
{
connect(w, &SieveIncludeActionWidget::addWidget, this, &SieveIncludeWidgetLister::slotAddWidget, Qt::UniqueConnection);
connect(w, &SieveIncludeActionWidget::removeWidget, this, &SieveIncludeWidgetLister::slotRemoveWidget, Qt::UniqueConnection);
connect(w, &SieveIncludeActionWidget::valueChanged, this, &SieveIncludeWidgetLister::valueChanged, Qt::UniqueConnection);
}
void SieveIncludeWidgetLister::clearWidget(QWidget *aWidget)
{
if (aWidget) {
SieveIncludeActionWidget *widget = static_cast(aWidget);
widget->clear();
}
Q_EMIT valueChanged();
}
QWidget *SieveIncludeWidgetLister::createWidget(QWidget *parent)
{
SieveIncludeActionWidget *w = new SieveIncludeActionWidget(parent);
w->setListOfIncludeFile(mListOfIncludeFile);
reconnectWidget(w);
return w;
}
void SieveIncludeWidgetLister::loadScript(QXmlStreamReader &element, QString &error)
{
if (widgets().count() == MAXIMUMINCLUDEACTION) {
error += QLatin1Char('\n') + i18n("We can not add more includes elements.") + QLatin1Char('\n');
return;
}
SieveIncludeActionWidget *w = static_cast(widgets().constLast());
if (w->isInitialized()) {
addWidgetAfterThisWidget(widgets().constLast());
w = static_cast(widgets().constLast());
}
w->loadScript(element, error);
}
diff --git a/src/ksieveui/editor/sieveeditorutil.cpp b/src/ksieveui/editor/sieveeditorutil.cpp
index 5e0deb8..f463cb4 100644
--- a/src/ksieveui/editor/sieveeditorutil.cpp
+++ b/src/ksieveui/editor/sieveeditorutil.cpp
@@ -1,235 +1,235 @@
/*
Copyright (C) 2013-2018 Laurent Montel
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "sieveeditorutil.h"
QUrl KSieveUi::SieveEditorUtil::helpUrl(KSieveUi::SieveEditorUtil::HelpVariableName type)
{
switch (type) {
case AddressCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5228#page-16"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5228#page-16"));
case BodyCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5173"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5173"));
case ConvertCondition:
return QUrl(); //TODO
case CurrentdateCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5260#page-6"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5260#page-6"));
case DateCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5260#page-4"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5260#page-4"));
case EnvelopeCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-24"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-24"));
case EnvironmentCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5183"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5183"));
case ExistsCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-25"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-25"));
case FalseCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-25"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-25"));
case HasflagCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5232#page-5"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5232#page-5"));
case HeaderCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5228#page-9"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5228#page-9"));
case IhaveCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5463"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5463"));
case MailboxexistsCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5490#page-2"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5490#page-2"));
case MetadataexistsCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5490#page-6"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5490#page-6"));
case MetadataCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5490#page-5"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5490#page-5"));
case ServermetadataexistsCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5490#page-4"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5490#page-4"));
case ServermetadataCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5490#page-5"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5490#page-5"));
case SizeCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-26"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-26"));
case SpamtestCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3685#page-3"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3685#page-3"));
case TrueCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-26"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-26"));
case NotCondition:
return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-26"));
case AnyOf:
return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-24"));
case Allof:
return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-23"));
case VirustestCondition:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3685#page-4"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3685#page-4"));
case AbstracteditheaderAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5228#page-9"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5228#page-9"));
case AddflagsAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5232#page-5"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5232#page-5"));
case AddheaderAction:
case DeleteheaderAction:
case EditHeaderExtension:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5293"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5293"));
case BreakAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5703#page-3"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5703#page-3"));
case ConvertAction:
return QUrl(); //TODO
case DiscardAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-22"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-22"));
case EncloseAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5703#page-10"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5703#page-10"));
case ExtracttextAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5703#page-11"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5703#page-11"));
case FileintoAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-20"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-20"));
case KeepAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-21"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-21"));
case NotifyAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5435#page-3"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5435#page-3"));
case RedirectAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-20"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-20"));
case RejectAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-20"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-20"));
case ERejectAction:
return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5429#section-2.1"));
case RemoveflagsAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5232#page-5"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5232#page-5"));
case ReplaceAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5703#page-8"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5703#page-8"));
case ReturnAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc6609#page-7"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc6609#page-7"));
case SetflagsAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5232#page-4"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5232#page-4"));
case SetvariableAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5229"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5229"));
case StopAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3028#page-19"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3028#page-19"));
case VacationAction:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5230#page-3"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5230#page-3"));
case GlobalVariable:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5229"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5229"));
case Includes:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc6609#page-4"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc6609#page-4"));
case ForEveryPart:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5703#page-3"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5703#page-3"));
case CopyExtension:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc3894"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc3894"));
case MBoxMetaDataExtension:
- return QUrl(QStringLiteral("http://tools.ietf.org/html/rfc5490#page-2"));
+ return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5490#page-2"));
case SubAddressExtension:
return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5233"));
case ImapFlagsExtension:
return QUrl(QStringLiteral("https://tools.ietf.org/html/rfc5232"));
case UnknownHelp:
break;
}
return QUrl();
}
KSieveUi::SieveEditorUtil::HelpVariableName KSieveUi::SieveEditorUtil::strToVariableName(const QString &str)
{
if (str == QLatin1String("address")) {
return AddressCondition;
} else if (str == QLatin1String("body")) {
return BodyCondition;
} else if (str == QLatin1String("currentdate")) {
return CurrentdateCondition;
} else if (str == QLatin1String("date")) {
return DateCondition;
} else if (str == QLatin1String("envelope")) {
return EnvelopeCondition;
} else if (str == QLatin1String("environment")) {
return EnvironmentCondition;
} else if (str == QLatin1String("exists")) {
return ExistsCondition;
} else if (str == QLatin1String("false")) {
return FalseCondition;
} else if (str == QLatin1String("hasflag")) {
return HasflagCondition;
} else if (str == QLatin1String("header")) {
return HeaderCondition;
} else if (str == QLatin1String("ihave")) {
return IhaveCondition;
} else if (str == QLatin1String("mailboxexists")) {
return MailboxexistsCondition;
} else if (str == QLatin1String("metadata")) {
return MetadataCondition;
} else if (str == QLatin1String("metadataexists")) {
return MetadataexistsCondition;
} else if (str == QLatin1String("servermetadata")) {
return ServermetadataCondition;
} else if (str == QLatin1String("servermetadataexists")) {
return ServermetadataexistsCondition;
} else if (str == QLatin1String("size")) {
return SizeCondition;
} else if (str == QLatin1String("spamtest")) {
return SpamtestCondition;
} else if (str == QLatin1String("true")) {
return TrueCondition;
} else if (str == QLatin1String("not")) {
return NotCondition;
} else if (str == QLatin1String("anyof")) {
return AnyOf;
} else if (str == QLatin1String("allof")) {
return Allof;
} else if (str == QLatin1String("virustest")) {
return VirustestCondition;
} else if (str == QLatin1String("break")) {
return BreakAction;
} else if (str == QLatin1String("convert")) {
return ConvertAction; //TODO
} else if (str == QLatin1String("discard")) {
return DiscardAction;
} else if (str == QLatin1String("enclose")) {
return EncloseAction;
} else if (str == QLatin1String("extracttext")) {
return ExtracttextAction;
} else if (str == QLatin1String("fileinto")) {
return FileintoAction;
} else if (str == QLatin1String("keep")) {
return KeepAction;
} else if (str == QLatin1String("notify")) {
return NotifyAction;
} else if (str == QLatin1String("redirect")) {
return RedirectAction;
} else if (str == QLatin1String("reject")) {
return RejectAction;
} else if (str == QLatin1String("ereject")) {
return ERejectAction;
} else if (str == QLatin1String("replace")) {
return ReplaceAction;
} else if (str == QLatin1String("return")) {
return ReturnAction;
} else if (str == QLatin1String("set")) {
return SetvariableAction;
} else if (str == QLatin1String("stop")) {
return StopAction;
} else if (str == QLatin1String("vacation")) {
return VacationAction;
} else if (str == QLatin1String("include")) {
return Includes;
} else if (str == QLatin1String("globalvariable")) {
return GlobalVariable;
} else if (str == QLatin1String("foreverypart")) {
return ForEveryPart;
} else if (str == QLatin1String("copy")) {
return CopyExtension;
} else if (str == QLatin1String("mboxmetadata")) {
return MBoxMetaDataExtension;
} else if (str == QLatin1String("subaddress")) {
return SubAddressExtension;
} else if (str == QLatin1String("imapflags")) {
return ImapFlagsExtension;
} else if (str == QLatin1String("editheader")) {
return EditHeaderExtension;
}
//TODO
return UnknownHelp;
}