> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]
> On Behalf Of [email protected]
> Sent: Thursday, September 15, 2011 09:34
> To: [email protected]; [email protected]
> Cc: [email protected]
> Subject: Re: [Qt5-feedback] MIME type support in Qt5
>
>
> Mimetype handling should become part of the basic offering. But only
> for
> the common use case of reading them and figuring out themimetype of
> files
> and data.
>
> Cheers,
> Lars
>

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)

________________________________
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