From c190b5dad9473bc49c3c870c626f2037eae4281f Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 11 Mar 2013 16:27:36 +0100 Subject: [PATCH] Fix opening of xml files. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Friedemann Kleint Reviewed-by: Orgad Shaneh Reviewed-by: Tobias Nätterlund --- src/plugins/coreplugin/mimedatabase.cpp | 2 +- src/plugins/texteditor/TextEditor.mimetypes.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/coreplugin/mimedatabase.cpp b/src/plugins/coreplugin/mimedatabase.cpp index ccbe55a95de..a16cbc8805a 100644 --- a/src/plugins/coreplugin/mimedatabase.cpp +++ b/src/plugins/coreplugin/mimedatabase.cpp @@ -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); diff --git a/src/plugins/texteditor/TextEditor.mimetypes.xml b/src/plugins/texteditor/TextEditor.mimetypes.xml index e8e8aaa11c3..2431241c2e9 100644 --- a/src/plugins/texteditor/TextEditor.mimetypes.xml +++ b/src/plugins/texteditor/TextEditor.mimetypes.xml @@ -9,7 +9,7 @@ XML document - +