File indexing completed on 2025-01-12 04:34:12

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 "misc/searchtreebasewidget.h"
0010 
0011 #include "libruqolawidgets_private_export.h"
0012 class LIBRUQOLAWIDGETS_TESTS_EXPORT UsersInRoleWidget : public SearchTreeBaseWidget
0013 {
0014     Q_OBJECT
0015 public:
0016     explicit UsersInRoleWidget(RocketChatAccount *account, QWidget *parent = nullptr);
0017     ~UsersInRoleWidget() override;
0018 
0019     [[nodiscard]] const QString &roleId() const;
0020     void setRoleId(const QString &newRoleId);
0021 
0022     [[nodiscard]] const QString &roleName() const;
0023     void setRoleName(const QString &newRoleName);
0024 
0025 protected:
0026     void updateLabel() override;
0027     void slotLoadElements(int offset = -1, int count = -1, const QString &searchName = {}) override;
0028     void slotCustomContextMenuRequested(const QPoint &pos) override;
0029 
0030 private:
0031     LIBRUQOLAWIDGETS_NO_EXPORT void slotTextChanged(const QString &str);
0032     LIBRUQOLAWIDGETS_NO_EXPORT void slotLoadMoreElements();
0033     LIBRUQOLAWIDGETS_NO_EXPORT void finishSearching();
0034     LIBRUQOLAWIDGETS_NO_EXPORT void slotSearchCleared();
0035     LIBRUQOLAWIDGETS_NO_EXPORT void slotSearchRequested(const QString &str);
0036     LIBRUQOLAWIDGETS_NO_EXPORT void slotActivateUser(const QModelIndex &index, bool activateUser);
0037     LIBRUQOLAWIDGETS_NO_EXPORT void slotAddUser();
0038     LIBRUQOLAWIDGETS_NO_EXPORT void slotRemoveUser(const QModelIndex &index);
0039     LIBRUQOLAWIDGETS_NO_EXPORT void slotRemoveUsersFromRoleDone(const QJsonObject &replyObject);
0040     LIBRUQOLAWIDGETS_NO_EXPORT void slotAddUsersToRoleDone(const QJsonObject &replyObject);
0041     [[nodiscard]] LIBRUQOLAWIDGETS_NO_EXPORT QString displayShowMessageInRoom() const;
0042     QString mRoleId;
0043     QString mRoleName;
0044 };