Commit c97b7f57 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

pk: From SystemUpgrade track changes of the packages upgrade

parent ab019c74
......@@ -60,11 +60,6 @@ public:
: AbstractResource(backend)
, m_backend(backend)
{
for (auto res : qAsConst(m_resources)) {
connect(res, &AbstractResource::sizeChanged, this, [this] {
Q_EMIT m_backend->resourcesChanged(this, {"size", "homepage", "license"});
});
}
}
QString packageName() const override { return QStringLiteral("discover-offline-upgrade");}
......@@ -132,8 +127,20 @@ public:
return ret;
}
void refreshResource() {
Q_EMIT m_backend->resourcesChanged(this, {"size", "license"});
}
void setCandidates(const QSet<AbstractResource*> &candidates) {
for (auto res : (m_resources - candidates)) {
disconnect(res, &AbstractResource::sizeChanged, this, &SystemUpgrade::refreshResource);
}
const auto newCandidates = (candidates - m_resources);
m_resources = candidates;
for (auto res : newCandidates) {
connect(res, &AbstractResource::sizeChanged, this, &SystemUpgrade::refreshResource);
}
}
private:
......
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