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 c432c5f0 authored by Laurent Montel's avatar Laurent Montel 😁

Propagate listOfIncludeFile

parent 138ac30e
......@@ -93,6 +93,11 @@ void SieveIncludeActionWidget::clear()
mIncludeName->setText(QString());
}
void SieveIncludeActionWidget::setListOfIncludeFile(const QStringList &listOfIncludeFile)
{
mIncludeName->setListOfIncludeFile(listOfIncludeFile);
}
void SieveIncludeActionWidget::loadScript(QXmlStreamReader &element, QString &error)
{
while (element.readNextStartElement()) {
......@@ -207,6 +212,7 @@ SieveIncludeWidget::SieveIncludeWidget(QWidget *parent)
connect(mHelpButton, &SieveHelpButton::clicked, this, &SieveIncludeWidget::slotHelp);
mIncludeLister = new SieveIncludeWidgetLister;
//mIncludeLister->setListOfIncludeFile();
connect(mIncludeLister, &SieveIncludeWidgetLister::valueChanged, this, &SieveIncludeWidget::valueChanged);
lay->addWidget(mIncludeLister, 0, Qt::AlignTop);
setPageType(KSieveUi::SieveScriptBlockWidget::Include);
......@@ -290,6 +296,11 @@ void SieveIncludeWidgetLister::updateAddRemoveButton()
}
}
void SieveIncludeWidgetLister::setListOfIncludeFile(const QStringList &listOfIncludeFile)
{
mListOfIncludeFile = listOfIncludeFile;
}
void SieveIncludeWidgetLister::generatedScript(QString &script, QStringList &requires)
{
requires << QStringLiteral("include");
......@@ -321,6 +332,7 @@ void SieveIncludeWidgetLister::clearWidget(QWidget *aWidget)
QWidget *SieveIncludeWidgetLister::createWidget(QWidget *parent)
{
SieveIncludeActionWidget *w = new SieveIncludeActionWidget(parent);
w->setListOfIncludeFile(mListOfIncludeFile);
reconnectWidget(w);
return w;
}
......
......@@ -31,6 +31,7 @@ class QCheckBox;
class QXmlStreamReader;
namespace KSieveUi {
class SieveHelpButton;
class IncludeFileLineEdit;
class SieveIncludeLocation : public KComboBox
{
Q_OBJECT
......@@ -60,6 +61,7 @@ public:
void loadScript(QXmlStreamReader &element, QString &error);
bool isInitialized() const;
void clear();
void setListOfIncludeFile(const QStringList &listOfIncludeFile);
private Q_SLOTS:
void slotAddWidget();
......@@ -78,7 +80,7 @@ private:
QCheckBox *mOptional;
QCheckBox *mOnce;
SieveIncludeLocation *mLocation;
QLineEdit *mIncludeName;
IncludeFileLineEdit *mIncludeName;
};
class SieveIncludeWidgetLister : public KPIM::KWidgetLister
......@@ -91,6 +93,8 @@ public:
void generatedScript(QString &script, QStringList &requires);
void loadScript(QXmlStreamReader &element, QString &error);
void setListOfIncludeFile(const QStringList &listOfIncludeFile);
Q_SIGNALS:
void valueChanged();
......@@ -104,6 +108,7 @@ protected:
private:
void reconnectWidget(SieveIncludeActionWidget *w);
void updateAddRemoveButton();
QStringList mListOfIncludeFile;
};
class SieveIncludeWidget : public SieveWidgetPageAbstract
......
......@@ -37,7 +37,7 @@ IncludeFileLineEdit::~IncludeFileLineEdit()
}
void IncludeFileLineEdit::setStringList(const QStringList &lst)
void IncludeFileLineEdit::setListOfIncludeFile(const QStringList &lst)
{
mCompleter->setModel(new QStringListModel(lst));
}
......@@ -31,7 +31,7 @@ public:
explicit IncludeFileLineEdit(QWidget *parent = nullptr);
~IncludeFileLineEdit();
void setStringList(const QStringList &lst);
void setListOfIncludeFile(const QStringList &lst);
private:
void initialize();
......
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