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

Port to AbstractRegexpEditorLineEdit

parent 06a8eaba
......@@ -66,8 +66,10 @@ QWidget *SieveConditionAddress::createParamWidget(QWidget *parent) const
QLabel *lab = new QLabel(i18n("address:"));
grid->addWidget(lab, 1, 0);
QLineEdit *edit = new QLineEdit;
connect(edit, &QLineEdit::textChanged, this, &SieveConditionAddress::valueChanged);
AbstractRegexpEditorLineEdit *edit = AutoCreateScriptUtil::createRegexpEditorLineEdit();
connect(edit, &AbstractRegexpEditorLineEdit::textChanged, this, &SieveConditionAddress::valueChanged);
connect(selectMatchCombobox, &SelectMatchTypeComboBox::switchToRegexp, edit, &AbstractRegexpEditorLineEdit::switchToRegexpEditorLineEdit);
edit->setClearButtonEnabled(true);
edit->setPlaceholderText(i18n("Use ; to separate emails"));
grid->addWidget(edit, 1, 1);
......@@ -87,8 +89,8 @@ QString SieveConditionAddress::code(QWidget *w) const
const SelectHeaderTypeComboBox *selectHeaderType = w->findChild<SelectHeaderTypeComboBox *>(QStringLiteral("headertypecombobox"));
const QString selectHeaderTypeStr = selectHeaderType->code();
const QLineEdit *edit = w->findChild<QLineEdit *>(QStringLiteral("editaddress"));
const QString addressStr = AutoCreateScriptUtil::createAddressList(edit->text().trimmed(), false);
const AbstractRegexpEditorLineEdit *edit = w->findChild<AbstractRegexpEditorLineEdit *>(QStringLiteral("editaddress"));
const QString addressStr = AutoCreateScriptUtil::createAddressList(edit->code().trimmed(), false);
return AutoCreateScriptUtil::negativeString(isNegative) + QStringLiteral("address %1 %2 %3 %4").arg(selectAddressPartStr, matchTypeStr, selectHeaderTypeStr, addressStr)
+ AutoCreateScriptUtil::generateConditionComment(comment());
}
......@@ -126,8 +128,8 @@ bool SieveConditionAddress::setParamWidgetValue(const QDomElement &element, QWid
SelectHeaderTypeComboBox *selectHeaderType = w->findChild<SelectHeaderTypeComboBox *>(QStringLiteral("headertypecombobox"));
selectHeaderType->setCode(e.text());
} else if (indexStr == 1) {
QLineEdit *edit = w->findChild<QLineEdit *>(QStringLiteral("editaddress"));
edit->setText(AutoCreateScriptUtil::quoteStr(e.text()));
AbstractRegexpEditorLineEdit *edit = w->findChild<AbstractRegexpEditorLineEdit *>(QStringLiteral("editaddress"));
edit->setCode(AutoCreateScriptUtil::quoteStr(e.text()));
} else {
tooManyArgument(tagName, indexStr, 2, error);
qCDebug(LIBKSIEVE_LOG) << " SieveConditionAddress::setParamWidgetValue too many argument :" << index;
......@@ -138,8 +140,8 @@ bool SieveConditionAddress::setParamWidgetValue(const QDomElement &element, QWid
SelectHeaderTypeComboBox *selectHeaderType = w->findChild<SelectHeaderTypeComboBox *>(QStringLiteral("headertypecombobox"));
selectHeaderType->setCode(AutoCreateScriptUtil::listValueToStr(e));
} else if (indexStr == 1) {
QLineEdit *edit = w->findChild<QLineEdit *>(QStringLiteral("editaddress"));
edit->setText(AutoCreateScriptUtil::listValueToStr(e));
AbstractRegexpEditorLineEdit *edit = w->findChild<AbstractRegexpEditorLineEdit *>(QStringLiteral("editaddress"));
edit->setCode(AutoCreateScriptUtil::listValueToStr(e));
} else {
tooManyArgument(tagName, indexStr, 2, error);
qCDebug(LIBKSIEVE_LOG) << " SieveConditionAddress::setParamWidgetValue too many argument :" << index;
......
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