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

Reply via email to