+ issue #0000175: Auto save function

This commit is contained in:
wmayer
2015-09-04 17:53:22 +02:00
parent 5cfbde93da
commit 984608aaaa
4 changed files with 31 additions and 4 deletions

View File

@@ -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 << " <Label>" << info.label << "</Label>" << endl;
str << " <FileName>" << info.fileName << "</FileName>" << endl;
str << "</AutoRecovery>" << 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<QString> filter;
filter << QString::fromLatin1("Label");
filter << QString::fromLatin1("FileName");
filter << QString::fromLatin1("Status");
QDomElement child;