<div dir="ltr">Yep, i had a lot of fun learning mime database details.<div>This is a real contest to the programmer, even to qualified one. And i'm not belong to those group :)</div><div>So, i will try to eviscerate the Windows registry to find MIME info storage. And how are Windows users lives without such MIME database... i don't understand this. Just extension gives too limited information to software.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/16 Jerome Leclanche <span dir="ltr"><<a href="mailto:adys.wh@gmail.com" target="_blank">adys.wh@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Mime types are interesting to know about, so if you want to learn more<br>
about them why not. A windows-compatible lib would be interesting. But<br>
all in all, Qt already has a mime type solution.<br>
<br>
J. Leclanche<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Mon, Dec 16, 2013 at 9:55 AM, Alexander Kamyshnikov<br>
<<a href="mailto:axill777@gmail.com">axill777@gmail.com</a>> wrote:<br>
> Oh thanks, Kevin! This library is exactly i need for.<br>
> However, yet-another-implementation-of MIME loader might be useful for<br>
> somebody, or i'm just wasted my time? :)<br>
> This was funny and interesting quest.<br>
><br>
><br>
> 2013/12/16 Kevin Krammer <<a href="mailto:krammer@kde.org">krammer@kde.org</a>><br>
>><br>
>> On Monday, 2013-12-16, 12:45:47, Alexander Kamyshnikov wrote:<br>
>> > I'm confused a bit.<br>
>> > So, you want to say that QMimeDatabase from Qt5 can be separately used<br>
>> > in<br>
>> > Qt4?<br>
>> > I.e. i can just include this code in mine.<br>
>><br>
>> Not the Qt5 based code obviously. But Jerome said that there is a Qt4 port<br>
>> of<br>
>> the Qt5 code.<br>
>><br>
>> I guess he is referring to<br>
>> <a href="https://github.com/pasnox/mimetypes-qt4" target="_blank">https://github.com/pasnox/mimetypes-qt4</a><br>
>><br>
>> Cheers,<br>
>> Kevin<br>
>><br>
>> > Also, i'm trying to google "qmimedatabase qt4", but find nothing<br>
>> > appropriate.<br>
>> > A more concrete search direction will be welcome.<br>
>> > P.S. Sorry, if i don't understand simple things. My english is not<br>
>> > perfect<br>
>> > yet.<br>
>> ><br>
>> ><br>
>> > 2013/12/16 Kevin Krammer <<a href="mailto:krammer@kde.org">krammer@kde.org</a>><br>
>> ><br>
>> > > On Monday, 2013-12-16, 11:41:34, Alexander Kamyshnikov wrote:<br>
>> > > > Hi Kevin. I'm glad to see KDE developer here because i'm KDE fan for<br>
>> > > > many<br>
>> > > > years :)<br>
>> > > > But this KDE MIME-support code hardly depend from other KDE stuff,<br>
>> > > > isn't<br>
>> > ><br>
>> > > it?<br>
>> > ><br>
>> > > > I need "pure" Qt code - this is our software client requirement :/<br>
>> > > > So<br>
>> > > > i'm<br>
>> > > > wrote CMimeDatabase class. And just want to make it fully compliant<br>
>> > > > with<br>
>> > > > freedesktop standart.<br>
>> > ><br>
>> > > Just wanted to point out that the Qt5 implementation was contributed<br>
>> > > by<br>
>> > > KDE<br>
>> > > developers, so additional to the Qt4 port of that code there is also<br>
>> > > "the<br>
>> > > original" Qt4 code available.<br>
>> > ><br>
>> > > But of course if you need a pure C++ implementation without Qt then<br>
>> > > writing a<br>
>> > > new one is your only choice.<br>
>> > ><br>
>> > > Cheers,<br>
>> > > Kevin<br>
>> > ><br>
>> > > > (see<br>
>> > ><br>
>> > ><br>
>> > > <a href="http://api.kde.org/4.0-api/kdelibs-apidocs/kdecore/html/kmimetype_8h_sourc" target="_blank">http://api.kde.org/4.0-api/kdelibs-apidocs/kdecore/html/kmimetype_8h_sourc</a><br>
>> > > e<br>
>> > > .<br>
>> > ><br>
>> > > > html -<br>
>> > > > KUrl, KServiceType etc.)<br>
>> > > ><br>
>> > > ><br>
>> > > > 2013/12/14 Kevin Krammer <<a href="mailto:krammer@kde.org">krammer@kde.org</a>><br>
>> > > ><br>
>> > > > > On Friday, 2013-12-13, 20:11:34, Jerome Leclanche wrote:<br>
>> > > > > > There is a Qt 4 port of this.<br>
>> > > > ><br>
>> > > > > And there should also be the original Qt4 based code in the<br>
>> > > > > kdelibs<br>
>> > > > > repository.<br>
>> > > > ><br>
>> > > > > Cheers,<br>
>> > > > > Kevin<br>
>> > > > ><br>
>> > > > > > As for windows support... I've been down that road, trying to<br>
>> > > > > > provide<br>
>> > > > > > it. Windows' feature set doesn't even sort of come close; it<br>
>> > > > > > only<br>
>> > > > > > provides real mime types for a limited set of registered<br>
>> > > > > > extensions,<br>
>> > > > > > and it doesn't provide any of the very useful features such as<br>
>> > > > > > subclassing, etc. In the end, I gave up and am only providing<br>
>> > > > > > xdg-based mime types. I think Qt made an excellent choice in<br>
>> > ><br>
>> > > providing<br>
>> > ><br>
>> > > > > > the xdg database itself. But if you choose against that, good<br>
>> > > > > > luck.<br>
>> > > > > ><br>
>> > > > > > Anyway you can have a look at my python-based mimetype lib.<br>
>> > > > > > Magic<br>
>> > > > > > matches are implemented on line 192 onwards.<br>
>> > > > > ><br>
>> > > > > > <a href="https://github.com/Adys/python-xdg/blob/master/xdg/mime.py" target="_blank">https://github.com/Adys/python-xdg/blob/master/xdg/mime.py</a><br>
>> > > > > ><br>
>> > > > > > J. Leclanche<br>
>> > > > > ><br>
>> > > > > ><br>
>> > > > > > On Fri, Dec 13, 2013 at 7:56 PM, Alexander Kamyshnikov<br>
>> > > > > ><br>
>> > > > > > <<a href="mailto:axill777@gmail.com">axill777@gmail.com</a>> wrote:<br>
>> > > > > > > Yes, i had. But i decided to write my own implementation<br>
>> > > > > > > because:<br>
>> > > > > > > a) my project is forced to use Qt4 only (clients have very old<br>
>> > > > ><br>
>> > > > > versions of<br>
>> > > > ><br>
>> > > > > > > modified Red Hat with XDG_DATA_DIRS undefined);<br>
>> > > > > > > b) Windows support (through reading registry HKCR/.ext keys)<br>
>> > > > > > > is<br>
>> > > > ><br>
>> > > > > required;<br>
>> > > > ><br>
>> > > > > > > c) I'm very curious :)<br>
>> > > > > > ><br>
>> > > > > > > You think i'm should look deeply at the qmimedatabase.cpp<br>
>> > > > > > > however?<br>
>> > > > > > ><br>
>> > > > > > ><br>
>> > > > > > > 2013/12/13 Jerome Leclanche <<a href="mailto:adys.wh@gmail.com">adys.wh@gmail.com</a>><br>
>> > > > > > ><br>
>> > > > > > >> Have you had a look at the Qt 5 mimetype module?<br>
>> > > > > > >><br>
>> > > > > > >> <a href="http://qt-project.org/doc/qt-5.0/qtcore/qmimedatabase.html" target="_blank">http://qt-project.org/doc/qt-5.0/qtcore/qmimedatabase.html</a><br>
>> > > > > > >> J. Leclanche<br>
>> > > > > > >><br>
>> > > > > > >><br>
>> > > > > > >> On Fri, Dec 13, 2013 at 7:35 PM, Alexander Kamyshnikov<br>
>> > > > > > >><br>
>> > > > > > >> <<a href="mailto:axill777@gmail.com">axill777@gmail.com</a>> wrote:<br>
>> > > > > > >> > Hi all!<br>
>> > > > > > >> > I'm developing the implementation of MIME database in<br>
>> > > > > > >> > C++/Qt<br>
>> > > > > > >> > for<br>
>> > > > > > >> > one<br>
>> > > > > > >> > commercial program (requirement managment tool, if one will<br>
>> > > > > > >> > be<br>
>> > > > > > >> > interested).<br>
>> > > > > > >> > So my question is: the format of magic values to compare<br>
>> > > > > > >> > file<br>
>> > > > > > >> > header<br>
>> > > > > > >> > data<br>
>> > > > > > >> > with is not specified exactly in the spec. I mean the<br>
>> > > > ><br>
>> > > > > magic/match/value<br>
>> > > > ><br>
>> > > > > > >> > attribute.<br>
>> > > > > > >> > What exactly mean those magic strings from<br>
>> > > > > > >> > /usr/share/mime/packages/freedesktop.org.xml from my<br>
>> > > > > > >> > Kubuntu?<br>
>> > > > > > >> > 1) "\1\9"<br>
>> > > > > > >> > 2) "\376\067\0\043"<br>
>> > > > > > >> > 3) "\x8AMNG\x0D\x0A\x1A\x0A"<br>
>> > > > > > >> > Second is looks like octal number in C notation, third -<br>
>> > > > ><br>
>> > > > > hexadecimal,<br>
>> > > > ><br>
>> > > > > > >> > but<br>
>> > > > > > >> > about first i'm not sure. It is just "usual" decimal value?<br>
>> > > > > > >> > What format exactly should use magic values?<br>
>> > > > > > >> > Thanks for your help. WBR, Alexander<br>
>> > ><br>
>> > > > > > >> > P.S. Spec i'm using living here:<br>
>> > ><br>
>> > > <a href="http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info" target="_blank">http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info</a><br>
>> > ><br>
>> > > > > > >> > -spec-latest.html#id2661973 P.S. <match> items can be<br>
>> > > > > > >> > nested.<br>
>> > ><br>
>> > > But i<br>
>> > ><br>
>> > > > > > >> > can't find yet the clear way to implement their storage<br>
>> > > > > > >> > programmatically. Some kind of tree, or reverse polish<br>
>> > > > > > >> > notation<br>
>> > > > ><br>
>> > > > > should<br>
>> > > > ><br>
>> > > > > > >> > be used here? nevermind<br>
>> > > > > > >> ><br>
>> > > > > > >> > _______________________________________________<br>
>> > > > > > >> > xdg mailing list<br>
>> > > > > > >> > <a href="mailto:xdg@lists.freedesktop.org">xdg@lists.freedesktop.org</a><br>
>> > > > > > >> > <a href="http://lists.freedesktop.org/mailman/listinfo/xdg" target="_blank">http://lists.freedesktop.org/mailman/listinfo/xdg</a><br>
>> > > > > ><br>
>> > > > > > _______________________________________________<br>
>> > > > > > xdg mailing list<br>
>> > > > > > <a href="mailto:xdg@lists.freedesktop.org">xdg@lists.freedesktop.org</a><br>
>> > > > > > <a href="http://lists.freedesktop.org/mailman/listinfo/xdg" target="_blank">http://lists.freedesktop.org/mailman/listinfo/xdg</a><br>
>> > > > ><br>
>> > > > > --<br>
>> > > > > Kevin Krammer, KDE developer, xdg-utils developer<br>
>> > > > > KDE user support, developer mentoring<br>
>> > > > ><br>
>> > > > > _______________________________________________<br>
>> > > > > xdg mailing list<br>
>> > > > > <a href="mailto:xdg@lists.freedesktop.org">xdg@lists.freedesktop.org</a><br>
>> > > > > <a href="http://lists.freedesktop.org/mailman/listinfo/xdg" target="_blank">http://lists.freedesktop.org/mailman/listinfo/xdg</a><br>
>> > ><br>
>> > > --<br>
>> > > Kevin Krammer, KDE developer, xdg-utils developer<br>
>> > > KDE user support, developer mentoring<br>
>> > ><br>
>> > > _______________________________________________<br>
>> > > xdg mailing list<br>
>> > > <a href="mailto:xdg@lists.freedesktop.org">xdg@lists.freedesktop.org</a><br>
>> > > <a href="http://lists.freedesktop.org/mailman/listinfo/xdg" target="_blank">http://lists.freedesktop.org/mailman/listinfo/xdg</a><br>
>> --<br>
>> Kevin Krammer, KDE developer, xdg-utils developer<br>
>> KDE user support, developer mentoring<br>
>><br>
>> _______________________________________________<br>
>> xdg mailing list<br>
>> <a href="mailto:xdg@lists.freedesktop.org">xdg@lists.freedesktop.org</a><br>
>> <a href="http://lists.freedesktop.org/mailman/listinfo/xdg" target="_blank">http://lists.freedesktop.org/mailman/listinfo/xdg</a><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> xdg mailing list<br>
> <a href="mailto:xdg@lists.freedesktop.org">xdg@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/xdg" target="_blank">http://lists.freedesktop.org/mailman/listinfo/xdg</a><br>
><br>
</div></div></blockquote></div><br></div>