1- When open a .qet by double click on it, QET ask user for open the backup file, of this .qet.
2- On windows, if user open a project from the recent files menu, when close QET the file is deleted :(  user lose her work


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5383 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2018-06-01 18:33:08 +00:00
parent 2e32c75523
commit c19ec8c65a
2 changed files with 22 additions and 13 deletions

View File

@@ -166,12 +166,13 @@ QETProject::~QETProject()
//Project is closed without crash, we can safely remove the backup file.
if (!m_file_path.isEmpty())
{
QDir dir(QETApp::configDir() + "/backup");
QDir dir(QETApp::configDir() + "backup");
if(!dir.exists())
return;
QString project_name = m_file_path.split("/").last();
dir.remove(project_name);
QFileInfo info(m_file_path);
if(info.exists())
dir.remove(info.fileName());
}
}
@@ -1656,7 +1657,7 @@ void QETProject::writeBackup()
if(m_file_path.isEmpty())
return;
QDir dir(QETApp::configDir() + "/backup");
QDir dir(QETApp::configDir() + "backup");
if(!dir.exists())
{
dir.cdUp();
@@ -1664,11 +1665,13 @@ void QETProject::writeBackup()
dir.cd("backup");
}
QDomDocument xml_project;
xml_project.appendChild(xml_project.importNode(toXml().documentElement(), true));
QString project_name = m_file_path.split("/").last();
QET::writeXmlFile(xml_project, dir.absoluteFilePath(project_name));
QFileInfo info(m_file_path);
if(info.exists())
{
QDomDocument xml_project;
xml_project.appendChild(xml_project.importNode(toXml().documentElement(), true));
QET::writeXmlFile(xml_project, dir.absoluteFilePath(info.fileName()));
}
}
/**