File indexing completed on 2024-12-01 07:41:07
0001 /* 0002 SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "libruqolacore_export.h" 0010 #include "permissions/permissions.h" 0011 #include <QAbstractListModel> 0012 0013 class LIBRUQOLACORE_EXPORT PermissionsModel : public QAbstractListModel 0014 { 0015 Q_OBJECT 0016 public: 0017 enum AdminPermissionsRoles { 0018 IdentifierRole, 0019 RolesRole, 0020 RolesStrRole, 0021 LastColumn = RolesStrRole, 0022 }; 0023 Q_ENUM(AdminPermissionsRoles) 0024 0025 explicit PermissionsModel(QObject *parent = nullptr); 0026 ~PermissionsModel() override; 0027 0028 [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0029 [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override; 0030 [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role) const override; 0031 [[nodiscard]] int columnCount(const QModelIndex &parent = QModelIndex()) const override; 0032 0033 [[nodiscard]] Permissions permissions() const; 0034 void setPermissions(const Permissions &newPermissions); 0035 0036 private: 0037 Permissions mPermissions; 0038 };