File indexing completed on 2024-05-12 16:27:13

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 "common/completionlineedit.h"
0010 #include "libruqolawidgets_private_export.h"
0011 class QJsonObject;
0012 class InputCompleterModel;
0013 class ChannelCompleterFilterProxyModel;
0014 class RocketChatAccount;
0015 class LIBRUQOLAWIDGETS_TESTS_EXPORT ChannelSearchNameLineEdit : public CompletionLineEdit
0016 {
0017     Q_OBJECT
0018 public:
0019     struct ChannelCompletionInfo {
0020         QString channelName;
0021         QString channelId;
0022     };
0023     explicit ChannelSearchNameLineEdit(RocketChatAccount *account, QWidget *parent = nullptr);
0024     ~ChannelSearchNameLineEdit() override;
0025 Q_SIGNALS:
0026     void newRoomName(const ChannelSearchNameLineEdit::ChannelCompletionInfo &userInfo);
0027 
0028 private:
0029     void slotTextChanged(const QString &text);
0030     void slotComplete(const QModelIndex &index);
0031     void slotSearchDone(const QJsonObject &obj);
0032     ChannelCompleterFilterProxyModel *const mChannelCompleterFilterProxyModel;
0033     InputCompleterModel *const mChannelCompleterModel;
0034     RocketChatAccount *const mRocketChatAccount;
0035 };