Fix backup file on windows

For unknown reason KautoSaveFile don't write the file on Windows if file
is open in another part of the code.
No error is returned and use the method :
qint64 QIODevice::write(const QByteArray &byteArray) return the good
number of bytes written but the real file stay empty.
Probably the problem don't come from KautoSaveFile but QFileDevice or
QIODevice on windows.

The fix consist to open the file just before write on it and close it
just after.
This commit is contained in:
Claveau Joshua
2020-08-02 22:24:46 +02:00
parent 7a04788d54
commit 78992ee762
2 changed files with 8 additions and 18 deletions

View File

@@ -28,6 +28,8 @@
#include "projectdatabase.h"
#include "reportproperties.h"
#include <KAutoSaveFile>
class Diagram;
class ElementsLocation;
class QETResult;
@@ -264,7 +266,7 @@ class QETProject : public QObject
bool m_freeze_new_conductors = false;
QTimer m_save_backup_timer,
m_autosave_timer;
KAutoSaveFile *m_backup_file = nullptr;
KAutoSaveFile m_backup_file;
QUuid m_uuid = QUuid::createUuid();
projectDataBase m_data_base;
};