MessageViewer::Util Namespace
| Header: | #include <messageviewerutil.h> |
| CMake: | find_package(KPim6MessageViewer REQUIRED)target_link_libraries(mytarget PRIVATE KPim6::MessageViewer) |
Functions
| bool | deleteAttachment(KMime::Content *node) |
| int | deleteAttachments(const QList<KMime::Content *> &contents) |
| QString | iconPathForMimetype(const QString &mimeType, int iconSize, const QString &fallbackFileName1 = QString(), const QString &fallbackFileName2 = QString()) |
Detailed Description
The Util namespace contains a collection of helper functions use in various places.
Function Documentation
bool Util::deleteAttachment(KMime::Content *node)
Replaces the \ node message part by an empty attachment with information about deleted attachment.
node A 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.
int Util::deleteAttachments(const QList<KMime::Content *> &contents)
Calls deleteAttachment() for each node in the contents list.
contents List of attachments to replace by an empty part (see deleteAttachment()) Returns Returns number of attachments that have actually been replaced.
See also deleteAttachment().
QString 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.
mimeType The primary mime type used to find the icon, e.g. "application/zip". Alias mimetypes are resolved. iconSize Size of the requested icon, e.g. KIconLoader::Desktop fallbackFileName1 When 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" fallbackFileName2 Fallback for fallbackFileName1. Returns the full file name of the icon file