Commit 613b04da authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Continue to implement rules

parent de305359
Pipeline #67989 canceled with stage
......@@ -30,3 +30,13 @@ void ConfirmBeforeDeletingManager::saveRules()
{
// TODO
}
bool ConfirmBeforeDeletingManager::deletingNeedToConfirm() const
{
for (const auto &r : qAsConst(mRules)) {
if (r.deletingNeedToConfirm()) {
return true;
}
}
return false;
}
......@@ -23,6 +23,8 @@ public:
void loadRules();
void saveRules();
Q_REQUIRED_RESULT bool deletingNeedToConfirm() const;
private:
QVector<ConfirmBeforeDeletingRule> mRules;
};
......@@ -24,8 +24,25 @@ void ConfirmBeforeDeletingRule::setPattern(const QString &newPattern)
mPattern = newPattern;
}
ConfirmBeforeDeletingRule::RuleType ConfirmBeforeDeletingRule::ruleType() const
{
return mRuleType;
}
void ConfirmBeforeDeletingRule::setRuleType(RuleType newRuleType)
{
mRuleType = newRuleType;
}
bool ConfirmBeforeDeletingRule::deletingNeedToConfirm() const
{
// TODO
return false;
}
QDebug operator<<(QDebug d, const ConfirmBeforeDeletingRule &t)
{
d << "Pattern " << t.pattern();
d << "mRuleType " << t.ruleType();
return d;
}
......@@ -10,7 +10,17 @@
#include <QString>
class KMAILCONFIRMBEFOREDELETING_EXPORT ConfirmBeforeDeletingRule
{
Q_GADGET
public:
enum RuleType {
Unknown = 0,
Body,
Subject,
To,
Cc,
};
Q_ENUM(RuleType)
ConfirmBeforeDeletingRule();
~ConfirmBeforeDeletingRule();
......@@ -18,8 +28,14 @@ public:
void setPattern(const QString &newPattern);
// TODO save/Load
Q_REQUIRED_RESULT RuleType ruleType() const;
void setRuleType(RuleType newRuleType);
Q_REQUIRED_RESULT bool deletingNeedToConfirm() const;
private:
QString mPattern;
RuleType mRuleType = RuleType::Unknown;
};
Q_DECLARE_TYPEINFO(ConfirmBeforeDeletingRule, Q_MOVABLE_TYPE);
KMAILCONFIRMBEFOREDELETING_EXPORT QDebug operator<<(QDebug d, const ConfirmBeforeDeletingRule &t);
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