mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 21:15:55 +03:00
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:
parent
9ead33ab93
commit
72fe5f643c
3 changed files with 15 additions and 7 deletions
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue