summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleix Pol <[email protected]>2016-11-20 15:52:48 +0100
committerAleix Pol <[email protected]>2016-11-20 15:52:48 +0100
commitb38373e928aafd5fb71a229ea93fb7d257d55a59 (patch)
tree8d945a0f1824c4f09048fcf09985051458be5344
parent84124e8cad48a2e745cdc191bca7d42de7dac8d2 (diff)
Fetch subcategories when results are added
The API isn't synchronous anymore
-rw-r--r--libdiscover/backends/DummyBackend/tests/DummyTest.cpp1
-rw-r--r--libdiscover/resources/ResourcesProxyModel.cpp4
2 files changed, 3 insertions, 2 deletions
diff --git a/libdiscover/backends/DummyBackend/tests/DummyTest.cpp b/libdiscover/backends/DummyBackend/tests/DummyTest.cpp
index 6e35a55..0c6973e 100644
--- a/libdiscover/backends/DummyBackend/tests/DummyTest.cpp
+++ b/libdiscover/backends/DummyBackend/tests/DummyTest.cpp
@@ -105,6 +105,7 @@ void DummyTest::testProxy()
QVERIFY(spy.wait());
QVERIFY(!pm.isBusy());
QCOMPARE(m_appBackend->property("startElements").toInt(), pm.rowCount());
+ QCOMPARE(pm.subcategories().count(), 7);
pm.setSearch(QString());
QVERIFY(pm.isBusy());
QVERIFY(spy.wait());
diff --git a/libdiscover/resources/ResourcesProxyModel.cpp b/libdiscover/resources/ResourcesProxyModel.cpp
index 73ad3da..18d38fc 100644
--- a/libdiscover/resources/ResourcesProxyModel.cpp
+++ b/libdiscover/resources/ResourcesProxyModel.cpp
@@ -112,7 +112,6 @@ void ResourcesProxyModel::setSearch(const QString &searchText)
if (diff) {
Q_EMIT searchChanged(m_filters.search);
- fetchSubcategories();
}
}
@@ -135,6 +134,8 @@ void ResourcesProxyModel::addResources(const QVector<AbstractResource *>& _res)
qSort(m_displayedResources.begin(), m_displayedResources.end(), [this](AbstractResource* res, AbstractResource* res2){ return lessThan(res, res2); });
endResetModel();
}
+
+ fetchSubcategories();
}
void ResourcesProxyModel::invalidateSorting()
@@ -185,7 +186,6 @@ void ResourcesProxyModel::setFiltersFromCategory(Category *category)
m_filters.category = category;
invalidateFilter();
emit categoryChanged();
- fetchSubcategories();
}
void ResourcesProxyModel::fetchSubcategories()