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

Fix envelop script without "part"

parent 8c83add9
require "envelope";
require "subaddress";
#SCRIPTNAME: Script part 0
if envelope :all :matches "from" "*jim-???@*"
{
discard;
stop;
}
\ No newline at end of file
if envelope :matches "from" "*jim-???@*" { discard; stop; }
......@@ -115,6 +115,7 @@ void SieveEditorGraphicalModeWidgetTest::shouldLoadScripts_data()
QTest::newRow("test-elseif") << QStringLiteral("test-elseif") << false << true;
QTest::newRow("test-address-order") << QStringLiteral("test-address-order") << false << true;
QTest::newRow("test-regexp") << QStringLiteral("test-regexp") << false << true;
QTest::newRow("test-envelop-without-part") << QStringLiteral("test-envelop-without-part") << false << true;
}
......
......@@ -128,8 +128,14 @@ bool SieveConditionEnvelope::setParamWidgetValue(const QDomElement &element, QWi
if (tagName == QLatin1String("tag")) {
const QString tagValue = e.text();
if (indexTag == 0) {
QString err;
SelectAddressPartComboBox *selectAddressPart = w->findChild<SelectAddressPartComboBox *>(QStringLiteral("addresspartcombobox"));
selectAddressPart->setCode(AutoCreateScriptUtil::tagValue(tagValue), name(), error);
selectAddressPart->setCode(AutoCreateScriptUtil::tagValue(tagValue), name(), err);
//all: is default sometime we don't add it.
if (!err.isEmpty()) {
SelectMatchTypeComboBox *selectMatchCombobox = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtypecombobox"));
selectMatchCombobox->setCode(AutoCreateScriptUtil::tagValueWithCondition(tagValue, notCondition), name(), error);
}
} else if (indexTag == 1) {
SelectMatchTypeComboBox *selectMatchCombobox = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtypecombobox"));
selectMatchCombobox->setCode(AutoCreateScriptUtil::tagValueWithCondition(tagValue, notCondition), name(), error);
......
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