<div dir="ltr">Oh thanks, Kevin! This library is exactly i need for.<div>However, yet-another-implementation-of MIME loader might be useful for somebody, or i'm just wasted my time? :)</div><div>This was funny and interesting quest.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/16 Kevin Krammer <span dir="ltr"><<a href="mailto:krammer@kde.org" target="_blank">krammer@kde.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">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 in<br>
> Qt4?<br>
> I.e. i can just include this code in mine.<br>
<br>
</div>Not the Qt5 based code obviously. But Jerome said that there is a Qt4 port 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>
<div class="HOEnZb"><div class="h5"><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 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, isn't<br>
> ><br>
> > it?<br>
> ><br>
> > > I need "pure" Qt code - this is our software client requirement :/ So<br>
> > > i'm<br>
> > > wrote CMimeDatabase class. And just want to make it fully compliant with<br>
> > > freedesktop standart.<br>
> ><br>
> > Just wanted to point out that the Qt5 implementation was contributed by<br>
> > KDE<br>
> > developers, so additional to the Qt4 port of that code there is also "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>
> > <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 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 only<br>
> > > > > provides real mime types for a limited set of registered 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 luck.<br>
> > > > ><br>
> > > > > Anyway you can have a look at my python-based mimetype lib. 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 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) is<br>
> > > ><br>
> > > > required;<br>
> > > ><br>
> > > > > > c) I'm very curious :)<br>
> > > > > ><br>
> > > > > > You think i'm should look deeply at the qmimedatabase.cpp 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 C++/Qt<br>
> > > > > >> > for<br>
> > > > > >> > one<br>
> > > > > >> > commercial program (requirement managment tool, if one will be<br>
> > > > > >> > interested).<br>
> > > > > >> > So my question is: the format of magic values to compare 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 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>
> > <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 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 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>
</div></div><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></blockquote></div><br></div>