Messagelib

mimetype.h
1 /*
2  SPDX-FileCopyrightText: 2005 Till Adam <[email protected]>
3  SPDX-FileCopyrightText: 2016 Sandro Knauß <[email protected]>
4 
5  SPDX-License-Identifier: GPL-2.0-or-later
6 */
7 
8 #pragma once
9 
10 #include "messageviewer_export.h"
11 
12 #include <QString>
13 
14 namespace KMime
15 {
16 class Content;
17 }
18 
19 namespace MessageViewer
20 {
21 /**
22  * The Util namespace contains a collection of helper functions use in
23  * various places.
24  */
25 namespace Util
26 {
27 /**
28  * Finds the filename of an icon based on the given mimetype or filenames.
29  *
30  * Always use this functions when looking up icon names for mime types, don't use
31  * KMimeType directly.
32  *
33  * Uses the IconNameCache internally to speed things up.
34  *
35  * @param mimeType The primary mime type used to find the icon, e.g. "application/zip". Alias
36  * mimetypes are resolved.
37  * @param iconSize Size of the requested icon, e.g. KIconLoader::Desktop
38  * @param fallbackFileName1 When the icon is not found by the given mime type, use the file
39  * name extensions of these file names to look the icon up.
40  * Example: "test.zip"
41  * @param fallbackFileName2 Fallback for @p fallbackFileName1.
42  * @return the full file name of the icon file
43  */
44 Q_REQUIRED_RESULT QString MESSAGEVIEWER_EXPORT iconPathForMimetype(const QString &mimeType,
45  int iconSize,
46  const QString &fallbackFileName1 = QString(),
47  const QString &fallbackFileName2 = QString());
48 
49 Q_REQUIRED_RESULT QString MESSAGEVIEWER_EXPORT iconPathForContent(KMime::Content *node, int iconSize);
50 
51 struct AttachmentDisplayInfo {
52  QString label;
53  QString icon;
54  bool displayInHeader = false;
55 };
56 
57 Q_REQUIRED_RESULT AttachmentDisplayInfo attachmentDisplayInfo(KMime::Content *node);
58 }
59 }
QString MESSAGEVIEWER_EXPORT 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.
Definition: mimetype.cpp:17
QString label(StandardShortcut id)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Mar 26 2023 04:08:11 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.