diff --git a/src/Gui/AutoSaver.cpp b/src/Gui/AutoSaver.cpp index a50a754c7b..d38942a9ff 100644 --- a/src/Gui/AutoSaver.cpp +++ b/src/Gui/AutoSaver.cpp @@ -109,6 +109,7 @@ void AutoSaver::saveDocument(const std::string& name) << "" << endl; str << " Created" << endl; str << " " << endl; // store the document's current label + str << " " << doc->FileName.getValue() << "" << endl; // store the document's current filename str << "" << endl; file.close(); } diff --git a/src/Gui/DlgSettingsDocument.ui b/src/Gui/DlgSettingsDocument.ui index 4d3b7fa286..c82bcd8f47 100644 --- a/src/Gui/DlgSettingsDocument.ui +++ b/src/Gui/DlgSettingsDocument.ui @@ -200,6 +200,22 @@ + + + Run AutoRecovery at startup + + + true + + + RecoveryEnabled + + + Document + + + + @@ -244,7 +260,7 @@ - + QFrame::HLine @@ -257,7 +273,7 @@ - + Save thumbnail into project file when saving document @@ -270,7 +286,7 @@ - + 6 diff --git a/src/Gui/DlgSettingsDocumentImp.cpp b/src/Gui/DlgSettingsDocumentImp.cpp index e97839516d..f2fb90450c 100644 --- a/src/Gui/DlgSettingsDocumentImp.cpp +++ b/src/Gui/DlgSettingsDocumentImp.cpp @@ -77,6 +77,7 @@ void DlgSettingsDocumentImp::saveSettings() prefAuthor->onSave(); prefSetAuthorOnSave->onSave(); prefCompany->onSave(); + prefRecovery->onSave(); prefAutoSaveEnabled->onSave(); prefAutoSaveTimeout->onSave(); @@ -104,6 +105,7 @@ void DlgSettingsDocumentImp::loadSettings() prefAuthor->onRestore(); prefSetAuthorOnSave->onRestore(); prefCompany->onRestore(); + prefRecovery->onRestore(); prefAutoSaveEnabled->onRestore(); prefAutoSaveTimeout->onRestore(); } diff --git a/src/Gui/DocumentRecovery.cpp b/src/Gui/DocumentRecovery.cpp index 48e298ee2c..da2ecc0850 100644 --- a/src/Gui/DocumentRecovery.cpp +++ b/src/Gui/DocumentRecovery.cpp @@ -75,6 +75,7 @@ public: QString projectFile; QString xmlFile; QString label; + QString fileName; QString tooltip; Status status; }; @@ -154,7 +155,8 @@ void DocumentRecovery::accept() // If something goes wrong an exception will be thrown here document->restore(); - document->FileName.setValue(std::string()); + file = it->fileName; + document->FileName.setValue(file.toUtf8().constData()); document->Label.setValue(it->label.toUtf8().constData()); // Set the modified flag so that the user cannot close by accident @@ -233,6 +235,7 @@ void DocumentRecoveryPrivate::writeRecoveryInfo(const DocumentRecoveryPrivate::I break; } str << " " << endl; + str << " " << info.fileName << "" << endl; str << "" << endl; file.close(); } @@ -260,6 +263,10 @@ DocumentRecoveryPrivate::Info DocumentRecoveryPrivate::getRecoveryInfo(const QFi info.label = cfg[QString::fromLatin1("Label")]; } + if (cfg.contains(QString::fromLatin1("FileName"))) { + info.fileName = cfg[QString::fromLatin1("FileName")]; + } + if (cfg.contains(QString::fromLatin1("Status"))) { QString status = cfg[QString::fromLatin1("Status")]; if (status == QLatin1String("Success")) @@ -299,6 +306,7 @@ DocumentRecoveryPrivate::XmlConfig DocumentRecoveryPrivate::readXmlFile(const QS QVector filter; filter << QString::fromLatin1("Label"); + filter << QString::fromLatin1("FileName"); filter << QString::fromLatin1("Status"); QDomElement child;