OK, the qmime module already has a suitable API.
Is a "best match" API that returns the QMimeType with the best match score 
useful, or should it be left to applications?

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]
> On Behalf Of ???? ??????????
> Sent: Thursday, September 15, 2011 15:03
> To: [email protected]
> Subject: Re: [Qt5-feedback] MIME type support in Qt5
>
> Do not guess what should happen - it is all mentioned in shared mime
> info spec and mostly implemented in qmime.
> I pass QByteArray to method findByData().
> API is almost same as in QtCreator mime (i didn't changed it lot when i
> refactored code)
>
> > 15.09.2011, в 17:55, <[email protected]> написал(а):
> >
> > So does this module need an API for determining mime type from data?
> > e.g. something like:
> >
> > static QMimeType determineMimeType(QIODevice* device, QString
> fileNameHint);
> > static QMimeType determineMimeType(QFile file); //convenience wrapper
> for common case
> >
> > Given a known filename, the type can be guessed if the extension is
> unambiguous (e.g. "picture.jpg" is probably "image/jpeg")
> > Given an unknown filename or ambiguous extension, the type can be
> guessed by reading & parsing the file header (e.g. a binary file with
> "JFIF" in the right place in the first 16 bytes is probably
> "image/jpeg")
> >
> > There are some edge cases e.g. a file called "image.jpg" that
> actually contains data of the "image/tiff" type.
> > Also, the IO device may be unavailable (e.g. you have the filename
> but no permission to open the file)
> > Or the file name may be unknown (e.g. you don't have a file, just a
> data stream from the network)
> >
> _______________________________________________
> Qt5-feedback mailing list
> [email protected]
> http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback

________________________________
This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise private information. If you have received it in 
error, please notify the sender immediately and delete the original. Any other 
use of the email by you is prohibited.
_______________________________________________
Qt5-feedback mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback

Reply via email to