Messagelib

mimetreeparser/src/utils/util.h
1 /*
2  SPDX-FileCopyrightText: 2016 Sandro Knauß <[email protected]>
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 [[nodiscard]] MIMETREEPARSER_EXPORT QString htmlModeToString(Util::HtmlMode mode);
41 
42 [[nodiscard]] MIMETREEPARSER_EXPORT bool isTypeBlacklisted(KMime::Content *node);
43 
44 [[nodiscard]] MIMETREEPARSER_EXPORT QString labelForContent(KMime::Content *node);
45 
46 [[nodiscard]] MIMETREEPARSER_EXPORT QMimeType mimetype(const QString &name);
47 
48 [[nodiscard]] MIMETREEPARSER_EXPORT QString iconNameForMimetype(const QString &mimeType,
49  const QString &fallbackFileName1 = QString(),
50  const QString &fallbackFileName2 = QString());
51 
52 [[nodiscard]] MIMETREEPARSER_EXPORT QString iconNameForContent(KMime::Content *node);
53 }
54 }
MIMETREEPARSER_EXPORT QString htmlModeToString(Util::HtmlMode mode)
@ Html
A HTML message, non-multipart.
@ MultipartHtml
A multipart/alternative message, the HTML part is currently displayed.
HtmlMode
Describes the type of the displayed message.
@ MultipartIcal
A multipart/alternative message, the ICal part is currently displayed.
@ Normal
A normal plaintext message, non-multipart.
@ MultipartPlain
A multipart/alternative message, the plain text part is currently displayed.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Dec 5 2023 04:03:19 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.