Commit 3feada8b authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

packagekit: Don't list repeated packages several times

Now that we are showing them sorted, it's clear that sometimes they're
repeated on distros that there's less of a 1:1 mapping on resources
(e.g. KDE Neon).

Make sure then that we only print them once.
parent da310daa
......@@ -105,10 +105,16 @@ public:
}
void fetchChangelog() override {
QStringList changes;
QSet<QString> donePkgs;
for (auto res : qAsConst(m_resources)) {
const auto versions = res->upgradeText();
const auto idx = versions.indexOf(u'\u009C');
changes += QStringLiteral("<li>") + res->packageName() + QStringLiteral(": ") + versions.leftRef(idx) + QStringLiteral("</li>\n");
PackageKitResource * app = qobject_cast<PackageKitResource*>(res);
QString pkgid = m_backend->upgradeablePackageId(app);
if (!donePkgs.contains(pkgid)) {
donePkgs.insert(pkgid);
const auto versions = res->upgradeText();
const auto idx = versions.indexOf(u'\u009C');
changes += QStringLiteral("<li>") + res->packageName() + QStringLiteral(": ") + versions.leftRef(idx) + QStringLiteral("</li>\n");
}
}
changes.sort();
Q_EMIT changelogFetched(QStringLiteral("<ul>") + changes.join(QString()) + QStringLiteral("</ul>\n"));
......
Supports Markdown
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