Fix marking files modified externally as modified

It replaces 59c90e00c1
and d0c537ca75

Task-number: QTCREATORBUG-17048
Change-Id: Ief4b1b72f2e5e7b1711be05d4ea8c03bbbf48fdf
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Jarek Kobus
2016-10-20 14:45:15 +02:00
committed by Jarek Kobus
parent ca4be197ef
commit 72e19c4886
8 changed files with 220 additions and 12 deletions

View File

@@ -183,6 +183,9 @@ void FormWindowFile::setFilePath(const FileName &newName)
void FormWindowFile::updateIsModified()
{
if (m_modificationChangedGuard.isLocked())
return;
bool value = m_formWindow && m_formWindow->isDirty();
if (value)
emit contentsChanged();
@@ -209,8 +212,20 @@ bool FormWindowFile::isSaveAsAllowed() const
bool FormWindowFile::reload(QString *errorString, ReloadFlag flag, ChangeType type)
{
if (flag == FlagIgnore)
if (flag == FlagIgnore) {
if (!m_formWindow || type != TypeContents)
return true;
const bool wasModified = m_formWindow->isDirty();
{
Utils::GuardLocker locker(m_modificationChangedGuard);
// hack to ensure we clean the clear state in form window
m_formWindow->setDirty(false);
m_formWindow->setDirty(true);
}
if (!wasModified)
updateIsModified();
return true;
}
if (type == TypePermissions) {
emit changed();
} else {