From 4d0176cd740eb76b4e7e19b17950339ff629d05f Mon Sep 17 00:00:00 2001 From: Leandro Melo Date: Mon, 20 Sep 2010 11:47:01 +0200 Subject: Generic highlighter: Show/hide info bar whenever the editor is configured. --- src/plugins/texteditor/plaintexteditor.cpp | 2 ++ src/plugins/texteditor/plaintexteditor.h | 3 +++ src/plugins/texteditor/plaintexteditorfactory.cpp | 9 ++++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/plugins/texteditor/plaintexteditor.cpp b/src/plugins/texteditor/plaintexteditor.cpp index 56be20f9f5..67b99faabf 100644 --- a/src/plugins/texteditor/plaintexteditor.cpp +++ b/src/plugins/texteditor/plaintexteditor.cpp @@ -214,6 +214,8 @@ void PlainTextEditor::configure(const Core::MimeType &mimeType) // because Kate recommends to configure indentation through another feature. Maybe we should // provide something similar in Creator? For now, only normal indentation is supported. m_indenter.reset(new NormalIndenter); + + emit configured(editableInterface()); } bool PlainTextEditor::isMissingSyntaxDefinition() const diff --git a/src/plugins/texteditor/plaintexteditor.h b/src/plugins/texteditor/plaintexteditor.h index 55fb62ca03..2d8a2309cc 100644 --- a/src/plugins/texteditor/plaintexteditor.h +++ b/src/plugins/texteditor/plaintexteditor.h @@ -81,6 +81,9 @@ public slots: private slots: void configure(); +signals: + void configured(Core::IEditor *editor); + protected: virtual BaseTextEditorEditable *createEditableInterface() { return new PlainTextEditorEditable(this); } virtual void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar); diff --git a/src/plugins/texteditor/plaintexteditorfactory.cpp b/src/plugins/texteditor/plaintexteditorfactory.cpp index e060df1873..a26f3bd2df 100644 --- a/src/plugins/texteditor/plaintexteditorfactory.cpp +++ b/src/plugins/texteditor/plaintexteditorfactory.cpp @@ -83,6 +83,8 @@ Core::IEditor *PlainTextEditorFactory::createEditor(QWidget *parent) { PlainTextEditor *rc = new PlainTextEditor(parent); TextEditorPlugin::instance()->initializeEditor(rc); + connect(rc, SIGNAL(configured(Core::IEditor*)), + this, SLOT(updateEditorInfoBar(Core::IEditor*))); return rc->editableInterface(); } @@ -95,14 +97,15 @@ void PlainTextEditorFactory::updateEditorInfoBar(Core::IEditor *editor) 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("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())); + return; } - } else { - Core::EditorManager::instance()->hideEditorInfoBar(Constants::INFO_SYNTAX_DEFINITION); } + Core::EditorManager::instance()->hideEditorInfoBar(Constants::INFO_SYNTAX_DEFINITION); } void PlainTextEditorFactory::addMimeType(const QString &type) -- cgit v1.2.1