• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

messageviewer

  • MessageViewer
  • NodeHelper
Classes | Public Member Functions | Static Public Member Functions | List of all members
MessageViewer::NodeHelper Class Reference

#include <nodehelper.h>

Classes

struct  AttachmentDisplayInfo
 

Public Member Functions

 NodeHelper ()
 
 ~NodeHelper ()
 
void addTempFile (const QString &file)
 
QString asHREF (const KMime::Content *node, const QString &place)
 
void attachExtraContent (KMime::Content *topLevelNode, KMime::Content *content)
 
Interface::BodyPartMemento * bodyPartMemento (KMime::Content *node, const QByteArray &which) const
 
void clear ()
 
const QTextCodec * codec (KMime::Content *node)
 
QString createTempDir (const QString &param=QString())
 
KMime::Content * decryptedNodeForContent (KMime::Content *content) const
 
KMMsgEncryptionState encryptionState (KMime::Content *node) const
 
QList< KMime::Content * > extraContents (KMime::Content *topLevelNode) const
 
void forceCleanTempFiles ()
 
bool isNodeDisplayedEmbedded (KMime::Content *node) const
 
bool isNodeDisplayedHidden (KMime::Content *node) const
 
bool isPermanentWithExtraContent (KMime::Content *node) const
 
const QTextCodec * localCodec () const
 
void magicSetType (KMime::Content *node, bool autoDecode=true)
 
KMime::Message * messageWithExtraContent (KMime::Content *topLevelNode)
 
bool nodeProcessed (KMime::Content *node) const
 
KMMsgEncryptionState overallEncryptionState (KMime::Content *node) const
 
KMMsgSignatureState overallSignatureState (KMime::Content *node) const
 
PartMetaData partMetaData (KMime::Content *node)
 
void removeAllExtraContent (KMime::Content *topLevelNode)
 
void removeTempFiles ()
 
void setBodyPartMemento (KMime::Content *node, const QByteArray &which, Interface::BodyPartMemento *memento)
 
void setEncryptionState (KMime::Content *node, const KMMsgEncryptionState state)
 
void setNodeDisplayedEmbedded (KMime::Content *node, bool displayedEmbedded)
 
void setNodeDisplayedHidden (KMime::Content *node, bool displayedHidden)
 
void setNodeProcessed (KMime::Content *node, bool recurse)
 
void setNodeUnprocessed (KMime::Content *node, bool recurse)
 
void setOverrideCodec (KMime::Content *node, const QTextCodec *codec)
 
void setPartMetaData (KMime::Content *node, const PartMetaData &metaData)
 
void setSignatureState (KMime::Content *node, const KMMsgSignatureState state)
 
KMMsgSignatureState signatureState (KMime::Content *node) const
 
KUrl tempFileUrlFromNode (const KMime::Content *node)
 
KMime::Message::Ptr unencryptedMessage (const KMime::Message::Ptr &originalMessage)
 
QString writeNodeToTempFile (KMime::Content *node)
 

Static Public Member Functions

static AttachmentDisplayInfo attachmentDisplayInfo (KMime::Content *node)
 
static QByteArray autoDetectCharset (const QByteArray &_encoding, const QStringList &encodingList, const QString &text)
 
static QByteArray charset (KMime::Content *node)
 
static QString cleanSubject (KMime::Message *message)
 
static const QTextCodec * codecForName (const QByteArray &_str)
 
static QString encodingForName (const QString &descriptiveName)
 
static QString fileName (const KMime::Content *node)
 
static QString fixEncoding (const QString &encoding)
 
static QString fromAsString (KMime::Content *node)
 
static QString iconName (KMime::Content *node, int size=KIconLoader::Desktop)
 
static bool isInEncapsulatedMessage (KMime::Content *node)
 
static bool isToltecMessage (KMime::Content *node)
 
static QString replacePrefixes (const QString &str, const QStringList &prefixRegExps, bool replace, const QString &newPrefix)
 
static QStringList supportedEncodings (bool usAscii)
 
static QByteArray toUsAscii (const QString &_str, bool *ok)
 

Detailed Description

Author
Andras Mantia andra.nosp@m.s@kd.nosp@m.ab.ne.nosp@m.t

Definition at line 71 of file nodehelper.h.

Constructor & Destructor Documentation

MessageViewer::NodeHelper::NodeHelper ( )

Definition at line 58 of file nodehelper.cpp.

MessageViewer::NodeHelper::~NodeHelper ( )

Definition at line 88 of file nodehelper.cpp.

Member Function Documentation

void MessageViewer::NodeHelper::addTempFile ( const QString &  file)

Add a file to the list of managed temporary files.

Definition at line 314 of file nodehelper.cpp.

QString MessageViewer::NodeHelper::asHREF ( const KMime::Content *  node,
const QString &  place 
)

Definition at line 683 of file nodehelper.cpp.

void MessageViewer::NodeHelper::attachExtraContent ( KMime::Content *  topLevelNode,
KMime::Content *  content 
)

Attach an extra node to an existing node.

Definition at line 797 of file nodehelper.cpp.

NodeHelper::AttachmentDisplayInfo MessageViewer::NodeHelper::attachmentDisplayInfo ( KMime::Content *  node)
static

Definition at line 899 of file nodehelper.cpp.

QByteArray MessageViewer::NodeHelper::autoDetectCharset ( const QByteArray &  _encoding,
const QStringList &  encodingList,
const QString &  text 
)
static

Definition at line 732 of file nodehelper.cpp.

Interface::BodyPartMemento * MessageViewer::NodeHelper::bodyPartMemento ( KMime::Content *  node,
const QByteArray &  which 
) const

Definition at line 597 of file nodehelper.cpp.

QByteArray MessageViewer::NodeHelper::charset ( KMime::Content *  node)
static

Returns the charset for the given node.

If no charset is specified for the node, the defaultCharset() is returned.

Definition at line 366 of file nodehelper.cpp.

QString MessageViewer::NodeHelper::cleanSubject ( KMime::Message *  message)
static

Return this mails subject, with all "forward" and "reply" prefixes removed.

Definition at line 526 of file nodehelper.cpp.

void MessageViewer::NodeHelper::clear ( )

Definition at line 160 of file nodehelper.cpp.

const QTextCodec * MessageViewer::NodeHelper::codec ( KMime::Content *  node)

Get a QTextCodec suitable for this message part.

Definition at line 554 of file nodehelper.cpp.

const QTextCodec * MessageViewer::NodeHelper::codecForName ( const QByteArray &  _str)
static

Return a QTextCodec for the specified charset.

This function is a bit more tolerant, than QTextCodec::codecForName

Definition at line 577 of file nodehelper.cpp.

QString MessageViewer::NodeHelper::createTempDir ( const QString &  param = QString())

Creates a temporary dir for saving attachments, etc.

Will be automatically deleted when another message is viewed.

Parameters
paramOptional part of the directory name.

Definition at line 278 of file nodehelper.cpp.

KMime::Content * MessageViewer::NodeHelper::decryptedNodeForContent ( KMime::Content *  content) const

Definition at line 925 of file nodehelper.cpp.

QString MessageViewer::NodeHelper::encodingForName ( const QString &  descriptiveName)
static

Drop-in replacement for KCharsets::encodingForName().

The problem with the KCharsets function is that it returns "human-readable" encoding names like "ISO 8859-15" instead of valid encoding names like "ISO-8859-15". This function fixes this by replacing whitespace with a hyphen.

Definition at line 702 of file nodehelper.cpp.

KMMsgEncryptionState MessageViewer::NodeHelper::encryptionState ( KMime::Content *  node) const

Definition at line 191 of file nodehelper.cpp.

QList< KMime::Content * > MessageViewer::NodeHelper::extraContents ( KMime::Content *  topLevelNode) const

Get the extra nodes attached to the.

Parameters
topLevelNodeand all sub-nodes of
topLevelNode

Definition at line 813 of file nodehelper.cpp.

QString MessageViewer::NodeHelper::fileName ( const KMime::Content *  node)
static

Returns a usable filename for a node, that can be the filename from the content disposition header, or if that one is empty, the name from the content type header.

Definition at line 586 of file nodehelper.cpp.

QString MessageViewer::NodeHelper::fixEncoding ( const QString &  encoding)
static

Fixes an encoding received by a KDE function and returns the proper, MIME-compilant encoding name instead.

See also
encodingForName

Definition at line 688 of file nodehelper.cpp.

void MessageViewer::NodeHelper::forceCleanTempFiles ( )

Definition at line 300 of file nodehelper.cpp.

QString MessageViewer::NodeHelper::fromAsString ( KMime::Content *  node)
static

Definition at line 789 of file nodehelper.cpp.

QString MessageViewer::NodeHelper::iconName ( KMime::Content *  node,
int  size = KIconLoader::Desktop 
)
static

Definition at line 469 of file nodehelper.cpp.

bool MessageViewer::NodeHelper::isInEncapsulatedMessage ( KMime::Content *  node)
static
Returns
true if this node is a child or an encapsulated message

Definition at line 350 of file nodehelper.cpp.

bool MessageViewer::NodeHelper::isNodeDisplayedEmbedded ( KMime::Content *  node) const

Definition at line 631 of file nodehelper.cpp.

bool MessageViewer::NodeHelper::isNodeDisplayedHidden ( KMime::Content *  node) const

Definition at line 646 of file nodehelper.cpp.

bool MessageViewer::NodeHelper::isPermanentWithExtraContent ( KMime::Content *  node) const

Returns true if the given node at least one extra content node, implying that the given node is an encrypted node or otherwise a type of node that needs extra handling.

Definition at line 823 of file nodehelper.cpp.

bool MessageViewer::NodeHelper::isToltecMessage ( KMime::Content *  node)
static

Definition at line 319 of file nodehelper.cpp.

const QTextCodec* MessageViewer::NodeHelper::localCodec ( ) const
inline

Definition at line 136 of file nodehelper.h.

void MessageViewer::NodeHelper::magicSetType ( KMime::Content *  node,
bool  autoDecode = true 
)

Set the 'Content-Type' by mime-magic from the contents of the body.

If autoDecode is true the decoded body will be used for mime type determination (this does not change the body itself).

Definition at line 484 of file nodehelper.cpp.

KMime::Message * MessageViewer::NodeHelper::messageWithExtraContent ( KMime::Content *  topLevelNode)

Return a modified message (node tree) starting from.

Parameters
topLevelNodethat has the original nodes and the extra nodes. The caller has the responsibility to delete the new message.

Definition at line 874 of file nodehelper.cpp.

bool MessageViewer::NodeHelper::nodeProcessed ( KMime::Content *  node) const

Definition at line 140 of file nodehelper.cpp.

KMMsgEncryptionState MessageViewer::NodeHelper::overallEncryptionState ( KMime::Content *  node) const

Definition at line 374 of file nodehelper.cpp.

KMMsgSignatureState MessageViewer::NodeHelper::overallSignatureState ( KMime::Content *  node) const

Definition at line 422 of file nodehelper.cpp.

PartMetaData MessageViewer::NodeHelper::partMetaData ( KMime::Content *  node)

Definition at line 206 of file nodehelper.cpp.

void MessageViewer::NodeHelper::removeAllExtraContent ( KMime::Content *  topLevelNode)

Definition at line 803 of file nodehelper.cpp.

void MessageViewer::NodeHelper::removeTempFiles ( )

Cleanup the attachment temp files.

Definition at line 307 of file nodehelper.cpp.

QString MessageViewer::NodeHelper::replacePrefixes ( const QString &  str,
const QStringList &  prefixRegExps,
bool  replace,
const QString &  newPrefix 
)
static

Check for prefixes prefixRegExps in str.

If none is found, newPrefix + ' ' is prepended to str and the resulting string is returned. If replace is true, any sequence of whitespace-delimited prefixes at the beginning of str is replaced by newPrefix.

Definition at line 494 of file nodehelper.cpp.

void MessageViewer::NodeHelper::setBodyPartMemento ( KMime::Content *  node,
const QByteArray &  which,
Interface::BodyPartMemento *  memento 
)

Definition at line 610 of file nodehelper.cpp.

void MessageViewer::NodeHelper::setEncryptionState ( KMime::Content *  node,
const KMMsgEncryptionState  state 
)

Definition at line 186 of file nodehelper.cpp.

void MessageViewer::NodeHelper::setNodeDisplayedEmbedded ( KMime::Content *  node,
bool  displayedEmbedded 
)

Definition at line 637 of file nodehelper.cpp.

void MessageViewer::NodeHelper::setNodeDisplayedHidden ( KMime::Content *  node,
bool  displayedHidden 
)

Definition at line 651 of file nodehelper.cpp.

void MessageViewer::NodeHelper::setNodeProcessed ( KMime::Content *  node,
bool  recurse 
)

Definition at line 95 of file nodehelper.cpp.

void MessageViewer::NodeHelper::setNodeUnprocessed ( KMime::Content *  node,
bool  recurse 
)

Definition at line 111 of file nodehelper.cpp.

void MessageViewer::NodeHelper::setOverrideCodec ( KMime::Content *  node,
const QTextCodec *  codec 
)

Set the charset the user selected for the message to display.

Definition at line 546 of file nodehelper.cpp.

void MessageViewer::NodeHelper::setPartMetaData ( KMime::Content *  node,
const PartMetaData &  metaData 
)

Definition at line 211 of file nodehelper.cpp.

void MessageViewer::NodeHelper::setSignatureState ( KMime::Content *  node,
const KMMsgSignatureState  state 
)

Definition at line 196 of file nodehelper.cpp.

KMMsgSignatureState MessageViewer::NodeHelper::signatureState ( KMime::Content *  node) const

Definition at line 201 of file nodehelper.cpp.

QStringList MessageViewer::NodeHelper::supportedEncodings ( bool  usAscii)
static

Return a list of the supported encodings.

Parameters
usAsciiif true, US-Ascii encoding will be prepended to the list.

Definition at line 708 of file nodehelper.cpp.

KUrl MessageViewer::NodeHelper::tempFileUrlFromNode ( const KMime::Content *  node)

Returns the temporary file path and name where this node was saved, or an empty url if it wasn't saved yet with writeNodeToTempFile()

Definition at line 257 of file nodehelper.cpp.

QByteArray MessageViewer::NodeHelper::toUsAscii ( const QString &  _str,
bool *  ok 
)
static

Definition at line 774 of file nodehelper.cpp.

KMime::Message::Ptr MessageViewer::NodeHelper::unencryptedMessage ( const KMime::Message::Ptr &  originalMessage)

This function returns the unencrypted message that is based on originalMessage.

All encrypted MIME parts are removed and replaced by their decrypted plain-text versions. Encrypted parts that are within signed parts are not replaced, since that would invalidate the signature.

This only works if the message was run through ObjectTreeParser::parseObjectTree() with the currrent NodeHelper before, because parseObjectTree() actually decrypts the message and stores the decrypted nodes by calling attachExtraContent().

Returns
the unencrypted message or an invalid pointer if the original message didn't contain a part that needed to be modified.

Definition at line 1061 of file nodehelper.cpp.

QString MessageViewer::NodeHelper::writeNodeToTempFile ( KMime::Content *  node)

Writes the given message part to a temporary file and returns the name of this file or QString() if writing failed.

Definition at line 216 of file nodehelper.cpp.


The documentation for this class was generated from the following files:
  • nodehelper.h
  • nodehelper.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:58 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

messageviewer

Skip menu "messageviewer"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal