diff options
author | Bernd Weimer <bernd.weimer@pelagicore.com> | 2019-09-06 13:12:50 +0200 |
---|---|---|
committer | Bernd Weimer <bernd.weimer@pelagicore.com> | 2019-09-12 11:59:45 +0200 |
commit | 877e4cd4cf7f581a0a92eb2adb6f95695b186104 (patch) | |
tree | 55f35f8dcde6fd73d7704df275f1857b619615d8 /src/manager-lib/applicationmanager.cpp | |
parent | ff4bc7cbaf5827736fda4b1a8c85fcdd351680c1 (diff) |
Fix canceling installations
Canceling an update left the app in an inconsistent state. There is
still a known issues: canceling the update of an already updated
built-in app will revert back to the original app. This will be
fixed in 5.14
Also downgrading a built-in app didn't work as expected (the app would
be blocked, the icon etc. wouldn't be updated).
Change-Id: I6c72e7f87e993a6839e97ceb6cea443f07e1fd77
Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
Diffstat (limited to 'src/manager-lib/applicationmanager.cpp')
-rw-r--r-- | src/manager-lib/applicationmanager.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/manager-lib/applicationmanager.cpp b/src/manager-lib/applicationmanager.cpp index b2745ecb..dc6071d9 100644 --- a/src/manager-lib/applicationmanager.cpp +++ b/src/manager-lib/applicationmanager.cpp @@ -1203,16 +1203,10 @@ bool ApplicationManager::startingApplicationInstallation(ApplicationInfo *info) if (!blockApplication(app->id())) return false; - if (app->isBuiltIn()) { - // overlay the existing base info - // we will rollback to the base one if this update is removed. - app->setUpdatedInfo(newInfo.take()); - } else { - // overwrite the existing base info - // we're not keeping track of the original. so removing the updated base version removes the - // application entirely. - app->setBaseInfo(newInfo.take()); - } + // There is still an issue with "shadowing" built-in apps (which will be properly fixed in 5.14): + // As the updatedInfo might be used already (by an already updated built-in app), we cannot revert back any + // more to the previous version. Canceling the update will therefore revert back to the original app. + app->setUpdatedInfo(newInfo.take()); app->setState(Application::BeingUpdated); app->setProgress(0); emitDataChanged(app); @@ -1290,8 +1284,11 @@ bool ApplicationManager::finishedApplicationInstall(const QString &id) case Application::Installed: return false; - case Application::BeingInstalled: - case Application::BeingUpdated: { + case Application::BeingUpdated: + if (!static_cast<ApplicationInfo*>(app->baseInfo())->isBuiltIn()) + app->setBaseInfo(app->takeUpdatedInfo()); + Q_FALLTHROUGH(); + case Application::BeingInstalled: { // The Application object has been updated right at the start of the installation/update. // Now's the time to update the InstallationReport that was written by the installer. QFile irfile(QDir(app->nonAliasedInfo()->manifestDir()).absoluteFilePath(qSL("installation-report.yaml"))); @@ -1316,6 +1313,8 @@ bool ApplicationManager::finishedApplicationInstall(const QString &id) app->setUpdatedInfo(nullptr); app->setState(Application::Installed); registerMimeTypes(); + emitDataChanged(app); + unblockApplication(id); break; case Application::BeingRemoved: { int row = d->apps.indexOf(app); @@ -1361,11 +1360,13 @@ bool ApplicationManager::canceledApplicationInstall(const QString &id) break; } case Application::BeingUpdated: + app->setUpdatedInfo(nullptr); + Q_FALLTHROUGH(); case Application::BeingDowngraded: case Application::BeingRemoved: app->setState(Application::Installed); app->setProgress(0); - emitDataChanged(app, QVector<int> { IsUpdating }); + emitDataChanged(app); unblockApplication(id); break; |