diff --git a/src/plugins/designer/formwindoweditor.cpp b/src/plugins/designer/formwindoweditor.cpp index 895ac3aae16d31dfcccbb6cc86b2f6d2e0f83bd8..76d606a9a2373af11dc30fdb7824cd6f3117f2a1 100644 --- a/src/plugins/designer/formwindoweditor.cpp +++ b/src/plugins/designer/formwindoweditor.cpp @@ -39,6 +39,7 @@ #include <coreplugin/icore.h> #include <coreplugin/coreconstants.h> #include <coreplugin/uniqueidmanager.h> +#include <coreplugin/mimedatabase.h> #include <texteditor/basetextdocument.h> #include <texteditor/plaintexteditor.h> @@ -82,6 +83,7 @@ FormWindowEditor::FormWindowEditor(Internal::DesignerXmlEditor *editor, // Force update of open editors model. connect(&(d->m_file), SIGNAL(saved()), this, SIGNAL(changed())); connect(&(d->m_file), SIGNAL(changed()), this, SIGNAL(changed())); + connect(this, SIGNAL(changed()), this, SLOT(configureXmlEditor())); } FormWindowEditor::~FormWindowEditor() @@ -164,6 +166,15 @@ void FormWindowEditor::syncXmlEditor() syncXmlEditor(contents()); } +void FormWindowEditor::configureXmlEditor() const +{ + TextEditor::PlainTextEditor *editor = + qobject_cast<TextEditor::PlainTextEditor *>(d->m_textEditable.editor()); + if (editor) + editor->configure(Core::ICore::instance()->mimeDatabase()->findByFile( + d->m_file.fileName())); +} + void FormWindowEditor::syncXmlEditor(const QString &contents) { d->m_textEditable.editor()->setPlainText(contents); diff --git a/src/plugins/designer/formwindoweditor.h b/src/plugins/designer/formwindoweditor.h index d85845e7d2d59bd9239a5b2db3d3df41c966db09..d432189d29434ec5268333504b95b3e30d4069f3 100644 --- a/src/plugins/designer/formwindoweditor.h +++ b/src/plugins/designer/formwindoweditor.h @@ -102,6 +102,7 @@ public: public slots: void syncXmlEditor(); + void configureXmlEditor() const; private slots: void slotOpen(const QString &fileName); diff --git a/src/plugins/texteditor/TextEditor.mimetypes.xml b/src/plugins/texteditor/TextEditor.mimetypes.xml index 913b9fe0ebaf6e18b99c60e040059a9d607e7635..c2b7765b31695c8d876bca9e233ed6ea705b1d4a 100644 --- a/src/plugins/texteditor/TextEditor.mimetypes.xml +++ b/src/plugins/texteditor/TextEditor.mimetypes.xml @@ -6,6 +6,7 @@ <glob pattern="*.txt"/> </mime-type> <mime-type type="application/xml"> + <alias type="text/xml"/> <sub-class-of type="text/plain"/> <comment>XML document</comment> <glob pattern="*.xml"/>