File indexing completed on 2024-04-14 15:03:46

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "accountroomsettings.h"
0008 
0009 AccountRoomSettings::AccountRoomSettings() = default;
0010 
0011 AccountRoomSettings::~AccountRoomSettings() = default;
0012 
0013 void AccountRoomSettings::remove(const QString &roomId)
0014 {
0015     mPendingTypedTexts.remove(roomId);
0016 }
0017 
0018 void AccountRoomSettings::add(const QString &roomId, const PendingTypedInfo &info)
0019 {
0020     mPendingTypedTexts[roomId] = info;
0021 }
0022 
0023 AccountRoomSettings::PendingTypedInfo AccountRoomSettings::value(const QString &roomId)
0024 {
0025     return mPendingTypedTexts.value(roomId);
0026 }
0027 
0028 bool AccountRoomSettings::isEmpty() const
0029 {
0030     return mPendingTypedTexts.isEmpty();
0031 }
0032 
0033 bool AccountRoomSettings::PendingTypedInfo::isValid() const
0034 {
0035     return !text.isEmpty() || !messageIdBeingEdited.isEmpty() || (scrollbarPosition != -1) || !threadMessageId.isEmpty() || !quotePermalink.isEmpty()
0036         || !quoteText.isEmpty();
0037 }
0038 
0039 QDebug operator<<(QDebug d, const AccountRoomSettings::PendingTypedInfo &t)
0040 {
0041     d.space() << "text" << t.text;
0042     d.space() << "messageIdBeingEdited" << t.messageIdBeingEdited;
0043     d.space() << "scrollbarPosition" << t.scrollbarPosition;
0044     d.space() << "threadMessageId" << t.threadMessageId;
0045     d.space() << "quotePermalink" << t.quotePermalink;
0046     d.space() << "quoteText" << t.quoteText;
0047     return d;
0048 }