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

Add support for bcc

parent b32ff425
Pipeline #98995 passed with stage
in 53 minutes and 37 seconds
......@@ -63,6 +63,7 @@ void ConfirmBeforeDeletingCreateRuleWidget::fillComboBox()
mRuleTypeComboBox->addItem(i18n("Subject"), ConfirmBeforeDeletingRule::ruleTypeToString(ConfirmBeforeDeletingRule::Subject));
mRuleTypeComboBox->addItem(i18n("To"), ConfirmBeforeDeletingRule::ruleTypeToString(ConfirmBeforeDeletingRule::To));
mRuleTypeComboBox->addItem(i18n("Cc"), ConfirmBeforeDeletingRule::ruleTypeToString(ConfirmBeforeDeletingRule::Cc));
mRuleTypeComboBox->addItem(i18n("Bcc"), ConfirmBeforeDeletingRule::ruleTypeToString(ConfirmBeforeDeletingRule::Bcc));
}
bool ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo::operator==(const ConfirmBeforeDeletingInfo &other) const
......
......@@ -66,6 +66,8 @@ ConfirmBeforeDeletingRule::RuleType ConfirmBeforeDeletingRule::stringToRuleType(
return To;
} else if (str == QLatin1String("cc")) {
return Cc;
} else if (str == QLatin1String("bcc")) {
return Bcc;
}
return Unknown;
}
......@@ -93,6 +95,9 @@ QString ConfirmBeforeDeletingRule::ruleTypeToString(ConfirmBeforeDeletingRule::R
case Cc:
tmp = QStringLiteral("cc");
break;
case Bcc:
tmp = QStringLiteral("bcc");
break;
}
return tmp;
}
......@@ -141,6 +146,16 @@ bool ConfirmBeforeDeletingRule::deletingNeedToConfirm(const Akonadi::Item &item,
}
break;
}
case Bcc: {
if (auto bcc = msg->bcc(false)) {
const QString bccStr = bcc->asUnicodeString();
if (bccStr.contains(pattern())) {
needToConfirm = true;
generateConfirmMessageInfo(msg, checkFoundInfo);
}
}
break;
}
case Unknown:
qCWarning(KMAIL_CONFIRMBEFOREDELETING_PLUGIN_LOG) << "Invalid rules!";
break;
......
......@@ -21,6 +21,7 @@ public:
Subject,
To,
Cc,
Bcc,
};
Q_ENUM(RuleType)
......
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