1 /*
2   SPDX-FileCopyrightText: 2016 Sandro Knauß <sknauss@kde.org>
3 
4   SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "mimetreeparser_export.h"
10 
11 #include <QString>
12 
13 class QMimeType;
14 
15 namespace KMime
16 {
17 class Content;
18 }
19 
20 namespace MimeTreeParser
21 {
22 /**
23  * The Util namespace contains a collection of helper functions use in
24  * various places.
25  */
26 namespace Util
27 {
28 /**
29  * Describes the type of the displayed message. This depends on the MIME structure
30  * of the mail and on whether HTML mode is enabled (which is decided by htmlMail())
31  */
32 enum HtmlMode {
33     Normal, ///< A normal plaintext message, non-multipart
34     Html, ///< A HTML message, non-multipart
35     MultipartPlain, ///< A multipart/alternative message, the plain text part is currently displayed
36     MultipartHtml, ///< A multipart/alternative message, the HTML part is currently displayed
37     MultipartIcal ///< A multipart/alternative message, the ICal part is currently displayed
38 };
39 
40 MIMETREEPARSER_EXPORT Q_REQUIRED_RESULT QString htmlModeToString(Util::HtmlMode mode);
41 
42 MIMETREEPARSER_EXPORT Q_REQUIRED_RESULT bool isTypeBlacklisted(KMime::Content *node);
43 
44 MIMETREEPARSER_EXPORT Q_REQUIRED_RESULT QString labelForContent(KMime::Content *node);
45 
46 MIMETREEPARSER_EXPORT Q_REQUIRED_RESULT QMimeType mimetype(const QString &name);
47 
48 MIMETREEPARSER_EXPORT Q_REQUIRED_RESULT QString iconNameForMimetype(const QString &mimeType,
49                                                                     const QString &fallbackFileName1 = QString(),
50                                                                     const QString &fallbackFileName2 = QString());
51 
52 MIMETREEPARSER_EXPORT Q_REQUIRED_RESULT QString iconNameForContent(KMime::Content *node);
53 }
54 }
55 
56