Commit 06e0b532 authored by Laurent Montel's avatar Laurent Montel 😁

Add regex support

parent 1a5f78fd
require "regex";
require "fileinto";
require "mailbox";
require "regex";
#SCRIPTNAME: Script part 0
if header :regex "subject" ".* \\| Nouveau ticket - .*"
{
fileinto :create "GLPI/Nouveaux tickets";
stop;
}
}
\ No newline at end of file
......@@ -82,6 +82,12 @@ void SelectMatchTypeComboBox::setCode(const QString &code, const QString &name,
QStringList SelectMatchTypeComboBox::needRequires() const
{
//TODO
return {};
QStringList requires;
if (mHasRegexCapability) {
const QString value = itemData(currentIndex()).toString();
if (value.contains(QLatin1String("regex"))) {
requires << QStringLiteral("regex");
}
}
return requires;
}
......@@ -144,3 +144,10 @@ bool SieveConditionHeader::setParamWidgetValue(const QDomElement &element, QWidg
return true;
}
QStringList KSieveUi::SieveConditionHeader::needRequires(QWidget *w) const
{
const SelectMatchTypeComboBox *matchTypeCombo = w->findChild<SelectMatchTypeComboBox *>(QStringLiteral("matchtypecombobox"));
return matchTypeCombo->needRequires();
}
......@@ -33,6 +33,7 @@ public:
QString code(QWidget *parent) const Q_DECL_OVERRIDE;
QString help() const Q_DECL_OVERRIDE;
QStringList needRequires(QWidget *parent) const Q_DECL_OVERRIDE;
bool setParamWidgetValue(const QDomElement &element, QWidget *parent, bool notCondition, QString &error) Q_DECL_OVERRIDE;
};
......
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