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

Port away from deprecated API

parent 0761d3bb
......@@ -58,7 +58,8 @@ UpdateModel::~UpdateModel()
QHash<int,QByteArray> UpdateModel::roleNames() const
{
return QAbstractItemModel::roleNames().unite({
auto ret = QAbstractItemModel::roleNames();
ret.insert({
{ Qt::CheckStateRole, "checked" },
{ ResourceProgressRole, "resourceProgress" },
{ ResourceStateRole, "resourceState" },
......@@ -69,6 +70,7 @@ QHash<int,QByteArray> UpdateModel::roleNames() const
{ InstalledVersionRole, "installedVersion" },
{ AvailableVersionRole, "availableVersion" }
} );
return ret;
}
void UpdateModel::setBackend(ResourcesUpdatesModel* updates)
......
......@@ -538,7 +538,14 @@ ResultsStream * PackageKitBackend::findResourceByPackageName(const QUrl& url)
const auto f = [this, appstreamIds, stream] () {
AbstractResource* pkg = nullptr;
const QStringList allAppStreamIds = appstreamIds + deprecatedAppstreamIds.values(appstreamIds.first());
QStringList allAppStreamIds = appstreamIds;
{
auto it = deprecatedAppstreamIds.constFind(appstreamIds.first());
if (it != deprecatedAppstreamIds.constEnd()) {
allAppStreamIds << *it;
}
}
for (auto it = m_packages.packages.constBegin(), itEnd = m_packages.packages.constEnd(); it != itEnd; ++it) {
const bool matches = kContains(allAppStreamIds, [&it] (const QString& id) {
return it.key().compare(id, Qt::CaseInsensitive) == 0 ||
......
......@@ -337,9 +337,9 @@ public:
, m_res(res)
, m_backend(backend)
{
setItemRoleNames(roleNames().unite(
{ {Qt::CheckStateRole, "checked"} }
));
auto roles = roleNames();
roles.insert(Qt::CheckStateRole, "checked");
setItemRoleNames(roles);
auto req = backend->client()->getInterfaces();
req->runSync();
......
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