File indexing completed on 2024-02-18 15:43:49

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 "directoryusersmodel.h"
0010 
0011 #include "libruqolacore_export.h"
0012 
0013 class LIBRUQOLACORE_EXPORT AdminUsersModel : public DirectoryUsersModel
0014 {
0015     Q_OBJECT
0016 public:
0017     enum AdminUsersRoles {
0018         Name,
0019         UserName,
0020         Email,
0021         Roles,
0022         Status,
0023         UserId,
0024         ActiveUserDisplay,
0025         ActiveUser,
0026         Administrator,
0027         LastColumn = Administrator,
0028     };
0029     Q_ENUM(AdminUsersRoles)
0030 
0031     explicit AdminUsersModel(QObject *parent = nullptr);
0032     ~AdminUsersModel() override;
0033 
0034     [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
0035     [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
0036     [[nodiscard]] int columnCount(const QModelIndex &parent = QModelIndex()) const override;
0037     [[nodiscard]] QList<int> hideColumns() const override;
0038     [[nodiscard]] bool setData(const QModelIndex &index, const QVariant &value, int role) override;
0039 
0040 protected:
0041     [[nodiscard]] LIBRUQOLACORE_NO_EXPORT Users::ParseType parseType() const override;
0042     LIBRUQOLACORE_NO_EXPORT void removeElement(const QString &identifier) override;
0043     LIBRUQOLACORE_NO_EXPORT void updateElement(const QJsonObject &obj) override;
0044     LIBRUQOLACORE_NO_EXPORT void insertElement(const QJsonObject &obj) override;
0045 };