Messagelib
9#include "mimetreeparser_export.h"
11#include "mimetreeparser/bodypartformatter.h"
12#include "mimetreeparser/util.h"
14#include <KMime/Message>
16#include <gpgme++/decryptionresult.h>
17#include <gpgme++/importresult.h>
18#include <gpgme++/key.h>
19#include <gpgme++/verificationresult.h>
21#include <QSharedPointer>
46namespace MimeTreeParser
48class CompositeMemento;
49class MessagePartPrivate;
57class MIMETREEPARSER_EXPORT MessagePart :
public QObject
62 Q_PROPERTY(
bool isAttachment READ isAttachment)
66 Q_PROPERTY(
bool neverDisplayInline READ neverDisplayInline CONSTANT)
72 ~MessagePart()
override;
74 void setParentPart(MessagePart *parentPart);
75 [[nodiscard]] MessagePart *parentPart()
const;
77 [[nodiscard]]
virtual QString text()
const;
78 void setText(
const QString &text);
80 [[nodiscard]]
virtual QString plaintextContent()
const;
81 [[nodiscard]]
virtual QString htmlContent()
const;
95 [[nodiscard]]
bool isAttachment()
const;
97 [[nodiscard]]
QString attachmentIndex()
const;
106 void setIsRoot(
bool root);
107 [[nodiscard]]
bool isRoot()
const;
109 virtual bool isHtml()
const;
111 [[nodiscard]]
bool neverDisplayInline()
const;
112 void setNeverDisplayInline(
bool displayInline);
113 [[nodiscard]]
bool isImage()
const;
114 void setIsImage(
bool image);
116 PartMetaData *partMetaData()
const;
122 virtual void fix()
const;
124 void appendSubPart(
const MessagePart::Ptr &messagePart);
126 [[nodiscard]]
bool hasSubParts()
const;
127 void clearSubParts();
132 [[nodiscard]]
virtual bool hasHeader(
const char *headerType)
const;
138 [[nodiscard]]
QString renderInternalText()
const;
143 std::unique_ptr<MessagePartPrivate> d;
148class MIMETREEPARSER_EXPORT MimeMessagePart :
public MessagePart
154 ~MimeMessagePart()
override;
156 [[nodiscard]]
QString text()
const override;
158 [[nodiscard]]
QString plaintextContent()
const override;
159 [[nodiscard]]
QString htmlContent()
const override;
162 const bool mOnlyOneMimePart;
167class MIMETREEPARSER_EXPORT MessagePartList :
public MessagePart
173 ~MessagePartList()
override;
175 [[nodiscard]]
QString text()
const override;
177 [[nodiscard]]
QString plaintextContent()
const override;
178 [[nodiscard]]
QString htmlContent()
const override;
189class MIMETREEPARSER_EXPORT TextMessagePart :
public MessagePartList
192 Q_PROPERTY(
bool showLink READ showLink CONSTANT)
193 Q_PROPERTY(
bool isFirstTextPart READ isFirstTextPart CONSTANT)
194 Q_PROPERTY(
bool hasLabel READ hasLabel CONSTANT)
200 ~TextMessagePart()
override;
202 KMMsgSignatureState signatureState()
const;
203 KMMsgEncryptionState encryptionState()
const;
205 [[nodiscard]]
bool decryptMessage()
const;
207 [[nodiscard]]
bool showLink()
const;
208 [[nodiscard]]
bool isFirstTextPart()
const;
209 [[nodiscard]]
bool hasLabel()
const;
212 [[nodiscard]]
QString label()
const;
214 [[nodiscard]]
QString comment()
const;
219 MIMETREEPARSER_NO_EXPORT
void parseContent();
221 KMMsgSignatureState mSignatureState;
222 KMMsgEncryptionState mEncryptionState;
223 const bool mDecryptMessage;
228class MIMETREEPARSER_EXPORT AttachmentMessagePart :
public TextMessagePart
234 ~AttachmentMessagePart()
override;
239class MIMETREEPARSER_EXPORT HtmlMessagePart :
public MessagePart
245 ~HtmlMessagePart()
override;
247 [[nodiscard]]
QString text()
const override;
248 [[nodiscard]]
QString plaintextContent()
const override;
250 void fix()
const override;
251 [[nodiscard]]
bool isHtml()
const override;
253 [[nodiscard]]
QString bodyHtml()
const;
262class MIMETREEPARSER_EXPORT AlternativeMessagePart :
public MessagePart
268 ~AlternativeMessagePart()
override;
270 [[nodiscard]]
QString text()
const override;
275 [[nodiscard]]
bool isHtml()
const override;
277 [[nodiscard]]
QString plaintextContent()
const override;
278 [[nodiscard]]
QString htmlContent()
const override;
282 void fix()
const override;
295class MIMETREEPARSER_EXPORT CertMessagePart :
public MessagePart
301 ~CertMessagePart()
override;
303 [[nodiscard]]
QString text()
const override;
305 const GpgME::ImportResult &importResult()
const;
309 GpgME::ImportResult mImportResult;
310 const QGpgME::Protocol *mCryptoProto;
315class MIMETREEPARSER_EXPORT EncapsulatedRfc822MessagePart :
public MessagePart
321 ~EncapsulatedRfc822MessagePart()
override;
323 [[nodiscard]]
QString text()
const override;
325 void fix()
const override;
335class MIMETREEPARSER_EXPORT EncryptedMessagePart :
public MessagePart
338 Q_PROPERTY(
bool decryptMessage READ decryptMessage WRITE setDecryptMessage)
341 Q_PROPERTY(
bool passphraseError READ passphraseError)
346 ~EncryptedMessagePart()
override;
348 [[nodiscard]]
QString text()
const override;
350 void setDecryptMessage(
bool decrypt);
351 [[nodiscard]]
bool decryptMessage()
const;
353 void setIsEncrypted(
bool encrypted);
354 [[nodiscard]]
bool isEncrypted()
const;
356 [[nodiscard]]
bool isDecryptable()
const;
358 [[nodiscard]]
bool isNoSecKey()
const;
359 [[nodiscard]]
bool passphraseError()
const;
367 [[nodiscard]]
QString plaintextContent()
const override;
368 [[nodiscard]]
QString htmlContent()
const override;
370 const QGpgME::Protocol *cryptoProto()
const;
371 [[nodiscard]]
QString fromAddress()
const;
373 const std::vector<std::pair<GpgME::DecryptionResult::Recipient, GpgME::Key>> &decryptRecipients()
const;
375 [[nodiscard]]
bool hasHeader(
const char *headerType)
const override;
389 bool mPassphraseError;
391 bool mDecryptMessage;
392 const QGpgME::Protocol *mCryptoProto;
396 std::vector<std::pair<GpgME::DecryptionResult::Recipient, GpgME::Key>> mDecryptRecipients;
397 std::shared_ptr<const Kleo::KeyCache> mKeyCache;
399 friend class EncryptedBodyPartFormatter;
404class MIMETREEPARSER_EXPORT SignedMessagePart :
public MessagePart
412 ~SignedMessagePart()
override;
414 void setIsSigned(
bool isSigned);
415 [[nodiscard]]
bool isSigned()
const;
424 std::vector<GpgME::Signature> mSignatures;
426 [[nodiscard]]
QString plaintextContent()
const override;
427 [[nodiscard]]
QString htmlContent()
const override;
429 const QGpgME::Protocol *cryptoProto()
const;
430 [[nodiscard]]
QString fromAddress()
const;
432 [[nodiscard]]
bool hasHeader(
const char *headerType)
const override;
444 MIMETREEPARSER_NO_EXPORT
void sigStatusToMetaData();
446 MIMETREEPARSER_NO_EXPORT
void setVerificationResult(
const CompositeMemento *m,
KMime::Content *textNode);
449 const QGpgME::Protocol *mCryptoProto;
453 std::shared_ptr<const Kleo::KeyCache> mKeyCache;
455 friend EncryptedMessagePart;
QSharedPointer< Message > Ptr
interface of classes that implement status for BodyPartFormatters.
Interface for object tree sources.
KMime::Content * content() const
The KMime::Content* node that's represented by this part.
QString makeLink(const QString &path) const
Returns a string representation of an URL that can be used to invoke a BodyPartURLHandler for this bo...
KMime::Content * attachmentContent() const
The KMime::Content* node that's the source of this part.
QString attachmentLink() const
Parses messages and generates HTML display code out of them.
QString temporaryFilePath() const
Temporary file containing the part content.
HtmlMode
Describes the type of the displayed message.
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:47:39 by
doxygen 1.13.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.