Commit 10ff6769 authored by Nikolai Kosjar's avatar Nikolai Kosjar

Core: Let IDocument also report failed file reload operations

Change-Id: I8fa02f2398f59306c49481316fdedf50a1c4e32f
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent a0439779
......@@ -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;
}
......
......@@ -112,7 +112,8 @@ signals:
void changed();
void aboutToReload();
void reloaded();
void reloadFinished(bool success);
void fileNameChanged(const QString &oldName, const QString &newName);
private:
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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();
}
......
......@@ -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);
......
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