Messagelib
objecttreeparser.h
6 SPDX-FileCopyrightText: 2002-2003, 2009 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.net
87extracting the plainTextContent() for situations where only the message text is needed, for example
88when inline forwarding a message. The mode depends on the Interface::ObjectTreeSource passed to the
89constructor: If Interface::ObjectTreeSource::htmlWriter() is not 0, then the HTML code generation mode is
97processMultiPartAlternativeSubtype() or processTextHtmlSubtype(), or it can be an external plugin.
104processed normally, the processMultipartXXX() functions call stdChildHandling() for the node that
105should be handled normally. stdChildHandling() creates its own ObjectTreeParser, which is a clone
106of the current ObjectTreeParser, and processes the node. stdChildHandling() is not called for all
107children of the multipart node, for example processMultiPartAlternativeSubtype() only calls it on
109processMultiPartSignedSubtype() doesn't call stdChildHandling() for the signature node, only for the
116list in NodeHelper, see NodeHelper::setNodeProcessed(), NodeHelper::nodeProcessed() and the other
120related functions. This is important so that processing the same node twice can be prevented. The
123An example where duplicate processing would happen if we didn't check for it is in stdChildHandling(),
124which is for example called from processMultiPartAlternativeSubtype(). Let's say the setting is to
127parseObjectTree() on it. parseObjectTree() processes the node and all its siblings, and one of the
133Various nodes have plain text that should be displayed. This plain text is usually processed though
134writeBodyString() first. That method checks if the provided text is an inline PGP text and decrypts
135it if necessary. It also pushes the text through quotedHTML(), which does a number of things like
141before displaying. This is for example the case when displaying a decrypted message: The original
142message only contains a binary blob of crypto data, and processMultiPartEncryptedSubtype() decrypts
148For signature and decryption handling, there are functions which help with generating the HTML code
149for the signature header and footer. These are writeDeferredDecryptionBlock(), writeSigstatFooter()
150and writeSigstatHeader(). As the name writeDeferredDecryptionBlock() suggests, a setting can cause
152decrypted or not can be controlled by Interface::ObjectTreeSource::decryptMessage(). When the user clicks the
153decryption link, the URLHandler for 'kmail:' URLs sets that variable to true and triggers an update
158The above case describes decryption the message in place. However, decryption and also verifying of
159the signature can take a long time, so synchronous decryption and verifying would cause the Viewer to
164BodyPartMemento with the current node, for example a VerifyDetachedBodyPartMemento. Each node can
168retrieve these mementos. A memento is basically a thin wrapper around the crypto job, it stores the
169job pointer, the job input data and the job result. Mementos can be used for any async situation,
180will, in ViewerPrivate::parseMsg(), create a new ObjectTreeParser and call parseObjectTree() on it.
184processMultiPartEncryptedSubtype() will look if they find a BodyPartMemento that is associated with
185the current node. Now it finds that memento, since it was created in the first run. It checks if the
186memento's job has finished, and if so, the result can be written out (either the decrypted data or
189When dealing with encrypted nodes, new nodes are created with the decrypted data. It is important to
190note that the original MIME tree is never modified, and remains the same as the original one. The method
191createAndParseTempNode is called with the newly decrypted data, and it generates a new temporary node to
192store the decrypted data. When these nodes are created, it is important to keep track of them as otherwise
193some mementos that are added to the newly created temporary nodes will be constantly regenerated. As the
194regeneration triggers a viewer update when complete, it results in an infinite refresh loop. The function
195NodeHelper::linkAsPermanentDecrypted will create a link between the newly created node and the original parent.
196Conversely, the function NodeHelper::attachExtraContent will create a link in the other direction, from the parent
199When generating some mementos for nodes that may be temporary nodes (for example, contact photo mementos), the
200function NodeHelper::setBodyPartMementoForPermanentParent is used. This will save the given body part memento for
201the closest found permanent parent node, rather than the transient node itself. Then when checking for the existence
202of a certain memento in a node, NodeHelper::findPermanentParentBodyPartMemento will check to see if any parent of the
203given temporary node is a permanent (encrypted) node that has been used to generate the asked-for node.
206crypto operation and creates the BodyPartMemento, the second calls sees that the BodyPartMemento is
211For crypto operations, the class PartMetaData is used a lot, mainly to pass around info about the
213NodeHelper::setPartMetaData(). The only user of that however is MessageAnalyzer::processPart() of
216You'll notice that a ProcessResult is passed to each formatter. The formatter is supposed to modify
217the ProcessResult to tell the callers something about the state of the nodes that were processed.
222As mentioned way earlier, BodyPartFormatter can either be plugins or be internal. bodypartformatter.cpp
226The BodyPartFormatter code is work in progress, it was supposed to be refactored, but that has not
232external plugins have powerful capabilities, which are needed for example in the iCal formatter or
240example a div with the id 'attachmentInjectionPoint', or a div with the id 'attachmentDiv', which
241is used to mark an attachment in the body with a yellow border when the user clicks the attachment
242in the header. Finally, parseObjectTree() creates an anchor with the id 'att%1', which is used in
249 * Copies the context of @p other, but not it's rawDecryptedBody, plainTextContent or htmlContent.
254 explicit ObjectTreeParser(Interface::ObjectTreeSource *source, NodeHelper *nodeHelper = nullptr);
294 MIMETREEPARSER_NO_EXPORT MessagePartPtr parseObjectTreeInternal(KMime::Content *node, bool mOnlyOneMimePart);
295 MIMETREEPARSER_NO_EXPORT MessagePartPtr processType(KMime::Content *node, MimeTreeParser::ProcessResult &processResult, const QByteArray &mimeType);
The EncryptedMessagePart class.
Definition mimetreeparser/src/messagepart.h:336
The HtmlMessagePart class.
Definition mimetreeparser/src/messagepart.h:240
Interface for object tree sources.
Definition objecttreesource.h:33
Definition nodehelper.h:42
Parses messages and generates HTML display code out of them.
Definition objecttreeparser.h:246
an implementation of the BodyPart interface using KMime::Content's
Definition partnodebodypart.h:32
The SignedMessagePart class.
Definition mimetreeparser/src/messagepart.h:405
The TextMessagePart class.
Definition mimetreeparser/src/messagepart.h:190
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.