Skip to content
Snippets Groups Projects
Commit ceaa92ec authored by dt's avatar dt
Browse files

Set correct mime type for C++ files.

parent 1653e287
No related branches found
No related tags found
No related merge requests found
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/editormanager/ieditor.h> #include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/mimedatabase.h>
#include <utils/uncommentselection.h> #include <utils/uncommentselection.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
...@@ -1751,6 +1752,13 @@ const char *CPPEditorEditable::kind() const ...@@ -1751,6 +1752,13 @@ const char *CPPEditorEditable::kind() const
return CppEditor::Constants::CPPEDITOR_KIND; 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) void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs)
{ {
TextEditor::BaseTextEditor::setFontSettings(fs); TextEditor::BaseTextEditor::setFontSettings(fs);
......
...@@ -164,6 +164,7 @@ public: ...@@ -164,6 +164,7 @@ public:
const char *kind() const; const char *kind() const;
bool isTemporary() const { return false; } bool isTemporary() const { return false; }
virtual bool open(const QString & fileName);
private: private:
QList<int> m_context; QList<int> m_context;
......
...@@ -97,7 +97,6 @@ Core::IEditor *CppEditorFactory::createEditor(QWidget *parent) ...@@ -97,7 +97,6 @@ Core::IEditor *CppEditorFactory::createEditor(QWidget *parent)
{ {
CPPEditor *editor = new CPPEditor(parent); CPPEditor *editor = new CPPEditor(parent);
editor->setRevisionsVisible(true); editor->setRevisionsVisible(true);
editor->setMimeType(CppEditor::Constants::CPP_SOURCE_MIMETYPE);
m_owner->initializeEditor(editor); m_owner->initializeEditor(editor);
return editor->editableInterface(); return editor->editableInterface();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment