Commit 7968853f authored by Leandro Melo's avatar Leandro Melo
Browse files

Snippets: Check for content change on apply

Cannot rely on the focus out event (on Mac) in the
situation where a snippet is added/edited and the
dialog is immediately confirmed.

Reviewed-by: con
Task-number: QTCREATORBUG-3464
parent 30b03650
......@@ -73,8 +73,10 @@ void SnippetEditor::setSyntaxHighlighter(TextEditor::SyntaxHighlighter *highligh
void SnippetEditor::focusOutEvent(QFocusEvent *event)
{
if (event->reason() != Qt::ActiveWindowFocusReason && document()->isModified())
if (event->reason() != Qt::ActiveWindowFocusReason && document()->isModified()) {
document()->setModified(false);
emit snippetContentChanged();
}
}
BaseTextEditorEditable *SnippetEditor::createEditableInterface()
......
......@@ -387,6 +387,9 @@ void SnippetsSettingsPagePrivate::apply()
if (settingsChanged())
writeSettings();
if (currentEditor()->document()->isModified())
setSnippetContent();
if (m_snippetsCollectionChanged) {
SnippetsCollection::instance()->synchronize();
m_snippetsCollectionChanged = false;
......
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