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

Reset the ApplicationAddionsModel when the state of an application changes

BUG: 426027
parent 83bb529c
Pipeline #126157 passed with stage
in 1 minute and 52 seconds
......@@ -6,6 +6,7 @@
#include "ApplicationAddonsModel.h"
#include "libdiscover_debug.h"
#include "utils.h"
#include <Transaction/TransactionModel.h>
#include <resources/AbstractResource.h>
#include <resources/ResourcesModel.h>
......@@ -17,6 +18,17 @@ ApplicationAddonsModel::ApplicationAddonsModel(QObject *parent)
// new QAbstractItemModelTester(this, this);
connect(TransactionModel::global(), &TransactionModel::transactionRemoved, this, &ApplicationAddonsModel::transactionOver);
connect(ResourcesModel::global(), &ResourcesModel::resourceDataChanged, this, [this](AbstractResource *resource, const QVector<QByteArray> &properties) {
if (!properties.contains("state"))
return;
const QString appstreamId = resource->appstreamId();
if (kContains(m_initial, [&appstreamId](const PackageState &state) {
return appstreamId == state.packageName();
})) {
resetState();
}
});
}
QHash<int, QByteArray> ApplicationAddonsModel::roleNames() const
......
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