Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
555e8284
Commit
555e8284
authored
Feb 02, 2021
by
Christoph Cullmann
🐮
Browse files
ensure no file ends up without an icon in the project treeview
parent
5ffe1058
Changes
1
Hide whitespace changes
Inline
Side-by-side
addons/project/kateprojectitem.cpp
View file @
555e8284
...
...
@@ -110,12 +110,15 @@ QIcon *KateProjectItem::icon() const
break
;
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
);
}
break
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment