MessageViewer::Util

MessageViewer::Util Namespace Reference

Functions

AttachmentDisplayInfo attachmentDisplayInfo (KMime::Content *node)
 
bool MESSAGEVIEWER_EXPORT checkOverwrite (const QUrl &url, QWidget *w)
 
const MESSAGEVIEWER_EXPORT QTextCodeccodecForName (const QByteArray &_str)
 
MESSAGEVIEWER_EXPORT bool containsExternalReferences (const QString &str, const QString &extraHead)
 
MESSAGEVIEWER_EXPORT QActioncreateAppAction (const KService::Ptr &service, bool singleOffer, QActionGroup *actionGroup, QObject *parent)
 
const MESSAGEVIEWER_EXPORT QStringDecoder * decoderForName (const QByteArray &_str)
 
MESSAGEVIEWER_EXPORT bool deleteAttachment (KMime::Content *node)
 
MESSAGEVIEWER_EXPORT int deleteAttachments (const KMime::Content::List &contents)
 
MESSAGEVIEWER_EXPORT bool excludeExtraHeader (const QString &s)
 
MESSAGEVIEWER_EXPORT QString generateFileNameForExtension (const Akonadi::Item &msgBase, const QString &extension)
 
MESSAGEVIEWER_EXPORT QString generateMboxFileName (const Akonadi::Item &msgBase)
 
MESSAGEVIEWER_EXPORT QByteArray htmlCodec (const QByteArray &data, const QByteArray &currentCodec)
 
MESSAGEVIEWER_EXPORT QStringConverter::Encoding htmlEncoding (const QByteArray &data, const QByteArray &codec)
 
QString MESSAGEVIEWER_EXPORT iconPathForContent (KMime::Content *node, int iconSize)
 
QString MESSAGEVIEWER_EXPORT iconPathForMimetype (const QString &mimeType, int iconSize, const QString &fallbackFileName1=QString(), const QString &fallbackFileName2=QString())
 
MESSAGEVIEWER_EXPORT QString parseBodyStyle (const QString &style)
 
MESSAGEVIEWER_EXPORT HtmlMessageInfo processHtml (const QString &htmlSource)
 
MESSAGEVIEWER_EXPORT bool saveAttachments (const KMime::Content::List &contents, QWidget *parent, QList< QUrl > &saveUrl)
 
MESSAGEVIEWER_EXPORT bool saveMessageInMbox (const Akonadi::Item::List &retrievedMsgs, QWidget *parent, bool appendMessages=false)
 
MESSAGEVIEWER_EXPORT bool saveMessageInMboxAndGetUrl (QUrl &url, const Akonadi::Item::List &retrievedMsgs, QWidget *parent, bool appendMessages=false)
 

Detailed Description

The Util namespace contains a collection of helper functions use in various places.

Function Documentation

◆ codecForName()

const QTextCodec * MessageViewer::Util::codecForName ( const QByteArray _str)

Return a QTextCodec for the specified charset.

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

Definition at line 675 of file messageviewerutil.cpp.

◆ containsExternalReferences()

bool MessageViewer::Util::containsExternalReferences ( const QString str,
const QString extraHead 
)

Checks whether str contains external references.

To be precise, we only check whether str contains 'xxx="http[s]:' where xxx is not href. Obfuscated external references are ignored on purpose.

Definition at line 45 of file messageviewerutil.cpp.

◆ deleteAttachment()

bool MessageViewer::Util::deleteAttachment ( KMime::Content node)

Replaces the node message part by an empty attachment with information about deleted attachment.

Parameters
nodeA message part representing an attachment. The part will be replaced by a new empty party with filename "Deleted: <original attachment name>". Must not be null.
Returns
Returns whether the message was actually modified.

Definition at line 575 of file messageviewerutil.cpp.

◆ deleteAttachments()

int MessageViewer::Util::deleteAttachments ( const KMime::Content::List contents)

Calls deleteAttachment() for each node in the contents list.

Parameters
contentsList of attachments to replace by an empty part (see deleteAttachment())
Returns
Returns number of attachments that have actually been replaced.
See also
deleteAttachment()

Definition at line 625 of file messageviewerutil.cpp.

◆ iconPathForMimetype()

QString MessageViewer::Util::iconPathForMimetype ( const QString mimeType,
int  iconSize,
const QString fallbackFileName1 = QString(),
const QString fallbackFileName2 = QString() 
)

Finds the filename of an icon based on the given mimetype or filenames.

Always use this functions when looking up icon names for mime types, don't use KMimeType directly.

Uses the IconNameCache internally to speed things up.

Parameters
mimeTypeThe primary mime type used to find the icon, e.g. "application/zip". Alias mimetypes are resolved.
iconSizeSize of the requested icon, e.g. KIconLoader::Desktop
fallbackFileName1When the icon is not found by the given mime type, use the file name extensions of these file names to look the icon up. Example: "test.zip"
fallbackFileName2Fallback for fallbackFileName1.
Returns
the full file name of the icon file

Definition at line 17 of file mimetype.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Sep 25 2023 03:59:20 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.