Bug 315983

Summary: browse mode does not correctly display custom folder icon
Product: [Applications] gwenview Reporter: Nan Zou <nzou>
Component: generalAssignee: Gwenview Bugs <gwenview-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: benni, devel, nate, ndzou, nerobat2004, null
Priority: NOR    
Version: 2.9.5   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 18.04.1
Attachments: screenshot of Dolphin displaying folder contents
screenshot of gwenview incorrectly displaying Dropbox folder icon

Description Nan Zou 2013-03-01 22:05:01 UTC
Created attachment 77674 [details]
screenshot of Dolphin displaying folder contents

I have a directory Dropbox in my home directory, I use a custom icon for the folder, the file .directory within this folder has this content:

[Desktop Entry]
Icon=/usr/share/icons/oxygen/scalable/places/folder-dropbox.svg

Dolphin displays the folder with its custom icon correctly.  However gwenview is unable to display the custom icon and instead displays a completely unrelated icon.  See the attached screenshots for both Dolphin and gwenview.
Comment 1 Nan Zou 2013-03-01 22:06:11 UTC
Created attachment 77675 [details]
screenshot of gwenview incorrectly displaying Dropbox folder icon
Comment 2 Benni Hill 2013-03-04 17:18:27 UTC
What happens when you replace Icon=... with
Icon=folder-dropbox ?
Comment 3 francescobat 2015-10-05 14:38:35 UTC
Same and identical problem with all custom icons folders.
Dolphin is ok, gwenview no :-(
The problem is if i selected custom icons from home folders; if i custom icon from system folders, gwenview works.
I have this problem from some years and I thought I was wrong something, but now i see this report i understand i'm not wrong.
The screenshots sent from Nan Zou, they fully confirm the anomaly in all folders with custom icons in different folders from system folders.
Bye
Francesco bat
Comment 4 N. Zou 2015-10-06 16:29:42 UTC
Actually it works if the icon points to a system icon instead of absolute path.  Sorry I did not see the response sooner and have forgotten about this.  I think it's OK to close this bug since there's a workaround.

For icons under home folder you can put them in ~/.kde/share/icons/hicolor/[size]/apps, replace size with actual size like 64x64, scalable, etc.
Comment 5 Nate Graham 2017-09-08 21:56:01 UTC
Confirmed. A workaround isn't enough; we should fix the bug!
Comment 6 Nate Graham 2017-09-08 21:59:05 UTC
This likely has the same root cause as https://bugs.kde.org/show_bug.cgi?id=368951
Comment 7 Peter Mühlenpfordt 2018-04-20 07:01:05 UTC
I can confirm this only for folders with an absolute path icon
* without any images inside or
* the custom icon's size is less than 128 pixel.
With at least one image in the folder the custom icon shows up with the mini thumbnails overlay. It also doesn't matter if the icon is in PNG/SVG/JPG format.
Comment 8 Peter Mühlenpfordt 2018-05-07 06:58:48 UTC
Git commit dd0d608a27711cdd1a64a5cb43f01513c212b0cf by Peter Mühlenpfordt.
Committed on 07/05/2018 at 06:57.
Pushed by muhlenpfordt into branch 'Applications/18.04'.

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.
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

M  +2    -2    lib/thumbnailview/thumbnailview.cpp

https://commits.kde.org/gwenview/dd0d608a27711cdd1a64a5cb43f01513c212b0cf
Comment 9 null 2018-05-07 07:12:42 UTC
> FIXED-IN: 18.04.2
As far as I understand the schedule (https://community.kde.org/Schedules/Applications/18.04_Release_Schedule), tagging is only after 23:59 UTC, so you still made it into 18.04.1 ;)

(To double-check, look at any announcement in https://mail.kde.org/pipermail/release-team/.)

ae6fc125c838 was only to update the version number, but the tag could still go to a later commit.
Comment 10 Peter Mühlenpfordt 2018-05-07 07:21:06 UTC
> ae6fc125c838 was only to update the version number, but the tag could still go to a later commit.

Oh, right - I mixed that up.
Comment 11 Peter Mühlenpfordt 2018-05-15 15:08:12 UTC
Git commit bafc90d730f2ad018ff440060e19b8affa074d31 by Peter Mühlenpfordt.
Committed on 15/05/2018 at 15:04.
Pushed by muhlenpfordt into branch 'Applications/18.04'.

Scale up folder icon before creating preview overlays

Summary:
If a custom folder icon is smaller than the requested preview size
`KIO::PreviewJob` returns a pixmap of only that size. E.g. `dolphin`
scales this up to its current thumbnail size which results in ugly
overlay icons for very small folder icons. If the folder icon is
scaled up before creating the overlay icons the overall preview
looks much better.

Test Plan:
# Set a small custom icon (e.g. 32 px) for a folder containing images
# Start dolphin with `Preview` enabled in the parent folder
# Zoom thumbnails to e.g. 128 pixels overlay
# The overlayed preview icons should not be blurry

| Before:    | After:     |
| {F5837958} | {F5837960} |

Reviewers: #frameworks, rkflx

Reviewed By: rkflx

Subscribers: ngraham, rkflx

Differential Revision: https://phabricator.kde.org/D12734

M  +8    -1    thumbnail/thumbnail.cpp

https://commits.kde.org/kio-extras/bafc90d730f2ad018ff440060e19b8affa074d31