File indexing completed on 2024-09-15 12:31:34
0001 /* 0002 SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QAbstractListModel> 0010 0011 #include "libruqolacore_export.h" 0012 #include "personalaccesstokens/personalaccesstokeninfos.h" 0013 #include <QVector> 0014 0015 class LIBRUQOLACORE_EXPORT PersonalAccessTokenInfosModel : public QAbstractListModel 0016 { 0017 Q_OBJECT 0018 public: 0019 enum PersonalAccessTokenInfosRoles { 0020 Name, 0021 CreateAt, 0022 CreateAtDateTime, 0023 LastTokenPart, 0024 ByPassTwoFactor, 0025 LastColumn = ByPassTwoFactor, 0026 }; 0027 Q_ENUM(PersonalAccessTokenInfosRoles) 0028 0029 explicit PersonalAccessTokenInfosModel(QObject *parent = nullptr); 0030 ~PersonalAccessTokenInfosModel() override; 0031 0032 [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0033 [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override; 0034 [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role) const override; 0035 [[nodiscard]] int columnCount(const QModelIndex &parent = QModelIndex()) const override; 0036 0037 void clear(); 0038 0039 void insertPersonalAccessTokenInfos(const PersonalAccessTokenInfos &infos); 0040 0041 void removeToken(const QString &tokenName); 0042 0043 private: 0044 PersonalAccessTokenInfos mPersonalAccessTokenInfos; 0045 };