diff --git a/src/plugins/texteditor/generichighlighter/manager.cpp b/src/plugins/texteditor/generichighlighter/manager.cpp index 571fa4065e6..1ab8ced5309 100644 --- a/src/plugins/texteditor/generichighlighter/manager.cpp +++ b/src/plugins/texteditor/generichighlighter/manager.cpp @@ -236,6 +236,8 @@ void Manager::registerMimeTypesFinished() if (m_queuedMimeTypeRegistrations > 0) { --m_queuedMimeTypeRegistrations; registerMimeTypes(); + } else { + emit mimeTypesRegistered(); } } diff --git a/src/plugins/texteditor/generichighlighter/manager.h b/src/plugins/texteditor/generichighlighter/manager.h index eac24665ed2..7729efcad7c 100644 --- a/src/plugins/texteditor/generichighlighter/manager.h +++ b/src/plugins/texteditor/generichighlighter/manager.h @@ -88,6 +88,9 @@ private slots: void downloadAvailableDefinitionsListFinished(); void downloadDefinitionsFinished(); +signals: + void mimeTypesRegistered(); + private: Manager(); Q_DISABLE_COPY(Manager) diff --git a/src/plugins/texteditor/plaintexteditor.cpp b/src/plugins/texteditor/plaintexteditor.cpp index 58441bf02b6..f4092e34006 100644 --- a/src/plugins/texteditor/plaintexteditor.cpp +++ b/src/plugins/texteditor/plaintexteditor.cpp @@ -74,7 +74,8 @@ PlainTextEditor::PlainTextEditor(QWidget *parent) m_commentDefinition.clearCommentStyles(); - connect(file(), SIGNAL(changed()), this, SLOT(fileChanged())); + connect(file(), SIGNAL(changed()), this, SLOT(configure())); + connect(Manager::instance(), SIGNAL(mimeTypesRegistered()), this, SLOT(configure())); } PlainTextEditor::~PlainTextEditor() @@ -161,7 +162,7 @@ void PlainTextEditor::setTabSettings(const TextEditor::TabSettings &ts) } } -void PlainTextEditor::fileChanged() +void PlainTextEditor::configure() { configure(Core::ICore::instance()->mimeDatabase()->findByFile(file()->fileName())); } diff --git a/src/plugins/texteditor/plaintexteditor.h b/src/plugins/texteditor/plaintexteditor.h index fb9436907e5..55fb62ca035 100644 --- a/src/plugins/texteditor/plaintexteditor.h +++ b/src/plugins/texteditor/plaintexteditor.h @@ -79,7 +79,7 @@ public slots: virtual void setTabSettings(const TextEditor::TabSettings &); private slots: - void fileChanged(); + void configure(); protected: virtual BaseTextEditorEditable *createEditableInterface() { return new PlainTextEditorEditable(this); }