MIME Activation

David Faure dfaure at trolltech.com
Sun Apr 13 15:43:06 BST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 13 April 2003 04:25, Owen Taylor wrote:
>  - Since multiple handlers for one format are likely, it has to work
>    as "I can handle audio/x-mp3" not "I am the handler for audio/x-mp3"
> 
>    (I don't think there should be any way of setting the default from
>    an application install perspective, because an application never
>    knows if it should be the default.)

Yes. This is why we have an InitialPreference field in KDE's desktop files.
The higher the value, the most "preferred" the app will be. Although it
is possible to abuse this system, of course, the idea is that on a given system
it's possible to "classify" the apps for a given mimetype, and the user can
change this order of course (hence "Initial"), but e.g. removing an application 
doesn't break the system - if it was the most preferred, the 2nd most preferred 
will become the default one.

It turns out that this field isn't enough, for instance Karbon (vector drawing app)
should have a high InitialPreference for its own native mimetype, but should 
be rather low as a PostScript handler (it can import PS files), since most of
the time when you click on a .ps you want e.g. kghostview. We had this problem
several times, due to the fact that the InitialPreference value didn't depend on the
mimetype.

So my request would be that there is an "initial preference" number
per application+mimetype combination.
Then we could say things like:
Karbon+application/x-vnd.kde.karbon = 10
Karbon+application/postscript=2
KGhostview+application/postscript=10

Since this list is in fact redundant with the MimeType field in the .desktop file,
maybe this means the best solution is to group the two, i.e. something like
MimeTypeList=application/x-vnd.kde.karbon(10),application/postscript(2)
in the .desktop file of the application, replacing the MimeType line.
(I gave it a new name to avoid confusing existing MimeType=... parsers)
(Any other syntax is fine with me of course).

The other mistake we did was to make the default value 1. Then most things
end up being at level 1, and there's no way to specify "this app should be
less than most others". So I guess a default value of e.g. 5 or 10.

> In terms of workflow, putting information  in .desktop files as KDE does
> currently is nice and simple, but there are lots of other things that
> would work as well . But not having installed applications munge
> /etc/mailcap.
Definitely.

- -- 
David FAURE, faure at kde.org, sponsored by TrollTech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
How to write a Makefile.am for KDE/Qt code:
http://developer.kde.org/documentation/other/makefile_am_howto.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+mXeA72KcVAmwbhARAmQdAJ9O2ymIVWDv40stZMo5kdVdwza0cQCfU24H
64pomLORAb8UXFyTWyaIY44=
=JNgO
-----END PGP SIGNATURE-----





More information about the kde-core-devel mailing list