20 #ifndef _MESSAGEVIEWER_NODEHELPER_H
21 #define _MESSAGEVIEWER_NODEHELPER_H
26 #include <KMime/Message>
28 #include <KIconLoader>
37 namespace MessageViewer {
39 class BodyPartMemento;
43 namespace MessageViewer {
45 class AttachmentTemporaryFilesDirs;
77 void setNodeProcessed( KMime::Content* node,
bool recurse );
78 void setNodeUnprocessed( KMime::Content* node,
bool recurse );
79 bool nodeProcessed( KMime::Content* node )
const;
81 void forceCleanTempFiles();
92 void setPartMetaData( KMime::Content* node,
const PartMetaData &metaData );
95 static QString iconName( KMime::Content *node,
int size = KIconLoader::Desktop );
102 void magicSetType( KMime::Content *node,
bool autoDecode=
true );
109 static QString cleanSubject( KMime::Message *message );
112 void attachExtraContent( KMime::Content *topLevelNode, KMime::Content* content );
113 void removeAllExtraContent( KMime::Content *topLevelNode );
116 QList<KMime::Content*> extraContents( KMime::Content *topLevelNode )
const;
121 KMime::Message *messageWithExtraContent( KMime::Content* topLevelNode );
128 bool isPermanentWithExtraContent( KMime::Content* node )
const;
131 const QTextCodec * codec( KMime::Content* node );
134 void setOverrideCodec( KMime::Content* node,
const QTextCodec* codec );
140 void setBodyPartMemento( KMime::Content* node,
const QByteArray &which,
145 bool isNodeDisplayedEmbedded( KMime::Content* node )
const;
146 void setNodeDisplayedEmbedded( KMime::Content* node,
bool displayedEmbedded );
149 bool isNodeDisplayedHidden( KMime::Content* node )
const;
150 void setNodeDisplayedHidden( KMime::Content* node,
bool displayedHidden );
156 QString writeNodeToTempFile( KMime::Content* node );
162 KUrl tempFileUrlFromNode(
const KMime::Content *node );
169 QString createTempDir(
const QString ¶m = QString() );
174 void removeTempFiles();
179 void addTempFile(
const QString& file );
183 QString asHREF(
const KMime::Content* node,
const QString &place );
185 static bool isToltecMessage( KMime::Content* node );
190 static bool isInEncapsulatedMessage( KMime::Content* node );
196 static QByteArray charset( KMime::Content *node );
205 static QString replacePrefixes(
const QString& str,
206 const QStringList& prefixRegExps,
208 const QString& newPrefix );
214 static const QTextCodec* codecForName(
const QByteArray& _str);
221 static QString fileName(
const KMime::Content *node );
228 static QString fixEncoding(
const QString &encoding );
236 static QString encodingForName(
const QString &descriptiveName );
242 static QStringList supportedEncodings(
bool usAscii );
244 static QByteArray autoDetectCharset(
const QByteArray &_encoding,
const QStringList &encodingList,
const QString &text);
245 static QByteArray toUsAscii(
const QString& _str,
bool *ok);
247 static QString fromAsString( KMime::Content* node );
258 KMime::Content * decryptedNodeForContent( KMime::Content * content )
const;
273 KMime::Message::Ptr unencryptedMessage(
const KMime::Message::Ptr &originalMessage );
277 bool unencryptedMessage_helper( KMime::Content *node, QByteArray &resultingData,
bool addHeaders,
278 int recursionLevel = 1 );
286 static QString cleanSubject( KMime::Message *message,
const QStringList& prefixRegExps,
287 bool replace,
const QString& newPrefix );
289 void mergeExtraNodes( KMime::Content *node );
290 void cleanFromExtraNodes( KMime::Content *node );
292 QString persistentIndex(
const KMime::Content * node )
const;
295 QList<KMime::Content*> mProcessedNodes;
296 QList<KMime::Content*> mNodesUnderProcess;
297 QMap<KMime::Content *, KMMsgEncryptionState> mEncryptionState;
298 QMap<KMime::Content *, KMMsgSignatureState> mSignatureState;
299 QSet<KMime::Content *> mDisplayEmbeddedNodes;
300 QSet<KMime::Content *> mDisplayHiddenNodes;
301 QTextCodec *mLocalCodec;
302 QMap<KMime::Content*, const QTextCodec*> mOverrideCodecs;
303 QMap<QString, QMap<QByteArray, Interface::BodyPartMemento*> > mBodyPartMementoMap;
304 QMap<KMime::Content*, PartMetaData> mPartMetaDatas;
305 QMap<KMime::Message::Content*, QList<KMime::Content*> > mExtraContents;
KMMsgSignatureState
Flags for the signature state.
#define MESSAGEVIEWER_EXPORT
const QTextCodec * localCodec() const
interface of classes that implement status for BodyPartFormatters.
KMMsgEncryptionState
Flags for the encryption state.