Commit eb671f73 authored by Laurent Montel's avatar Laurent Montel 😁

Make failed-2 file works now

parent dce01e1f
## Flag: |UniqueId:2|Rulename: Mail delivery failed <bae.vo.pb+ma@gmail.com> require "body";
if allof ( header :contains "From" "mailer-daemon@foo.de" , header :matches "Subject" "Mail delivery failed: returning message to sender" , size :under 10000 , body :contains :text "<blo@dd.com>" ) require "fileinto";
require "imap4flags";
#SCRIPTNAME: Script part 0
## Flag: |UniqueId:2|Rulename: Mail delivery failed "bae.vo.pb+ma@gmail.com"
if allof (header :contains "From" "mailer-daemon@foo.de"
, header :matches "Subject" "Mail delivery failed: returning message to sender"
, size :under 10000
, body :text :contains "<blo@dd.com>"
)
{ {
fileinto "folder" ; fileinto "folder";
addflag "\\seen" ; addflag [ "\\seen" ];
stop ; stop;
} }
\ No newline at end of file
...@@ -107,7 +107,6 @@ void SieveEditorGraphicalModeWidgetTest::shouldLoadScripts() ...@@ -107,7 +107,6 @@ void SieveEditorGraphicalModeWidgetTest::shouldLoadScripts()
QEXPECT_FAIL("foreverypart", "Expected failure on foreverypart file. A lot of parsing errors.", Continue); QEXPECT_FAIL("foreverypart", "Expected failure on foreverypart file. A lot of parsing errors.", Continue);
QEXPECT_FAIL("failed-1", "Expected failure on failed-1 file. anyof + allof.", Continue); QEXPECT_FAIL("failed-1", "Expected failure on failed-1 file. anyof + allof.", Continue);
QEXPECT_FAIL("failed-2", "Expected failure on failed-2 file. Problem with body + text.", Continue);
QEXPECT_FAIL("failed-if-in-if", "Expected failure on failed-if-in-if file. Problem with if in another if.", Continue); QEXPECT_FAIL("failed-if-in-if", "Expected failure on failed-if-in-if file. Problem with if in another if.", Continue);
QEXPECT_FAIL("test-comment2", "Expected failure on test-comment2 file. Problem with # and /* .", Continue); QEXPECT_FAIL("test-comment2", "Expected failure on test-comment2 file. Problem with # and /* .", Continue);
QEXPECT_FAIL("test-comment7", "Expected failure on test-comment7 file. Problem comment after an action .", Continue); QEXPECT_FAIL("test-comment7", "Expected failure on test-comment7 file. Problem comment after an action .", Continue);
...@@ -195,7 +194,7 @@ void SieveEditorGraphicalModeWidgetTest::shouldLoadScripts_data() ...@@ -195,7 +194,7 @@ void SieveEditorGraphicalModeWidgetTest::shouldLoadScripts_data()
//Failed //Failed
QTest::newRow("failed-1") << QStringLiteral("failed-1") << true << true; QTest::newRow("failed-1") << QStringLiteral("failed-1") << true << true;
QTest::newRow("failed-2") << QStringLiteral("failed-2") << true << true; QTest::newRow("failed-2") << QStringLiteral("failed-2") << false << true;
QTest::newRow("failed-if-in-if") << QStringLiteral("failed-if-in-if") << true << true; QTest::newRow("failed-if-in-if") << QStringLiteral("failed-if-in-if") << true << true;
QTest::newRow("test-comment2") << QStringLiteral("test-comment2") << false << true; QTest::newRow("test-comment2") << QStringLiteral("test-comment2") << false << true;
......
...@@ -178,7 +178,6 @@ bool SieveConditionAddress::setParamWidgetValue(const QDomElement &element, QWid ...@@ -178,7 +178,6 @@ bool SieveConditionAddress::setParamWidgetValue(const QDomElement &element, QWid
} else { //Problem with order } else { //Problem with order
SelectMatchTypeComboBox *selectMatchCombobox = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtypecombobox")); SelectMatchTypeComboBox *selectMatchCombobox = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtypecombobox"));
selectMatchCombobox->setCode(AutoCreateScriptUtil::tagValueWithCondition(lstTagValue.at(0), notCondition), name(), error); selectMatchCombobox->setCode(AutoCreateScriptUtil::tagValueWithCondition(lstTagValue.at(0), notCondition), name(), error);
SelectAddressPartComboBox *selectAddressPart = w->findChild<SelectAddressPartComboBox *>(QStringLiteral("addresspartcombobox"));
selectAddressPart->setCode(AutoCreateScriptUtil::tagValue(lstTagValue.at(1)), name(), error); selectAddressPart->setCode(AutoCreateScriptUtil::tagValue(lstTagValue.at(1)), name(), error);
} }
} else if (lstTagValue.count() > 2) { } else if (lstTagValue.count() > 2) {
......
...@@ -146,18 +146,30 @@ bool SieveConditionBody::setParamWidgetValue(const QDomElement &element, QWidget ...@@ -146,18 +146,30 @@ bool SieveConditionBody::setParamWidgetValue(const QDomElement &element, QWidget
setComment(commentStr); setComment(commentStr);
} }
QString errorStr;
if (strValue.count() == 1) { if (strValue.count() == 1) {
SelectBodyTypeWidget *bodyType = w->findChild<SelectBodyTypeWidget *>(QStringLiteral("bodytype")); SelectBodyTypeWidget *bodyType = w->findChild<SelectBodyTypeWidget *>(QStringLiteral("bodytype"));
bodyType->setCode(tagValueList.at(0), QString(), name(), error); bodyType->setCode(tagValueList.at(0), QString(), name(), errorStr);
if (errorStr.isEmpty()) {
SelectMatchTypeComboBox *matchType = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtype")); SelectMatchTypeComboBox *matchType = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtype"));
matchType->setCode(tagValueList.at(1), name(), error); matchType->setCode(tagValueList.at(1), name(), error);
} else {
SelectMatchTypeComboBox *matchType = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtype"));
matchType->setCode(tagValueList.at(0), name(), error);
bodyType->setCode(tagValueList.at(1), QString(), name(), errorStr);
}
AbstractRegexpEditorLineEdit *edit = w->findChild<AbstractRegexpEditorLineEdit *>(QStringLiteral("edit")); AbstractRegexpEditorLineEdit *edit = w->findChild<AbstractRegexpEditorLineEdit *>(QStringLiteral("edit"));
edit->setCode(wasListElement ? strValue.at(0) : AutoCreateScriptUtil::quoteStr(strValue.at(0))); edit->setCode(wasListElement ? strValue.at(0) : AutoCreateScriptUtil::quoteStr(strValue.at(0)));
} else if (strValue.count() == 2) { } else if (strValue.count() == 2) {
SelectBodyTypeWidget *bodyType = w->findChild<SelectBodyTypeWidget *>(QStringLiteral("bodytype")); SelectBodyTypeWidget *bodyType = w->findChild<SelectBodyTypeWidget *>(QStringLiteral("bodytype"));
bodyType->setCode(tagValueList.at(0), indexStr == 2 ? strValue.at(0) : QString(), name(), error); bodyType->setCode(tagValueList.at(0), indexStr == 2 ? strValue.at(0) : QString(), name(), errorStr);
SelectMatchTypeComboBox *matchType = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtype")); SelectMatchTypeComboBox *matchType = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtype"));
if (!errorStr.isEmpty()) {
matchType->setCode(tagValueList.at(0), name(), error);
bodyType->setCode(tagValueList.at(1), indexStr == 2 ? strValue.at(0) : QString(), name(), error);
} else {
matchType->setCode(tagValueList.at(1), name(), error); matchType->setCode(tagValueList.at(1), name(), error);
}
AbstractRegexpEditorLineEdit *edit = w->findChild<AbstractRegexpEditorLineEdit *>(QStringLiteral("edit")); AbstractRegexpEditorLineEdit *edit = w->findChild<AbstractRegexpEditorLineEdit *>(QStringLiteral("edit"));
edit->setCode(indexStr == 1 ? AutoCreateScriptUtil::quoteStr(strValue.at(0)) : AutoCreateScriptUtil::quoteStr(strValue.at(1))); edit->setCode(indexStr == 1 ? AutoCreateScriptUtil::quoteStr(strValue.at(0)) : AutoCreateScriptUtil::quoteStr(strValue.at(1)));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment