From 8a83c1bb5504d34e07ce7cce36c10b6d5a9876bd Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 19 Nov 2012 17:14:02 +0100 Subject: Add QMimeType::aliases(). Requested by Allan Sandfeld Jensen for QWebkit, which needs to register upfront all the mimetypes that a given plugin can handle. Change-Id: I64b8d39c7988adfc7db4ed8bfdc73acd16e999da Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Thiago Macieira --- src/corelib/mimetypes/qmimetype.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/corelib/mimetypes/qmimetype.cpp') diff --git a/src/corelib/mimetypes/qmimetype.cpp b/src/corelib/mimetypes/qmimetype.cpp index 9be613924e..80510bc914 100644 --- a/src/corelib/mimetypes/qmimetype.cpp +++ b/src/corelib/mimetypes/qmimetype.cpp @@ -349,6 +349,22 @@ QStringList QMimeType::allAncestors() const return allParents; } +/*! + Return the list of aliases of this mimetype. + + For instance, for text/csv, the returned list would be: + text/x-csv, text/x-comma-separated-values. + + Note that all QMimeType instances refer to proper mimetypes, + never to aliases directly. + + The order of the aliases in the list is undefined. +*/ +QStringList QMimeType::aliases() const +{ + return QMimeDatabasePrivate::instance()->provider()->listAliases(d->name); +} + /*! Returns the known suffixes for the MIME type. No leading dot is included, so for instance this would return "jpg", "jpeg" for image/jpeg. -- cgit v1.2.3