Commit bde0f1b0 authored by Jaroslaw Kobus's avatar Jaroslaw Kobus

DiffEditor: disable saveAs action during reload

Change-Id: I6786139c1cd9c9e3c0786b14da058cb260fba3ed
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent f5d68398
......@@ -203,11 +203,19 @@ QString DiffEditorDocument::fallbackSaveAsPath() const
return QDir::homePath();
}
bool DiffEditorDocument::isSaveAsAllowed() const
{
return !isReloading();
}
bool DiffEditorDocument::save(QString *errorString, const QString &fileName, bool autoSave)
{
Q_UNUSED(errorString)
Q_UNUSED(autoSave)
if (isReloading())
return false;
const bool ok = write(fileName, format(), plainText(), errorString);
if (!ok)
......@@ -330,6 +338,7 @@ void DiffEditorDocument::beginReload()
{
emit aboutToReload();
m_isReloading = true;
emit changed();
const bool blocked = blockSignals(true);
setDiffFiles(QList<FileData>(), QString());
setDescription(QString());
......@@ -339,6 +348,7 @@ void DiffEditorDocument::beginReload()
void DiffEditorDocument::endReload(bool success)
{
m_isReloading = false;
emit changed();
emit reloadFinished(success);
}
......
......@@ -70,7 +70,7 @@ public:
QString fallbackSaveAsPath() const override;
QString fallbackSaveAsFileName() const override;
bool isSaveAsAllowed() const override { return true; }
bool isSaveAsAllowed() const override;
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
void reload();
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
......
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