Messagelib

mimetype.h
1/*
2 SPDX-FileCopyrightText: 2005 Till Adam <adam@kde.org>
3 SPDX-FileCopyrightText: 2016 Sandro Knauß <sknauss@kde.org>
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
14namespace KMime
15{
16class Content;
17}
18
19namespace MessageViewer
20{
21/**
22 * The Util namespace contains a collection of helper functions use in
23 * various places.
24 */
25namespace 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[[nodiscard]] QString MESSAGEVIEWER_EXPORT iconPathForMimetype(const QString &mimeType,
45 int iconSize,
46 const QString &fallbackFileName1 = QString(),
47 const QString &fallbackFileName2 = QString());
48
49[[nodiscard]] QString MESSAGEVIEWER_EXPORT iconPathForContent(KMime::Content *node, int iconSize);
50
51struct AttachmentDisplayInfo {
52 QString label;
53 QString icon;
54 bool displayInHeader = false;
55};
56
57[[nodiscard]] 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
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.