Commit aaa054a2 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add constructor for info

parent cc58af25
Pipeline #73210 passed with stage
in 53 minutes and 5 seconds
......@@ -45,9 +45,7 @@ ConfirmBeforeDeletingCreateRuleWidget::~ConfirmBeforeDeletingCreateRuleWidget()
ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo ConfirmBeforeDeletingCreateRuleWidget::info() const
{
ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo info;
info.pattern = mPatternLineEdit->text();
info.ruleType = mRuleTypeComboBox->currentData().toString();
const ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo info(mPatternLineEdit->text(), mRuleTypeComboBox->currentData().toString());
return info;
}
......
......@@ -16,6 +16,11 @@ class KMAILCONFIRMBEFOREDELETING_TESTS_EXPORT ConfirmBeforeDeletingCreateRuleWid
Q_OBJECT
public:
struct ConfirmBeforeDeletingInfo {
ConfirmBeforeDeletingInfo(const QString &p, const QString &type)
: pattern(p)
, ruleType(type)
{
}
QString pattern;
QString ruleType;
};
......
......@@ -44,9 +44,7 @@ void ConfirmBeforeDeletingWidget::fillRules()
const QVector<ConfirmBeforeDeletingRule> rules = ConfirmBeforeDeletingManager::self()->rules();
for (const ConfirmBeforeDeletingRule &r : rules) {
auto item = new QTreeWidgetItem(mTreeWidget);
ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo info;
info.pattern = r.pattern();
info.ruleType = ConfirmBeforeDeletingRule::ruleTypeToString(r.ruleType());
const ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo info(r.pattern(), ConfirmBeforeDeletingRule::ruleTypeToString(r.ruleType()));
initializeItem(item, info);
}
}
......@@ -56,9 +54,7 @@ void ConfirmBeforeDeletingWidget::slotEditRule()
QTreeWidgetItem *item = mTreeWidget->currentItem();
if (item) {
QPointer<ConfirmBeforeDeletingCreateRuleDialog> dlg = new ConfirmBeforeDeletingCreateRuleDialog(this);
ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo currentInfo;
currentInfo.pattern = item->text(1);
currentInfo.ruleType = item->text(0);
const ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo currentInfo(item->text(1), item->text(0));
dlg->setInfo(currentInfo);
if (dlg->exec()) {
initializeItem(item, dlg->info());
......
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