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 "core/textautogeneratemessageutils.h"
9
10#include <QDateTime>
11
12using namespace TextAutogenerateText;
13TextAutoGenerateMessage::TextAutoGenerateMessage() = default;
14
15TextAutoGenerateMessage::~TextAutoGenerateMessage() = default;
16
18{
19 d.space() << "content:" << t.content();
20 d.space() << "htmlGenerated:" << t.htmlGenerated();
21 d.space() << "sender:" << t.sender();
22 d.space() << "dateTime:" << t.dateTime();
23 d.space() << "in progress:" << t.inProgress();
24 d.space() << "uuid:" << t.uuid();
25 d.space() << "answerUuid:" << t.answerUuid();
26 d.space() << "topic:" << t.topic();
27 d.space() << "mouseHover:" << t.mouseHover();
28 d.space() << "archived:" << t.archived();
29 d.space() << "editingMode:" << t.editingMode();
30 return d;
31}
32
33QString TextAutoGenerateMessage::content() const
34{
35 return mContent;
36}
37
38void TextAutoGenerateMessage::setContent(const QString &newContent)
39{
40 if (mContent != newContent) {
41 mContent = newContent;
42 mHtmlGenerated = TextAutoGenerateMessageUtils::convertTextToHtml(mContent);
43 }
44}
45
46TextAutoGenerateMessage::Sender TextAutoGenerateMessage::sender() const
47{
48 return mSender;
49}
50
51void TextAutoGenerateMessage::setSender(TextAutoGenerateMessage::Sender newSender)
52{
53 mSender = newSender;
54}
55
56qint64 TextAutoGenerateMessage::dateTime() const
57{
58 return mDateTime;
59}
60
61void TextAutoGenerateMessage::setDateTime(qint64 newDateTime)
62{
63 mDateTime = newDateTime;
64 QLocale locale;
65 mDateTimeStr = locale.toString(QDateTime::fromSecsSinceEpoch(mDateTime));
66}
67
68bool TextAutoGenerateMessage::isValid() const
69{
70 return mSender != TextAutoGenerateMessage::Sender::Unknown;
71}
72
73bool TextAutoGenerateMessage::inProgress() const
74{
75 return mInProgress;
76}
77
78void TextAutoGenerateMessage::setInProgress(bool newInProgress)
79{
80 mInProgress = newInProgress;
81}
82
83bool TextAutoGenerateMessage::operator==(const TextAutoGenerateMessage &other) const
84{
85 return other.uuid() == mUuid && other.inProgress() == mInProgress && other.sender() == mSender && other.dateTime() == mDateTime
86 && other.content() == mContent && other.answerUuid() == mAnswerUuid && other.topic() == mTopic && other.mArchived == mArchived
87 && other.editingMode() == mEditingMode;
88}
89
90QByteArray TextAutoGenerateMessage::uuid() const
91{
92 return mUuid;
93}
94
95void TextAutoGenerateMessage::setUuid(const QByteArray &newUuid)
96{
97 mUuid = newUuid;
98}
99
100QString TextAutoGenerateMessage::htmlGenerated() const
101{
102 return mHtmlGenerated;
103}
104
105QByteArray TextAutoGenerateMessage::answerUuid() const
106{
107 return mAnswerUuid;
108}
109
110void TextAutoGenerateMessage::setAnswerUuid(const QByteArray &newAnswerUuid)
111{
112 mAnswerUuid = newAnswerUuid;
113}
114
115QString TextAutoGenerateMessage::topic() const
116{
117 return mTopic;
118}
119
120void TextAutoGenerateMessage::setTopic(const QString &newTopic)
121{
122 mTopic = newTopic;
123}
124
125QString TextAutoGenerateMessage::dateTimeStr() const
126{
127 return mDateTimeStr;
128}
129
130bool TextAutoGenerateMessage::mouseHover() const
131{
132 return mMouseHover;
133}
134
135void TextAutoGenerateMessage::setMouseHover(bool newMouseHover)
136{
137 mMouseHover = newMouseHover;
138}
139
140bool TextAutoGenerateMessage::archived() const
141{
142 return mArchived;
143}
144
145void TextAutoGenerateMessage::setArchived(bool newArchived)
146{
147 mArchived = newArchived;
148}
149
150bool TextAutoGenerateMessage::editingMode() const
151{
152 return mEditingMode;
153}
154
155void TextAutoGenerateMessage::setEditingMode(bool newEditingMode)
156{
157 mEditingMode = newEditingMode;
158}
159
160#include "moc_textautogeneratemessage.cpp"
QDateTime fromSecsSinceEpoch(qint64 secs)
QDebug & space()
QString toString(QDate date, FormatType format) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri May 2 2025 12:06:03 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.