mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
Bugfix :
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:
@@ -150,10 +150,7 @@ QETApp::~QETApp()
|
|||||||
QStringList extension_filter("*.qet");
|
QStringList extension_filter("*.qet");
|
||||||
QStringList list = dir.entryList(extension_filter);
|
QStringList list = dir.entryList(extension_filter);
|
||||||
for(QString str : list)
|
for(QString str : list)
|
||||||
{
|
dir.remove(str);
|
||||||
QFile file(dir.path() + "/" + str);
|
|
||||||
file.remove();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1644,6 +1641,15 @@ void QETApp::checkBackupFiles()
|
|||||||
{
|
{
|
||||||
QStringList extension_filter("*.qet");
|
QStringList extension_filter("*.qet");
|
||||||
QStringList list = dir.entryList(extension_filter);
|
QStringList list = dir.entryList(extension_filter);
|
||||||
|
|
||||||
|
//Remove from the list, the backup file of registred project
|
||||||
|
for(QETProject *project : registeredProjects().values())
|
||||||
|
if(!project->filePath().isEmpty())
|
||||||
|
{
|
||||||
|
QFileInfo info(project->filePath());
|
||||||
|
list.removeOne(info.fileName());
|
||||||
|
}
|
||||||
|
|
||||||
if(list.isEmpty())
|
if(list.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -166,12 +166,13 @@ QETProject::~QETProject()
|
|||||||
//Project is closed without crash, we can safely remove the backup file.
|
//Project is closed without crash, we can safely remove the backup file.
|
||||||
if (!m_file_path.isEmpty())
|
if (!m_file_path.isEmpty())
|
||||||
{
|
{
|
||||||
QDir dir(QETApp::configDir() + "/backup");
|
QDir dir(QETApp::configDir() + "backup");
|
||||||
if(!dir.exists())
|
if(!dir.exists())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString project_name = m_file_path.split("/").last();
|
QFileInfo info(m_file_path);
|
||||||
dir.remove(project_name);
|
if(info.exists())
|
||||||
|
dir.remove(info.fileName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1656,7 +1657,7 @@ void QETProject::writeBackup()
|
|||||||
if(m_file_path.isEmpty())
|
if(m_file_path.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QDir dir(QETApp::configDir() + "/backup");
|
QDir dir(QETApp::configDir() + "backup");
|
||||||
if(!dir.exists())
|
if(!dir.exists())
|
||||||
{
|
{
|
||||||
dir.cdUp();
|
dir.cdUp();
|
||||||
@@ -1664,11 +1665,13 @@ void QETProject::writeBackup()
|
|||||||
dir.cd("backup");
|
dir.cd("backup");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QFileInfo info(m_file_path);
|
||||||
|
if(info.exists())
|
||||||
|
{
|
||||||
QDomDocument xml_project;
|
QDomDocument xml_project;
|
||||||
xml_project.appendChild(xml_project.importNode(toXml().documentElement(), true));
|
xml_project.appendChild(xml_project.importNode(toXml().documentElement(), true));
|
||||||
|
QET::writeXmlFile(xml_project, dir.absoluteFilePath(info.fileName()));
|
||||||
QString project_name = m_file_path.split("/").last();
|
}
|
||||||
QET::writeXmlFile(xml_project, dir.absoluteFilePath(project_name));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user