By default do not display warning about backups made of the config file.

Use the setting showConfigBackupWarning to change the default value.

Signed-off-by: Camila <hello@camila.codes>
This commit is contained in:
Camila 2023-02-01 17:25:24 +01:00
parent 9ead33ab93
commit 72fe5f643c
No known key found for this signature in database
GPG key ID: 7A4A6121E88E2AD4
3 changed files with 15 additions and 7 deletions

View file

@ -147,15 +147,11 @@ bool Application::configVersionMigration()
const auto versionChanged = previousVersion != currentVersion;
const auto downgrading = previousVersion > currentVersion;
// We want to message the user either for destructive changes,
// or if we're ignoring something and the client version changed.
const auto showWarning = !deleteKeys.isEmpty() || (!ignoreKeys.isEmpty() && versionChanged);
if (!versionChanged && !showWarning) {
if (!versionChanged && !(!deleteKeys.isEmpty() || (!ignoreKeys.isEmpty() && versionChanged))) {
return true;
}
// back up all old config file
// back up all old config files
QStringList backupFilesList;
QDir configDir(configFile.configPath());
const auto anyConfigFileNameList = configDir.entryInfoList({"*.cfg"}, QDir::Files);
@ -171,7 +167,9 @@ bool Application::configVersionMigration()
}
}
if (showWarning || backupFilesList.count() > 0) {
// We want to message the user either for destructive changes,
// or if we're ignoring something and the client version changed.
if (configFile.showConfigBackupWarning() && backupFilesList.count() > 0) {
QMessageBox box(
QMessageBox::Warning,
APPLICATION_SHORTNAME,

View file

@ -51,6 +51,7 @@
namespace {
static constexpr char showMainDialogAsNormalWindowC[] = "showMainDialogAsNormalWindow";
static constexpr char showConfigBackupWarningC[] = "showConfigBackupWarning";
static constexpr char remotePollIntervalC[] = "remotePollInterval";
static constexpr char forceSyncIntervalC[] = "forceSyncInterval";
@ -456,6 +457,11 @@ QString ConfigFile::backup(const QString &fileName) const
return backupFile;
}
bool ConfigFile::showConfigBackupWarning() const
{
return getValue(showConfigBackupWarningC, QString(), false).toBool();
}
QString ConfigFile::configFile() const
{
return configPath() + Theme::instance()->configFileName();

View file

@ -54,6 +54,10 @@ public:
* Returns the path of the new backup.
*/
[[nodiscard]] QString backup(const QString &fileName) const;
/**
* Display warning with a list of the config files that were backed up
*/
[[nodiscard]] bool showConfigBackupWarning() const;
bool exists();