From: Matthieu Gallien Date: Tue, 31 Jan 2023 17:43:57 +0000 (+0100) Subject: use QVersionNumber to compare versions and improve upgrade warning X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~11^2~15^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=04ea61e620582d201910b249cabbc4d10410591f;p=nextcloud-desktop.git use QVersionNumber to compare versions and improve upgrade warning Signed-off-by: Matthieu Gallien --- diff --git a/src/gui/application.cpp b/src/gui/application.cpp index d8e7291d8..b74943093 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -63,6 +63,7 @@ #include #include #include +#include class QSocket; @@ -141,7 +142,10 @@ bool Application::configVersionMigration() // Did the client version change? // (The client version is adjusted further down) - const auto versionChanged = configFile.clientVersionString() != MIRALL_VERSION_STRING; + const auto currentVersion = QVersionNumber::fromString(MIRALL_VERSION_STRING); + const auto previousVersion = QVersionNumber::fromString(configFile.clientVersionString()); + 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. @@ -178,13 +182,13 @@ bool Application::configVersionMigration() QMessageBox box( QMessageBox::Warning, APPLICATION_SHORTNAME, - tr("Some settings were configured in newer versions of this client and " + tr("Some settings were configured in %1 versions of this client and " "use features that are not available in this version.
" "
" - "%1
" + "%2
" "
" - "The current configuration file was already backed up to %2.") - .arg(boldMessage, backupFilesList.join("
"))); + "The current configuration file was already backed up to %3.") + .arg((downgrading ? tr("newer", "newer software version") : tr("older", "older software version")), boldMessage, backupFilesList.join("
"))); box.addButton(tr("Quit"), QMessageBox::AcceptRole); auto continueBtn = box.addButton(tr("Continue"), QMessageBox::DestructiveRole);