Menu

Icons in the file chooser

Yesterday I implemented a system to let the file chooser use appropriate icons for various file types. Before, all files had the same Oxygen "unknown type" icon.

I used a MIME type mapping first, noticing that the Oxygen icons are stored by the MIME type of the file they represent. Unfortunately it seems that the Java extension-to-MIME-type mapping is very bad, and only recognizes a few types of files.

So now we have a list of file extensions with their MIME types. That is working quite well, but does not always choose the same icon as KDE does. Firstly the list is not complete, and secondly KDE uses magic numbers to identify a file, and (often) ignores the extension.

A solution would be to call the KDE method KMimeType::iconNameForUrl that returns a path to the appropriate icon for a file. This however would mean that we also have to link against the KDE libraries in our native code, and as we have already problems with the build script right now concerning linking the Qt libraries, we will not do this at the moment. To be continued...

Posted by Willem3141 2012-03-31

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.