MimeTreeParser::NodeHelper

Search for usage in LXR

MimeTreeParser::NodeHelper Class Reference

#include <nodehelper.h>

Inheritance diagram for MimeTreeParser::NodeHelper:

Signals

void update (MimeTreeParser::UpdateMode)
 

Public Member Functions

void addTempFile (const QString &file)
 
QString asHREF (const KMime::Content *node) const
 
QString asHREF (const KMime::Content *node, const QString &place) const
 
void attachExtraContent (KMime::Content *topLevelNode, KMime::Content *content)
 
QVector< KMime::Content * > attachmentsOfExtraContents () const
 
Interface::BodyPartMementobodyPartMemento (KMime::Content *node, const QByteArray &which) const
 
void cleanExtraContent (KMime::Content *topLevelNode)
 
void clear ()
 
void clearOverrideHeaders ()
 
const QTextCodeccodec (KMime::Content *node)
 
QString createTempDir (const QString &param=QString())
 
QDateTime dateHeader (KMime::Content *message) const
 
KMime::ContentdecryptedNodeForContent (KMime::Content *content) const
 
KMMsgEncryptionState encryptionState (const KMime::Content *node) const
 
QVector< KMime::Content * > extraContents (KMime::Content *topLevelNode) const
 
QString extractAttachmentIndex (const QString &path) const
 
void forceCleanTempFiles ()
 
QString fromAsString (KMime::Content *node) const
 
KMime::ContentfromHREF (const KMime::Message::Ptr &mMessage, const QUrl &href) const
 
bool hasMailHeader (const char *header, const KMime::Content *message) const
 
QVector< KMime::Headers::Base * > headers (const char *header, const KMime::Content *message)
 
bool isNodeDisplayedEmbedded (KMime::Content *node) const
 
bool isNodeDisplayedHidden (KMime::Content *node) const
 
QSharedPointer< KMime::Headers::Generics::AddressListmailHeaderAsAddressList (const char *header, const KMime::Content *message) const
 
const KMime::Headers::BasemailHeaderAsBase (const char *header, const KMime::Content *message) const
 
QVector< MessagePartPtrmessagePartsOfMailHeader (const char *header, const KMime::Content *message) const
 
KMime::MessagemessageWithExtraContent (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 registerOverrideHeader (KMime::Content *message, MessagePartPtr)
 
void removeTempFiles ()
 
void setBodyPartMemento (KMime::Content *node, const QByteArray &which, Interface::BodyPartMemento *memento)
 
void setEncryptionState (const 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 (const KMime::Content *node, const KMMsgSignatureState state)
 
KMMsgSignatureState signatureState (const KMime::Content *node) const
 
QUrl tempFileUrlFromNode (const KMime::Content *node)
 
KMime::Message::Ptr unencryptedMessage (const KMime::Message::Ptr &originalMessage)
 
QString writeFileToTempFile (KMime::Content *node, const QString &filename)
 
QString writeNodeToTempFile (KMime::Content *node)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Static Public Member Functions

static QByteArray charset (KMime::Content *node)
 
static const QTextCodeccodecForName (const QByteArray &_str)
 
static QString encodingForName (const QString &descriptiveName)
 
static QString fileName (const KMime::Content *node)
 
static QString fixEncoding (const QString &encoding)
 
static bool isInEncapsulatedMessage (KMime::Content *node)
 
static void magicSetType (KMime::Content *node, bool autoDecode=true)
 
static QStringList supportedEncodings (bool usAscii)
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

Member Function Documentation

◆ addTempFile()

void MimeTreeParser::NodeHelper::addTempFile ( const QString file)

Add a file to the list of managed temporary files.

Definition at line 340 of file mimetreeparser/src/nodehelper.cpp.

◆ attachExtraContent()

void MimeTreeParser::NodeHelper::attachExtraContent ( KMime::Content topLevelNode,
KMime::Content content 
)

Attach an extra node to an existing node.

Definition at line 883 of file mimetreeparser/src/nodehelper.cpp.

◆ attachmentsOfExtraContents()

QVector< KMime::Content * > MimeTreeParser::NodeHelper::attachmentsOfExtraContents ( ) const

Returns a list of attachments of attached extra content nodes.

This is mainly useful is order to get attachments of encrypted messages. Note that this does not include attachments from the primary node tree.

See also
KMime::Content::attachments().

Definition at line 1122 of file mimetreeparser/src/nodehelper.cpp.

◆ charset()

QByteArray MimeTreeParser::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 360 of file mimetreeparser/src/nodehelper.cpp.

◆ codec()

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

Get a QTextCodec suitable for this message part.

Definition at line 593 of file mimetreeparser/src/nodehelper.cpp.

◆ codecForName()

const QTextCodec * MimeTreeParser::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 619 of file mimetreeparser/src/nodehelper.cpp.

◆ createTempDir()

QString MimeTreeParser::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 301 of file mimetreeparser/src/nodehelper.cpp.

◆ encodingForName()

QString MimeTreeParser::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 840 of file mimetreeparser/src/nodehelper.cpp.

◆ extraContents()

QVector< KMime::Content * > MimeTreeParser::NodeHelper::extraContents ( KMime::Content topLevelNode) const

Get the extra nodes attached to the.

Parameters
topLevelNodeand all sub-nodes of
topLevelNode

Definition at line 895 of file mimetreeparser/src/nodehelper.cpp.

◆ fileName()

QString MimeTreeParser::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 632 of file mimetreeparser/src/nodehelper.cpp.

◆ fixEncoding()

QString MimeTreeParser::NodeHelper::fixEncoding ( const QString encoding)
static

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

See also
encodingForName

Definition at line 826 of file mimetreeparser/src/nodehelper.cpp.

◆ isInEncapsulatedMessage()

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

Definition at line 345 of file mimetreeparser/src/nodehelper.cpp.

◆ magicSetType()

void MimeTreeParser::NodeHelper::magicSetType ( KMime::Content node,
bool  autoDecode = true 
)
static

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 491 of file mimetreeparser/src/nodehelper.cpp.

◆ messageWithExtraContent()

KMime::Message * MimeTreeParser::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 947 of file mimetreeparser/src/nodehelper.cpp.

◆ removeTempFiles()

void MimeTreeParser::NodeHelper::removeTempFiles ( )

Cleanup the attachment temp files.

Definition at line 330 of file mimetreeparser/src/nodehelper.cpp.

◆ setOverrideCodec()

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

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

Definition at line 584 of file mimetreeparser/src/nodehelper.cpp.

◆ supportedEncodings()

QStringList MimeTreeParser::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 846 of file mimetreeparser/src/nodehelper.cpp.

◆ tempFileUrlFromNode()

QUrl MimeTreeParser::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 269 of file mimetreeparser/src/nodehelper.cpp.

◆ unencryptedMessage()

KMime::Message::Ptr MimeTreeParser::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 current 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 1101 of file mimetreeparser/src/nodehelper.cpp.

◆ writeNodeToTempFile()

QString MimeTreeParser::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 221 of file mimetreeparser/src/nodehelper.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Jun 8 2023 03:56:13 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.