Commit c11e58f8 authored by Jochen Becher's avatar Jochen Becher

ModelEditor: Support auto save

Change-Id: Ifec4cf592c3fbc8cef6f6df13865a35f3e17f531
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent c77abc42
......@@ -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;
......
......@@ -52,6 +52,7 @@ public:
OpenResult open(QString *errorString, const QString &fileName,
const QString &realFileName) override;
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
bool shouldAutoSave() const override;
bool isModified() const override;
bool isSaveAsAllowed() const override;
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