KImageIO::mimeTypes and SVG/SVGZ Files

David Faure faure at kde.org
Thu Sep 1 12:46:42 BST 2011


On Wednesday 31 August 2011 19:30:19 Martin Koller wrote:
> On Wednesday, 31. August 2011 17:54:45 David Faure wrote:
> > The translated name is redundant indeed, though, it's not used, except
> > when looking at the servicetype's associated plugins in keditfiletype.
> even in keditfiletype I do not see where the name is used.
> E.g. using "keditfiletype image/png" I see nowhere only the name "PNG"
> which is inside the .desktop file.

True, it only shows apps and parts, not plugins. My bad.

But "ktraderclient --servicetype QImageIOPlugins" shows the names :)

> So the main question is: can't we simply get rid of the translation lines
> in these image.desktop files and save our translators some time ?
> (BTW: If the translation is not used/needed, I assume I do not need to ask
> the translation team for permission to add these new files in the 4.7
> branch, right ?)

Re-reading the code in KService, it allows to have no Name field, actually: it 
makes one up from the filename. So if it works, feel free to remove all Name 
fields. If I said it was mandatory before, I was wrong.

> Another question: the line X-KDE-ImageFormat seems to be used when I want to
> pass this format to e.g. QImage::save().
> But I see here inconsistencies in the different .desktop files, where some
> include only the lowercase string, e.g.
> X-KDE-ImageFormat=gif
> others lower and uppercase, e.g.
> X-KDE-ImageFormat=eps,EPS,EPSI,epsf,EPSF

Hmm, these are the values returned by KImageIO::types() and typeForMime(), but 
I have no idea where these are used. Apparently the norm was all-uppercase; 
this is a format name, not a file extension.

http://lxr.kde.org/ident?i=typeForMime
Hmm, seems this is used for telling the user about supported formats, or for 
passing as 2nd argument to QPixmap::save(), probably to trigger the plugin.

I see, so the lowercase/uppercase redundancy is to maximize the chances of 
QPixmap::save finding the right plugin when some piece of code somewhere 
specifies a format name. Since the author of the plugin doesn't control what 
application authors might write in their code, he tends to be inclusive...

OK, except that qimagereader.cpp does format.toLower(), so case doesn't matter 
indeed. We can make it all lowercase.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).





More information about the kde-core-devel mailing list