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)
 
QList< KMime::Content * > attachmentsOfExtraContents () const
 
Interface::BodyPartMementobodyPartMemento (KMime::Content *node, const QByteArray &which) const
 
void cleanExtraContent (KMime::Content *topLevelNode)
 
void clear ()
 
void clearOverrideHeaders ()
 
QByteArray codecName (KMime::Content *node) const
 
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
 
QList< 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
 
QList< 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
 
KMime::Headers::Base const * mailHeaderAsBase (const char *header, const KMime::Content *message) const
 
QList< 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 QByteArray &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)
 
QBindable< QStringbindableObjectName ()
 
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 () const const
 
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 QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
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_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 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
 
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 setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType)
 
QThreadthread () const const
 

Static Public Member Functions

static QByteArray charset (const KMime::Content *node)
 
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 ()
 
- 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)
 

Additional Inherited Members

- Public Types inherited from QObject
typedef  QObjectList
 
- Properties inherited from QObject
 objectName
 
- 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

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

Definition at line 41 of file nodehelper.h.

Constructor & Destructor Documentation

◆ NodeHelper()

MimeTreeParser::NodeHelper::NodeHelper ( )

Definition at line 35 of file nodehelper.cpp.

◆ ~NodeHelper()

MimeTreeParser::NodeHelper::~NodeHelper ( )
override

Definition at line 42 of file nodehelper.cpp.

Member Function Documentation

◆ addTempFile()

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

Add a file to the list of managed temporary files.

Definition at line 308 of file nodehelper.cpp.

◆ asHREF() [1/2]

QString MimeTreeParser::NodeHelper::asHREF ( const KMime::Content * node) const
nodiscard

Definition at line 743 of file nodehelper.cpp.

◆ asHREF() [2/2]

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

Definition at line 738 of file nodehelper.cpp.

◆ attachExtraContent()

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

Attach an extra node to an existing node.

Definition at line 835 of file nodehelper.cpp.

◆ attachmentsOfExtraContents()

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

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 1074 of file nodehelper.cpp.

◆ bodyPartMemento()

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

Definition at line 599 of file nodehelper.cpp.

◆ charset()

QByteArray MimeTreeParser::NodeHelper::charset ( const KMime::Content * node)
staticnodiscard

Returns the charset for the given node.

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

Definition at line 327 of file nodehelper.cpp.

◆ cleanExtraContent()

void MimeTreeParser::NodeHelper::cleanExtraContent ( KMime::Content * topLevelNode)

Definition at line 841 of file nodehelper.cpp.

◆ clear()

void MimeTreeParser::NodeHelper::clear ( )

Definition at line 118 of file nodehelper.cpp.

◆ clearOverrideHeaders()

void MimeTreeParser::NodeHelper::clearOverrideHeaders ( )

Definition at line 528 of file nodehelper.cpp.

◆ codecName()

QByteArray MimeTreeParser::NodeHelper::codecName ( KMime::Content * node) const
nodiscard

Get a codec suitable for this message part.

Definition at line 559 of file nodehelper.cpp.

◆ createTempDir()

QString MimeTreeParser::NodeHelper::createTempDir ( const QString & param = QString())
nodiscard

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 269 of file nodehelper.cpp.

◆ dateHeader()

QDateTime MimeTreeParser::NodeHelper::dateHeader ( KMime::Content * message) const
nodiscard

Definition at line 541 of file nodehelper.cpp.

◆ decryptedNodeForContent()

KMime::Content * MimeTreeParser::NodeHelper::decryptedNodeForContent ( KMime::Content * content) const
nodiscard

Definition at line 925 of file nodehelper.cpp.

◆ encodingForName()

QString MimeTreeParser::NodeHelper::encodingForName ( const QString & descriptiveName)
staticnodiscard

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 795 of file nodehelper.cpp.

◆ encryptionState()

KMMsgEncryptionState MimeTreeParser::NodeHelper::encryptionState ( const KMime::Content * node) const
nodiscard

Definition at line 149 of file nodehelper.cpp.

◆ extraContents()

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

Get the extra nodes attached to the.

Parameters
topLevelNodeand all sub-nodes of
topLevelNode

Definition at line 847 of file nodehelper.cpp.

◆ extractAttachmentIndex()

QString MimeTreeParser::NodeHelper::extractAttachmentIndex ( const QString & path) const
nodiscard

Definition at line 766 of file nodehelper.cpp.

◆ fileName()

QString MimeTreeParser::NodeHelper::fileName ( const KMime::Content * node)
staticnodiscard

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 587 of file nodehelper.cpp.

◆ fixEncoding()

QString MimeTreeParser::NodeHelper::fixEncoding ( const QString & encoding)
staticnodiscard

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

See also
encodingForName

Definition at line 781 of file nodehelper.cpp.

◆ forceCleanTempFiles()

void MimeTreeParser::NodeHelper::forceCleanTempFiles ( )

Definition at line 291 of file nodehelper.cpp.

◆ fromAsString()

QString MimeTreeParser::NodeHelper::fromAsString ( KMime::Content * node) const
nodiscard

Definition at line 819 of file nodehelper.cpp.

◆ fromHREF()

KMime::Content * MimeTreeParser::NodeHelper::fromHREF ( const KMime::Message::Ptr & mMessage,
const QUrl & href ) const
nodiscard

Definition at line 748 of file nodehelper.cpp.

◆ hasMailHeader()

bool MimeTreeParser::NodeHelper::hasMailHeader ( const char * header,
const KMime::Content * message ) const
nodiscard

Definition at line 467 of file nodehelper.cpp.

◆ headers()

QList< KMime::Headers::Base * > MimeTreeParser::NodeHelper::headers ( const char * header,
const KMime::Content * message )
nodiscard

Definition at line 494 of file nodehelper.cpp.

◆ isInEncapsulatedMessage()

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

Definition at line 313 of file nodehelper.cpp.

◆ isNodeDisplayedEmbedded()

bool MimeTreeParser::NodeHelper::isNodeDisplayedEmbedded ( KMime::Content * node) const
nodiscard

Definition at line 629 of file nodehelper.cpp.

◆ isNodeDisplayedHidden()

bool MimeTreeParser::NodeHelper::isNodeDisplayedHidden ( KMime::Content * node) const
nodiscard

Definition at line 645 of file 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 457 of file nodehelper.cpp.

◆ mailHeaderAsAddressList()

QSharedPointer< KMime::Headers::Generics::AddressList > MimeTreeParser::NodeHelper::mailHeaderAsAddressList ( const char * header,
const KMime::Content * message ) const
nodiscard

Definition at line 517 of file nodehelper.cpp.

◆ mailHeaderAsBase()

KMime::Headers::Base const * MimeTreeParser::NodeHelper::mailHeaderAsBase ( const char * header,
const KMime::Content * message ) const

Definition at line 504 of file nodehelper.cpp.

◆ messagePartsOfMailHeader()

QList< MessagePart::Ptr > MimeTreeParser::NodeHelper::messagePartsOfMailHeader ( const char * header,
const KMime::Content * message ) const
nodiscard

Definition at line 480 of file nodehelper.cpp.

◆ messageWithExtraContent()

KMime::Message * MimeTreeParser::NodeHelper::messageWithExtraContent ( KMime::Content * topLevelNode)
nodiscard

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 899 of file nodehelper.cpp.

◆ nodeProcessed()

bool MimeTreeParser::NodeHelper::nodeProcessed ( KMime::Content * node) const
nodiscard

Definition at line 100 of file nodehelper.cpp.

◆ overallEncryptionState()

KMMsgEncryptionState MimeTreeParser::NodeHelper::overallEncryptionState ( KMime::Content * node) const
nodiscard

Definition at line 335 of file nodehelper.cpp.

◆ overallSignatureState()

KMMsgSignatureState MimeTreeParser::NodeHelper::overallSignatureState ( KMime::Content * node) const
nodiscard

Definition at line 396 of file nodehelper.cpp.

◆ partMetaData()

PartMetaData MimeTreeParser::NodeHelper::partMetaData ( KMime::Content * node)
nodiscard

Definition at line 164 of file nodehelper.cpp.

◆ registerOverrideHeader()

void MimeTreeParser::NodeHelper::registerOverrideHeader ( KMime::Content * message,
MessagePartPtr part )

Definition at line 533 of file nodehelper.cpp.

◆ removeTempFiles()

void MimeTreeParser::NodeHelper::removeTempFiles ( )

Cleanup the attachment temp files.

Definition at line 298 of file nodehelper.cpp.

◆ setBodyPartMemento()

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

Definition at line 610 of file nodehelper.cpp.

◆ setEncryptionState()

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

Definition at line 144 of file nodehelper.cpp.

◆ setNodeDisplayedEmbedded()

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

Definition at line 635 of file nodehelper.cpp.

◆ setNodeDisplayedHidden()

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

Definition at line 650 of file nodehelper.cpp.

◆ setNodeProcessed()

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

Definition at line 53 of file nodehelper.cpp.

◆ setNodeUnprocessed()

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

Definition at line 69 of file nodehelper.cpp.

◆ setOverrideCodec()

void MimeTreeParser::NodeHelper::setOverrideCodec ( KMime::Content * node,
const QByteArray & codec )

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

Definition at line 550 of file nodehelper.cpp.

◆ setPartMetaData()

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

Definition at line 169 of file nodehelper.cpp.

◆ setSignatureState()

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

Definition at line 154 of file nodehelper.cpp.

◆ signatureState()

KMMsgSignatureState MimeTreeParser::NodeHelper::signatureState ( const KMime::Content * node) const
nodiscard

Definition at line 159 of file nodehelper.cpp.

◆ supportedEncodings()

QStringList MimeTreeParser::NodeHelper::supportedEncodings ( )
staticnodiscard

Return a list of the supported encodings.

Definition at line 801 of file nodehelper.cpp.

◆ tempFileUrlFromNode()

QUrl MimeTreeParser::NodeHelper::tempFileUrlFromNode ( const KMime::Content * node)
nodiscard

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 245 of file nodehelper.cpp.

◆ unencryptedMessage()

KMime::Message::Ptr MimeTreeParser::NodeHelper::unencryptedMessage ( const KMime::Message::Ptr & originalMessage)
nodiscard

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 1053 of file nodehelper.cpp.

◆ writeFileToTempFile()

QString MimeTreeParser::NodeHelper::writeFileToTempFile ( KMime::Content * node,
const QString & filename )
nodiscard

Definition at line 174 of file nodehelper.cpp.

◆ writeNodeToTempFile()

QString MimeTreeParser::NodeHelper::writeNodeToTempFile ( KMime::Content * node)
nodiscard

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

Definition at line 197 of file nodehelper.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:33:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.