Commit ceaa92ec authored by dt's avatar dt
Browse files

Set correct mime type for C++ files.

parent 1653e287
......@@ -67,6 +67,7 @@
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/mimedatabase.h>
#include <utils/uncommentselection.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
......@@ -1751,6 +1752,13 @@ const char *CPPEditorEditable::kind() const
return CppEditor::Constants::CPPEDITOR_KIND;
}
bool CPPEditorEditable::open(const QString & fileName)
{
bool b = TextEditor::BaseTextEditorEditable::open(fileName);
editor()->setMimeType(Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(fileName)).type());
return b;
}
void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs)
{
TextEditor::BaseTextEditor::setFontSettings(fs);
......
......@@ -164,6 +164,7 @@ public:
const char *kind() const;
bool isTemporary() const { return false; }
virtual bool open(const QString & fileName);
private:
QList<int> m_context;
......
......@@ -97,7 +97,6 @@ Core::IEditor *CppEditorFactory::createEditor(QWidget *parent)
{
CPPEditor *editor = new CPPEditor(parent);
editor->setRevisionsVisible(true);
editor->setMimeType(CppEditor::Constants::CPP_SOURCE_MIMETYPE);
m_owner->initializeEditor(editor);
return editor->editableInterface();
}
......
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