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

Allow to return info about "don't remove email"

parent 1d333790
Pipeline #69068 passed with stage
in 53 minutes and 52 seconds
......@@ -20,8 +20,9 @@ ConfirmBeforeDeletingInterface::~ConfirmBeforeDeletingInterface()
Akonadi::Item::List ConfirmBeforeDeletingInterface::exec(const Akonadi::Item::List &list)
{
Akonadi::Item::List lst;
QString checkFoundStr;
for (const auto &item : list) {
if (ConfirmBeforeDeletingManager::self()->deletingNeedToConfirm(item)) {
if (ConfirmBeforeDeletingManager::self()->deletingNeedToConfirm(item, checkFoundStr)) {
// Use subject ?
if (KMessageBox::questionYesNo(parentWidget(), i18n("Do you want to delete this email?"), i18n("Confirm Delete Mail")) == KMessageBox::Yes) {
lst << item;
......
......@@ -83,10 +83,10 @@ void ConfirmBeforeDeletingManager::saveRules()
}
}
bool ConfirmBeforeDeletingManager::deletingNeedToConfirm(const Akonadi::Item &item) const
bool ConfirmBeforeDeletingManager::deletingNeedToConfirm(const Akonadi::Item &item, QString &checkFound) const
{
for (const auto &r : std::as_const(mRules)) {
if (r.deletingNeedToConfirm(item)) {
if (r.deletingNeedToConfirm(item, checkFound)) {
return true;
}
}
......
......@@ -25,7 +25,7 @@ public:
void loadRules();
void saveRules();
Q_REQUIRED_RESULT bool deletingNeedToConfirm(const Akonadi::Item &list) const;
Q_REQUIRED_RESULT bool deletingNeedToConfirm(const Akonadi::Item &list, QString &checkFound) const;
Q_REQUIRED_RESULT const QVector<ConfirmBeforeDeletingRule> &rules() const;
......
......@@ -90,7 +90,7 @@ QString ConfirmBeforeDeletingRule::ruleTypeToString(ConfirmBeforeDeletingRule::R
return tmp;
}
bool ConfirmBeforeDeletingRule::deletingNeedToConfirm(const Akonadi::Item &item) const
bool ConfirmBeforeDeletingRule::deletingNeedToConfirm(const Akonadi::Item &item, QString &checkFound) const
{
bool needToConfirm = false;
if (item.hasPayload<KMime::Message::Ptr>()) {
......
......@@ -32,7 +32,7 @@ public:
Q_REQUIRED_RESULT RuleType ruleType() const;
void setRuleType(RuleType newRuleType);
Q_REQUIRED_RESULT bool deletingNeedToConfirm(const Akonadi::Item &item) const;
Q_REQUIRED_RESULT bool deletingNeedToConfirm(const Akonadi::Item &item, QString &checkFound) const;
void save(KConfigGroup &group) const;
void load(const KConfigGroup &group);
......
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