summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeandro Melo <leandro.melo@nokia.com>2010-09-20 11:47:01 +0200
committerLeandro Melo <leandro.melo@nokia.com>2010-09-20 11:48:46 +0200
commit4d0176cd740eb76b4e7e19b17950339ff629d05f (patch)
tree813a8dc5ad9479f66d2f7405ce63535239152666
parent58b800218bd0ae3b179f2b4ecaaa97f39d3268d3 (diff)
downloadqt-creator-4d0176cd740eb76b4e7e19b17950339ff629d05f.tar.gz
Generic highlighter: Show/hide info bar whenever the editor is configured.
-rw-r--r--src/plugins/texteditor/plaintexteditor.cpp2
-rw-r--r--src/plugins/texteditor/plaintexteditor.h3
-rw-r--r--src/plugins/texteditor/plaintexteditorfactory.cpp9
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)