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>
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 "body";
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" ;
addflag "\\seen" ;
stop ;
fileinto "folder";
addflag [ "\\seen" ];
stop;
}
\ No newline at end of file
......@@ -107,7 +107,6 @@ void SieveEditorGraphicalModeWidgetTest::shouldLoadScripts()
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-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("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);
......@@ -195,7 +194,7 @@ void SieveEditorGraphicalModeWidgetTest::shouldLoadScripts_data()
//Failed
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("test-comment2") << QStringLiteral("test-comment2") << false << true;
......
......@@ -178,7 +178,6 @@ bool SieveConditionAddress::setParamWidgetValue(const QDomElement &element, QWid
} else { //Problem with order
SelectMatchTypeComboBox *selectMatchCombobox = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtypecombobox"));
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);
}
} else if (lstTagValue.count() > 2) {
......
......@@ -146,18 +146,30 @@ bool SieveConditionBody::setParamWidgetValue(const QDomElement &element, QWidget
setComment(commentStr);
}
QString errorStr;
if (strValue.count() == 1) {
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"));
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"));
edit->setCode(wasListElement ? strValue.at(0) : AutoCreateScriptUtil::quoteStr(strValue.at(0)));
} else if (strValue.count() == 2) {
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"));
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);
}
AbstractRegexpEditorLineEdit *edit = w->findChild<AbstractRegexpEditorLineEdit *>(QStringLiteral("edit"));
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