Commit 8d48b3a0 authored by Leandro Melo's avatar Leandro Melo
Browse files

Generic highlighter: Don't nag about the missing definition if info bar was once closed.

Reviewed-by: con
parent f5877071
......@@ -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();
......
......@@ -82,7 +82,6 @@ public:
public slots:
void registerMimeTypes();
void showGenericHighlighterOptions() const;
private slots:
void registerMimeType(int index) const;
......
......@@ -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;
}
......@@ -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;
};
......
......@@ -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;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment