Commit 833cf18e authored by Laurent Montel's avatar Laurent Montel 😁

Fix clear actions/conditions

parent 8f150576
......@@ -200,6 +200,14 @@ void SieveActionWidget::slotHelp()
}
}
void SieveActionWidget::clear()
{
mComboBox->setCurrentIndex(mComboBox->count() - 1);
setFilterAction(nullptr);
mCommentButton->setEnabled(false);
mHelpButton->setEnabled(false);
}
void SieveActionWidget::slotAddComment()
{
const int index = mComboBox->currentIndex();
......@@ -338,9 +346,11 @@ void SieveActionWidgetLister::reconnectWidget(SieveActionWidget *w)
void SieveActionWidgetLister::clearWidget(QWidget *aWidget)
{
Q_UNUSED(aWidget);
if (aWidget) {
SieveActionWidget *widget = static_cast<SieveActionWidget *>(aWidget);
widget->clear();
}
Q_EMIT valueChanged();
//TODO
}
QWidget *SieveActionWidgetLister::createWidget(QWidget *parent)
......
......@@ -47,6 +47,7 @@ public:
void generatedScript(QString &script, QStringList &requires, bool onlyActions, bool inForEveryPartLoop);
bool setAction(const QString &actionName, const QDomElement &element, const QString &comment, QString &error);
bool isConfigurated() const;
void clear();
private Q_SLOTS:
void slotAddWidget();
......
......@@ -188,9 +188,11 @@ void SieveConditionWidget::slotRemoveWidget()
Q_EMIT valueChanged();
}
void SieveConditionWidget::reset()
void SieveConditionWidget::clear()
{
//TODO
mComboBox->setCurrentIndex(mComboBox->count() - 1);
setFilterCondition(nullptr);
mHelpButton->setEnabled(false);
}
void SieveConditionWidget::updateAddRemoveButton(bool addButtonEnabled, bool removeButtonEnabled)
......@@ -270,8 +272,10 @@ void SieveConditionWidgetLister::reconnectWidget(SieveConditionWidget *w)
void SieveConditionWidgetLister::clearWidget(QWidget *aWidget)
{
//TODO
Q_UNUSED(aWidget);
if (aWidget) {
SieveConditionWidget *widget = static_cast<SieveConditionWidget *>(aWidget);
widget->clear();
}
Q_EMIT valueChanged();
}
......
......@@ -44,6 +44,7 @@ public:
void updateAddRemoveButton(bool addButtonEnabled, bool removeButtonEnabled);
void generatedScript(QString &script, QStringList &requires, bool inForEveryPartLoop);
void setCondition(const QString &conditionName, const QDomElement &element, bool notCondition, QString &error);
void clear();
private Q_SLOTS:
void slotAddWidget();
......@@ -59,7 +60,6 @@ Q_SIGNALS:
private:
void initWidget();
void setFilterCondition(QWidget *widget);
void reset();
QList<KSieveUi::SieveCondition *> mConditionList;
QPushButton *mAdd;
QPushButton *mRemove;
......
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