Commit 4e6748b1 authored by Nate Graham's avatar Nate Graham
Browse files

Don't display critical packages/apps in the UI

Right now when the user clicks the Remove button for these, they'll get
a big ugly error message. Instead, we should just not show them in the
UI at all.

CCBUG: 449260


(cherry picked from commit 456b8c1e)
parent ad9ad39c
Pipeline #135818 passed with stage
in 54 seconds
......@@ -479,7 +479,7 @@ ResultsStream *PackageKitBackend::search(const AbstractResourcesBackend::Filters
const auto toResolve = kFilter<QVector<AbstractResource *>>(m_packages.packages, needsResolveFilter);
auto installedAndNameFilter = [filter](AbstractResource *res) {
return res->state() >= AbstractResource::Installed
return res->state() >= AbstractResource::Installed && !qobject_cast<PackageKitResource *>(res)->isCritical()
&& (res->name().contains(filter.search, Qt::CaseInsensitive) || res->packageName().compare(filter.search, Qt::CaseInsensitive) == 0);
};
bool furtherSearch = false;
......@@ -517,7 +517,8 @@ ResultsStream *PackageKitBackend::search(const AbstractResourcesBackend::Filters
auto stream = new PKResultsStream(this, QStringLiteral("PackageKitStream-all"));
auto f = [this, filter, stream] {
auto resources = kFilter<QVector<AbstractResource *>>(m_packages.packages, [](AbstractResource *res) {
return res->type() != AbstractResource::Technical && !qobject_cast<PackageKitResource *>(res)->extendsItself();
return res->type() != AbstractResource::Technical && !qobject_cast<PackageKitResource *>(res)->isCritical()
&& !qobject_cast<PackageKitResource *>(res)->extendsItself();
});
stream->setResources(resources);
stream->finish();
......
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