forked from qt-creator/qt-creator
Fix marking files modified externally as modified
It replaces59c90e00c1andd0c537ca75Task-number: QTCREATORBUG-17048 Change-Id: Ief4b1b72f2e5e7b1711be05d4ea8c03bbbf48fdf Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user