Skip to content

Commit

Permalink
while migrating from another version, clean updater config
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien committed Jan 17, 2025
1 parent 5bf841f commit dd6fcd0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/gui/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ bool Application::configVersionMigration()
qCInfo(lcApplication) << "versionChanged?" << versionChanged;
qCInfo(lcApplication) << "downgrading?" << downgrading;

if (versionChanged) {
configFile.cleanUpdaterConfiguration();
}

if (!versionChanged && !(!deleteKeys.isEmpty() || (!ignoreKeys.isEmpty() && versionChanged))) {
return true;
}
Expand Down
17 changes: 17 additions & 0 deletions src/libsync/configfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,23 @@ QString ConfigFile::excludeFileFromSystem()
return fi.absoluteFilePath();
}

void OCC::ConfigFile::cleanUpdaterConfiguration()
{
// [Updater]
// autoUpdateAttempted=true
// updateTargetVersion=5.3.1.14360
// updateTargetVersionString=sciebo sciebo 5.3.1 (build 14360)
// updateAvailable=C:/Users/Matthieu Gallien/AppData/Roaming/sciebo/sciebo-5.3.1.14360.x64.msi

QSettings settings(configFile(), QSettings::IniFormat);
settings.beginGroup("Updater");
settings.remove("autoUpdateAttempted");
settings.remove("updateTargetVersion");
settings.remove("updateTargetVersionString");
settings.remove("updateAvailable");
settings.sync();
}

QString ConfigFile::backup(const QString &fileName) const
{
const QString baseFilePath = configPath() + fileName;
Expand Down
2 changes: 2 additions & 0 deletions src/libsync/configfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class OWNCLOUDSYNC_EXPORT ConfigFile
[[nodiscard]] QString excludeFile(Scope scope) const;
static QString excludeFileFromSystem(); // doesn't access config dir

void cleanUpdaterConfiguration();

/**
* Creates a backup of any given fileName in the config folder
*
Expand Down

0 comments on commit dd6fcd0

Please sign in to comment.