Commit 555e8284 authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

ensure no file ends up without an icon in the project treeview

parent 5ffe1058
......@@ -110,12 +110,15 @@ QIcon *KateProjectItem::icon() const
case File: {
QString iconName = QMimeDatabase().mimeTypeForUrl(QUrl::fromLocalFile(data(Qt::UserRole).toString())).iconName();
QStringList emblems;
// ensure we have no empty icons, that breaks layout in tree views
QIcon icon = QIcon::fromTheme(QMimeDatabase().mimeTypeForUrl(QUrl::fromLocalFile(data(Qt::UserRole).toString())).iconName());
if (icon.isNull()) {
icon = QIcon::fromTheme(QStringLiteral("unknown"));
if (!m_emblem.isEmpty()) {
m_icon = new QIcon(KIconUtils::addOverlay(QIcon::fromTheme(iconName), QIcon(m_emblem), Qt::TopLeftCorner));
m_icon = new QIcon(KIconUtils::addOverlay(icon, QIcon(m_emblem), Qt::TopLeftCorner));
} else {
m_icon = new QIcon(QIcon::fromTheme(iconName));
m_icon = new QIcon(icon);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment