Messagelib

textpart.cpp
1/*
2 SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "textpart.h"
8
9using namespace MessageComposer;
10
11class TextPart::TextPartPrivate
12{
13public:
14 TextPartPrivate() = default;
15
16 KPIMTextEdit::ImageList embeddedImages;
17 QString cleanPlainText;
18 QString wrappedPlainText;
19 QString cleanHtml;
20 bool wordWrappingEnabled = true;
21 bool warnBadCharset = true;
22};
23
24TextPart::TextPart(QObject *parent)
25 : MessagePart(parent)
26 , d(new TextPartPrivate)
27{
28}
29
30TextPart::~TextPart() = default;
31
33{
34 return d->wordWrappingEnabled;
35}
36
37void TextPart::setWordWrappingEnabled(bool enabled)
38{
39 if (d->wordWrappingEnabled == enabled) {
40 return;
41 }
42 d->wordWrappingEnabled = enabled;
43 Q_EMIT wordWrappingChanged();
44}
45
46bool TextPart::warnBadCharset() const
47{
48 return d->warnBadCharset;
49}
50
51void TextPart::setWarnBadCharset(bool warn)
52{
53 if (d->warnBadCharset == warn) {
54 return;
55 }
56 d->warnBadCharset = warn;
57 Q_EMIT warnBadCharsetChanged();
58}
59
60QString TextPart::cleanPlainText() const
61{
62 return d->cleanPlainText;
63}
64
65void TextPart::setCleanPlainText(const QString &text)
66{
67 if (d->cleanPlainText == text) {
68 return;
69 }
70 d->cleanPlainText = text;
71 Q_EMIT cleanPlainTextChanged();
72}
73
74QString TextPart::wrappedPlainText() const
75{
76 return d->wrappedPlainText;
77}
78
79void TextPart::setWrappedPlainText(const QString &text)
80{
81 if (d->wrappedPlainText == text) {
82 return;
83 }
84 d->wrappedPlainText = text;
85 Q_EMIT wrappedPlainTextChanged();
86}
87
88bool TextPart::isHtmlUsed() const
89{
90 return !d->cleanHtml.isEmpty();
91}
92
93QString TextPart::cleanHtml() const
94{
95 return d->cleanHtml;
96}
97
98void TextPart::setCleanHtml(const QString &text)
99{
100 if (d->cleanHtml == text) {
101 return;
102 }
103 d->cleanHtml = text;
104 Q_EMIT cleanHtmlChanged();
105}
106
107bool TextPart::hasEmbeddedImages() const
108{
109 return !d->embeddedImages.isEmpty();
110}
111
112KPIMTextEdit::ImageList TextPart::embeddedImages() const
113{
114 return d->embeddedImages;
115}
116
117void TextPart::setEmbeddedImages(const KPIMTextEdit::ImageList &images)
118{
119 d->embeddedImages = images;
120}
121
122#include "moc_textpart.cpp"
bool warnBadCharset
Default true.
Definition textpart.h:28
bool isWordWrappingEnabled
True iff the text is word wrapped. By default: true.
Definition textpart.h:25
Simple interface that both EncryptJob and SignEncryptJob implement so the composer can extract some e...
Q_EMITQ_EMIT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:33:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.