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

Fix add regexp support

parent 06e0b532
require "subaddress"; require "subaddress";
require "regex";
require "spamtest"; require "spamtest";
require "relational"; require "relational";
require "spamtestplus"; require "spamtestplus";
......
...@@ -138,3 +138,10 @@ QUrl SieveActionDeleteHeader::href() const ...@@ -138,3 +138,10 @@ QUrl SieveActionDeleteHeader::href() const
{ {
return SieveEditorUtil::helpUrl(SieveEditorUtil::strToVariableName(name())); return SieveEditorUtil::helpUrl(SieveEditorUtil::strToVariableName(name()));
} }
QStringList SieveActionDeleteHeader::needRequires(QWidget *w) const
{
const SelectMatchTypeComboBox *combo = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtype"));
return SieveActionAbstractEditHeader::needRequires(w) + combo->needRequires();
}
...@@ -31,6 +31,7 @@ public: ...@@ -31,6 +31,7 @@ public:
bool setParamWidgetValue(const QDomElement &element, QWidget *parent, QString &error) Q_DECL_OVERRIDE; bool setParamWidgetValue(const QDomElement &element, QWidget *parent, QString &error) Q_DECL_OVERRIDE;
QString help() const Q_DECL_OVERRIDE; QString help() const Q_DECL_OVERRIDE;
QUrl href() const Q_DECL_OVERRIDE; QUrl href() const Q_DECL_OVERRIDE;
QStringList needRequires(QWidget *parent) const Q_DECL_OVERRIDE;
private: private:
bool parseValue(const QDomElement &element, QWidget *w, QString &error, bool isNegative); bool parseValue(const QDomElement &element, QWidget *w, QString &error, bool isNegative);
}; };
......
...@@ -96,7 +96,9 @@ QString SieveConditionAddress::code(QWidget *w) const ...@@ -96,7 +96,9 @@ QString SieveConditionAddress::code(QWidget *w) const
QStringList SieveConditionAddress::needRequires(QWidget *w) const QStringList SieveConditionAddress::needRequires(QWidget *w) const
{ {
const SelectAddressPartComboBox *selectAddressPart = w->findChild<SelectAddressPartComboBox *>(QStringLiteral("addresspartcombobox")); const SelectAddressPartComboBox *selectAddressPart = w->findChild<SelectAddressPartComboBox *>(QStringLiteral("addresspartcombobox"));
return selectAddressPart->extraRequire(); const SelectMatchTypeComboBox *selectMatchCombobox = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtypecombobox"));
return selectAddressPart->extraRequire() + selectMatchCombobox->needRequires();
} }
QString SieveConditionAddress::help() const QString SieveConditionAddress::help() const
......
...@@ -75,9 +75,11 @@ QString SieveConditionBody::code(QWidget *w) const ...@@ -75,9 +75,11 @@ QString SieveConditionBody::code(QWidget *w) const
+ AutoCreateScriptUtil::generateConditionComment(comment()); + AutoCreateScriptUtil::generateConditionComment(comment());
} }
QStringList SieveConditionBody::needRequires(QWidget *) const QStringList SieveConditionBody::needRequires(QWidget *w) const
{ {
return QStringList() << QStringLiteral("body"); const SelectMatchTypeComboBox *matchType = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtype"));
return QStringList() << QStringLiteral("body") << matchType->needRequires();
} }
bool SieveConditionBody::needCheckIfServerHasCapability() const bool SieveConditionBody::needCheckIfServerHasCapability() const
......
...@@ -78,9 +78,11 @@ QString SieveConditionCurrentDate::serverNeedsCapability() const ...@@ -78,9 +78,11 @@ QString SieveConditionCurrentDate::serverNeedsCapability() const
return QStringLiteral("date"); return QStringLiteral("date");
} }
QStringList SieveConditionCurrentDate::needRequires(QWidget *) const QStringList SieveConditionCurrentDate::needRequires(QWidget *w) const
{ {
return QStringList() << QStringLiteral("date"); const SelectMatchTypeComboBox *selectMatchCombobox = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtype"));
return QStringList() << QStringLiteral("date") << selectMatchCombobox->needRequires();
} }
QString SieveConditionCurrentDate::help() const QString SieveConditionCurrentDate::help() const
......
...@@ -93,9 +93,10 @@ QString SieveConditionDate::serverNeedsCapability() const ...@@ -93,9 +93,10 @@ QString SieveConditionDate::serverNeedsCapability() const
return QStringLiteral("date"); return QStringLiteral("date");
} }
QStringList SieveConditionDate::needRequires(QWidget *) const QStringList SieveConditionDate::needRequires(QWidget *w) const
{ {
return QStringList() << QStringLiteral("date"); const SelectMatchTypeComboBox *selectMatchCombobox = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtype"));
return QStringList() << QStringLiteral("date") << selectMatchCombobox->needRequires();
} }
QString SieveConditionDate::help() const QString SieveConditionDate::help() const
......
...@@ -99,7 +99,8 @@ QString SieveConditionEnvelope::code(QWidget *w) const ...@@ -99,7 +99,8 @@ QString SieveConditionEnvelope::code(QWidget *w) const
QStringList SieveConditionEnvelope::needRequires(QWidget *w) const QStringList SieveConditionEnvelope::needRequires(QWidget *w) const
{ {
const SelectAddressPartComboBox *selectAddressPart = w->findChild<SelectAddressPartComboBox *>(QStringLiteral("addresspartcombobox")); const SelectAddressPartComboBox *selectAddressPart = w->findChild<SelectAddressPartComboBox *>(QStringLiteral("addresspartcombobox"));
return QStringList() << QStringLiteral("envelope") << selectAddressPart->extraRequire(); const SelectMatchTypeComboBox *selectMatchCombobox = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtypecombobox"));
return QStringList() << QStringLiteral("envelope") << selectAddressPart->extraRequire() << selectMatchCombobox->needRequires();
} }
bool SieveConditionEnvelope::needCheckIfServerHasCapability() const bool SieveConditionEnvelope::needCheckIfServerHasCapability() const
......
...@@ -97,7 +97,7 @@ QString SieveConditionHasFlag::code(QWidget *w) const ...@@ -97,7 +97,7 @@ QString SieveConditionHasFlag::code(QWidget *w) const
return result + AutoCreateScriptUtil::generateConditionComment(comment()); return result + AutoCreateScriptUtil::generateConditionComment(comment());
} }
QStringList SieveConditionHasFlag::needRequires(QWidget *) const QStringList SieveConditionHasFlag::needRequires(QWidget *w) const
{ {
QStringList lst; QStringList lst;
if (sieveCapabilities().contains(QStringLiteral("imap4flags"))) { if (sieveCapabilities().contains(QStringLiteral("imap4flags"))) {
...@@ -108,6 +108,8 @@ QStringList SieveConditionHasFlag::needRequires(QWidget *) const ...@@ -108,6 +108,8 @@ QStringList SieveConditionHasFlag::needRequires(QWidget *) const
if (hasVariableSupport) { if (hasVariableSupport) {
lst << QStringLiteral("variables"); lst << QStringLiteral("variables");
} }
const SelectMatchTypeComboBox *matchTypeCombo = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtype"));
lst << matchTypeCombo->needRequires();
return lst; return lst;
} }
......
...@@ -103,9 +103,10 @@ QString SieveConditionMetaData::code(QWidget *w) const ...@@ -103,9 +103,10 @@ QString SieveConditionMetaData::code(QWidget *w) const
return result + AutoCreateScriptUtil::generateConditionComment(comment()); return result + AutoCreateScriptUtil::generateConditionComment(comment());
} }
QStringList SieveConditionMetaData::needRequires(QWidget *) const QStringList SieveConditionMetaData::needRequires(QWidget *w) const
{ {
return QStringList() << QStringLiteral("mboxmetadata"); const SelectMatchTypeComboBox *selectType = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("selecttype"));
return QStringList() << QStringLiteral("mboxmetadata") << selectType->needRequires();
} }
bool SieveConditionMetaData::needCheckIfServerHasCapability() const bool SieveConditionMetaData::needCheckIfServerHasCapability() const
......
...@@ -104,9 +104,10 @@ QString SieveConditionServerMetaData::code(QWidget *w) const ...@@ -104,9 +104,10 @@ QString SieveConditionServerMetaData::code(QWidget *w) const
return result + AutoCreateScriptUtil::generateConditionComment(comment()); return result + AutoCreateScriptUtil::generateConditionComment(comment());
} }
QStringList SieveConditionServerMetaData::needRequires(QWidget *) const QStringList SieveConditionServerMetaData::needRequires(QWidget *w) const
{ {
return QStringList() << QStringLiteral("servermetadata"); const SelectMatchTypeComboBox *selectType = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("selecttype"));
return QStringList() << QStringLiteral("servermetadata") << selectType->needRequires();
} }
bool SieveConditionServerMetaData::needCheckIfServerHasCapability() const bool SieveConditionServerMetaData::needCheckIfServerHasCapability() const
......
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