How to use this class? it's really simple.
Example 1: Get Information about specified MIME Type
QFreeDesktopMime mime;
QString description = mime.description("application/epub+zip");
QString expandedAcronym = mime.expandedAcronym("text/x-xslfo");
QString acronym = mime.acronym("text/x-xslfo");
Example 2: Extract MIME Type and information from File Name (Results based on File Extension)
QFreeDesktopMime mime;
QString mimeType = mime.fromFileName("test.png");
QString mimeDescription = mime.description();
Example 3: Extract MIME Type and information from File (Data)
QFreeDesktopMime mime;
QString mimeType = mime.fromFile("/home/oz/myUnknownFile");
QString mimeDescription = mime.description();
If fromFile() method doesn't find the matching data it tries to use fromFileName() method to get the MIME Type. In all cases if file's MIME Type wasn't found it returns an empty QString.
No comments:
Post a Comment