Warning, /pim/messagelib/messageviewer/src/Mainpage.dox is written in an unsupported language. File is not indexed.

0001 // Put this in the MessageViewer namespace so that autolinks to classes work without needing a
0002 // MessageViewer:: prefix.
0003 
0004 namespace MessageViewer {
0005 
0006 /** \mainpage The MessageViewer library
0007 \section Overview
0008 
0009 The messageviewer is a library that provides a widget that can show a KMime::Message in a nice
0010 way.
0011 
0012 The message is displayed by first converting it to HTML and then displaying the HTML in a widget
0013 based on WebKit.
0014 
0015 \section ObjectTreeParser
0016 
0017 The class ObjectTreeParser is used to parse the KMime::Message and create a HTML representation out
0018 of it. An implementation of the ObjectTreeSource interface is passed to the ObjectTreeParser,
0019 which provides an interface for the ObjectTreeParser to interact with the viewer widget. The most
0020 import part of this interface is that it provides a HtmlWriter, which the ObjectTreeParser uses to
0021 write the HTML it generates to.
0022 
0023 The HtmlWriter passed to the ObjectTreeParser can be a dummy implementation, like in EmptySource.
0024 This is used when one is not interested in the interaction between the ObjectTreeParser and the
0025 viewer. The most common use case is that one is not interested in the generated HTML, but only in
0026 the textual content that the ObjectTreeParser extracted, which can be retrieved with
0027 ObjectTreeParser::textualContent(). This is used for example when KMail creates an inline forward
0028 message.
0029 
0030 The Viewer of course uses a non-dummy implementation of the ObjectTreeSource, the MailViewerSource.
0031 The HtmlWriter provided by the MailViewerSource is a WebKitPartHtmlWriter, which writes the HTML
0032 directly to the MailWebView widget, which is a KWebView.
0033 
0034 The header of the message or the headers of any embedded messages are formatted in a special way.
0035 The user can chose between many styles of header formatting, like 'fancy' or 'brief'. The creation
0036 of the HTML code for these headers is handled by HeaderStyle. The ObjectTreeParser does not use
0037 the HeaderStyle classes directly; instead, it is delegated to ViewerPrivate::writeMsgHeader() via
0038 ObjectTreeSource::createMessageHeader().
0039 
0040 The 'fancy' header style can display the spam status of the message in a nice way. To extract the
0041 spam information, SpamHeaderAnalyzer, AntiSpamConfig and SpamAgent are used.
0042 
0043 The HeaderStrategy controls which parts of the header should be shown. Based on this strategy, the
0044 HeaderStyle implementations decide which header fields to include in the HTML code they generate.
0045 
0046 Some parts of the appearance of the message can be customized by changing the CSS. For this, the
0047 CSSHelper class is used, which is passed to the ObjectTreeParser with ObjectTreeSource::cssHelper().
0048 
0049 The ObjectTreeParser can have plugins that create the HTML for special MIME parts themselves. Those
0050 plugins are found in kdepim/plugins/messageviewer. Examples are plugins that render the vCard in a
0051 nice way when a vCard MIME type is encountered, or which do the same when a diff attachment is found.
0052 The classes used for this are the interfaces BodyPartFormatter and BodyPartFormatterPlugin and their
0053 helper interfaces in the interfaces/ subdirectory. The plugins only depend on these interfaces and
0054 are independent from the rest of the viewer.
0055 
0056 Most MIME parts are handled internally, like all multipart types or text/plain and text/html. For
0057 text/html, a HTMLQuoteColorer is used to change the HTML of the message to include coloring of the
0058 quotes.
0059 
0060 The AttachmentStrategy which is passed to the constructor or ObjectTreeParser controls how some of
0061 the MIME parts are handled: For example, an image MIME part might be displayed as an icon, or it
0062 might display the full image inline in the body.
0063 
0064 For details on the internals of the ObjectTreeParser, especially the way it parses and changes a
0065 message, see the documentation of ObjectTreeParser.
0066 
0067 \section Widgets
0068 
0069 The Viewer consists of several widgets.
0070 The main widget is the MailWebView, which displays the HTML code that the ObjectTreeParser generated
0071 from the message.
0072 On the left side of that, a HtmlStatusBar displays the type of the displayed message.
0073 Below the MailWebView, a QTreeView shows the message structure by using a MimeTreeModel.
0074 The viewer can open an additional window to show the raw message source with the MailSourceViewer.
0075 The viewer also can show the properties of a MIME part of the message, which uses the
0076 AttachmentDialog class.
0077 When opening MIME parts that are vCards, they are displayed in a VCardViewer.
0078 When searching through the message, a FindBar is displayed at the bottom.
0079 
0080 \section urlhandling URL handling
0081 
0082 The generated HTML has many different URLs in it. Those can be the normal URLs which are contained
0083 in the message text, the mailto URLs that are in the header, or special KMail URLs. These KMail URLs
0084 for example include the "Load external references" link for HTML mails with external images, the
0085 "Show details" link for signed messages, the URL to expand or collapse quoted text and many more.
0086 
0087 Throughout the displayed message, there are links to attachments, either in the header when using
0088 some header styles, or at the place where the actual attachment is, in the body. These URLs all
0089 start with 'attachment:', followed by a number that describes the KMime::ContentIndex of the
0090 attachment. The attachment links also contain a parameter that describes whether the link is in the
0091 header of the message or in the body. This is needed because clicking on the links in the header
0092 should scroll to the attachment in the body.
0093 
0094 These URLs are all written to the HTML code by ObjectTreeParser, but it is up to the Viewer to
0095 handle interaction with these URLs, such as clicking on them or hovering over them.
0096 
0097 For this, the Viewer has a URLHandlerManager, which manages a list of URLHandler. An URLHandler is
0098 responsible for the interaction with exactly one type or URL. Interaction means executing an action
0099 when clicking the URL or showing a status bar message when hovering over it. Examples of these
0100 URLHandler are AttachmentURLHandler or ExpandCollapseQuoteURLManager. The special
0101 KMailProtocolURLHandler deals with multiple types of URLs that all start with 'kmail:'.
0102 
0103 Note that the 'kmail:' URLs are only named like this for historic reasons, nowadays the viewer is
0104 independent of KMail.
0105 
0106 \section Misc
0107 
0108 There are various smaller and unimportant classes in this library.
0109 
0110 PartNodeBodyPart is an implementation of the BodyPart interface. It is used by plugins to gain
0111 access to various properties of the MIME part the plugins are supposed to handle.
0112 
0113 NodeHelper currently is a big mess that consists of mainly two things: First, it provides
0114 convenience methods for operations related to the MIME part class KMime::Content, such as
0115 nextSibling() or charset(). All these methods should eventually be moved away from here, either to
0116 kdepim/messagecore or to kdpimlibs/kmime.
0117 Secondly, it provides lists and maps which are used by the ObjectTreeParser and the Viewer during
0118 processing. Such can include a list of all KMime::Content that are currently being processed, a map
0119 of KMime::Content to their signature or encryption state, a map of KMime::Content to PartMetaData,
0120 and so on.
0121 
0122 The class Global is used so that applications that use this library can set the correct config
0123 object. Those applications also can use the ConfigureWidget in their application to display some
0124 settings. Most of the settings use KConfigXT, and the file for the settings definitions is
0125 messageviewer.kcfg. The GlobalSettings class is a thin wrapper around the GlobalSettingsBase class,
0126 which is generated from the KCFG.
0127 
0128 StringUtil is a namespace that groups various functions that mainly do string operations, for
0129 example on mail addresses.
0130 
0131 Then there is the Util namespace, which again has some convenience functions that neither fit into
0132 StringUtil or into NodeHelper.
0133 
0134 The last utilitly thing are the functions in stl_util.h, which are supposed to be used in
0135 combination with STL algorithms.
0136 
0137 There are a bunch of smaller classes like AutoQPointer, EditorWatcher, IconNameCache, KCursorSaver,
0138 KleoJobExecutor, KabcBridge and many more. See the full class list if you're curious.
0139 
0140 You should also read the documentation of the following classes, which are extensively documented:
0141 \sa MessageViewer::ViewerPrivate
0142 \sa MessageViewer::ObjectTreeParser
0143 
0144 */
0145 
0146 }
0147 // DOXYGEN_NAME=messageviewer
0148 // DOXYGEN_ENABLE=YES
0149 // DOXYGEN_REFERENCES=kmime