From kde-core-devel Mon Feb 19 09:42:20 2007 From: David Faure Date: Mon, 19 Feb 2007 09:42:20 +0000 To: kde-core-devel Subject: Re: KDE's MIME magic (KMimeMagic) database (format) Message-Id: <200702191042.21460.faure () kde ! org> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=117187815920099 On Sunday 18 February 2007, Daniel Leidert wrote: > > So this will only work if both conflicting mimetypes don't have Patterns=, > > or if they have X-KDE-PatternsAccuracy=50 (any number < 100). > > Feel free to submit a patch for kdelibs/mimetypes which adds the latter to all > > the mimetypes with "not so deterministic extensions". > Ok. I will have this in mind. So both need to have this line or no > pattern, if I understand you. Yes. > Yes. It searches from a given offset in the given offset-range length. OK. > > Interesting; especially since xdg mime doesn't support that, does it? > > It supports. But it doesn't use the search type. Instead it allows to > give an offset range "x:y" in the offset attribute of the match element. > I used the search-type of file's magic.mime file syntax, because the > file syntax does not contain something like offset_start:offset_end. The > only thing, that fits this idea, is the search type. Yes, same functionality, different syntax. > But also byte|short|long|leshort|lelong|beshort|belong? Yes. And date/bedate/ledate. > > > I've attached the current database to this > > > mail, so that you can have a look at your own for the used syntax. To > > > test, I simply copied it to ~/.kde/share/mimelnk. > > You can put it under /share/config/magic/chemical.magic (filename doesn't matter, extension does), instead. > > This is how to install kmimemagic snippets. > > Ah. In Debian /etc/kde3/magic for system files. Many thanks. Didn't know > that. I always thought, you cannot extend the database. I should add > this information to the freedesktop.org Wiki, so it will not be lost :) Good idea (although it's kde-specific, not fdo related) > So, I should create .desktop files for the aliases too and simply add > the X-KDE-IsAlso there, without any pattern? Yes. > > I know, this isn't really like aliases - if an application declares that it supports only the > > subclass/alias then it won't be launched for a file that has the canonical type. > > This is why we use the chosen canonical type in all application desktop files, > > and the alias is really only for the case where the 'wrong mimetype name' is being found, > > e.g. as returned by apache. > Ok. Understood. This is, how it should work. Interesting ;) This makes me wonder if I should really implement the xdg-mime aliases as complete equivalent aliases in kde4, or just as subclasses like we do already ;) But that might not be spec-compliant. > BTW, is there somewhere an official documentation of the X-KDE keys > in .desktop files? I mostly found discussion on this list, but no > complete documentation. Not really, unfortunately. For Type=Application files, the best documentation (well, list) is /share/servicetypes/application.desktop For mimetype files, there are really just three: X-KDE-AutoEmbed, X-KDE-text, and X-KDE-PatternsAccuracy. (I still need to find a replacement for the first one in kde4...) -- David Faure, faure@kde.org, sponsored by Trolltech to work on KDE, Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).