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

Fix filtering

Don't try to match when the URL isn't adequate.
Also check the state.
parent 0709cf85
......@@ -96,9 +96,16 @@ int DummyBackend::updatesCount() const
ResultsStream* DummyBackend::search(const AbstractResourcesBackend::Filters& filter)
{
QVector<AbstractResource*> ret;
if (!filter.resourceUrl.isEmpty() && filter.resourceUrl.scheme() == QLatin1String("dummy"))
if (!filter.resourceUrl.isEmpty())
return findResourceByPackageName(filter.resourceUrl);
else foreach(AbstractResource* r, m_resources) {
if (r->isTechnical() && filter.state != AbstractResource::Upgradeable) {
continue;
}
if (r->state() < filter.state)
continue;
if(r->name().contains(filter.search, Qt::CaseInsensitive) || r->comment().contains(filter.search, Qt::CaseInsensitive))
ret += r;
}
......
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