Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 0f7d0ee3 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

pk: make sense of the pk install code

Only install the application once if there's addons.
Use resourceByPackageName.
parent 9d5fa1b2
......@@ -516,28 +516,19 @@ int PackageKitBackend::updatesCount() const
Transaction* PackageKitBackend::installApplication(AbstractResource* app, const AddonList& addons)
{
Transaction* t = nullptr;
if(!addons.addonsToInstall().isEmpty())
{
QVector<AbstractResource*> appsToInstall;
if(!addons.addonsToInstall().isEmpty()) {
QVector<AbstractResource*> appsToInstall = resourcesByPackageNames<QVector<AbstractResource*>>(addons.addonsToInstall());
if(!app->isInstalled())
appsToInstall << app;
foreach(const QString& toInstall, addons.addonsToInstall()) {
appsToInstall += m_packages.packages.value(toInstall);
Q_ASSERT(appsToInstall.last());
}
t = new PKTransaction(appsToInstall, Transaction::ChangeAddonsRole);
}
} else if (!app->isInstalled())
t = installApplication(app);
if (!addons.addonsToRemove().isEmpty()) {
QVector<AbstractResource*> appsToRemove = kTransform<QVector<AbstractResource*>>(addons.addonsToRemove(), [this](const QString& toRemove){ return m_packages.packages.value(toRemove); });
const auto appsToRemove = resourcesByPackageNames<QVector<AbstractResource*>>(addons.addonsToRemove());
t = new PKTransaction(appsToRemove, Transaction::RemoveRole);
}
if (!app->isInstalled())
t = installApplication(app);
return t;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment