forked from qt-creator/qt-creator
Mime types: Fix that some QML files were opened as C++
We registered a mime type "application/x-qml" conflicting with "text/x- qml" from freedesktop.org.xml. The magic matcher of the C++ mime types might kick in, in that case. Task-number: QTCREATORBUG-13994 Change-Id: I5900c233b42681d7b7d3af185d6ff3e1c4166e59 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
"featuresRequired": [ "Plugin.QmlJSEditor", "QtSupport.Wizards.FeatureQtQuick.UiFiles" ],
|
||||
|
||||
"options" : [
|
||||
{ "key": "QmlFile", "value": "%{Class}.%{JS: Util.preferredSuffix('application/x-qml')}" },
|
||||
{ "key": "QmlFile", "value": "%{Class}.%{JS: Util.preferredSuffix('text/x-qml')}" },
|
||||
{ "key": "UiFile", "value": "%{FormClass}.%{JS: Util.preferredSuffix('application/x-qt.ui+qml')}" }
|
||||
],
|
||||
|
||||
|
@@ -29,7 +29,7 @@
|
||||
"data":
|
||||
{
|
||||
"source": "file.qml",
|
||||
"target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('application/x-qml')}')}",
|
||||
"target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-qml')}')}",
|
||||
"openInEditor": true
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@
|
||||
"data":
|
||||
{
|
||||
"source": "file.qml",
|
||||
"target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('application/x-qml')}')}",
|
||||
"target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-qml')}')}",
|
||||
"openInEditor": true
|
||||
}
|
||||
}
|
||||
|
@@ -173,7 +173,7 @@ const char CPP_SOURCE_MIMETYPE[] = "text/x-c++src";
|
||||
const char CPP_HEADER_MIMETYPE[] = "text/x-c++hdr";
|
||||
const char LINGUIST_MIMETYPE[] = "text/vnd.trolltech.linguist";
|
||||
const char FORM_MIMETYPE[] = "application/x-designer";
|
||||
const char QML_MIMETYPE[] = "application/x-qml"; // separate def also in qmljstoolsconstants.h
|
||||
const char QML_MIMETYPE[] = "text/x-qml"; // separate def also in qmljstoolsconstants.h
|
||||
const char RESOURCE_MIMETYPE[] = "application/vnd.qt.xml.resource";
|
||||
|
||||
// Settings page
|
||||
|
@@ -1,32 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
||||
<mime-type type="application/x-qml">
|
||||
<alias type="text/x-qml"/>
|
||||
<mime-type type="text/x-qml">
|
||||
<alias type="application/x-qml"/>
|
||||
<!-- sub class is missing in the freedesktop.org definition -->
|
||||
<sub-class-of type="text/plain"/>
|
||||
<comment>QML file</comment>
|
||||
<glob pattern="*.qml"/>
|
||||
</mime-type>
|
||||
<mime-type type="application/x-qt.qbs+qml">
|
||||
<alias type="text/x-qt.qbs+qml"/>
|
||||
<sub-class-of type="application/x-qml"/>
|
||||
<sub-class-of type="text/x-qml"/>
|
||||
<comment>Qt Build Suite file</comment>
|
||||
<glob pattern="*.qbs"/>
|
||||
</mime-type>
|
||||
<mime-type type="application/x-qt.ui+qml">
|
||||
<alias type="text/x-qt.ui+qml"/>
|
||||
<sub-class-of type="application/x-qml"/>
|
||||
<sub-class-of type="text/x-qml"/>
|
||||
<comment>QtQuick Designer ui file</comment>
|
||||
<glob pattern="*.ui.qml"/>
|
||||
</mime-type>
|
||||
<mime-type type="application/x-qmlproject">
|
||||
<alias type="text/x-qmlproject"/>
|
||||
<sub-class-of type="application/x-qml"/>
|
||||
<sub-class-of type="text/x-qml"/>
|
||||
<comment>Qt Creator Qt UI project file</comment>
|
||||
<glob pattern="*.qmlproject"/>
|
||||
</mime-type>
|
||||
<mime-type type="application/x-qt.meta-info+qml">
|
||||
<alias type="text/x-qt.meta-info+qml"/>
|
||||
<sub-class-of type="application/x-qml"/>
|
||||
<sub-class-of type="text/x-qml"/>
|
||||
<comment>QML file</comment>
|
||||
<glob pattern="*.qmltypes"/>
|
||||
</mime-type>
|
||||
|
@@ -36,7 +36,7 @@
|
||||
namespace QmlJSTools {
|
||||
namespace Constants {
|
||||
|
||||
const char QML_MIMETYPE[] = "application/x-qml"; // separate def also in projectexplorerconstants.h
|
||||
const char QML_MIMETYPE[] = "text/x-qml"; // separate def also in projectexplorerconstants.h
|
||||
const char QBS_MIMETYPE[] = "application/x-qt.qbs+qml";
|
||||
const char QMLPROJECT_MIMETYPE[] = "application/x-qmlproject";
|
||||
const char QMLTYPES_MIMETYPE[] = "application/x-qt.meta-info+qml";
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
||||
<mime-type type="application/x-qmlproject">
|
||||
<sub-class-of type="application/x-qml"/>
|
||||
<sub-class-of type="text/x-qml"/>
|
||||
<comment>QML Project file</comment>
|
||||
<glob pattern="*.qmlproject"/>
|
||||
</mime-type>
|
||||
|
@@ -269,7 +269,7 @@ void QmlProjectRunConfiguration::updateEnabled()
|
||||
IDocument *document = EditorManager::currentDocument();
|
||||
if (document) {
|
||||
m_currentFileFilename = document->filePath().toString();
|
||||
if (mdb.mimeTypeForFile(mainScript()).matchesName(QLatin1String("application/x-qml")))
|
||||
if (mdb.mimeTypeForFile(mainScript()).matchesName(QLatin1String("text/x-qml")))
|
||||
qmlFileFound = true;
|
||||
}
|
||||
if (!document
|
||||
@@ -280,7 +280,7 @@ void QmlProjectRunConfiguration::updateEnabled()
|
||||
const QFileInfo fi(filename);
|
||||
|
||||
if (!filename.isEmpty() && fi.baseName()[0].isLower()
|
||||
&& mdb.mimeTypeForFile(fi).matchesName(QLatin1String("application/x-qml")))
|
||||
&& mdb.mimeTypeForFile(fi).matchesName(QLatin1String("text/x-qml")))
|
||||
{
|
||||
m_currentFileFilename = filename;
|
||||
qmlFileFound = true;
|
||||
|
Reference in New Issue
Block a user