Commit 36643a92 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Fix updates count when listing resources that point to the same package

parent 34a91690
......@@ -248,12 +248,34 @@ ResourcesUpdatesModel* UpdateModel::backend() const
int UpdateModel::toUpdateCount() const
{
int ret = 0;
QSet<QString> packages;
foreach (UpdateItem* item, m_updateItems) {
const auto packageName = item->resource()->packageName();
if (packages.contains(packageName)) {
continue;
}
packages.insert(packageName);
ret += item->checked() != Qt::Unchecked ? 1 : 0;
}
return ret;
}
int UpdateModel::totalUpdatesCount() const
{
int ret = 0;
QSet<QString> packages;
foreach (UpdateItem* item, m_updateItems) {
const auto packageName = item->resource()->packageName();
if (packages.contains(packageName)) {
continue;
}
packages.insert(packageName);
ret += 1;
}
return ret;
}
UpdateItem * UpdateModel::itemFromResource(AbstractResource* res)
{
foreach (UpdateItem* item, m_updateItems) {
......
......@@ -64,7 +64,7 @@ public:
bool hasUpdates() const;
///all upgradeable packages
int totalUpdatesCount() const { return m_updateItems.count(); }
int totalUpdatesCount() const;
///packages marked to upgrade
int toUpdateCount() const;
......
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