From: Christian Kamm Date: Mon, 29 Jul 2019 11:47:38 +0000 (+0200) Subject: Updater: Preserve target version string X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~22^2~46^2~10 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d2991210c5ccb95dd7ab763d2ccc095a66697e82;p=nextcloud-desktop.git Updater: Preserve target version string For #7217 --- diff --git a/src/gui/updater/ocupdater.cpp b/src/gui/updater/ocupdater.cpp index 996c8c9b9..c48202b1d 100644 --- a/src/gui/updater/ocupdater.cpp +++ b/src/gui/updater/ocupdater.cpp @@ -31,6 +31,7 @@ namespace OCC { static const char updateAvailableC[] = "Updater/updateAvailable"; static const char updateTargetVersionC[] = "Updater/updateTargetVersion"; +static const char updateTargetVersionStringC[] = "Updater/updateTargetVersionString"; static const char seenVersionC[] = "Updater/seenVersion"; static const char autoUpdateAttemptedC[] = "Updater/autoUpdateAttempted"; @@ -294,6 +295,7 @@ void NSISUpdater::wipeUpdateData() QFile::remove(updateFileName); settings.remove(updateAvailableC); settings.remove(updateTargetVersionC); + settings.remove(updateTargetVersionStringC); settings.remove(autoUpdateAttemptedC); } @@ -322,6 +324,7 @@ void NSISUpdater::slotDownloadFinished() setDownloadState(DownloadComplete); qCInfo(lcUpdater) << "Downloaded" << url.toString() << "to" << _targetFile; settings.setValue(updateTargetVersionC, updateInfo().version()); + settings.setValue(updateTargetVersionStringC, updateInfo().versionString()); settings.setValue(updateAvailableC, _targetFile); } @@ -411,7 +414,7 @@ void NSISUpdater::showNoUrlDialog(const UpdateInfo &info) msgBox->open(); } -void NSISUpdater::showUpdateErrorDialog() +void NSISUpdater::showUpdateErrorDialog(const QString &targetVersion) { QDialog *msgBox = new QDialog; msgBox->setAttribute(Qt::WA_DeleteOnClose); @@ -435,7 +438,7 @@ void NSISUpdater::showUpdateErrorDialog() QString txt = tr("

A new version of the %1 Client is available but the updating process failed.

" "

%2 has been downloaded. The installed version is %3.

") .arg(Utility::escape(Theme::instance()->appNameGUI()), - Utility::escape(updateInfo().versionString()), Utility::escape(clientVersion())); + Utility::escape(targetVersion), Utility::escape(clientVersion())); lbl->setText(txt); lbl->setTextFormat(Qt::RichText); @@ -488,7 +491,7 @@ bool NSISUpdater::handleStartup() return false; } else { // auto update failed. Ask user what to do - showUpdateErrorDialog(); + showUpdateErrorDialog(settings.value(updateTargetVersionStringC).toString()); return false; } } else { diff --git a/src/gui/updater/ocupdater.h b/src/gui/updater/ocupdater.h index 6de88b704..dbdb6be51 100644 --- a/src/gui/updater/ocupdater.h +++ b/src/gui/updater/ocupdater.h @@ -158,7 +158,7 @@ private slots: private: void wipeUpdateData(); void showNoUrlDialog(const UpdateInfo &info); - void showUpdateErrorDialog(); + void showUpdateErrorDialog(const QString &targetVersion); void versionInfoArrived(const UpdateInfo &info) override; QScopedPointer _file; QString _targetFile;