Changeset View
Changeset View
Standalone View
Standalone View
messageviewer/src/viewer/messagepart.cpp
Show First 20 Lines • Show All 176 Lines • ▼ Show 20 Line(s) | |||||
177 | QString MessagePart::renderInternalText() const | 177 | QString MessagePart::renderInternalText() const | ||
178 | { | 178 | { | ||
179 | if (!mSubOtp) { | 179 | if (!mSubOtp) { | ||
180 | return QString(); | 180 | return QString(); | ||
181 | } | 181 | } | ||
182 | return mSubOtp->plainTextContent(); | 182 | return mSubOtp->plainTextContent(); | ||
183 | } | 183 | } | ||
184 | 184 | | |||
185 | //-----TextMessageBlock---------------------- | ||||
186 | | ||||
187 | TextMessagePart::TextMessagePart(ObjectTreeParser* otp, KMime::Content* node, bool drawFrame, bool showLink) | ||||
188 | : MessagePart(otp, QString()) | ||||
189 | , mNode(node) | ||||
190 | , mDrawFrame(drawFrame) | ||||
191 | , mShowLink(showLink) | ||||
192 | { | ||||
193 | if (!mNode) { | ||||
194 | qCWarning(MESSAGEVIEWER_LOG) << "not a valid node"; | ||||
195 | return; | ||||
196 | } | ||||
197 | | ||||
198 | KMMsgSignatureState inlineSignatureState; | ||||
199 | KMMsgEncryptionState inlineEncryptionState; | ||||
200 | mBlocks = mOtp->writeBodyStr2(mNode->decodedContent(), mOtp->codecFor(mNode), NodeHelper::fromAsString(mNode), inlineSignatureState, inlineEncryptionState); | ||||
201 | } | ||||
202 | | ||||
203 | TextMessagePart::~TextMessagePart() | ||||
204 | { | ||||
205 | | ||||
206 | } | ||||
207 | | ||||
208 | void TextMessagePart::html(bool decorate) | ||||
209 | { | ||||
210 | HTMLBlock::Ptr block; | ||||
211 | MessageViewer::HtmlWriter *writer = mOtp->htmlWriter(); | ||||
212 | if (mDrawFrame) { | ||||
213 | block = HTMLBlock::Ptr(new TextBlock(writer, mOtp->nodeHelper(), mNode, mShowLink)); | ||||
214 | } | ||||
215 | | ||||
216 | foreach (const MessagePart::Ptr &mp, mBlocks) { | ||||
217 | mp->html(decorate); | ||||
218 | } | ||||
219 | } | ||||
220 | | ||||
221 | QString TextMessagePart::text() const | ||||
222 | { | ||||
223 | QString text; | ||||
224 | foreach (const MessagePart::Ptr &mp, mBlocks) { | ||||
225 | text += mp->text(); | ||||
226 | } | ||||
227 | return text; | ||||
228 | } | ||||
229 | | ||||
185 | //-----MimeMessageBlock---------------------- | 230 | //-----MimeMessageBlock---------------------- | ||
186 | 231 | | |||
187 | MimeMessagePart::MimeMessagePart(ObjectTreeParser *otp, KMime::Content *node, bool onlyOneMimePart) | 232 | MimeMessagePart::MimeMessagePart(ObjectTreeParser *otp, KMime::Content *node, bool onlyOneMimePart) | ||
188 | : MessagePart(otp, QString()) | 233 | : MessagePart(otp, QString()) | ||
189 | , mNode(node) | 234 | , mNode(node) | ||
190 | , mOnlyOneMimePart(onlyOneMimePart) | 235 | , mOnlyOneMimePart(onlyOneMimePart) | ||
191 | { | 236 | { | ||
192 | if (!mNode) { | 237 | if (!mNode) { | ||
▲ Show 20 Lines • Show All 296 Lines • Show Last 20 Lines |