Messagelib

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

KDE's Doxygen guidelines are available online.