File indexing completed on 2025-03-09 04:54:39
0001 /* 0002 SPDX-FileCopyrightText: 2005 Till Adam <adam@kde.org> 0003 SPDX-FileCopyrightText: 2016 Sandro Knauß <sknauss@kde.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include "messageviewer_export.h" 0011 0012 #include <QString> 0013 0014 namespace KMime 0015 { 0016 class Content; 0017 } 0018 0019 namespace MessageViewer 0020 { 0021 /** 0022 * The Util namespace contains a collection of helper functions use in 0023 * various places. 0024 */ 0025 namespace Util 0026 { 0027 /** 0028 * Finds the filename of an icon based on the given mimetype or filenames. 0029 * 0030 * Always use this functions when looking up icon names for mime types, don't use 0031 * KMimeType directly. 0032 * 0033 * Uses the IconNameCache internally to speed things up. 0034 * 0035 * @param mimeType The primary mime type used to find the icon, e.g. "application/zip". Alias 0036 * mimetypes are resolved. 0037 * @param iconSize Size of the requested icon, e.g. KIconLoader::Desktop 0038 * @param fallbackFileName1 When the icon is not found by the given mime type, use the file 0039 * name extensions of these file names to look the icon up. 0040 * Example: "test.zip" 0041 * @param fallbackFileName2 Fallback for @p fallbackFileName1. 0042 * @return the full file name of the icon file 0043 */ 0044 [[nodiscard]] QString MESSAGEVIEWER_EXPORT iconPathForMimetype(const QString &mimeType, 0045 int iconSize, 0046 const QString &fallbackFileName1 = QString(), 0047 const QString &fallbackFileName2 = QString()); 0048 0049 [[nodiscard]] QString MESSAGEVIEWER_EXPORT iconPathForContent(KMime::Content *node, int iconSize); 0050 0051 struct AttachmentDisplayInfo { 0052 QString label; 0053 QString icon; 0054 bool displayInHeader = false; 0055 }; 0056 0057 [[nodiscard]] AttachmentDisplayInfo attachmentDisplayInfo(KMime::Content *node); 0058 } 0059 }