File indexing completed on 2024-04-21 12:28:42

0001 /*
0002    SPDX-FileCopyrightText: 2018-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolacore_export.h"
0010 #include "messagesmodel.h"
0011 
0012 class RocketChatAccount;
0013 class LIBRUQOLACORE_EXPORT CommonMessagesModel : public MessagesModel
0014 {
0015     Q_OBJECT
0016 public:
0017     explicit CommonMessagesModel(RocketChatAccount *account = nullptr, QObject *parent = nullptr);
0018     ~CommonMessagesModel() override;
0019     void parse(const QJsonObject &obj);
0020 
0021     void setLoadCommonMessagesInProgress(bool loadSearchMessageInProgress);
0022     [[nodiscard]] bool loadCommonMessagesInProgress() const;
0023 
0024     void clearModel();
0025 Q_SIGNALS:
0026     void stringNotFoundChanged();
0027     void loadingInProgressChanged();
0028 
0029 protected:
0030     [[nodiscard]] virtual QVector<Message> extractMessages(const QJsonObject &obj);
0031 
0032 private:
0033     LIBRUQOLACORE_NO_EXPORT void setStringNotFound(bool stringNotFound);
0034     bool mStringNotFound = true;
0035     bool mLoadingInProgress = false;
0036 };