diff options
author | Christian Kamm <mail@ckamm.de> | 2019-07-29 14:47:38 +0300 |
---|---|---|
committer | Christian Kamm <mail@ckamm.de> | 2019-08-01 11:13:03 +0300 |
commit | 08f58ff30409981943bba06266860f49fe1aebf5 (patch) | |
tree | c906692330643f1feb1cb61ab35f1040e5b47648 /src/gui/updater | |
parent | 736ad72bbb964a3e35e675d0b106cf5210168cdd (diff) |
Updater: Preserve target version string
For #7217
Diffstat (limited to 'src/gui/updater')
-rw-r--r-- | src/gui/updater/ocupdater.cpp | 9 | ||||
-rw-r--r-- | src/gui/updater/ocupdater.h | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/updater/ocupdater.cpp b/src/gui/updater/ocupdater.cpp index a19f0d54d..f555d3476 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); } @@ -409,7 +412,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); @@ -433,7 +436,7 @@ void NSISUpdater::showUpdateErrorDialog() QString txt = tr("<p>A new version of the %1 Client is available but the updating process failed.</p>" "<p><b>%2</b> has been downloaded. The installed version is %3.</p>") .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); @@ -486,7 +489,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 9bc15e966..d2f39c7bd 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) Q_DECL_OVERRIDE; QScopedPointer<QTemporaryFile> _file; QString _targetFile; |