Commit c190b5da authored by Eike Ziller's avatar Eike Ziller

Fix opening of xml files.

They were either opened as text/plain, or, if they were empty, as
application/vnd.rim.qnx.bar_descriptor types.
This hotfix makes the mime database consider lower levels for matching
by extension, if no match with maxweight was found, and reduces the
weight of the application/xml type's ".xml" extension, so the
bar_descriptor type can override this based on its content matcher.

We should do a real fix in post-2.7.

Task-number: QTCREATORBUG-8920
Change-Id: I3d6f4455ba23485d0229967eaa3eea6abe19746f
Reviewed-by: default avatarFriedemann Kleint <>
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <>
Reviewed-by: default avatarTobias Nätterlund <>
parent ceb314b3
......@@ -1493,7 +1493,7 @@ MimeType MimeDatabasePrivate::findByFile(const QFileInfo &f, unsigned *priorityP
// Pass 1) Try to match on suffix
const TypeMimeTypeMap::const_iterator cend = m_typeMimeTypeMap.constEnd();
for (int level = m_maxLevel; level >= 0 && candidate.isNull(); level--) {
for (int level = m_maxLevel; level >= 0; level--) {
for (TypeMimeTypeMap::const_iterator it = m_typeMimeTypeMap.constBegin(); it != cend; ++it) {
if (it.value().level == level) {
const unsigned suffixPriority = it.value().type.matchesFileBySuffix(context);
......@@ -9,7 +9,7 @@
<alias type="text/xml"/>
<sub-class-of type="text/plain"/>
<comment>XML document</comment>
<glob pattern="*.xml"/>
<glob pattern="*.xml" weight="50"/><!-- reduce weight to allow application/vnd.rim.qnx.bar_descriptor to override by content -->
<glob pattern="*.xsl"/>
<glob pattern="*.xslt"/>
<glob pattern="*.xbl"/>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment