File indexing completed on 2024-02-25 16:44:41

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "custombasemodel.h"
0010 #include "libruqolacore_export.h"
0011 #include "users.h"
0012 
0013 class LIBRUQOLACORE_EXPORT UsersInRoleModel : public CustomBaseModel
0014 {
0015     Q_OBJECT
0016 public:
0017     enum UsersInRoleRoles {
0018         Name,
0019         Email,
0020         UserId,
0021         UserName,
0022         LastColumn = UserName,
0023     };
0024     Q_ENUM(UsersInRoleRoles)
0025     explicit UsersInRoleModel(QObject *parent = nullptr);
0026     ~UsersInRoleModel() 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 total() const override;
0032 
0033     void parseElements(const QJsonObject &obj) override;
0034     void addMoreElements(const QJsonObject &obj) override;
0035 
0036     int columnCount(const QModelIndex &parent = {}) const override;
0037 
0038 protected:
0039     [[nodiscard]] QList<int> hideColumns() const override;
0040 
0041 private:
0042     Q_DISABLE_COPY(UsersInRoleModel)
0043     LIBRUQOLACORE_NO_EXPORT void checkFullList() override;
0044     Users mUsers;
0045 };