File indexing completed on 2024-12-08 04:34:20
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 class QWidget; 0010 0011 #include "misc/searchtreebasewidget.h" 0012 0013 #include "libruqolawidgets_private_export.h" 0014 class LIBRUQOLAWIDGETS_TESTS_EXPORT DirectoryWidget : public SearchTreeBaseWidget 0015 { 0016 Q_OBJECT 0017 public: 0018 enum DirectoryType { 0019 Unknown = 0, 0020 Room = 1, 0021 User = 2, 0022 Team = 3, 0023 }; 0024 explicit DirectoryWidget(RocketChatAccount *account, DirectoryType type, QWidget *parent = nullptr); 0025 ~DirectoryWidget() override; 0026 0027 void fillDirectory(); 0028 0029 [[nodiscard]] DirectoryType type() const; 0030 0031 protected: 0032 void showEvent(QShowEvent *event) override; 0033 void updateLabel() override; 0034 void slotLoadElements(int offset = -1, int count = -1, const QString &searchName = {}) override; 0035 void slotCustomContextMenuRequested(const QPoint &pos) override; 0036 0037 private: 0038 LIBRUQOLAWIDGETS_NO_EXPORT void slotOpen(const QModelIndex &index); 0039 LIBRUQOLAWIDGETS_NO_EXPORT void slotSearchRequested(const QString &str); 0040 LIBRUQOLAWIDGETS_NO_EXPORT void slotSearchCleared(); 0041 [[nodiscard]] LIBRUQOLAWIDGETS_NO_EXPORT QString displayShowMessageInRoom() const; 0042 [[nodiscard]] LIBRUQOLAWIDGETS_NO_EXPORT QString noFoundInfo() const; 0043 LIBRUQOLAWIDGETS_NO_EXPORT void finishSearching(); 0044 const DirectoryType mType; 0045 bool mWasInitialized = false; 0046 };