summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleix Pol <[email protected]>2018-05-07 17:52:35 +0200
committerAleix Pol <[email protected]>2018-05-07 17:52:35 +0200
commitb4ee04e89df4b68ce7b1ce329fef019a2d305f0f (patch)
tree0ebbe679dd3746f82f14b918935eed677e8897b9
parent0709cf8554200c8983b7d78dfbc8a49fe5bbc2f3 (diff)
Fix filtering
Don't try to match when the URL isn't adequate. Also check the state.
-rw-r--r--libdiscover/backends/DummyBackend/DummyBackend.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/libdiscover/backends/DummyBackend/DummyBackend.cpp b/libdiscover/backends/DummyBackend/DummyBackend.cpp
index 79f2fc4..ce3659b 100644
--- a/libdiscover/backends/DummyBackend/DummyBackend.cpp
+++ b/libdiscover/backends/DummyBackend/DummyBackend.cpp
@@ -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;
}