ModelEditor: Support auto save

Change-Id: Ifec4cf592c3fbc8cef6f6df13865a35f3e17f531
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Jochen Becher
2016-03-14 20:52:31 +01:00
parent c77abc4230
commit c11e58f8f5
2 changed files with 9 additions and 1 deletions

View File

@@ -93,7 +93,9 @@ bool ModelDocument::save(QString *errorString, const QString &name, bool autoSav
return false;
}
if (!autoSave) {
if (autoSave) {
d->documentController->projectController()->setModified();
} else {
setFilePath(Utils::FileName::fromString(d->documentController->projectController()->project()->fileName()));
emit changed();
}
@@ -101,6 +103,11 @@ bool ModelDocument::save(QString *errorString, const QString &name, bool autoSav
return true;
}
bool ModelDocument::shouldAutoSave() const
{
return isModified();
}
bool ModelDocument::isModified() const
{
return d->documentController ? d->documentController->projectController()->isModified() : false;