diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
commit | 6630937e63ae5797487b86743a7733c8ae5cc42c (patch) | |
tree | 3d53dacf6430f9099e1fb20835881205de674961 /src/corelib/mimetypes/qmimedatabase.cpp | |
parent | 37ed6dae00640f9cc980ffda05347c12a7eb5d7e (diff) | |
parent | c7af193d2e49e9f10b86262e63d8d13abf72b5cf (diff) |
Merge commit 'dev' into 'wip/cmake-merge'
Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
Diffstat (limited to 'src/corelib/mimetypes/qmimedatabase.cpp')
-rw-r--r-- | src/corelib/mimetypes/qmimedatabase.cpp | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp index a2e99f3816..24a7a35ea5 100644 --- a/src/corelib/mimetypes/qmimedatabase.cpp +++ b/src/corelib/mimetypes/qmimedatabase.cpp @@ -40,8 +40,6 @@ #include <qplatformdefs.h> // always first -#ifndef QT_NO_MIMETYPE - #include "qmimedatabase.h" #include "qmimedatabase_p.h" @@ -424,7 +422,7 @@ bool QMimeDatabasePrivate::inherits(const QString &mime, const QString &parent) toCheck.pop(); const auto parentList = parents(mimeName); for (const QString &par : parentList) - toCheck.push(par); + toCheck.push(resolveAlias(par)); } return false; } @@ -443,25 +441,14 @@ bool QMimeDatabasePrivate::inherits(const QString &mime, const QString &parent) Applications which want to define custom MIME types need to install an XML file into the locations searched for MIME definitions. These locations can be queried with - \code - QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("mime/packages"), - QStandardPaths::LocateDirectory); - \endcode + \snippet code/src_corelib_mimetype_qmimedatabase.cpp 1 On a typical Unix system, this will be /usr/share/mime/packages/, but it is also possible to extend the list of directories by setting the environment variable \c XDG_DATA_DIRS. For instance adding /opt/myapp/share to \c XDG_DATA_DIRS will result in /opt/myapp/share/mime/packages/ being searched for MIME definitions. Here is an example of MIME XML: - \code - <?xml version="1.0" encoding="UTF-8"?> - <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> - <mime-type type="application/vnd.qt.qmakeprofile"> - <comment xml:lang="en">Qt qmake Profile</comment> - <glob pattern="*.pro" weight="50"/> - </mime-type> - </mime-info> - \endcode + \snippet code/src_corelib_mimetype_qmimedatabase.cpp 2 For more details about the syntax of XML MIME definitions, including defining "magic" in order to detect MIME types based on data as well, read the @@ -798,5 +785,3 @@ QList<QMimeType> QMimeDatabase::allMimeTypes() const */ QT_END_NAMESPACE - -#endif // QT_NO_MIMETYPE |