File indexing completed on 2025-03-09 04:54:30
0001 /* 0002 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #pragma once 0007 #include "dkimmanagerkey.h" 0008 #include "messageviewer_export.h" 0009 #include <QAbstractListModel> 0010 #include <QList> 0011 namespace MessageViewer 0012 { 0013 class MESSAGEVIEWER_EXPORT DKIMManagerKeyModel : public QAbstractListModel 0014 { 0015 Q_OBJECT 0016 public: 0017 enum DKIMManagerKeyRoles { 0018 DomainRole, 0019 SelectorRole, 0020 KeyRole, 0021 StoredAtDateTimeRole, 0022 LastUsedDateTimeRole, 0023 LastColumn = LastUsedDateTimeRole, 0024 }; 0025 0026 explicit DKIMManagerKeyModel(QObject *parent = nullptr); 0027 ~DKIMManagerKeyModel() override; 0028 0029 [[nodiscard]] QList<MessageViewer::KeyInfo> keyInfos() const; 0030 void setKeyInfos(const QList<MessageViewer::KeyInfo> &newKeyInfos); 0031 0032 [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0033 [[nodiscard]] int columnCount(const QModelIndex &parent = QModelIndex()) const override; 0034 [[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 0035 [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; 0036 [[nodiscard]] bool insertKeyInfo(const MessageViewer::KeyInfo &keyInfo); 0037 void removeKeyInfo(const QString &keyValue); 0038 void removeKeyInfos(const QStringList &keyInfos); 0039 0040 void clear(); 0041 0042 private: 0043 QList<MessageViewer::KeyInfo> mKeyInfos; 0044 }; 0045 }