Commit dd0d608a authored by Peter Mühlenpfordt's avatar Peter Mühlenpfordt
Browse files

Fix custom folder icons using an absolute path entry

Summary:
Gwenview does not display a custom folder icon which is configured
by an absolute path and the folder does not contain any images.
This is caused by `KIconLoader::loadMimeTypeIcon()` failing for
absolute path entries. If the folder contains images the preview
job corrects the icon later.
Using `KIconLoader::loadIcon()` loads the correct icon.

BUG: 315983
FIXED-IN: 18.04.2

Test Plan:
* Create an empty folder (e.g. /tmp/parent/test-empty)
* Set a custom icon for `test-empty` using an absolute path
* Start Gwenview in Browse Mode in the `parent` folder
* Folder `test-empty` should display the custom icon

| Before:    | After:     |
| {F5818845} | {F5818847} |

Reviewers: #gwenview, rkflx

Reviewed By: #gwenview, rkflx

Subscribers: rkflx, huoni

Differential Revision: https://phabricator.kde.org/D12465
parent ae6fc125
......@@ -577,7 +577,7 @@ void ThumbnailView::setBrokenThumbnail(const KFileItem& item)
// Special case for videos because our kde install may come without
// support for video thumbnails so we show the mimetype icon instead of
// a broken image icon
QPixmap pix = KIconLoader::global()->loadMimeTypeIcon(item.iconName(), KIconLoader::Desktop, d->mThumbnailSize.height());
const QPixmap pix = KIconLoader::global()->loadIcon(item.iconName(), KIconLoader::Desktop, d->mThumbnailSize.height());
thumbnail.initAsIcon(pix);
} else if (kind == MimeTypeUtils::KIND_DIR) {
// Special case for folders because ThumbnailProvider does not return a
......@@ -616,7 +616,7 @@ QPixmap ThumbnailView::thumbnailForIndex(const QModelIndex& index, QSize* fullSi
if (kind == MimeTypeUtils::KIND_ARCHIVE || kind == MimeTypeUtils::KIND_DIR) {
int groupSize = ThumbnailGroup::pixelSize(ThumbnailGroup::fromPixelSize(d->mThumbnailSize.height()));
if (thumbnail.mGroupPix.isNull() || thumbnail.mGroupPix.height() < groupSize) {
QPixmap pix = KIconLoader::global()->loadMimeTypeIcon(item.iconName(), KIconLoader::Desktop, d->mThumbnailSize.height());
const QPixmap pix = KIconLoader::global()->loadIcon(item.iconName(), KIconLoader::Desktop, d->mThumbnailSize.height());
thumbnail.initAsIcon(pix);
if (kind == MimeTypeUtils::KIND_ARCHIVE) {
......
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