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);
}
}
- 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,
namespace {
static constexpr char showMainDialogAsNormalWindowC[] = "showMainDialogAsNormalWindow";
+static constexpr char showConfigBackupWarningC[] = "showConfigBackupWarning";
static constexpr char remotePollIntervalC[] = "remotePollInterval";
static constexpr char forceSyncIntervalC[] = "forceSyncInterval";
return backupFile;
}
+bool ConfigFile::showConfigBackupWarning() const
+{
+ return getValue(showConfigBackupWarningC, QString(), false).toBool();
+}
+
QString ConfigFile::configFile() const
{
return configPath() + Theme::instance()->configFileName();
* 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();