KTextAddons

textautogeneratemessage.cpp
1/*
2 SPDX-FileCopyrightText: 2025 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "textautogeneratemessage.h"
8#include <KTextToHTML>
9using namespace TextAutogenerateText;
10TextAutoGenerateMessage::TextAutoGenerateMessage() = default;
11
12TextAutoGenerateMessage::~TextAutoGenerateMessage() = default;
13
14QDebug operator<<(QDebug d, const TextAutogenerateText::TextAutoGenerateMessage &t)
15{
16 d.space() << "content:" << t.content();
17 d.space() << "htmlGenerated:" << t.htmlGenerated();
18 d.space() << "sender:" << t.sender();
19 d.space() << "dateTime:" << t.dateTime();
20 d.space() << "in progress:" << t.inProgress();
21 d.space() << "uuid:" << t.uuid();
22 d.space() << "answerUuid:" << t.answerUuid();
23 return d;
24}
25
26QString TextAutoGenerateMessage::content() const
27{
28 return mContent;
29}
30
31void TextAutoGenerateMessage::setContent(const QString &newContent)
32{
33 if (mContent != newContent) {
34 mContent = newContent;
36 mHtmlGenerated = KTextToHTML::convertToHtml(mContent, convertFlags);
37 }
38}
39
40TextAutoGenerateMessage::Sender TextAutoGenerateMessage::sender() const
41{
42 return mSender;
43}
44
45void TextAutoGenerateMessage::setSender(TextAutoGenerateMessage::Sender newSender)
46{
47 mSender = newSender;
48}
49
50qint64 TextAutoGenerateMessage::dateTime() const
51{
52 return mDateTime;
53}
54
55void TextAutoGenerateMessage::setDateTime(qint64 newDateTime)
56{
57 mDateTime = newDateTime;
58}
59
60bool TextAutoGenerateMessage::isValid() const
61{
62 return mSender != TextAutoGenerateMessage::Sender::Unknown;
63}
64
65bool TextAutoGenerateMessage::inProgress() const
66{
67 return mInProgress;
68}
69
70void TextAutoGenerateMessage::setInProgress(bool newInProgress)
71{
72 mInProgress = newInProgress;
73}
74
75bool TextAutoGenerateMessage::operator==(const TextAutoGenerateMessage &other) const
76{
77 return other.uuid() == mUuid && other.inProgress() == mInProgress && other.sender() == mSender && other.dateTime() == mDateTime
78 && other.content() == mContent && other.answerUuid() == mAnswerUuid;
79}
80
81QByteArray TextAutoGenerateMessage::uuid() const
82{
83 return mUuid;
84}
85
86void TextAutoGenerateMessage::setUuid(const QByteArray &newUuid)
87{
88 mUuid = newUuid;
89}
90
91QString TextAutoGenerateMessage::htmlGenerated() const
92{
93 return mHtmlGenerated;
94}
95
96QByteArray TextAutoGenerateMessage::answerUuid() const
97{
98 return mAnswerUuid;
99}
100
101void TextAutoGenerateMessage::setAnswerUuid(const QByteArray &newAnswerUuid)
102{
103 mAnswerUuid = newAnswerUuid;
104}
105
106#include "moc_textautogeneratemessage.cpp"
KCOREADDONS_EXPORT QString convertToHtml(const QString &plainText, const KTextToHTML::Options &options, int maxUrlLen=4096, int maxAddressLen=255)
QFlags< Option > Options
QDebug & space()
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 18 2025 12:00:52 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.