Commit 39d091d7 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Allow to test if we really edit rule

parent bf3a8d77
Pipeline #74705 passed with stage
in 55 minutes and 3 seconds
......@@ -62,3 +62,13 @@ void ConfirmBeforeDeletingCreateRuleWidget::fillComboBox()
mRuleTypeComboBox->addItem(i18n("To"), QStringLiteral("to"));
mRuleTypeComboBox->addItem(i18n("Cc"), QStringLiteral("cc"));
}
bool ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo::operator==(const ConfirmBeforeDeletingInfo &other) const
{
return other.pattern != pattern && other.ruleType != ruleType;
}
bool ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo::operator!=(const ConfirmBeforeDeletingInfo &other) const
{
return !operator==(other);
}
......@@ -23,6 +23,8 @@ public:
}
QString pattern;
QString ruleType;
Q_REQUIRED_RESULT bool operator==(const ConfirmBeforeDeletingInfo &other) const;
Q_REQUIRED_RESULT bool operator!=(const ConfirmBeforeDeletingInfo &other) const;
};
explicit ConfirmBeforeDeletingCreateRuleWidget(QWidget *parent = nullptr);
~ConfirmBeforeDeletingCreateRuleWidget() override;
......
......@@ -37,7 +37,6 @@ Akonadi::Item::List ConfirmBeforeDeletingInterface::exec(const Akonadi::Item::Li
continue;
}
// TODO add warning icon ?
QPointer<ConfirmBeforeDeletingMessageBoxDialog> dlg = new ConfirmBeforeDeletingMessageBoxDialog(parentWidget());
dlg->setInfo(i18n("Do you want to delete this email?\n%1", checkFoundStr));
const int result = dlg->exec();
......
......@@ -25,14 +25,11 @@ ConfirmBeforeDeletingMessageBoxDialog::ConfirmBeforeDeletingMessageBoxDialog(QWi
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::Cancel | QDialogButtonBox::No, this);
buttonBox->setObjectName(QStringLiteral("buttonBox"));
mainLayout->addWidget(buttonBox);
connect(buttonBox->button(QDialogButtonBox::Yes), &QPushButton::clicked, this, [this]() {
done(QDialogButtonBox::Yes);
});
connect(buttonBox->button(QDialogButtonBox::No), &QPushButton::clicked, this, [this]() {
done(QDialogButtonBox::No);
});
connect(buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, [this]() {
done(QDialogButtonBox::Cancel);
connect(buttonBox, &QDialogButtonBox::clicked, this, [this, buttonBox](QAbstractButton *button) {
QDialogButtonBox::StandardButton code = buttonBox->standardButton(button);
if (code != QDialogButtonBox::NoButton) {
done(code);
}
});
}
......
......@@ -40,7 +40,7 @@ ConfirmBeforeDeletingMessageBoxWidget::ConfirmBeforeDeletingMessageBoxWidget(QWi
mLabelInfo->setObjectName(QStringLiteral("mLabelInfo"));
mLabelInfo->setWordWrap(true);
textLayout->addWidget(mLabelInfo);
textLayout->addWidget(mLabelInfo, Qt::AlignTop);
mUseSameResultForOtherCheck->setObjectName(QStringLiteral("mUseSameResultForOtherCheck"));
textLayout->addWidget(mUseSameResultForOtherCheck);
......
......@@ -57,7 +57,9 @@ void ConfirmBeforeDeletingWidget::slotEditRule()
const ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo currentInfo(item->text(1), item->text(0));
dlg->setInfo(currentInfo);
if (dlg->exec()) {
initializeItem(item, dlg->info());
if (currentInfo != currentInfo) {
initializeItem(item, currentInfo);
}
}
delete dlg;
}
......
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