diff --git a/src/plugins/texteditor/generichighlighter/manager.cpp b/src/plugins/texteditor/generichighlighter/manager.cpp index a0c03556ae32cb56607c0e2de778efff732bd905..09a1a49ddaecb4ed39be8a5d24cd85903f9f8862 100644 --- a/src/plugins/texteditor/generichighlighter/manager.cpp +++ b/src/plugins/texteditor/generichighlighter/manager.cpp @@ -410,12 +410,6 @@ bool Manager::isDownloadingDefinitions() const return m_downloadingDefinitions; } -void Manager::showGenericHighlighterOptions() const -{ - Core::ICore::instance()->showOptionsDialog(Constants::TEXT_EDITOR_SETTINGS_CATEGORY, - Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS); -} - void Manager::clear() { m_idByName.clear(); diff --git a/src/plugins/texteditor/generichighlighter/manager.h b/src/plugins/texteditor/generichighlighter/manager.h index a880f056f9f0abfe43f31a7143c4d5c502e5add9..8ed80100b78bac52758feb41c8ca53ff08cdc2e7 100644 --- a/src/plugins/texteditor/generichighlighter/manager.h +++ b/src/plugins/texteditor/generichighlighter/manager.h @@ -82,7 +82,6 @@ public: public slots: void registerMimeTypes(); - void showGenericHighlighterOptions() const; private slots: void registerMimeType(int index) const; diff --git a/src/plugins/texteditor/plaintexteditor.cpp b/src/plugins/texteditor/plaintexteditor.cpp index 81b30c9e3229fe871c6137618d5e13a81b7aca35..5d169aae71dbfecdc14d8cf07c184e6bf9e3d238 100644 --- a/src/plugins/texteditor/plaintexteditor.cpp +++ b/src/plugins/texteditor/plaintexteditor.cpp @@ -62,7 +62,8 @@ PlainTextEditorEditable::PlainTextEditorEditable(PlainTextEditor *editor) PlainTextEditor::PlainTextEditor(QWidget *parent) : BaseTextEditor(parent), - m_isMissingSyntaxDefinition(false) + m_isMissingSyntaxDefinition(false), + m_ignoreMissingSyntaxDefinition(false) { setRevisionsVisible(true); setMarksVisible(true); @@ -225,6 +226,11 @@ bool PlainTextEditor::isMissingSyntaxDefinition() const return m_isMissingSyntaxDefinition; } +bool PlainTextEditor::ignoreMissingSyntaxDefinition() const +{ + return m_ignoreMissingSyntaxDefinition; +} + QString PlainTextEditor::findDefinitionId(const Core::MimeType &mimeType, bool considerParents) const { @@ -246,3 +252,14 @@ void PlainTextEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar ty { m_indenter->indentBlock(doc, block, typedChar, tabSettings()); } + +void PlainTextEditor::acceptMissingSyntaxDefinitionInfo() +{ + Core::ICore::instance()->showOptionsDialog(Constants::TEXT_EDITOR_SETTINGS_CATEGORY, + Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS); +} + +void PlainTextEditor::ignoreMissingSyntaxDefinitionInfo() +{ + m_ignoreMissingSyntaxDefinition = true; +} diff --git a/src/plugins/texteditor/plaintexteditor.h b/src/plugins/texteditor/plaintexteditor.h index 2d8a2309ccc4909b9b9dccd70285e32bfd5c4a2f..7d7917ff9f38ae962ffad71cdfb48f657966b347 100644 --- a/src/plugins/texteditor/plaintexteditor.h +++ b/src/plugins/texteditor/plaintexteditor.h @@ -72,6 +72,7 @@ public: void configure(const Core::MimeType &mimeType); bool isMissingSyntaxDefinition() const; + bool ignoreMissingSyntaxDefinition() const; public slots: virtual void unCommentSelection(); @@ -80,6 +81,8 @@ public slots: private slots: void configure(); + void acceptMissingSyntaxDefinitionInfo(); + void ignoreMissingSyntaxDefinitionInfo(); signals: void configured(Core::IEditor *editor); @@ -92,6 +95,7 @@ private: QString findDefinitionId(const Core::MimeType &mimeType, bool considerParents) const; bool m_isMissingSyntaxDefinition; + bool m_ignoreMissingSyntaxDefinition; Utils::CommentDefinition m_commentDefinition; QScopedPointer<Indenter> m_indenter; }; diff --git a/src/plugins/texteditor/plaintexteditorfactory.cpp b/src/plugins/texteditor/plaintexteditorfactory.cpp index a26f3bd2df95c60909406a01f4a1340984023de1..d45014a61f30d00e5bad708291fabfabcf792b66 100644 --- a/src/plugins/texteditor/plaintexteditorfactory.cpp +++ b/src/plugins/texteditor/plaintexteditorfactory.cpp @@ -94,14 +94,16 @@ void PlainTextEditorFactory::updateEditorInfoBar(Core::IEditor *editor) if (editorEditable) { PlainTextEditor *textEditor = static_cast<PlainTextEditor *>(editorEditable->editor()); if (textEditor->isMissingSyntaxDefinition() && + !textEditor->ignoreMissingSyntaxDefinition() && TextEditorSettings::instance()->highlighterSettings().alertWhenNoDefinition()) { Core::EditorManager::instance()->showEditorInfoBar( Constants::INFO_SYNTAX_DEFINITION, tr("A highlight definition was not found for this file. " "Would you like to try to find one?"), tr("Show highlighter options"), - Manager::instance(), - SLOT(showGenericHighlighterOptions())); + textEditor, + SLOT(acceptMissingSyntaxDefinitionInfo()), + SLOT(ignoreMissingSyntaxDefinitionInfo())); return; } }