[PATCH] Support for XDG spec mimeapps.list

David Faure faure at kde.org
Sat Feb 23 00:24:45 GMT 2008


This is for fixing "[Bug 154595] Adding applications in edit file type doesn't work" the right way.

The KDE3 solution was: when the user associates a mimetype with an application (or removes
a mimetype from an application), we would create a copy of the application .desktop file in a local dir
(~/.local/share/applications) and add the mimetype there.
This solution had many problems - like all solutions that involve duplication of information.
Also the information about user preference was stored separately (in profilerc), which led to
complications (merging the info from profilerc with the info from installed desktop files), and was KDE-specific.

After discussing this topic on the XDG list (mostly with Alexander Larsson of Nautilus) we agreed
on a common spec for a file (called mimeapps.list) listing the mime-app associations added or removed
by the user. This leads to much simpler code in the filetype editor, and to a much cleaner
syntax for storing the user preferences compared to my old ugly profilerc file.

I finally finished support for mimeapps.list, both inside kbuildsycoca and in
the filetypes editor, including unit tests in both.
(It should make trader queries even faster since the user preferences are used by
kbuildsycoca when creating the offer list instead of being applied at query time)

All that's left to do now is to actually write down that spec, I'll have to do that
-- unless someone volunteers for doing that while I fix some bugs :)

Comments on the patches?

http://web.davidfaure.fr/kde/filetypes.diff
http://web.davidfaure.fr/kde/kdelibs.diff

IMHO it's good to go for trunk, but I would also like to apply this in 4.0.x, in order
to fix 154595 in a way that makes user preferences forward-compatible with 4.1
(instead of making 4.0.x propagate the bad KDE-3.x solution for this and then users
would lose their settings when upgrading to 4.1)

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