diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp index 1d060401433a6fcacb4e51106ca0a49f1b6dca96..3998c3d2e3a523883682d318cc6f9e2d80f0440f 100644 --- a/src/plugins/bineditor/bineditorplugin.cpp +++ b/src/plugins/bineditor/bineditorplugin.cpp @@ -302,9 +302,9 @@ public: emit changed(); } else { emit aboutToReload(); - if (!open(errorString, m_fileName)) - return false; - emit reloaded(); + const bool success = open(errorString, m_fileName); + emit reloadFinished(success); + return success; } return true; } diff --git a/src/plugins/coreplugin/idocument.h b/src/plugins/coreplugin/idocument.h index 9fb5e5ab6edb7e8ca67fcb4a2e7b82e3e0395a95..c543366316fc8f985ae53202330075df5535f7fc 100644 --- a/src/plugins/coreplugin/idocument.h +++ b/src/plugins/coreplugin/idocument.h @@ -112,7 +112,8 @@ signals: void changed(); void aboutToReload(); - void reloaded(); + void reloadFinished(bool success); + void fileNameChanged(const QString &oldName, const QString &newName); private: diff --git a/src/plugins/designer/formwindowfile.cpp b/src/plugins/designer/formwindowfile.cpp index fcb394ebf4e56f636921812dc56bc43a47bdd7f4..1aa35fc472108aad2dd63f1e42d9a1fdebbb741f 100644 --- a/src/plugins/designer/formwindowfile.cpp +++ b/src/plugins/designer/formwindowfile.cpp @@ -145,9 +145,9 @@ bool FormWindowFile::reload(QString *errorString, ReloadFlag flag, ChangeType ty } else { emit aboutToReload(); emit reload(errorString, m_fileName); - if (!errorString->isEmpty()) - return false; - emit reloaded(); + const bool success = errorString->isEmpty(); + emit reloadFinished(success); + return success; } return true; } diff --git a/src/plugins/resourceeditor/resourceeditorw.cpp b/src/plugins/resourceeditor/resourceeditorw.cpp index bbbf669923a84314fe3aedb5911bd3cbe6fb1914..1b49ad1e3ca3b08a30facdd783fc7a4202372a97 100644 --- a/src/plugins/resourceeditor/resourceeditorw.cpp +++ b/src/plugins/resourceeditor/resourceeditorw.cpp @@ -259,9 +259,9 @@ bool ResourceEditorDocument::reload(QString *errorString, ReloadFlag flag, Chang } else { emit aboutToReload(); QString fn = m_parent->m_resourceEditor->fileName(); - if (!m_parent->open(errorString, fn, fn)) - return false; - emit reloaded(); + const bool success = m_parent->open(errorString, fn, fn); + emit reloadFinished(success); + return success; } return true; } diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp index f21f0185a1b2537361848908789784f116e47cf7..64fb4359302aa571e5509e6cfe6206d630746169 100644 --- a/src/plugins/texteditor/basetextdocument.cpp +++ b/src/plugins/texteditor/basetextdocument.cpp @@ -415,8 +415,7 @@ bool BaseTextDocument::reload(QString *errorString) if (documentLayout) documentLayout->documentReloaded(marks); // readds text marks - if (success) - emit reloaded(); + emit reloadFinished(success); return success; } diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index a9b9df101f08ddc42b39591a823fd7c223f64a81..7fdb2c9534e2fdae13d530bff365b1a4cedf21ca 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -2204,8 +2204,11 @@ void BaseTextEditorWidget::documentAboutToBeReloaded() d->m_refactorOverlay->clear(); } -void BaseTextEditorWidget::documentReloaded() +void BaseTextEditorWidget::documentReloadFinished(bool success) { + if (!success) + return; + // restore cursor position restoreState(d->m_tempState); updateCannotDecodeInfo(); @@ -2584,7 +2587,7 @@ void BaseTextEditorWidgetPrivate::setupDocumentSignals(const QSharedPointer<Base QObject::connect(document.data(), SIGNAL(changed()), q, SIGNAL(changed())); QObject::connect(document.data(), SIGNAL(titleChanged(QString)), q, SLOT(setDisplayName(QString))); QObject::connect(document.data(), SIGNAL(aboutToReload()), q, SLOT(documentAboutToBeReloaded())); - QObject::connect(document.data(), SIGNAL(reloaded()), q, SLOT(documentReloaded())); + QObject::connect(document.data(), SIGNAL(reloadFinished(bool)), q, SLOT(documentReloadFinished(bool))); q->slotUpdateExtraAreaWidth(); } diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h index 850eb64eee9a31161748bfa284c85a5250568424..ce99441e207215afe0303c39e5f2e2ea4902bcc2 100644 --- a/src/plugins/texteditor/basetexteditor.h +++ b/src/plugins/texteditor/basetexteditor.h @@ -375,7 +375,7 @@ protected: private slots: void editorContentsChange(int position, int charsRemoved, int charsAdded); void documentAboutToBeReloaded(); - void documentReloaded(); + void documentReloadFinished(bool success); void highlightSearchResults(const QString &txt, Find::FindFlags findFlags); void setFindScope(const QTextCursor &start, const QTextCursor &end, int, int); bool inFindScope(const QTextCursor &cursor);