File indexing completed on 2025-03-09 04:54:30
0001 /* 0002 SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "messageviewer_export.h" 0010 #include <KSharedConfig> 0011 #include <MessageViewer/DKIMRule> 0012 #include <QList> 0013 #include <QObject> 0014 namespace MessageViewer 0015 { 0016 /** 0017 * @brief The DKIMManagerRules class 0018 * @author Laurent Montel <montel@kde.org> 0019 */ 0020 class MESSAGEVIEWER_EXPORT DKIMManagerRules : public QObject 0021 { 0022 Q_OBJECT 0023 public: 0024 explicit DKIMManagerRules(QObject *parent = nullptr); 0025 ~DKIMManagerRules() override; 0026 static DKIMManagerRules *self(); 0027 0028 void addRule(const DKIMRule &rule); 0029 0030 [[nodiscard]] QList<DKIMRule> rules() const; 0031 0032 void saveRules(const QList<DKIMRule> &lst); 0033 0034 void clear(); 0035 0036 [[nodiscard]] int importRules(const QString &fileName); 0037 void exportRules(const QString &fileName, const QList<DKIMRule> &lst = {}); 0038 0039 [[nodiscard]] bool isEmpty() const; 0040 0041 private: 0042 [[nodiscard]] MESSAGEVIEWER_NO_EXPORT int loadRules(const QString &fileName = QString()); 0043 MESSAGEVIEWER_NO_EXPORT void save(const QString &fileName = QString(), const QList<DKIMRule> &lst = {}); 0044 [[nodiscard]] MESSAGEVIEWER_NO_EXPORT QStringList ruleGroups(const KSharedConfig::Ptr &config) const; 0045 QList<DKIMRule> mRules; 0046 }; 0047 }