Messagelib

mimetype.cpp
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 #include "utils/mimetype.h"
9 #include "messageviewer_debug.h"
10 #include "utils/iconnamecache.h"
11 
12 #include <MimeTreeParser/NodeHelper>
13 #include <MimeTreeParser/Util>
14 
15 #include <KIconLoader>
16 #include <KMime/Content>
17 
18 QString MessageViewer::Util::iconPathForMimetype(const QString &mimeType, int iconSize, const QString &fallbackFileName1, const QString &fallbackFileName2)
19 {
20  return IconNameCache::instance()->iconPath(MimeTreeParser::Util::iconNameForMimetype(mimeType, fallbackFileName1, fallbackFileName2), iconSize);
21 }
22 
23 QString MessageViewer::Util::iconPathForContent(KMime::Content *node, int size)
24 {
25  return IconNameCache::instance()->iconPath(MimeTreeParser::Util::iconNameForContent(node), size);
26 }
27 
28 MessageViewer::Util::AttachmentDisplayInfo MessageViewer::Util::attachmentDisplayInfo(KMime::Content *node)
29 {
30  AttachmentDisplayInfo info;
31  info.icon = iconPathForContent(node, KIconLoader::Small);
32  info.label = MimeTreeParser::Util::labelForContent(node);
33 
34  bool typeBlacklisted = MimeTreeParser::Util::isTypeBlacklisted(node);
35  info.displayInHeader = !info.label.isEmpty() && !info.icon.isEmpty() && !typeBlacklisted;
36  return info;
37 }
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:18
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 23:16:25 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.