Add Qt-only autosave recovery fallback

Provide a small KAutoSaveFile-compatible implementation for the no-KF5 build path and use it to keep the existing crash-recovery code active when BUILD_WITH_KF5=OFF.

The normal KF5 build still uses the KDE KAutoSaveFile implementation.

Assisted-by: pi coding agent / Mika (OpenAI GPT-5.5)
This commit is contained in:
Gerhard Schwanzer
2026-07-05 13:16:19 +02:00
parent d0cea474a6
commit e6124e941a
8 changed files with 350 additions and 32 deletions
-9
View File
@@ -93,8 +93,6 @@ QETProject::QETProject(const QString &path, QObject *parent) :
init();
}
#ifdef BUILD_WITHOUT_KF5
#else
/**
@brief QETProject::QETProject
@param backup : backup file to open, QETProject take ownership of backup.
@@ -129,7 +127,6 @@ QETProject::QETProject(KAutoSaveFile *backup, QObject *parent) :
init();
}
#endif
/**
@brief QETProject::~QETProject
@@ -342,15 +339,12 @@ void QETProject::setFilePath(const QString &filepath)
if (filepath == m_file_path) {
return;
}
#ifdef BUILD_WITHOUT_KF5
#else
//Don't close/re-point the backup file while a backup is still writing it.
m_backup_future.waitForFinished();
if (m_backup_file.isOpen()) {
m_backup_file.close();
}
m_backup_file.setManagedFile(QUrl::fromLocalFile(filepath));
#endif
m_file_path = filepath;
QFileInfo fi(m_file_path);
@@ -1813,8 +1807,6 @@ void QETProject::writeBackup()
{
if (!m_backup_enabled)
return;
#ifdef BUILD_WITHOUT_KF5
#else
# if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
//Don't launch a new backup while the previous one is still writing:
//both would write through &m_backup_file on different threads.
@@ -1830,7 +1822,6 @@ void QETProject::writeBackup()
qDebug() << "Help code for QT 6 or later"
<< "QtConcurrent::run its backwards now...function, object, args";
# endif
#endif
}
/**