summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-05-30 08:08:08 +0200
committerMontel Laurent <[email protected]>2017-05-30 08:08:08 +0200
commitcca7a851f19766ed322c74d9241553de58143d24 (patch)
tree39118f11a594685e952738036f375988e5db6530
parentcae25af918be635de0f3b9b6ea3ef1752b53c4d7 (diff)
Fix generate multi line comment
-rw-r--r--src/ksieveui/autocreatescripts/autocreatescriptutil.cpp15
-rw-r--r--src/ksieveui/autocreatescripts/autocreatescriptutil_p.h1
-rw-r--r--src/ksieveui/autocreatescripts/autotests/data/test-comment6-ref.siv21
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionaddress.cpp10
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionbody.cpp8
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionconvert.cpp7
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditioncurrentdate.cpp7
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditiondate.cpp7
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvelope.cpp7
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvironment.cpp7
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionexists.cpp7
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionhasflag.cpp7
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionheader.cpp7
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionihave.cpp6
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmailboxexists.cpp6
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadata.cpp7
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadataexists.cpp7
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadata.cpp7
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadataexists.cpp7
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionsize.cpp7
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionspamtest.cpp7
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditions/sieveconditionvirustest.cpp7
22 files changed, 142 insertions, 30 deletions
diff --git a/src/ksieveui/autocreatescripts/autocreatescriptutil.cpp b/src/ksieveui/autocreatescripts/autocreatescriptutil.cpp
index 4e0d66f..9186f55 100644
--- a/src/ksieveui/autocreatescripts/autocreatescriptutil.cpp
+++ b/src/ksieveui/autocreatescripts/autocreatescriptutil.cpp
@@ -223,9 +223,22 @@ QString AutoCreateScriptUtil::generateConditionComment(const QString &comment)
if (str.isEmpty()) {
strComment += QLatin1Char('\n');
} else {
- strComment += QLatin1Char('#') + str + QLatin1Char('\n');
+ if (!strComment.isEmpty()) {
+ strComment += QLatin1Char('\n');
+ }
+ strComment += QStringLiteral(" #") + str;
}
}
}
return strComment;
}
+
+QString AutoCreateScriptUtil::loadConditionComment(QString originalComment, const QString &comment)
+{
+ if (originalComment.isEmpty()) {
+ originalComment = comment;
+ } else {
+ originalComment += QLatin1Char('\n') + comment;
+ }
+ return originalComment;
+}
diff --git a/src/ksieveui/autocreatescripts/autocreatescriptutil_p.h b/src/ksieveui/autocreatescripts/autocreatescriptutil_p.h
index b2e5927..dd9887d 100644
--- a/src/ksieveui/autocreatescripts/autocreatescriptutil_p.h
+++ b/src/ksieveui/autocreatescripts/autocreatescriptutil_p.h
@@ -45,6 +45,7 @@ QString protectSlash(QString str);
QString indentation();
AbstractRegexpEditorLineEdit *createRegexpEditorLineEdit(QWidget *parent = nullptr);
QString generateConditionComment(const QString &comment);
+QString loadConditionComment(QString originalComment, const QString &comment);
}
}
#endif // AUTOCREATESCRIPTUTIL_H
diff --git a/src/ksieveui/autocreatescripts/autotests/data/test-comment6-ref.siv b/src/ksieveui/autocreatescripts/autotests/data/test-comment6-ref.siv
index 1262042..74e4a0e 100644
--- a/src/ksieveui/autocreatescripts/autotests/data/test-comment6-ref.siv
+++ b/src/ksieveui/autocreatescripts/autotests/data/test-comment6-ref.siv
@@ -1,3 +1,14 @@
+require "spamtest";
+require "relational";
+require "environment";
+require "envelope";
+require "subaddress";
+require "imap4flags";
+require "variables";
+require "mboxmetadata";
+require "ihave";
+
+#SCRIPTNAME: Script part 0
if allof (virustest :value "gt" :comparator "i;octet" "0" #condition1
, environment "" "" #condition2
, envelope :all :is "" # condition3
@@ -5,10 +16,10 @@ if allof (virustest :value "gt" :comparator "i;octet" "0" #condition1
, false
, metadataexists "" "" # condition5
, ihave ""
-, environment "" "" /* condition6
- continue condition6
- again
- */
+, environment "" "" # condition6
+ # continue condition6
+ # again
+
)
{
-}
+} \ No newline at end of file
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionaddress.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionaddress.cpp
index 66f9ada..b18b210 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionaddress.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionaddress.cpp
@@ -89,10 +89,6 @@ QString SieveConditionAddress::code(QWidget *w) const
const QLineEdit *edit = w->findChild<QLineEdit *>(QStringLiteral("editaddress"));
const QString addressStr = AutoCreateScriptUtil::createAddressList(edit->text().trimmed(), false);
- QString strComment;
- if (!comment().trimmed().isEmpty()) {
- strComment = QLatin1Char('#') + comment();
- }
return AutoCreateScriptUtil::negativeString(isNegative) + QStringLiteral("address %1 %2 %3 %4").arg(selectAddressPartStr, matchTypeStr, selectHeaderTypeStr, addressStr)
+ AutoCreateScriptUtil::generateConditionComment(comment());
}
@@ -115,6 +111,7 @@ bool SieveConditionAddress::setParamWidgetValue(const QDomElement &element, QWid
int indexStr = 0;
QDomNode node = element.firstChild();
QStringList lstTagValue;
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -149,7 +146,7 @@ bool SieveConditionAddress::setParamWidgetValue(const QDomElement &element, QWid
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << " SieveConditionAddress::setParamWidgetValue unknown tagName " << tagName;
@@ -157,6 +154,9 @@ bool SieveConditionAddress::setParamWidgetValue(const QDomElement &element, QWid
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
if (lstTagValue.count() == 1) {
QString specificError;
SelectMatchTypeComboBox *selectMatchCombobox = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtypecombobox"));
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionbody.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionbody.cpp
index 87678c7..bd7d247 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionbody.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionbody.cpp
@@ -72,7 +72,7 @@ QString SieveConditionBody::code(QWidget *w) const
QLineEdit *edit = w->findChild<QLineEdit *>(QStringLiteral("edit"));
const QString editValue = AutoCreateScriptUtil::createAddressList(edit->text().trimmed(), false);
return AutoCreateScriptUtil::negativeString(isNegative) + QStringLiteral("body %1 %2 %3").arg(bodyValue, matchValue, editValue)
- + AutoCreateScriptUtil::generateConditionComment(comment());;
+ + AutoCreateScriptUtil::generateConditionComment(comment());
}
QStringList SieveConditionBody::needRequires(QWidget *) const
@@ -105,6 +105,7 @@ bool SieveConditionBody::setParamWidgetValue(const QDomElement &element, QWidget
bool wasListElement = false;
QDomNode node = element.firstChild();
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -126,7 +127,7 @@ bool SieveConditionBody::setParamWidgetValue(const QDomElement &element, QWidget
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else if (tagName == QLatin1String("list")) {
strValue << AutoCreateScriptUtil::listValueToStr(e);
wasListElement = true;
@@ -138,6 +139,9 @@ bool SieveConditionBody::setParamWidgetValue(const QDomElement &element, QWidget
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
if (strValue.count() == 1) {
SelectBodyTypeWidget *bodyType = w->findChild<SelectBodyTypeWidget *>(QStringLiteral("bodytype"));
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionconvert.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionconvert.cpp
index 55fca15..bc437df 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionconvert.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionconvert.cpp
@@ -110,6 +110,7 @@ bool SieveConditionConvert::setParamWidgetValue(const QDomElement &element, QWid
{
int index = 0;
QDomNode node = element.firstChild();
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -132,7 +133,7 @@ bool SieveConditionConvert::setParamWidgetValue(const QDomElement &element, QWid
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << "SieveActionConvert::setParamWidgetValue unknown tag " << tagName;
@@ -140,5 +141,9 @@ bool SieveConditionConvert::setParamWidgetValue(const QDomElement &element, QWid
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
+
return true;
}
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditioncurrentdate.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditioncurrentdate.cpp
index 391be6a..bc1c55f 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditioncurrentdate.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditioncurrentdate.cpp
@@ -94,6 +94,7 @@ bool SieveConditionCurrentDate::setParamWidgetValue(const QDomElement &element,
QString type;
QString value;
QDomNode node = element.firstChild();
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -114,7 +115,7 @@ bool SieveConditionCurrentDate::setParamWidgetValue(const QDomElement &element,
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << "SieveConditionCurrentDate::setParamWidgetValue unknown tag " << tagName;
@@ -122,6 +123,10 @@ bool SieveConditionCurrentDate::setParamWidgetValue(const QDomElement &element,
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
+
SelectDateWidget *dateWidget = w->findChild<SelectDateWidget *>(QStringLiteral("datewidget"));
dateWidget->setCode(type, value);
return true;
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditiondate.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditiondate.cpp
index 4c61518..d2a41ab 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditiondate.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditiondate.cpp
@@ -110,6 +110,7 @@ bool SieveConditionDate::setParamWidgetValue(const QDomElement &element, QWidget
QString value;
QString headerStr;
QDomNode node = element.firstChild();
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -132,7 +133,7 @@ bool SieveConditionDate::setParamWidgetValue(const QDomElement &element, QWidget
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << "SieveConditionDate::setParamWidgetValue unknown tag " << tagName;
@@ -140,6 +141,10 @@ bool SieveConditionDate::setParamWidgetValue(const QDomElement &element, QWidget
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
+
SelectDateWidget *dateWidget = w->findChild<SelectDateWidget *>(QStringLiteral("datewidget"));
dateWidget->setCode(type, value);
QLineEdit *header = w->findChild<QLineEdit *>(QStringLiteral("header"));
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvelope.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvelope.cpp
index 959cb77..3b81f8e 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvelope.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvelope.cpp
@@ -122,6 +122,7 @@ bool SieveConditionEnvelope::setParamWidgetValue(const QDomElement &element, QWi
int indexTag = 0;
int indexStr = 0;
QDomNode node = element.firstChild();
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -169,7 +170,7 @@ bool SieveConditionEnvelope::setParamWidgetValue(const QDomElement &element, QWi
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << " SieveConditionEnvelope::setParamWidgetValue unknown tagName " << tagName;
@@ -177,6 +178,10 @@ bool SieveConditionEnvelope::setParamWidgetValue(const QDomElement &element, QWi
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
+
return true;
}
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvironment.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvironment.cpp
index e2f1014..39f4a3a 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvironment.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionenvironment.cpp
@@ -109,6 +109,7 @@ bool SieveConditionEnvironment::setParamWidgetValue(const QDomElement &element,
{
QDomNode node = element.firstChild();
int index = 0;
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -128,7 +129,7 @@ bool SieveConditionEnvironment::setParamWidgetValue(const QDomElement &element,
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << " SieveActionSetVariable::setParamWidgetValue unknown tagName " << tagName;
@@ -136,6 +137,10 @@ bool SieveConditionEnvironment::setParamWidgetValue(const QDomElement &element,
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
+
return true;
}
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionexists.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionexists.cpp
index 84e0587..0d3efa4 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionexists.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionexists.cpp
@@ -78,6 +78,7 @@ QString SieveConditionExists::help() const
bool SieveConditionExists::setParamWidgetValue(const QDomElement &element, QWidget *w, bool notCondition, QString &error)
{
QDomNode node = element.firstChild();
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -95,7 +96,7 @@ bool SieveConditionExists::setParamWidgetValue(const QDomElement &element, QWidg
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << " SieveConditionExists::setParamWidgetValue unknown tagName " << tagName;
@@ -103,6 +104,10 @@ bool SieveConditionExists::setParamWidgetValue(const QDomElement &element, QWidg
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
+
return true;
}
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionhasflag.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionhasflag.cpp
index c0eb38c..ca1a1b8 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionhasflag.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionhasflag.cpp
@@ -139,6 +139,7 @@ bool SieveConditionHasFlag::setParamWidgetValue(const QDomElement &element, QWid
{
QStringList strList;
QDomNode node = element.firstChild();
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -151,7 +152,7 @@ bool SieveConditionHasFlag::setParamWidgetValue(const QDomElement &element, QWid
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << " SieveConditionExists::setParamWidgetValue unknown tagName " << tagName;
@@ -159,6 +160,10 @@ bool SieveConditionHasFlag::setParamWidgetValue(const QDomElement &element, QWid
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
+
switch (strList.count()) {
case 1:
{
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionheader.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionheader.cpp
index 72d783b..1ac2be6 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionheader.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionheader.cpp
@@ -92,6 +92,7 @@ bool SieveConditionHeader::setParamWidgetValue(const QDomElement &element, QWidg
{
int index = 0;
QDomNode node = element.firstChild();
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -129,7 +130,7 @@ bool SieveConditionHeader::setParamWidgetValue(const QDomElement &element, QWidg
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << " SieveConditionHeader::setParamWidgetValue unknown tagName " << tagName;
@@ -137,5 +138,9 @@ bool SieveConditionHeader::setParamWidgetValue(const QDomElement &element, QWidg
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
+
return true;
}
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionihave.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionihave.cpp
index 84cf336..5e876bd 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionihave.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionihave.cpp
@@ -82,6 +82,7 @@ QString SieveConditionIhave::help() const
bool SieveConditionIhave::setParamWidgetValue(const QDomElement &element, QWidget *w, bool, QString &error)
{
QDomNode node = element.firstChild();
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -93,7 +94,7 @@ bool SieveConditionIhave::setParamWidgetValue(const QDomElement &element, QWidge
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << " SieveConditionIhave::setParamWidgetValue unknown tagName " << tagName;
@@ -101,6 +102,9 @@ bool SieveConditionIhave::setParamWidgetValue(const QDomElement &element, QWidge
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
return true;
}
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmailboxexists.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmailboxexists.cpp
index 13632ab..ef0d195 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmailboxexists.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmailboxexists.cpp
@@ -80,6 +80,7 @@ QString SieveConditionMailboxExists::help() const
bool SieveConditionMailboxExists::setParamWidgetValue(const QDomElement &element, QWidget *w, bool /*notCondition*/, QString &error)
{
QDomNode node = element.firstChild();
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -91,7 +92,7 @@ bool SieveConditionMailboxExists::setParamWidgetValue(const QDomElement &element
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << " SieveConditionMailboxExists::setParamWidgetValue unknown tagName " << tagName;
@@ -99,6 +100,9 @@ bool SieveConditionMailboxExists::setParamWidgetValue(const QDomElement &element
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
return true;
}
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadata.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadata.cpp
index 9d30956..ada25ba 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadata.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadata.cpp
@@ -128,6 +128,7 @@ bool SieveConditionMetaData::setParamWidgetValue(const QDomElement &element, QWi
{
int index = 0;
QDomNode node = element.firstChild();
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -165,7 +166,7 @@ bool SieveConditionMetaData::setParamWidgetValue(const QDomElement &element, QWi
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << " SieveConditionMetaData::setParamWidgetValue unknown tagName " << tagName;
@@ -173,6 +174,10 @@ bool SieveConditionMetaData::setParamWidgetValue(const QDomElement &element, QWi
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
+
return true;
}
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadataexists.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadataexists.cpp
index 651a1e7..7f18a38 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadataexists.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionmetadataexists.cpp
@@ -93,6 +93,7 @@ bool SieveConditionMetaDataExists::setParamWidgetValue(const QDomElement &elemen
{
int index = 0;
QDomNode node = element.firstChild();
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -113,7 +114,7 @@ bool SieveConditionMetaDataExists::setParamWidgetValue(const QDomElement &elemen
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << " SieveConditionServerMetaDataExists::setParamWidgetValue unknown tagName " << tagName;
@@ -121,6 +122,10 @@ bool SieveConditionMetaDataExists::setParamWidgetValue(const QDomElement &elemen
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
+
return true;
}
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadata.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadata.cpp
index 9bf882d..d78311f 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadata.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadata.cpp
@@ -129,6 +129,7 @@ bool SieveConditionServerMetaData::setParamWidgetValue(const QDomElement &elemen
{
int index = 0;
QDomNode node = element.firstChild();
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -166,7 +167,7 @@ bool SieveConditionServerMetaData::setParamWidgetValue(const QDomElement &elemen
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << " SieveConditionServerMetaData::setParamWidgetValue unknown tagName " << tagName;
@@ -174,6 +175,10 @@ bool SieveConditionServerMetaData::setParamWidgetValue(const QDomElement &elemen
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
+
return true;
}
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadataexists.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadataexists.cpp
index c8d9af4..68146e3 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadataexists.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionservermetadataexists.cpp
@@ -81,6 +81,7 @@ QString SieveConditionServerMetaDataExists::help() const
bool SieveConditionServerMetaDataExists::setParamWidgetValue(const QDomElement &element, QWidget *w, bool /*notCondition*/, QString &error)
{
QDomNode node = element.firstChild();
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -92,7 +93,7 @@ bool SieveConditionServerMetaDataExists::setParamWidgetValue(const QDomElement &
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << " SieveConditionServerMetaDataExists::setParamWidgetValue unknown tagName " << tagName;
@@ -100,6 +101,10 @@ bool SieveConditionServerMetaDataExists::setParamWidgetValue(const QDomElement &
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
+
return true;
}
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionsize.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionsize.cpp
index a74f3b1..ce0c73c 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionsize.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionsize.cpp
@@ -72,6 +72,7 @@ QString SieveConditionSize::help() const
bool SieveConditionSize::setParamWidgetValue(const QDomElement &element, QWidget *w, bool /*notCondition*/, QString &error)
{
QDomNode node = element.firstChild();
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -94,7 +95,7 @@ bool SieveConditionSize::setParamWidgetValue(const QDomElement &element, QWidget
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << " SieveConditionSize::setParamWidgetValue unknown tagName " << tagName;
@@ -102,6 +103,10 @@ bool SieveConditionSize::setParamWidgetValue(const QDomElement &element, QWidget
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
+
return true;
}
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionspamtest.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionspamtest.cpp
index 70af37b..499d2bb 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionspamtest.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionspamtest.cpp
@@ -125,6 +125,7 @@ QString SieveConditionSpamTest::help() const
bool SieveConditionSpamTest::setParamWidgetValue(const QDomElement &element, QWidget *w, bool /*notCondition*/, QString &error)
{
QDomNode node = element.firstChild();
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -171,7 +172,7 @@ bool SieveConditionSpamTest::setParamWidgetValue(const QDomElement &element, QWi
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << " SieveSpamTest::setParamWidgetValue unknown tagName " << tagName;
@@ -179,6 +180,10 @@ bool SieveConditionSpamTest::setParamWidgetValue(const QDomElement &element, QWi
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
+
return true;
}
diff --git a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionvirustest.cpp b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionvirustest.cpp
index c131479..170446b 100644
--- a/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionvirustest.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditions/sieveconditionvirustest.cpp
@@ -106,6 +106,7 @@ QString SieveConditionVirusTest::help() const
bool SieveConditionVirusTest::setParamWidgetValue(const QDomElement &element, QWidget *w, bool /*notCondition*/, QString &error)
{
QDomNode node = element.firstChild();
+ QString commentStr;
while (!node.isNull()) {
QDomElement e = node.toElement();
if (!e.isNull()) {
@@ -144,7 +145,7 @@ bool SieveConditionVirusTest::setParamWidgetValue(const QDomElement &element, QW
} else if (tagName == QLatin1String("crlf")) {
//nothing
} else if (tagName == QLatin1String("comment")) {
- setComment(e.text());
+ commentStr = AutoCreateScriptUtil::loadConditionComment(commentStr, e.text());
} else {
unknownTag(tagName, error);
qCDebug(LIBKSIEVE_LOG) << " SieveConditionVirusTest::setParamWidgetValue unknown tagName " << tagName;
@@ -152,6 +153,10 @@ bool SieveConditionVirusTest::setParamWidgetValue(const QDomElement &element, QW
}
node = node.nextSibling();
}
+ if (!commentStr.isEmpty()) {
+ setComment(commentStr);
+ }
+
return true;
}