Bug 211491

Summary: (patch) Dolphin doesn't preview favicon .ico files
Product: [Frameworks and Libraries] kdelibs Reporter: skierpage <skierpage>
Component: generalAssignee: Peter Penz <peter.penz19>
Status: RESOLVED FIXED    
Severity: normal CC: andresbajotierra, faure
Priority: NOR Keywords: investigated, junior-jobs
Version: SVN   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 4.6.5

Description skierpage 2009-10-23 00:12:20 UTC
Version:           1.3 (using KDE 4.3.2)
OS:                Linux
Installed from:    Ubuntu Packages

On Kubuntu 9.04 Jaunty amd64,

I saved a website's favicon.ico to a local file (e.g. with the terminal command
  curl --dump-header - -o google_favicon.ico http://www.google.com/favicon.ico
).

When I view the local directory in Dolphin
a) with Preview on, the icon for the .ico filename is the generic balloon image
b) right-click the file and choose Preview This File from the context menu does nothing
c) right-click the file and choose Properties > Preview tab shows nothing.

Expected Behavior: .ico in Dolphin should behave like a .jpeg file or other image.

Gwenview, KolourPaint, and Konqueror can all render a favicon, so there's code in KDE to handle the .ico format.  I'm filing this as a bug because b) seems an active failure -- "Preview This File" should be grayed out if it's not going to work.

In the icon file's context menu, Open With... is empty.  It seems Gwenview and KolourPaint should nominate themselves to be in there (through some .desktop file magic?), but I assume that's a separate bug.

If I run dolphin from a console I see the following partial output.  The "Service 'org.kde.plasma' does not exist." seems odd.

dolphin(29440)/kio KIO::DelegateAnimationHandler::sequenceTimerTimeout: requesting 7
dolphin(29440)/kdecore (trader) KMimeTypeTrader::query: query for mimeType  "image/vnd.microsoft.icon" ,  "Application"  : returning  0  offers
dolphin(29440)/kio KIO::DelegateAnimationHandler::gotNewIcon: 7
dolphin(29440)/kio KIO::DelegateAnimationHandler::sequenceTimerTimeout: requesting 8
dolphin(29440) KDesktopFileActions::executeService: "Preview" first url's path= "/home/skierpage/Desktop/google_favicon.ico" exec= "qdbus org.kde.plasma /Previewer org.kde.Previewer.openFile %u"
dolphin(29440)/kfile (kdelibs) KRecentDocument::add: KRecentDocument::add for  "file:///home/skierpage/Desktop/google_favicon.ico"
dolphin(29440)/kio (KRun) runTempService: runTempService: first url  "file:///home/skierpage/Desktop/google_favicon.ico"
dolphin(29440)/kio (KRun) runTempService: runTempService: KProcess args= ("/usr/bin/qdbus", "org.kde.plasma", "/Previewer", "org.kde.Previewer.openFile", "/home/skierpage/Desktop/google_favicon.ico")
Service 'org.kde.plasma' does not exist.
dolphin(29440)/kio (KRun) KProcessRunner::slotProcessExited: "qdbus" exitCode= 1 exitStatus= 0
dolphin(29440) KProcessRunner::slotProcessExited: ""
dolphin(29440)/kio (KDirListerCache) KDirListerCache::processPendingUpdates: "file:///home/skierpage/Desktop/google_favicon.ico"
Comment 1 Dario Andres 2009-10-23 00:39:41 UTC
In fact the "Preview This File" is a (broken?) entry to show the image in the "Previewer" widget in Plasma Desktop :

dolphin(29440)/kio (KRun) runTempService: runTempService: KProcess args=
("/usr/bin/qdbus", "org.kde.plasma", "/Previewer",
"org.kde.Previewer.openFile", "/home/skierpage/Desktop/google_favicon.ico")
Service 'org.kde.plasma' does not exist.

It seems to be broken (never worked for me). And that should be filed in another bug report I think.

About the icon itself not being previewed in Dolphin, there is a related bug report: bug 107491 ("add support for windows icons", with a supplied patch to implement icon previewing for "ico" and even "exe")

Regards
Comment 2 skierpage 2009-10-23 03:27:47 UTC
(In reply to comment #1)
Thanks for analyzing!

> In fact the "Preview This File" is a (broken?) entry to show the image in the
> "Previewer" widget in Plasma Desktop :
> ...
> It seems to be broken (never worked for me). And that should be filed in
> another bug report I think.
You're right this is a separate bug -- Preview This File fails for me for all file types.  There's a bug 190388 about this but even if I add the Previewer plasma widget that menu item fails.

> About the icon itself not being previewed in Dolphin, there is a related bug
> report: bug 107491 ("add support for windows icons", with a supplied patch to
> implement icon previewing for "ico" and even "exe")
That seems like overkill (handling multiple icon sizes, parsing executables) just for previewing the favicon web standard, and the patch seems to introduce depencies on `wrestool` and `icotool` executables from an icotools package that I don't have even though I have Wine installed, with no fallback.

Since other parts of KDE render .ico fine, maybe just adding image/vnd.microsoft.icon; and image/x-icon; to MimeType in /usr/share/kde4/services/imagethumbnail.desktop is enough to get something working.  (I guess I have to restart KDE4 to see if this takes...)
Comment 3 skierpage 2009-10-23 08:33:46 UTC
(In reply to comment #2)
> Since other parts of KDE render .ico fine, maybe just adding
> image/vnd.microsoft.icon; and image/x-icon; to MimeType in
> /usr/share/kde4/services/imagethumbnail.desktop is enough to get something
> working.

I made this 1-line change, adding them after image/x-ico;, and logged out of K Desktop.  Upon logging back in, a) and c) are fixed, in Dolphin and Konqeror favicon.ico files in local directories have the small 16x16 preview you would expect!

Please consider making this tiny change to kdebase/runtime/kioslave/thumbnail/imagethumbnail.desktop.

@@ -86,7 +86,8 @@
 Name[zh_CN]=图像
 Name[zh_TW]=影像
 X-KDE-ServiceTypes=ThumbCreator
-MimeType=image/cgm;image/fax-g3;image/gif;image/jp2;image/png;image/tiff;image/bmp;image/x-dds;image/x-ico;image/x-jng;image/x-pcx;image/x-photo-cd;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-rgb;image/x-tga;image/x-wmf;image/x-xbitmap;image/x-xcf;image/x-xfig;image/x-xpixmap;
+MimeType=image/cgm;image/fax-g3;image/gif;image/jp2;image/png;image/tiff;image/bmp;image/x-dds;image/x-ico;image/vnd.microsoft.icon;image/x-icon;image/x-jng;image/x-pcx;image/x-photo-cd;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-rgb;image/x-tga;image/x-wmf;image/x-xbitmap;image/x-xcf;image/x-xfig;image/x-xpixmap;
 X-KDE-Library=imagethumbnail
 CacheThumbnail=true
 X-Ubuntu-Gettext-Domain=desktop_kdebase-runtime

Some notes: the official MIME type is image/vnd.microsoft.icon , but many web sites return a Content-Type: image/x-icon , so I added both.  According to /usr/share/mime/aliases and /usr/share/mime/image/vnd.microsoft.icon.xml, the existing image/x-ico in imagethumbnail.desktop is an alias of image/vnd.microsoft.icon , but clearly Dolphin doesn't consult aliases.
"Preview This File" and dragging into the Previewer plasma widget still don't work for .ico files.
Comment 4 Dario Andres 2009-10-23 14:00:47 UTC
Thanks for taking the time to investigate this. I closed the other bug report as it was implemented already, I'm going to leave this open so one dev can look at it.
Regards
Comment 5 Dawit Alemayehu 2011-06-05 20:29:55 UTC
Git commit 1749449fa96ac3a64896eaa94688cba5dea11a04 by Dawit Alemayehu.
Committed on 05/06/2011 at 20:28.
Pushed by adawit into branch 'KDE/4.6'.

Added preview support for ICO files.

BUG: 211491
FIXED-IN: 4.6.5

M  +1    -1    kioslave/thumbnail/imagethumbnail.desktop     

http://commits.kde.org/kde-runtime/1749449fa96ac3a64896eaa94688cba5dea11a04
Comment 6 Dawit Alemayehu 2011-06-05 20:30:30 UTC
Git commit c3a85e529bb68a1b09a56a8598f2488b345ffa09 by Dawit Alemayehu.
Committed on 05/06/2011 at 20:28.
Pushed by adawit into branch 'master'.

Added preview support for ICO files.

BUG: 211491
FIXED-IN: 4.6.5

(cherry picked from commit 1749449fa96ac3a64896eaa94688cba5dea11a04)

M  +1    -1    kioslave/thumbnail/imagethumbnail.desktop     

http://commits.kde.org/kde-runtime/c3a85e529bb68a1b09a56a8598f2488b345ffa09