summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-06-22 22:45:44 +0200
committerMontel Laurent <[email protected]>2017-06-22 22:45:44 +0200
commit3ea29c551efb6750f934f3cf71f8f7ea8ab476bb (patch)
treec00547fc593f196b178305bc2dce3c8e02537cb7
parent609bb85a18f54e75e4843c35585fa6f6598efd79 (diff)
Fix autotest 60 success now
-rw-r--r--src/ksieveui/autocreatescripts/autocreatescriptutil.cpp3
-rw-r--r--src/ksieveui/autocreatescripts/sieveactions/sieveactionabstractflags.cpp2
-rw-r--r--src/ksieveui/autocreatescripts/sieveactions/sieveactionaddheader.cpp2
-rw-r--r--src/ksieveui/autocreatescripts/sieveactions/sieveactionbreak.cpp7
-rw-r--r--src/ksieveui/autocreatescripts/sieveactions/sieveactionconvert.cpp2
-rw-r--r--src/ksieveui/autocreatescripts/sieveactions/sieveactiondeleteheader.cpp14
-rw-r--r--src/ksieveui/autocreatescripts/sieveactions/sieveactionenclose.cpp2
-rw-r--r--src/ksieveui/autocreatescripts/sieveactions/sieveactionereject.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveactions/sieveactionextracttext.cpp2
-rw-r--r--src/ksieveui/autocreatescripts/sieveactions/sieveactionfileinto.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveactions/sieveactionkeep.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveactions/sieveactionnotify.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveactions/sieveactionredirect.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveactions/sieveactionreject.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveactions/sieveactionreplace.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveactions/sieveactionsetvariable.cpp11
-rw-r--r--src/ksieveui/autocreatescripts/sieveactions/sieveactionvacation.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveactionwidgetlister.cpp6
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionaddress.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionbody.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionconvert.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditioncurrentdate.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditiondate.cpp45
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvelope.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvironment.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionexists.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionfalse.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionhasflag.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionheader.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionihave.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmailboxexists.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadata.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadataexists.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadata.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadataexists.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionsize.cpp3
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionspamtest.cpp29
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditiontrue.cpp1
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionvirustest.cpp27
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditionwidgetlister.cpp19
-rw-r--r--src/ksieveui/autocreatescripts/sievescriptblockwidget.cpp6
-rw-r--r--src/ksieveui/autocreatescripts/sievescriptlistbox.cpp255
42 files changed, 256 insertions, 204 deletions
diff --git a/src/ksieveui/autocreatescripts/autocreatescriptutil.cpp b/src/ksieveui/autocreatescripts/autocreatescriptutil.cpp
index f652c4b..7d817e5 100644
--- a/src/ksieveui/autocreatescripts/autocreatescriptutil.cpp
+++ b/src/ksieveui/autocreatescripts/autocreatescriptutil.cpp
@@ -25,6 +25,7 @@
#include <KPluginFactory>
#include <QStringList>
#include <QRegularExpression>
+#include <QDebug>
#include "autocreatescripts/sieveconditions/widgets/regexpeditorlineedit.h"
using namespace KSieveUi;
@@ -133,8 +134,10 @@ QString AutoCreateScriptUtil::tagValue(const QString &tag)
QString AutoCreateScriptUtil::strValue(QXmlStreamReader &node)
{
+ qDebug() << " QString AutoCreateScriptUtil::strValue(QXmlStreamReader &node)66666666666666666666666";
if (node.readNextStartElement()) {
const QStringRef textElementTagName = node.name();
+ qDebug() << "SSSSSSSSSSSSSSSSSSSSSSSSSSSSS QString AutoCreateScriptUtil::strValue(QXmlStreamReader &node)"<<textElementTagName;
if (textElementTagName == QLatin1String("str")) {
return node.readElementText();
}
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactionabstractflags.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactionabstractflags.cpp
index dff7f56..4e8d380 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactionabstractflags.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactionabstractflags.cpp
@@ -55,8 +55,10 @@ bool SieveActionAbstractFlags::setParamWidgetValue(QXmlStreamReader &element, QW
SelectFlagsWidget *flagsWidget = w->findChild<SelectFlagsWidget *>(QStringLiteral("flagswidget"));
flagsWidget->setFlags(QStringList() << element.readElementText());
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
+ element.skipCurrentElement();
//implement in the future ?
} else {
unknownTag(tagName, error);
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactionaddheader.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactionaddheader.cpp
index bafdcc4..79484fd 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactionaddheader.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactionaddheader.cpp
@@ -88,8 +88,10 @@ bool SieveActionAddHeader::setParamWidgetValue(QXmlStreamReader &element, QWidge
}
++index;
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
+ element.skipCurrentElement();
//implement in the future ?
} else {
unknownTag(tagName, error);
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactionbreak.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactionbreak.cpp
index 2cde6c6..ca72cf6 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactionbreak.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactionbreak.cpp
@@ -53,22 +53,29 @@ QWidget *SieveActionBreak::createParamWidget(QWidget *parent) const
bool SieveActionBreak::setParamWidgetValue(QXmlStreamReader &element, QWidget *w, QString &error)
{
+ qDebug() << " bool SieveActionBreak::setParamWidgetValue(QXmlStreamReader &element, QWidget *w, QString &error)";
while (element.readNextStartElement()) {
const QStringRef tagName = element.name();
+ qDebug() << " tagName " << tagName;
if (tagName == QLatin1String("tag")) {
const QString tagValue = element.readElementText();
+ qDebug() << " bool SieveActionBreak::setParamWidgetValue(QXmlStreamReader &element, QWidget *w, QString &error)"<<tagValue;
if (tagValue == QLatin1String("name")) {
QLineEdit *name = w->findChild<QLineEdit *>(QStringLiteral("name"));
name->setText(AutoCreateScriptUtil::strValue(element));
+ qDebug() << " NAME !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<name->text();
} else {
unknowTagValue(tagValue, error);
qCDebug(LIBKSIEVE_LOG) << " SieveActionBreak::setParamWidgetValue unknown tagValue " << tagValue;
}
} else if (tagName == QLatin1String("str")) {
+ element.skipCurrentElement();
//Nothing
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
+ element.skipCurrentElement();
//implement in the future ?
} else {
unknownTag(tagName, error);
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactionconvert.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactionconvert.cpp
index c1cda76..2f68610 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactionconvert.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactionconvert.cpp
@@ -89,8 +89,10 @@ bool SieveActionConvert::setParamWidgetValue(QXmlStreamReader &element, QWidget
SelectConvertParameterWidget *params = w->findChild<SelectConvertParameterWidget *>(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);
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactiondeleteheader.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactiondeleteheader.cpp
index d9149c2..a490d3a 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactiondeleteheader.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactiondeleteheader.cpp
@@ -73,12 +73,14 @@ bool SieveActionDeleteHeader::parseValue(QXmlStreamReader &element, QWidget *w,
while (element.readNextStartElement()) {
const QStringRef tagName = element.name();
if (tagName == QLatin1String("test")) {
-#ifdef FIXME_QDOMELEMENT
- const QDomNode testNode = e.toElement();
- const QString nameValue = e.attribute(QStringLiteral("name"), QString());
+ QString nameValue;
+ if (element.attributes().hasAttribute(QStringLiteral("name"))) {
+ nameValue = element.attributes().value(QStringLiteral("name")).toString();
+ }
const bool isNegative = (nameValue == QLatin1String("not"));
- return parseValue(element, w, error, isNegative);
-#endif
+ bool result = parseValue(element, w, error, isNegative);
+ element.skipCurrentElement();
+ return result;
} else if (tagName == QLatin1String("tag")) {
SelectMatchTypeComboBox *combo = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtype"));
combo->setCode(AutoCreateScriptUtil::tagValueWithCondition(element.readElementText(), isNegative), name(), error);
@@ -95,8 +97,10 @@ bool SieveActionDeleteHeader::parseValue(QXmlStreamReader &element, QWidget *w,
}
++index;
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
+ element.skipCurrentElement();
//implement in the future ?
} else {
unknownTag(tagName, error);
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactionenclose.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactionenclose.cpp
index 64394b1..8c4536b 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactionenclose.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactionenclose.cpp
@@ -95,8 +95,10 @@ bool SieveActionEnclose::setParamWidgetValue(QXmlStreamReader &element, QWidget
MultiLineEdit *edit = w->findChild<MultiLineEdit *>(QStringLiteral("text"));
edit->setPlainText(element.readElementText());
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
+ element.skipCurrentElement();
//implement in the future ?
} else {
unknownTag(tagName, error);
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactionereject.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactionereject.cpp
index 5612006..c75f3fb 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactionereject.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactionereject.cpp
@@ -59,6 +59,7 @@ bool SieveActionEReject::setParamWidgetValue(QXmlStreamReader &element, QWidget
MultiLineEdit *edit = w->findChild<MultiLineEdit *>(QStringLiteral("rejectmessage"));
edit->setPlainText(AutoCreateScriptUtil::quoteStr(tagValue));
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
//implement in the future ?
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactionextracttext.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactionextracttext.cpp
index 3dfd57d..51bbd0c 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactionextracttext.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactionextracttext.cpp
@@ -68,6 +68,7 @@ bool SieveActionExtractText::setParamWidgetValue(QXmlStreamReader &element, QWid
const QStringRef tagName = element.name();
if (tagName == QLatin1String("tag")) {
+ element.skipCurrentElement();
//TODO ?
} else if (tagName == QLatin1String("num")) {
QSpinBox *numberOfCharacters = w->findChild<QSpinBox *>(QStringLiteral("numberOfCharacters"));
@@ -76,6 +77,7 @@ bool SieveActionExtractText::setParamWidgetValue(QXmlStreamReader &element, QWid
QLineEdit *variableName = w->findChild<QLineEdit *>(QStringLiteral("variablename"));
variableName->setText(element.readElementText());
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
//implement in the future ?
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactionfileinto.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactionfileinto.cpp
index 3c885d2..b5e5d7e 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactionfileinto.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactionfileinto.cpp
@@ -90,6 +90,7 @@ bool SieveActionFileInto::setParamWidgetValue(QXmlStreamReader &element, QWidget
KSieveUi::AbstractMoveImapFolderWidget *edit = w->findChild<KSieveUi::AbstractMoveImapFolderWidget *>(QStringLiteral("fileintolineedit"));
edit->setText(AutoCreateScriptUtil::protectSlash(tagValue));
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
//implement in the future ?
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactionkeep.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactionkeep.cpp
index 8b972b4..e05a95e 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactionkeep.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactionkeep.cpp
@@ -91,6 +91,7 @@ bool SieveActionKeep::setParamWidgetValue(QXmlStreamReader &element, QWidget *w,
} else if (tagName == QLatin1String("tag") && element.readElementText() == QLatin1String("flags")) {
//nothing :)
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
//implement in the future ?
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactionnotify.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactionnotify.cpp
index 020cba0..fbaee75 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactionnotify.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactionnotify.cpp
@@ -90,6 +90,7 @@ bool SieveActionNotify::setParamWidgetValue(QXmlStreamReader &element, QWidget *
qCDebug(LIBKSIEVE_LOG) << " SieveActionNotify::setParamWidgetValue unknown tagValue" << tagValue;
}
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
//implement in the future ?
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactionredirect.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactionredirect.cpp
index a62d06e..b3466d9 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactionredirect.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactionredirect.cpp
@@ -93,6 +93,7 @@ bool SieveActionRedirect::setParamWidgetValue(QXmlStreamReader &element, QWidget
qCDebug(LIBKSIEVE_LOG) << " SieveActionRedirect::setParamWidgetValue tagValue unknown" << tagValue;
}
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
setComment(element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactionreject.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactionreject.cpp
index eb5d3a2..e319f2f 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactionreject.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactionreject.cpp
@@ -59,6 +59,7 @@ bool SieveActionReject::setParamWidgetValue(QXmlStreamReader &element, QWidget *
MultiLineEdit *edit = w->findChild<MultiLineEdit *>(QStringLiteral("rejectmessage"));
edit->setPlainText(AutoCreateScriptUtil::quoteStr(tagValue));
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
//implement in the future ?
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactionreplace.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactionreplace.cpp
index 30a0de0..032761b 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactionreplace.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactionreplace.cpp
@@ -95,6 +95,7 @@ bool SieveActionReplace::setParamWidgetValue(QXmlStreamReader &element, QWidget
qCDebug(LIBKSIEVE_LOG) << " SieveActionReplace::setParamWidgetValue unknown tagValue " << tagValue;
}
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
//implement in the future ?
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactionsetvariable.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactionsetvariable.cpp
index b3e1882..ebb0cef 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactionsetvariable.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactionsetvariable.cpp
@@ -89,19 +89,15 @@ bool SieveActionSetVariable::setParamWidgetValue(QXmlStreamReader &element, QWid
const QString tagValue = element.readElementText();
QLineEdit *value = w->findChild<QLineEdit *>(QStringLiteral("value"));
value->setText(tagValue);
-#ifdef QDOMELEMENT_FIXME
- node = node.nextSibling();
- QDomElement variableElement = node.toElement();
- if (!variableElement.isNull()) {
- const QString variableTagName = variableElement.tagName();
+ if (element.readNextStartElement()) {
+ const QStringRef variableTagName = element.name();
if (variableTagName == QLatin1String("str")) {
QLineEdit *variable = w->findChild<QLineEdit *>(QStringLiteral("variable"));
- variable->setText(AutoCreateScriptUtil::protectSlash(variableElement.text()));
+ variable->setText(AutoCreateScriptUtil::protectSlash(element.readElementText()));
}
} else {
return false;
}
-#endif
} else if (tagName == QLatin1String("tag")) {
const QString tagValue = element.readElementText();
if (tagValue == QLatin1String("quoteregex")) {
@@ -116,6 +112,7 @@ bool SieveActionSetVariable::setParamWidgetValue(QXmlStreamReader &element, QWid
modifier->setCode(AutoCreateScriptUtil::tagValue(tagValue), name(), error);
}
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
//implement in the future ?
diff --git a/src/ksieveui/autocreatescripts/sieveactions/sieveactionvacation.cpp b/src/ksieveui/autocreatescripts/sieveactions/sieveactionvacation.cpp
index d5b2003..8aae007 100644
--- a/src/ksieveui/autocreatescripts/sieveactions/sieveactionvacation.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactions/sieveactionvacation.cpp
@@ -127,6 +127,7 @@ bool SieveActionVacation::setParamWidgetValue(QXmlStreamReader &element, QWidget
QLineEdit *addresses = w->findChild<QLineEdit *>(QStringLiteral("addresses"));
addresses->setText(AutoCreateScriptUtil::listValueToStr(element));
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
//implement in the future ?
diff --git a/src/ksieveui/autocreatescripts/sieveactionwidgetlister.cpp b/src/ksieveui/autocreatescripts/sieveactionwidgetlister.cpp
index 82ab734..d5f7fd4 100644
--- a/src/ksieveui/autocreatescripts/sieveactionwidgetlister.cpp
+++ b/src/ksieveui/autocreatescripts/sieveactionwidgetlister.cpp
@@ -261,6 +261,7 @@ void SieveActionWidget::updateAddRemoveButton(bool addButtonEnabled, bool remove
bool SieveActionWidget::setAction(const QString &actionName, QXmlStreamReader &element, const QString &comment, QString &error)
{
+ qDebug() << "bool SieveActionWidget::setAction(const QString &actionName, QXmlStreamReader &element, const QString &comment, QString &error)" << actionName;
const int index = mComboBox->findData(actionName);
bool result = false;
if (index != -1) {
@@ -365,6 +366,7 @@ int SieveActionWidgetLister::actionNumber() const
void SieveActionWidgetLister::loadScript(QXmlStreamReader &element, bool onlyActions, QString &error)
{
+ qDebug() <<" void SieveActionWidgetLister::loadScript(QXmlStreamReader &element, bool onlyActions, QString &error) onlyaction" << onlyActions;
QString comment;
if (onlyActions) {
const QStringRef tagName = element.name();
@@ -379,6 +381,7 @@ void SieveActionWidgetLister::loadScript(QXmlStreamReader &element, bool onlyAct
w->setAction(actionName, element, comment, error);
//comment.clear();
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else {
qCDebug(LIBKSIEVE_LOG) << " SieveActionWidgetLister::loadScript don't have name attribute " << tagName;
@@ -391,9 +394,11 @@ void SieveActionWidgetLister::loadScript(QXmlStreamReader &element, bool onlyAct
bool previousActionWasAComment = false;
while (element.readNextStartElement()) {
const QStringRef tagName = element.name();
+ qDebug() << "ieveActionWidgetLister::loadScript SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSs" << tagName;
if (tagName == QLatin1String("action") || tagName == QLatin1String("control") /*for break action*/) {
if (element.attributes().hasAttribute(QStringLiteral("name"))) {
const QString actionName = element.attributes().value(QStringLiteral("name")).toString();
+ qDebug() << "************************************* actionName"<<actionName;
if (tagName == QLatin1String("control") && actionName == QLatin1String("if")) {
qCDebug(LIBKSIEVE_LOG) << "We found an loop if in a loop if. Not supported";
error += i18n("We detected a loop if in a loop if. It's not supported") + QLatin1Char('\n');
@@ -421,6 +426,7 @@ void SieveActionWidgetLister::loadScript(QXmlStreamReader &element, bool onlyAct
if (previousActionWasAComment) {
comment += QLatin1Char('\n');
}
+ element.skipCurrentElement();
} else {
qCDebug(LIBKSIEVE_LOG) << " SieveActionWidgetLister::loadScript unknown tagName " << tagName;
}
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionaddress.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionaddress.cpp
index cf58028..f85e335 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionaddress.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionaddress.cpp
@@ -144,6 +144,7 @@ bool SieveConditionAddress::setParamWidgetValue(QXmlStreamReader &element, QWidg
}
++indexStr;
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionbody.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionbody.cpp
index 80a4481..a929ebb 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionbody.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionbody.cpp
@@ -125,6 +125,7 @@ bool SieveConditionBody::setParamWidgetValue(QXmlStreamReader &element, QWidget
strValue << element.readElementText();
++indexStr;
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionconvert.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionconvert.cpp
index d6c1a9e..86ea30b 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionconvert.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionconvert.cpp
@@ -128,6 +128,7 @@ bool SieveConditionConvert::setParamWidgetValue(QXmlStreamReader &element, QWidg
SelectConvertParameterWidget *params = w->findChild<SelectConvertParameterWidget *>(QStringLiteral("params"));
params->setCode(AutoCreateScriptUtil::listValue(element), error);
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditioncurrentdate.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditioncurrentdate.cpp
index d8354e1..214688d 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditioncurrentdate.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditioncurrentdate.cpp
@@ -112,6 +112,7 @@ bool SieveConditionCurrentDate::setParamWidgetValue(QXmlStreamReader &element, Q
SelectMatchTypeComboBox *selectMatchCombobox = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtype"));
selectMatchCombobox->setCode(AutoCreateScriptUtil::tagValueWithCondition(element.readElementText(), notCondition), name(), error);
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditiondate.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditiondate.cpp
index 60e5618..015550b 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditiondate.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditiondate.cpp
@@ -106,6 +106,7 @@ QString SieveConditionDate::help() const
bool SieveConditionDate::setParamWidgetValue(QXmlStreamReader &element, QWidget *w, bool notCondition, QString &error)
{
+ qDebug() << " bool SieveConditionDate::setParamWidgetValue(QXmlStreamReader &element, QWidget *w, bool notCondition, QString &error)";
int index = 0;
QString type;
QString value;
@@ -113,29 +114,31 @@ bool SieveConditionDate::setParamWidgetValue(QXmlStreamReader &element, QWidget
QString commentStr;
while (element.readNextStartElement()) {
const QStringRef tagName = element.name();
- if (tagName == QLatin1String("str")) {
- if (index == 0) {
- headerStr = element.readElementText();
- } else if (index == 1) {
- type = element.readElementText();
- } else if (index == 2) {
- value = element.readElementText();
- } else {
- tooManyArgument(tagName, index, 3, error);
- qCDebug(LIBKSIEVE_LOG) << " SieveConditionDate::setParamWidgetValue too many argument :" << index;
- }
- ++index;
- } else if (tagName == QLatin1String("tag")) {
- SelectMatchTypeComboBox *selectMatchCombobox = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtype"));
- selectMatchCombobox->setCode(AutoCreateScriptUtil::tagValueWithCondition(element.readElementText(), notCondition), name(), error);
- } else if (tagName == QLatin1String("crlf")) {
- //nothing
- } else if (tagName == QLatin1String("comment")) {
- commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
+ qDebug() << " tagName "<< tagName;
+ if (tagName == QLatin1String("str")) {
+ if (index == 0) {
+ headerStr = element.readElementText();
+ } else if (index == 1) {
+ type = element.readElementText();
+ } else if (index == 2) {
+ value = element.readElementText();
} else {
- unknownTag(tagName, error);
- qCDebug(LIBKSIEVE_LOG) << "SieveConditionDate::setParamWidgetValue unknown tag " << tagName;
+ tooManyArgument(tagName, index, 3, error);
+ qCDebug(LIBKSIEVE_LOG) << " SieveConditionDate::setParamWidgetValue too many argument :" << index;
}
+ ++index;
+ } else if (tagName == QLatin1String("tag")) {
+ SelectMatchTypeComboBox *selectMatchCombobox = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtype"));
+ selectMatchCombobox->setCode(AutoCreateScriptUtil::tagValueWithCondition(element.readElementText(), notCondition), name(), error);
+ } else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
+ //nothing
+ } else if (tagName == QLatin1String("comment")) {
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
+ } else {
+ unknownTag(tagName, error);
+ qCDebug(LIBKSIEVE_LOG) << "SieveConditionDate::setParamWidgetValue unknown tag " << tagName;
+ }
}
if (!commentStr.isEmpty()) {
setComment(commentStr);
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvelope.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvelope.cpp
index a2da32f..8fdeba3 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvelope.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvelope.cpp
@@ -168,6 +168,7 @@ bool SieveConditionEnvelope::setParamWidgetValue(QXmlStreamReader &element, QWid
}
++indexStr;
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvironment.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvironment.cpp
index b22e6ca..cb0efb4 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvironment.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvironment.cpp
@@ -124,6 +124,7 @@ bool SieveConditionEnvironment::setParamWidgetValue(QXmlStreamReader &element, Q
}
++index;
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionexists.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionexists.cpp
index f7c768f..36670e0 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionexists.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionexists.cpp
@@ -91,6 +91,7 @@ bool SieveConditionExists::setParamWidgetValue(QXmlStreamReader &element, QWidge
SelectHeaderTypeComboBox *selectHeaderType = w->findChild<SelectHeaderTypeComboBox *>(QStringLiteral("headervalue"));
selectHeaderType->setCode(AutoCreateScriptUtil::listValueToStr(element));
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionfalse.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionfalse.cpp
index ff82638..a46df85 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionfalse.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionfalse.cpp
@@ -64,6 +64,7 @@ bool SieveConditionFalse::setParamWidgetValue(QXmlStreamReader &element, QWidget
if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else {
unknownTag(tagName, error);
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionhasflag.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionhasflag.cpp
index 620d3ac..0057d0b 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionhasflag.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionhasflag.cpp
@@ -150,6 +150,7 @@ bool SieveConditionHasFlag::setParamWidgetValue(QXmlStreamReader &element, QWidg
} else if (tagName == QLatin1String("str")) {
strList << element.readElementText();
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionheader.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionheader.cpp
index 0c9c47a..bb9a174 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionheader.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionheader.cpp
@@ -132,6 +132,7 @@ bool SieveConditionHeader::setParamWidgetValue(QXmlStreamReader &element, QWidge
}
++index;
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionihave.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionihave.cpp
index c75cecf..080e89f 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionihave.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionihave.cpp
@@ -89,6 +89,7 @@ bool SieveConditionIhave::setParamWidgetValue(QXmlStreamReader &element, QWidget
QLineEdit *edit = w->findChild<QLineEdit *>(QStringLiteral("edit"));
edit->setText(tagValue);
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmailboxexists.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmailboxexists.cpp
index cef7852..e21cb66 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmailboxexists.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmailboxexists.cpp
@@ -87,6 +87,7 @@ bool SieveConditionMailboxExists::setParamWidgetValue(QXmlStreamReader &element,
QLineEdit *edit = w->findChild<QLineEdit *>(QStringLiteral("edit"));
edit->setText(AutoCreateScriptUtil::quoteStr(tagValue));
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadata.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadata.cpp
index c5006a2..43544f1 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadata.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadata.cpp
@@ -163,6 +163,7 @@ bool SieveConditionMetaData::setParamWidgetValue(QXmlStreamReader &element, QWid
SelectMatchTypeComboBox *selectType = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("selecttype"));
selectType->setCode(AutoCreateScriptUtil::tagValueWithCondition(element.readElementText(), notCondition), name(), error);
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadataexists.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadataexists.cpp
index b140628..653b690 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadataexists.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadataexists.cpp
@@ -109,6 +109,7 @@ bool SieveConditionMetaDataExists::setParamWidgetValue(QXmlStreamReader &element
}
++index;
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadata.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadata.cpp
index 12df603..da74657 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadata.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadata.cpp
@@ -164,6 +164,7 @@ bool SieveConditionServerMetaData::setParamWidgetValue(QXmlStreamReader &element
SelectMatchTypeComboBox *selectType = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("selecttype"));
selectType->setCode(AutoCreateScriptUtil::tagValueWithCondition(element.readElementText(), notCondition), name(), error);
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadataexists.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadataexists.cpp
index 488365e..0133406 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadataexists.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadataexists.cpp
@@ -88,6 +88,7 @@ bool SieveConditionServerMetaDataExists::setParamWidgetValue(QXmlStreamReader &e
QLineEdit *value = w->findChild<QLineEdit *>(QStringLiteral("value"));
value->setText(tagValue);
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionsize.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionsize.cpp
index 59084ca..cb5453d 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionsize.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionsize.cpp
@@ -82,14 +82,15 @@ bool SieveConditionSize::setParamWidgetValue(QXmlStreamReader &element, QWidget
combo->setCurrentIndex(index);
}
} else if (tagName == QLatin1String("num")) {
- const qlonglong tagValue = element.readElementText().toLongLong();
QString numIdentifier;
if (element.attributes().hasAttribute(QStringLiteral("quantifier"))) {
numIdentifier = element.attributes().value(QStringLiteral("quantifier")).toString();
}
+ const qlonglong tagValue = element.readElementText().toLongLong();
SelectSizeWidget *sizeWidget = w->findChild<SelectSizeWidget *>(QStringLiteral("sizewidget"));
sizeWidget->setCode(tagValue, numIdentifier, name(), error);
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionspamtest.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionspamtest.cpp
index 17c406f..2d9e317 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionspamtest.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionspamtest.cpp
@@ -130,31 +130,19 @@ bool SieveConditionSpamTest::setParamWidgetValue(QXmlStreamReader &element, QWid
if (tagName == QLatin1String("tag")) {
const QString tagValue = element.readElementText();
if (tagValue == QLatin1String("count") || tagValue == QLatin1String("value")) {
-#ifdef QDOMELEMENT_FIXME
- node = node.nextSibling();
- if (!node.isNull()) {
- QDomElement relationalElement = node.toElement();
- if (!relationalElement.isNull()) {
- if (relationalElement.tagName() == QLatin1String("str")) {
- SelectRelationalMatchType *relation = w->findChild<SelectRelationalMatchType *>(QStringLiteral("relation"));
- relation->setCode(AutoCreateScriptUtil::tagValue(tagValue), relationalElement.text(), name(), error);
- }
+ if (element.readNextStartElement()) {
+ if (element.name() == QLatin1String("str")) {
+ SelectRelationalMatchType *relation = w->findChild<SelectRelationalMatchType *>(QStringLiteral("relation"));
+ relation->setCode(AutoCreateScriptUtil::tagValue(tagValue), element.readElementText(), name(), error);
}
}
-#endif
} else if (tagValue == QLatin1String("comparator")) {
-#ifdef QDOMELEMENT_FIXME
- node = node.nextSibling();
- if (!node.isNull()) {
- QDomElement comparatorElement = node.toElement();
- if (!comparatorElement.isNull()) {
- if (comparatorElement.tagName() == QLatin1String("str")) {
- SelectComparatorComboBox *comparator = w->findChild<SelectComparatorComboBox *>(QStringLiteral("comparator"));
- comparator->setCode(comparatorElement.text(), name(), error);
- }
+ if (element.readNextStartElement()) {
+ if (element.name() == QLatin1String("str")) {
+ SelectComparatorComboBox *comparator = w->findChild<SelectComparatorComboBox *>(QStringLiteral("comparator"));
+ comparator->setCode(element.readElementText(), name(), error);
}
}
-#endif
} else if (tagValue == QLatin1String("percent")) {
if (mHasSpamTestPlusSupport) {
QCheckBox *checkbox = w->findChild<QCheckBox *>(QStringLiteral("percent"));
@@ -171,6 +159,7 @@ bool SieveConditionSpamTest::setParamWidgetValue(QXmlStreamReader &element, QWid
QSpinBox *spinbox = w->findChild<QSpinBox *>(QStringLiteral("value"));
spinbox->setValue(element.readElementText().toInt());
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditiontrue.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditiontrue.cpp
index d6fa0c5..6c570dd 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditiontrue.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditiontrue.cpp
@@ -64,6 +64,7 @@ bool SieveConditionTrue::setParamWidgetValue(QXmlStreamReader &element, QWidget
if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else {
unknownTag(tagName, error);
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionvirustest.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionvirustest.cpp
index 9d811fe..5d3ba1f 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionvirustest.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionvirustest.cpp
@@ -111,38 +111,29 @@ bool SieveConditionVirusTest::setParamWidgetValue(QXmlStreamReader &element, QWi
if (tagName == QLatin1String("tag")) {
const QString tagValue = element.readElementText();
-#ifdef QDOMELEMENT_FIXME
if (tagValue == QLatin1String("count") || tagValue == QLatin1String("value")) {
- node = node.nextSibling();
- if (!node.isNull()) {
- QDomElement relationalElement = node.toElement();
- if (!relationalElement.isNull()) {
- if (relationalElement.tagName() == QLatin1String("str")) {
- SelectRelationalMatchType *relation = w->findChild<SelectRelationalMatchType *>(QStringLiteral("relation"));
- relation->setCode(AutoCreateScriptUtil::tagValue(tagValue), relationalElement.text(), name(), error);
- }
+ if (element.readNextStartElement()) {
+ if (element.name() == QLatin1String("str")) {
+ SelectRelationalMatchType *relation = w->findChild<SelectRelationalMatchType *>(QStringLiteral("relation"));
+ relation->setCode(AutoCreateScriptUtil::tagValue(tagValue), element.readElementText(), name(), error);
}
}
} else if (tagValue == QLatin1String("comparator")) {
- node = node.nextSibling();
- if (!node.isNull()) {
- QDomElement comparatorElement = node.toElement();
- if (!comparatorElement.isNull()) {
- if (comparatorElement.tagName() == QLatin1String("str")) {
- SelectComparatorComboBox *comparator = w->findChild<SelectComparatorComboBox *>(QStringLiteral("comparator"));
- comparator->setCode(comparatorElement.text(), name(), error);
- }
+ if (element.readNextStartElement()) {
+ if (element.name() == QLatin1String("str")) {
+ SelectComparatorComboBox *comparator = w->findChild<SelectComparatorComboBox *>(QStringLiteral("comparator"));
+ comparator->setCode(element.readElementText(), name(), error);
}
}
} else {
unknowTagValue(tagValue, error);
qCDebug(LIBKSIEVE_LOG) << " SieveConditionVirusTest::setParamWidgetValue unknown tagValue " << tagValue;
}
-#endif
} else if (tagName == QLatin1String("str")) {
QSpinBox *spinbox = w->findChild<QSpinBox *>(QStringLiteral("value"));
spinbox->setValue(element.readElementText().toInt());
} else if (tagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (tagName == QLatin1String("comment")) {
commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, element.readElementText());
diff --git a/src/ksieveui/autocreatescripts/sieveconditionwidgetlister.cpp b/src/ksieveui/autocreatescripts/sieveconditionwidgetlister.cpp
index c270b8c..d9febdf 100644
--- a/src/ksieveui/autocreatescripts/sieveconditionwidgetlister.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditionwidgetlister.cpp
@@ -378,11 +378,14 @@ void SieveConditionWidgetLister::loadScript(QXmlStreamReader &element, bool uniq
while (element.readNextStartElement()) {
const QStringRef tagName = element.name();
if (tagName == QLatin1String("testlist")) {
+ qDebug() << " test list !!!!!!!!!!!!!!";
while (element.readNextStartElement()) {
const QStringRef testTagName = element.name();
if (testTagName == QLatin1String("test")) {
+ qDebug() << "test :!!!!!!!!!!!!!!!!!!!!!!!!!!";
if (element.attributes().hasAttribute(QStringLiteral("name"))) {
QString conditionName = element.attributes().value(QStringLiteral("name")).toString();
+ qDebug() << " conditionName"<<conditionName;
if (firstCondition) {
firstCondition = false;
} else {
@@ -390,24 +393,26 @@ void SieveConditionWidgetLister::loadScript(QXmlStreamReader &element, bool uniq
}
SieveConditionWidget *w = qobject_cast<SieveConditionWidget *>(widgets().constLast());
if (conditionName == QLatin1String("not")) {
-#ifdef QDOMELEMENT_FIXME
+ qDebug() << " NOT!!!!!!!!!!!!!!!!!!!";
notCondition = true;
- QDomNode notNode = testElement.firstChild();
- QDomElement notElement = notNode.toElement();
- if (notElement.hasAttribute(QStringLiteral("name"))) {
- conditionName = notElement.attribute(QStringLiteral("name"));
+ element.readNextStartElement();
+ if (element.attributes().hasAttribute(QStringLiteral("name"))) {
+ conditionName = element.attributes().value(QStringLiteral("name")).toString();
+ qDebug() << "conditionNameNOY ! "<<conditionName;
}
- w->setCondition(conditionName, notElement, notCondition, error);
-#endif
+ w->setCondition(conditionName, element, notCondition, error);
+ element.skipCurrentElement();
} else {
notCondition = false;
w->setCondition(conditionName, element, notCondition, error);
}
}
} else if (testTagName == QLatin1String("crlf")) {
+ element.skipCurrentElement();
//nothing
} else if (testTagName == QLatin1String("comment")) {
qDebug() << "Need to implement comment here ";
+ element.skipCurrentElement();
//nothing
//implement in the future ?
} else {
diff --git a/src/ksieveui/autocreatescripts/sievescriptblockwidget.cpp b/src/ksieveui/autocreatescripts/sievescriptblockwidget.cpp
index 032e754..52239ed 100644
--- a/src/ksieveui/autocreatescripts/sievescriptblockwidget.cpp
+++ b/src/ksieveui/autocreatescripts/sievescriptblockwidget.cpp
@@ -249,17 +249,21 @@ void SieveScriptBlockWidget::updateCondition()
void SieveScriptBlockWidget::loadScript(QXmlStreamReader &element, bool onlyActions, QString &error)
{
if (onlyActions) {
+ qDebug() << "void SieveScriptBlockWidget::loadScript(QXmlStreamReader &element, bool onlyActions, QString &error) ";
mScriptActionLister->loadScript(element, true, error);
mMatchCondition = AllCondition;
updateCondition();
} else {
+ qDebug() << "void SieveScriptBlockWidget::loadScript(QXmlStreamReader &element, bool onlyActions, QString &error) 222";
bool uniqueTest = false;
while (element.readNextStartElement()) {
const QStringRef tagName = element.name();
+ qDebug() << " void SieveScriptBlockWidget::loadScript(QXmlStreamReader &element, bool onlyActions, QString &error) check"<<tagName;
if (tagName == QLatin1String("test")) {
bool notCondition = false;
if (element.attributes().hasAttribute(QStringLiteral("name"))) {
const QString typeCondition = element.attributes().value(QStringLiteral("name")).toString();
+ qDebug() << "loadScript(QXmlStreamReader &element, bool onlyActions, QString &error)typeCondition: "<<typeCondition;
if (typeCondition == QLatin1String("anyof")) {
mMatchCondition = OrCondition;
} else if (typeCondition == QLatin1String("allof")) {
@@ -279,6 +283,8 @@ void SieveScriptBlockWidget::loadScript(QXmlStreamReader &element, bool onlyActi
} else {
if (tagName != QLatin1String("crlf")) {
qCDebug(LIBKSIEVE_LOG) << " e.tag" << tagName;
+ } else {
+ element.skipCurrentElement();
}
}
}
diff --git a/src/ksieveui/autocreatescripts/sievescriptlistbox.cpp b/src/ksieveui/autocreatescripts/sievescriptlistbox.cpp
index b111d6c..3b1e0b3 100644
--- a/src/ksieveui/autocreatescripts/sievescriptlistbox.cpp
+++ b/src/ksieveui/autocreatescripts/sievescriptlistbox.cpp
@@ -408,144 +408,149 @@ void SieveScriptListBox::loadBlock(QXmlStreamReader &n, SieveScriptPage *current
bool hasCreatedAIfBlock = false;
bool previousElementWasAComment = false;
while (n.readNextStartElement()) {
- const QStringRef tagName = n.name();
- //qCDebug(LIBKSIEVE_LOG)<<" tagName "<<tagName;
- if (tagName == QLatin1String("control")) {
- previousElementWasAComment = false;
- //Create a new page when before it was "onlyactions"
- if (typeBlock == TypeBlockAction) {
+ const QStringRef tagName = n.name();
+ qDebug()<<" tagName "<<tagName;
+ if (tagName == QLatin1String("control")) {
+ previousElementWasAComment = false;
+ //Create a new page when before it was "onlyactions"
+ if (typeBlock == TypeBlockAction) {
+ currentPage = nullptr;
+ }
+ if (n.attributes().hasAttribute(QStringLiteral("name"))) {
+ const QString controlType =n.attributes().value(QStringLiteral("name")).toString();
+ qDebug() <<" SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSs"<< controlType;
+ //qCDebug(LIBKSIEVE_LOG)<<" controlType"<<controlType;
+ if (controlType == QLatin1String("if")) {
+ typeBlock = TypeBlockIf;
+ if (!currentPage || hasCreatedAIfBlock) {
+ currentPage = createNewScript(scriptName.isEmpty() ? createUniqName() : scriptName, comment);
+ }
+ hasCreatedAIfBlock = true;
+ comment.clear();
+ qDebug() << " IF BLOCK";
+ currentPage->blockIfWidget()->loadScript(n, false, error);
+ } else if (controlType == QLatin1String("elsif")) {
+ typeBlock = TypeBlockElsif;
+ if (!currentPage) {
+ qCDebug(LIBKSIEVE_LOG) << " script is not correct missing if block";
+ currentPage = createNewScript(scriptName.isEmpty() ? createUniqName() : scriptName, comment);
+ }
+ SieveScriptBlockWidget *blockWidget = currentPage->addScriptBlock(KSieveUi::SieveWidgetPageAbstract::BlockElsIf);
+ if (blockWidget) {
+ blockWidget->loadScript(n, false, error);
+ }
+ } else if (controlType == QLatin1String("else")) {
+ typeBlock = TypeBlockElse;
+ if (!currentPage) {
+ currentPage = createNewScript(scriptName.isEmpty() ? createUniqName() : scriptName, comment);
+ qCDebug(LIBKSIEVE_LOG) << " script is not correct missing if block";
+ }
+ SieveScriptBlockWidget *blockWidget = currentPage->addScriptBlock(KSieveUi::SieveWidgetPageAbstract::BlockElse);
+ if (blockWidget) {
+ blockWidget->loadScript(n, false, error);
+ }
+ //We are sure that we can't have another elsif
currentPage = nullptr;
- }
- if (n.attributes().hasAttribute(QStringLiteral("name"))) {
- const QString controlType =n.attributes().value(QStringLiteral("name")).toString();
- //qCDebug(LIBKSIEVE_LOG)<<" controlType"<<controlType;
- if (controlType == QLatin1String("if")) {
- typeBlock = TypeBlockIf;
- if (!currentPage || hasCreatedAIfBlock) {
- currentPage = createNewScript(scriptName.isEmpty() ? createUniqName() : scriptName, comment);
- }
- hasCreatedAIfBlock = true;
+ } else if (controlType == QLatin1String("foreverypart")) {
+ typeBlock = TypeBlockForeachBlock;
+ if (!currentPage) {
+ currentPage = createNewScript(scriptName.isEmpty() ? createUniqName() : scriptName, comment);
comment.clear();
- currentPage->blockIfWidget()->loadScript(n, false, error);
- } else if (controlType == QLatin1String("elsif")) {
- typeBlock = TypeBlockElsif;
- if (!currentPage) {
- qCDebug(LIBKSIEVE_LOG) << " script is not correct missing if block";
- currentPage = createNewScript(scriptName.isEmpty() ? createUniqName() : scriptName, comment);
- }
- SieveScriptBlockWidget *blockWidget = currentPage->addScriptBlock(KSieveUi::SieveWidgetPageAbstract::BlockElsIf);
- if (blockWidget) {
- blockWidget->loadScript(n, false, error);
- }
- } else if (controlType == QLatin1String("else")) {
- typeBlock = TypeBlockElse;
- if (!currentPage) {
- currentPage = createNewScript(scriptName.isEmpty() ? createUniqName() : scriptName, comment);
- qCDebug(LIBKSIEVE_LOG) << " script is not correct missing if block";
- }
- SieveScriptBlockWidget *blockWidget = currentPage->addScriptBlock(KSieveUi::SieveWidgetPageAbstract::BlockElse);
- if (blockWidget) {
- blockWidget->loadScript(n, false, error);
- }
- //We are sure that we can't have another elsif
- currentPage = nullptr;
- } else if (controlType == QLatin1String("foreverypart")) {
- typeBlock = TypeBlockForeachBlock;
- if (!currentPage) {
- currentPage = createNewScript(scriptName.isEmpty() ? createUniqName() : scriptName, comment);
- comment.clear();
- }
- if (currentPage->forEveryPartWidget()) {
- currentPage->forEveryPartWidget()->loadScript(n, error);
- } else {
- error += i18n("forEveryPart is not supported by your server") + QLatin1Char('\n');
- }
- //TODO verify it.
-#ifdef QDOMELEMENT_FIXME
- QDomNode block = e.firstChildElement(QStringLiteral("block")).firstChild();
- loadBlock(block, currentPage, typeBlock, error);
-#endif
- } else if (controlType == QLatin1String("require")) {
- //Nothing. autogenerated
+ }
+ if (currentPage->forEveryPartWidget()) {
+ currentPage->forEveryPartWidget()->loadScript(n, error);
} else {
- qCDebug(LIBKSIEVE_LOG) << " unknown controlType :" << controlType;
+ error += i18n("forEveryPart is not supported by your server") + QLatin1Char('\n');
}
- }
- } else if (tagName == QLatin1String("comment")) {
- previousElementWasAComment = true;
- #ifdef QDOMELEMENT_FIXME
- if (e.hasAttribute(QStringLiteral("hash"))) {
- //TODO
- } else if (e.hasAttribute(QStringLiteral("bracket"))) {
- //TODO
- }
+ //TODO verify it.
+#ifdef QDOMELEMENT_FIXME
+ QDomNode block = e.firstChildElement(QStringLiteral("block")).firstChild();
+ loadBlock(block, currentPage, typeBlock, error);
#endif
- QString str(n.readElementText());
- if (str.contains(defaultScriptName())) {
- scriptName = str.remove(defaultScriptName());
+ } else if (controlType == QLatin1String("require")) {
+ qDebug() << " REQUIRES";
+ n.skipCurrentElement();
+ //Nothing. autogenerated
} else {
- if (!comment.isEmpty()) {
- comment += QLatin1Char('\n');
- }
- comment += n.readElementText();
+ qCDebug(LIBKSIEVE_LOG) << " unknown controlType :" << controlType;
}
- } else if (tagName == QLatin1String("action")) {
- previousElementWasAComment = false;
- if (n.attributes().hasAttribute(QStringLiteral("name"))) {
- const QString actionName = n.attributes().value(QStringLiteral("name")).toString();
- if (actionName == QLatin1String("include")) {
- if (!currentPage || (typeBlock == TypeBlockIf) || (typeBlock == TypeBlockElse) || (typeBlock == TypeBlockElsif)) {
- currentPage = createNewScript(scriptName.isEmpty() ? createUniqName() : scriptName, comment);
- comment.clear();
- }
- typeBlock = TypeBlockInclude;
- if (currentPage->includeWidget()) {
- currentPage->includeWidget()->loadScript(n, error);
- } else {
- qCDebug(LIBKSIEVE_LOG) << " include not supported";
- }
- } else if (actionName == QLatin1String("global")) {
- if (!currentPage || (typeBlock == TypeBlockIf) || (typeBlock == TypeBlockElse) || (typeBlock == TypeBlockElsif)) {
- currentPage = createNewScript(scriptName.isEmpty() ? createUniqName() : scriptName, comment);
- comment.clear();
- }
- typeBlock = TypeBlockGlobal;
- if (currentPage->globalVariableWidget()) {
- currentPage->globalVariableWidget()->loadScript(n, error);
- } else {
- qCDebug(LIBKSIEVE_LOG) << " globalVariable not supported";
- }
- } else if (actionName == QLatin1String("set") && (typeBlock == TypeBlockGlobal)) {
- if (currentPage->globalVariableWidget()) {
- if (!currentPage->globalVariableWidget()->loadSetVariable(n, error)) {
- qCDebug(LIBKSIEVE_LOG) << "It's not a global variable";
- if (!currentPage || (typeBlock == TypeBlockIf) || (typeBlock == TypeBlockElse) || (typeBlock == TypeBlockElsif)) {
- currentPage = createNewScript(scriptName.isEmpty() ? createUniqName() : scriptName, comment);
- }
- typeBlock = TypeBlockAction;
- comment.clear();
- currentPage->blockIfWidget()->loadScript(n, true, error);
+ }
+ } else if (tagName == QLatin1String("comment")) {
+ previousElementWasAComment = true;
+#ifdef QDOMELEMENT_FIXME
+ if (e.hasAttribute(QStringLiteral("hash"))) {
+ //TODO
+ } else if (e.hasAttribute(QStringLiteral("bracket"))) {
+ //TODO
+ }
+#endif
+ QString str(n.readElementText());
+ if (str.contains(defaultScriptName())) {
+ scriptName = str.remove(defaultScriptName());
+ } else {
+ if (!comment.isEmpty()) {
+ comment += QLatin1Char('\n');
+ }
+ comment += str;
+ }
+ } else if (tagName == QLatin1String("action")) {
+ previousElementWasAComment = false;
+ if (n.attributes().hasAttribute(QStringLiteral("name"))) {
+ const QString actionName = n.attributes().value(QStringLiteral("name")).toString();
+ if (actionName == QLatin1String("include")) {
+ if (!currentPage || (typeBlock == TypeBlockIf) || (typeBlock == TypeBlockElse) || (typeBlock == TypeBlockElsif)) {
+ currentPage = createNewScript(scriptName.isEmpty() ? createUniqName() : scriptName, comment);
+ comment.clear();
+ }
+ typeBlock = TypeBlockInclude;
+ if (currentPage->includeWidget()) {
+ currentPage->includeWidget()->loadScript(n, error);
+ } else {
+ qCDebug(LIBKSIEVE_LOG) << " include not supported";
+ }
+ } else if (actionName == QLatin1String("global")) {
+ if (!currentPage || (typeBlock == TypeBlockIf) || (typeBlock == TypeBlockElse) || (typeBlock == TypeBlockElsif)) {
+ currentPage = createNewScript(scriptName.isEmpty() ? createUniqName() : scriptName, comment);
+ comment.clear();
+ }
+ typeBlock = TypeBlockGlobal;
+ if (currentPage->globalVariableWidget()) {
+ currentPage->globalVariableWidget()->loadScript(n, error);
+ } else {
+ qCDebug(LIBKSIEVE_LOG) << " globalVariable not supported";
+ }
+ } else if (actionName == QLatin1String("set") && (typeBlock == TypeBlockGlobal)) {
+ if (currentPage->globalVariableWidget()) {
+ if (!currentPage->globalVariableWidget()->loadSetVariable(n, error)) {
+ qCDebug(LIBKSIEVE_LOG) << "It's not a global variable";
+ if (!currentPage || (typeBlock == TypeBlockIf) || (typeBlock == TypeBlockElse) || (typeBlock == TypeBlockElsif)) {
+ currentPage = createNewScript(scriptName.isEmpty() ? createUniqName() : scriptName, comment);
}
- } else {
- qCDebug(LIBKSIEVE_LOG) << " set not supported";
+ typeBlock = TypeBlockAction;
+ comment.clear();
+ currentPage->blockIfWidget()->loadScript(n, true, error);
}
} else {
- if (!currentPage || (typeBlock == TypeBlockIf) || (typeBlock == TypeBlockElse) || (typeBlock == TypeBlockElsif)) {
- currentPage = createNewScript(scriptName.isEmpty() ? createUniqName() : scriptName, comment);
- }
- typeBlock = TypeBlockAction;
- comment.clear();
- currentPage->blockIfWidget()->loadScript(n, true, error);
+ qCDebug(LIBKSIEVE_LOG) << " set not supported";
}
+ } else {
+ if (!currentPage || (typeBlock == TypeBlockIf) || (typeBlock == TypeBlockElse) || (typeBlock == TypeBlockElsif)) {
+ currentPage = createNewScript(scriptName.isEmpty() ? createUniqName() : scriptName, comment);
+ }
+ typeBlock = TypeBlockAction;
+ comment.clear();
+ currentPage->blockIfWidget()->loadScript(n, true, error);
}
- } else if (tagName == QLatin1String("crlf")) {
- //If it was a comment previously you will create a \n
- if (previousElementWasAComment) {
- comment += QLatin1Char('\n');
- }
- } else {
- qCDebug(LIBKSIEVE_LOG) << " unknown tagname" << tagName;
}
+ } else if (tagName == QLatin1String("crlf")) {
+ //If it was a comment previously you will create a \n
+ if (previousElementWasAComment) {
+ comment += QLatin1Char('\n');
+ }
+ n.skipCurrentElement();
+ } else {
+ qCDebug(LIBKSIEVE_LOG) << " unknown tagname" << tagName;
+ }
}
#ifdef REMOVE_QDOMELEMENT
QString scriptName;