Commit 596192d8 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

fix enable disable lineedit

parent 25505b9a
Pipeline #108663 passed with stage
in 11 minutes and 9 seconds
......@@ -39,6 +39,7 @@ ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingCreateRuleWidget(QWi
connect(mPatternLineEdit, &QLineEdit::textChanged, this, [this](const QString &str) {
Q_EMIT updateOkButton(!str.trimmed().isEmpty());
});
connect(mRuleTypeComboBox, qOverload<int>(&QComboBox::currentIndexChanged), this, &ConfirmBeforeDeletingCreateRuleWidget::slotRuleTypeChanged);
}
ConfirmBeforeDeletingCreateRuleWidget::~ConfirmBeforeDeletingCreateRuleWidget() = default;
......@@ -49,6 +50,13 @@ ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo ConfirmBeforeDe
return info;
}
void ConfirmBeforeDeletingCreateRuleWidget::slotRuleTypeChanged(int index)
{
const QString str = mRuleTypeComboBox->itemData(index).toString();
const bool isAStatus = (str == QStringLiteral("unread") || str == QStringLiteral("important"));
mPatternLineEdit->setEnabled(!isAStatus);
}
void ConfirmBeforeDeletingCreateRuleWidget::setInfo(const ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo &info)
{
mPatternLineEdit->setText(info.pattern);
......
......@@ -36,6 +36,7 @@ Q_SIGNALS:
void updateOkButton(bool enabled);
private:
void slotRuleTypeChanged(int index);
void fillComboBox();
QLineEdit *const mPatternLineEdit;
QComboBox *const mRuleTypeComboBox;
......
Supports Markdown
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