summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNiels Weber <niels.weber@digia.com>2014-11-21 13:12:28 +0100
committerNiels Weber <niels.weber@theqtcompany.com>2014-12-01 10:50:52 +0100
commitb3a473cc7d050c8392749e41f4afd56b898ee2db (patch)
tree001f55db961083ad8d6c32dfbba93646bcebd7f5 /src
parentbccdcf3612f3225008ab246b8055754c56625baa (diff)
cleanup RollBackInstallation
Change-Id: I8ad696bd4a4b0d2979172f66dad5153a78643b5e Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/libs/installer/packagemanagercore.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index abff0bafa..a1c178150 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -578,12 +578,12 @@ void PackageManagerCore::rollBackInstallation()
{
emit titleMessageChanged(tr("Cancelling the Installer"));
- //this unregisters all operation progressChanged connects
+ // this unregisters all operation progressChanged connected
ProgressCoordinator::instance()->setUndoMode();
const int progressOperationCount = d->countProgressOperations(d->m_performedOperationsCurrentSession);
const double progressOperationSize = double(1) / progressOperationCount;
- //re register all the undo operations with the new size to the ProgressCoordninator
+ // reregister all the undo operations with the new size to the ProgressCoordinator
foreach (Operation *const operation, d->m_performedOperationsCurrentSession) {
QObject *const operationObject = dynamic_cast<QObject*> (operation);
if (operationObject != 0) {
@@ -602,17 +602,15 @@ void PackageManagerCore::rollBackInstallation()
const bool becameAdmin = !RemoteClient::instance().isActive()
&& operation->value(QLatin1String("admin")).toBool() && gainAdminRights();
- if (operation->hasValue(QLatin1String("uninstall-only"))) {
+ if (operation->value(QLatin1String("uninstall-only")).toBool() &&
+ QVariant(value(scRemoveTargetDir)).toBool() &&
+ (operation->name() == QLatin1String("Mkdir"))) {
// We know the mkdir operation which is creating the target path. If we do a
// full uninstall, prevent a forced remove of the full install path including the
- // target , instead try to remove the target only and only if it is empty,
- // otherwise fail silently. Note: we will ever experience this only -if-
- // RemoveTargetDir is set, otherwise the operation does not exist at all.
- const bool isMkDir = (operation->name() == QLatin1String("Mkdir"));
- const bool removeTargetDir = QVariant(value(scRemoveTargetDir)).toBool();
- const bool uninstallOnly = operation->value(QLatin1String("uninstall-only")).toBool();
- if (isMkDir && uninstallOnly && removeTargetDir)
- operation->setValue(QLatin1String("forceremoval"), false);
+ // target, instead try to remove the target only and only if it is empty,
+ // otherwise fail silently. Note: this can only happen if RemoveTargetDir is set,
+ // otherwise the operation does not exist at all.
+ operation->setValue(QLatin1String("forceremoval"), false);
}
PackageManagerCorePrivate::performOperationThreaded(operation, PackageManagerCorePrivate::Undo);