Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 01df23f2 authored by Laurent Montel's avatar Laurent Montel 😁

Add support for KSieveUi::AbstractMoveImapFolderWidget

parent 8a6f56b4
......@@ -68,12 +68,12 @@ QWidget *SieveConditionEnvelope::createParamWidget(QWidget *parent) const
grid->addWidget(lab, 1, 0);
AbstractRegexpEditorLineEdit *edit = AutoCreateScriptUtil::createRegexpEditorLineEdit();
edit->setObjectName(QStringLiteral("editaddress"));
connect(edit, &AbstractRegexpEditorLineEdit::textChanged, this, &SieveConditionEnvelope::valueChanged);
connect(selectMatchCombobox, &SelectMatchTypeComboBox::switchToRegexp, edit, &AbstractRegexpEditorLineEdit::switchToRegexpEditorLineEdit);
edit->setClearButtonEnabled(true);
edit->setPlaceholderText(i18n("Use ; to separate emails"));
grid->addWidget(edit, 1, 1);
edit->setObjectName(QStringLiteral("editaddress"));
return w;
}
......
......@@ -28,6 +28,7 @@
#include <QHBoxLayout>
#include "libksieve_debug.h"
#include <QXmlStreamReader>
#include <KSieveUi/AbstractMoveImapFolderWidget>
using namespace KSieveUi;
SieveConditionMetaData::SieveConditionMetaData(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QObject *parent)
......@@ -54,8 +55,9 @@ QWidget *SieveConditionMetaData::createParamWidget(QWidget *parent) const
QLabel *lab = new QLabel(i18n("Mailbox:"));
grid->addWidget(lab, 0, 0);
QLineEdit *mailbox = new QLineEdit;
connect(mailbox, &QLineEdit::textChanged, this, &SieveConditionMetaData::valueChanged);
KSieveUi::AbstractMoveImapFolderWidget *mailbox = AutoCreateScriptUtil::createImapFolderWidget();
connect(mailbox, &KSieveUi::AbstractMoveImapFolderWidget::textChanged, this, &SieveConditionMetaData::valueChanged);
mailbox->setObjectName(QStringLiteral("mailbox"));
grid->addWidget(mailbox, 0, 1);
......@@ -87,7 +89,7 @@ QString SieveConditionMetaData::code(QWidget *w) const
QString result = AutoCreateScriptUtil::negativeString(isNegative) + QStringLiteral("metadata %1 ").arg(matchString);
const QLineEdit *mailbox = w->findChild<QLineEdit *>(QStringLiteral("mailbox"));
const KSieveUi::AbstractMoveImapFolderWidget *mailbox = w->findChild<KSieveUi::AbstractMoveImapFolderWidget *>(QStringLiteral("mailbox"));
const QString mailboxStr = mailbox->text();
result += QStringLiteral("\"%1\" ").arg(mailboxStr);
......@@ -137,7 +139,7 @@ bool SieveConditionMetaData::setParamWidgetValue(QXmlStreamReader &element, QWid
switch (index) {
case 0:
{
QLineEdit *mailbox = w->findChild<QLineEdit *>(QStringLiteral("mailbox"));
KSieveUi::AbstractMoveImapFolderWidget *mailbox = w->findChild<KSieveUi::AbstractMoveImapFolderWidget *>(QStringLiteral("mailbox"));
mailbox->setText(tagValue);
break;
}
......
......@@ -26,6 +26,7 @@
#include "libksieve_debug.h"
#include <QXmlStreamReader>
#include <QGridLayout>
#include <KSieveUi/AbstractMoveImapFolderWidget>
using namespace KSieveUi;
SieveConditionMetaDataExists::SieveConditionMetaDataExists(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QObject *parent)
......@@ -43,8 +44,8 @@ QWidget *SieveConditionMetaDataExists::createParamWidget(QWidget *parent) const
QLabel *lab = new QLabel(i18n("Mailbox:"));
grid->addWidget(lab, 0, 0);
QLineEdit *mailbox = new QLineEdit;
connect(mailbox, &QLineEdit::textChanged, this, &SieveConditionMetaDataExists::valueChanged);
KSieveUi::AbstractMoveImapFolderWidget *mailbox = AutoCreateScriptUtil::createImapFolderWidget();
connect(mailbox, &KSieveUi::AbstractMoveImapFolderWidget::textChanged, this, &SieveConditionMetaDataExists::valueChanged);
mailbox->setObjectName(QStringLiteral("mailbox"));
grid->addWidget(mailbox, 0, 1);
......@@ -61,7 +62,7 @@ QWidget *SieveConditionMetaDataExists::createParamWidget(QWidget *parent) const
QString SieveConditionMetaDataExists::code(QWidget *w) const
{
const QLineEdit *mailbox = w->findChild<QLineEdit *>(QStringLiteral("mailbox"));
const KSieveUi::AbstractMoveImapFolderWidget *mailbox = w->findChild<KSieveUi::AbstractMoveImapFolderWidget *>(QStringLiteral("mailbox"));
const QString mailboxStr = mailbox->text();
const QLineEdit *value = w->findChild<QLineEdit *>(QStringLiteral("value"));
......@@ -98,7 +99,7 @@ bool SieveConditionMetaDataExists::setParamWidgetValue(QXmlStreamReader &element
if (tagName == QLatin1String("str")) {
const QString tagValue = element.readElementText();
if (index == 0) {
QLineEdit *mailbox = w->findChild<QLineEdit *>(QStringLiteral("mailbox"));
KSieveUi::AbstractMoveImapFolderWidget *mailbox = w->findChild<KSieveUi::AbstractMoveImapFolderWidget *>(QStringLiteral("mailbox"));
mailbox->setText(tagValue);
} else if (index == 1) {
QLineEdit *value = w->findChild<QLineEdit *>(QStringLiteral("value"));
......
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