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" ],
|
"featuresRequired": [ "Plugin.QmlJSEditor", "QtSupport.Wizards.FeatureQtQuick.UiFiles" ],
|
||||||
|
|
||||||
"options" : [
|
"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')}" }
|
{ "key": "UiFile", "value": "%{FormClass}.%{JS: Util.preferredSuffix('application/x-qt.ui+qml')}" }
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
"data":
|
"data":
|
||||||
{
|
{
|
||||||
"source": "file.qml",
|
"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
|
"openInEditor": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
"data":
|
"data":
|
||||||
{
|
{
|
||||||
"source": "file.qml",
|
"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
|
"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 CPP_HEADER_MIMETYPE[] = "text/x-c++hdr";
|
||||||
const char LINGUIST_MIMETYPE[] = "text/vnd.trolltech.linguist";
|
const char LINGUIST_MIMETYPE[] = "text/vnd.trolltech.linguist";
|
||||||
const char FORM_MIMETYPE[] = "application/x-designer";
|
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";
|
const char RESOURCE_MIMETYPE[] = "application/vnd.qt.xml.resource";
|
||||||
|
|
||||||
// Settings page
|
// Settings page
|
||||||
|
@@ -1,32 +1,33 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
||||||
<mime-type type="application/x-qml">
|
<mime-type type="text/x-qml">
|
||||||
<alias type="text/x-qml"/>
|
<alias type="application/x-qml"/>
|
||||||
|
<!-- sub class is missing in the freedesktop.org definition -->
|
||||||
<sub-class-of type="text/plain"/>
|
<sub-class-of type="text/plain"/>
|
||||||
<comment>QML file</comment>
|
<comment>QML file</comment>
|
||||||
<glob pattern="*.qml"/>
|
<glob pattern="*.qml"/>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
<mime-type type="application/x-qt.qbs+qml">
|
<mime-type type="application/x-qt.qbs+qml">
|
||||||
<alias type="text/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>
|
<comment>Qt Build Suite file</comment>
|
||||||
<glob pattern="*.qbs"/>
|
<glob pattern="*.qbs"/>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
<mime-type type="application/x-qt.ui+qml">
|
<mime-type type="application/x-qt.ui+qml">
|
||||||
<alias type="text/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>
|
<comment>QtQuick Designer ui file</comment>
|
||||||
<glob pattern="*.ui.qml"/>
|
<glob pattern="*.ui.qml"/>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
<mime-type type="application/x-qmlproject">
|
<mime-type type="application/x-qmlproject">
|
||||||
<alias type="text/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>
|
<comment>Qt Creator Qt UI project file</comment>
|
||||||
<glob pattern="*.qmlproject"/>
|
<glob pattern="*.qmlproject"/>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
<mime-type type="application/x-qt.meta-info+qml">
|
<mime-type type="application/x-qt.meta-info+qml">
|
||||||
<alias type="text/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>
|
<comment>QML file</comment>
|
||||||
<glob pattern="*.qmltypes"/>
|
<glob pattern="*.qmltypes"/>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
namespace QmlJSTools {
|
namespace QmlJSTools {
|
||||||
namespace Constants {
|
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 QBS_MIMETYPE[] = "application/x-qt.qbs+qml";
|
||||||
const char QMLPROJECT_MIMETYPE[] = "application/x-qmlproject";
|
const char QMLPROJECT_MIMETYPE[] = "application/x-qmlproject";
|
||||||
const char QMLTYPES_MIMETYPE[] = "application/x-qt.meta-info+qml";
|
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-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
|
||||||
<mime-type type="application/x-qmlproject">
|
<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>
|
<comment>QML Project file</comment>
|
||||||
<glob pattern="*.qmlproject"/>
|
<glob pattern="*.qmlproject"/>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
|
@@ -269,7 +269,7 @@ void QmlProjectRunConfiguration::updateEnabled()
|
|||||||
IDocument *document = EditorManager::currentDocument();
|
IDocument *document = EditorManager::currentDocument();
|
||||||
if (document) {
|
if (document) {
|
||||||
m_currentFileFilename = document->filePath().toString();
|
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;
|
qmlFileFound = true;
|
||||||
}
|
}
|
||||||
if (!document
|
if (!document
|
||||||
@@ -280,7 +280,7 @@ void QmlProjectRunConfiguration::updateEnabled()
|
|||||||
const QFileInfo fi(filename);
|
const QFileInfo fi(filename);
|
||||||
|
|
||||||
if (!filename.isEmpty() && fi.baseName()[0].isLower()
|
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;
|
m_currentFileFilename = filename;
|
||||||
qmlFileFound = true;
|
qmlFileFound = true;
|
||||||
|
Reference in New Issue
Block a user