KDE switched to XDG shared-mime-info

David Faure faure at kde.org
Tue Mar 20 12:52:22 GMT 2007


I forgot to announce it before so here it is:

I have changed kdelibs yesterday, with the help of Pino Toscano, to use the 
standard mimetype database from freedesktop.org 
(http://standards.freedesktop.org/shared-mime-info-spec/latest)
instead of defining our own mimetypes in kdelibs.
Well, we still define a few mimetypes that are not in the shared repository, 
but most of them do come from shared-mime-info, and the move of those
mimetypes to shared-mime-info is an on-going process.

There are a number of reasons for doing that:
 * Improving compatibility with other free desktops (e.g. when sending a file 
over email the receiver will get a mimetype his system understands)
 * Improving compatibility with web servers (I think Apache already 
implements, or will implement, support for shared-mime-info instead of having 
its own mimetype database too).
 * A bit less maintainance on our side
 * And the most important benefit is for third-party application makers. They 
will be able to install a single mimetype file to define the mimetype(s) 
specific to their application, instead of having to install one file per 
desktop as is the case currently.

IMPORTANT: what this means for you:

 1) you should unset XDG_DATA_DIRS.
Earlier setup instructions suggested to set it in order to keep kde3 
applications out of the way, but that hack breaks now, we need the xdg 
mimetype files to be found, so we can't set XDG_DATA_DIRS away from /usr.
Let's make sure kde3 apps work in kde4 instead [e.g. I renamed kbuildsycoca to 
kbuildsycoca4 yesterday].

 2) you should install shared-mime-info. Given that gnome has been using it 
for quite some time, it is packaged already on all distributions, you don't 
have to compile anything yourself. Except on Windows, obviously.
0.18 is the minimum version, but 0.20 is recommended since it includes a 
number of fixes in the mimetype definitions.

 3) you shouldn't write code that parses mimetype .desktop files, use 
KMimeType::mimeType() instead (e.g. I fixed ark to do that).

 4) you shouldn't ship a mimetype with your application. Well, that has always 
been true ;) kdelibs was the mimetype repository, and from now on if you 
define a new mimetype for your application, either define it in 
kdelibs/mimetypes/kde.xml, or if this type of file can be sent (e.g. over 
email) to people not using kde, then better register the mimetype at
http://www.freedesktop.org/Standards/AddingMIMETutor

 5) you should report to me and Pino Toscano when you see a file is given a 
wrong mimetype (either from the extension or from the file contents), but 
only after upgrading to shared-mime-info 0.20 ;)


Next step: Pino or I will migrate some mimetype names in the kde .desktop 
files.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list