38
38
#ifndef MAILVIEWERUTIL_H
39
39
#define MAILVIEWERUTIL_H
41
#include "messageviewer_export.h"
47
* The Util namespace contains a collection of helper functions use in
54
namespace MessageViewer {
57
* The Util namespace contains a collection of helper functions use in
63
* Describes the type of the displayed message. This depends on the MIME structure
64
* of the mail and on whether HTML mode is enabled (which is decided by htmlMail())
67
Normal, ///< A normal plaintext message, non-multipart
68
Html, ///< A HTML message, non-multipart
69
MultipartPlain, ///< A multipart/alternative message, the plain text part is currently displayed
70
MultipartHtml ///< A multipart/altervative message, the HTML part is currently displayed
52
73
// return true if we should proceed, false if we should abort
53
bool checkOverwrite( const KUrl &url, QWidget *w );
56
* Delegates opening a URL to the Max OSX mechanisms for that.
57
* Returns false if it did nothing (such as on other platforms.
59
bool handleUrlOnMac( const KUrl& url );
62
* Return a list of the supported encodings
63
* @param usAscii if true, US-Ascii encoding will be prepended to the list.
65
QStringList supportedEncodings( bool usAscii );
68
* Fixes an encoding received by a KDE function and returns the proper,
69
* MIME-compilant encoding name instead.
70
* @see encodingForName
72
QString fixEncoding( const QString &encoding );
75
* Drop-in replacement for KCharsets::encodingForName(). The problem with
76
* the KCharsets function is that it returns "human-readable" encoding names
77
* like "ISO 8859-15" instead of valid encoding names like "ISO-8859-15".
78
* This function fixes this by replacing whitespace with a hyphen.
80
QString encodingForName( const QString &descriptiveName );
74
bool MESSAGEVIEWER_EXPORT checkOverwrite( const KUrl &url, QWidget *w );
77
* Delegates opening a URL to the QDesktopServices mechanisms for that
78
* on Windows and MacOSX.
79
* Returns false if it did nothing (such as on other platforms).
81
bool MESSAGEVIEWER_EXPORT handleUrlWithQDesktopServices( const KUrl& url );
84
* evaluates GlobalSettings->disregardUmask()
85
* and returns resulting permissions for storing files
86
* @return specific file permissions or -1 for default permissions
88
int MESSAGEVIEWER_EXPORT getWritePermissions();
90
QList<KMime::Content*> MESSAGEVIEWER_EXPORT allContents( const KMime::Content *message );
91
QList<KMime::Content*> MESSAGEVIEWER_EXPORT extractAttachments( const KMime::Message *message );
92
bool MESSAGEVIEWER_EXPORT saveContents( QWidget *parent,
93
const QList<KMime::Content*> &contents );
94
bool MESSAGEVIEWER_EXPORT saveContent( QWidget *parent, KMime::Content* content,
98
* Finds the filename of an icon based on the given mimetype or filenames.
100
* Always use this functions when looking up icon names for mime types, don't use
101
* KMimeType directly.
103
* Uses the IconNameCache internally to speed things up.
105
* @param mimeType The primary mime type used to find the icon, e.g. "application/zip". Alias
106
* mimetypes are resolved.
107
* @param size Size of the requested icon, e.g. KIconLoader::Desktop
108
* @param fallbackFileName(1|2) When the icon is not found by the given mime type, use the file
109
* name extensions of these file names to look the icon up.
110
* Example: "test.zip"
111
* @return the full file name of the icon file
113
QString MESSAGEVIEWER_EXPORT fileNameForMimetype( const QString &mimeType, int iconSize,
114
const QString &fallbackFileName1 = QString(),
115
const QString &fallbackFileName2 = QString() );