Messagelib

mimetype.cpp
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#include "utils/mimetype.h"
9#include "utils/iconnamecache.h"
10
11#include <MimeTreeParser/NodeHelper>
12#include <MimeTreeParser/Util>
13
14#include <KIconLoader>
15#include <KMime/Content>
16
17QString MessageViewer::Util::iconPathForMimetype(const QString &mimeType, int iconSize, const QString &fallbackFileName1, const QString &fallbackFileName2)
18{
19 return IconNameCache::instance()->iconPath(MimeTreeParser::Util::iconNameForMimetype(mimeType, fallbackFileName1, fallbackFileName2), iconSize);
20}
21
22QString MessageViewer::Util::iconPathForContent(KMime::Content *node, int size)
23{
24 return IconNameCache::instance()->iconPath(MimeTreeParser::Util::iconNameForContent(node), size);
25}
26
27MessageViewer::Util::AttachmentDisplayInfo MessageViewer::Util::attachmentDisplayInfo(KMime::Content *node)
28{
29 AttachmentDisplayInfo info;
30 info.icon = iconPathForContent(node, KIconLoader::Small);
31 info.label = MimeTreeParser::Util::labelForContent(node);
32
33 const bool typeBlacklisted = MimeTreeParser::Util::isTypeBlacklisted(node);
34 info.displayInHeader = !info.label.isEmpty() && !info.icon.isEmpty() && !typeBlacklisted;
35 return info;
36}
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 Tue Mar 26 2024 11:12:43 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.