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

snap: readability

Use the right signal when using StoredResultsStream
parent cd52626a
......@@ -243,8 +243,7 @@ void DiscoverObject::openLocalPackage(const QUrl& localfile)
AbstractResourcesBackend::Filters f;
f.resourceUrl = localfile;
auto stream = new StoredResultsStream({ResourcesModel::global()->search(f)});
connect(stream, &StoredResultsStream::finished, this, [this, localfile, stream]() {
const auto res = stream->resources();
connect(stream, &StoredResultsStream::finishedResources, this, [this, localfile](const QVector<AbstractResource*> &res) {
if (res.count() == 1) {
emit openApplicationInternal(res.first());
} else {
......@@ -279,8 +278,7 @@ void DiscoverObject::openApplication(const QUrl& url)
AbstractResourcesBackend::Filters f;
f.resourceUrl = url;
auto stream = new StoredResultsStream({ResourcesModel::global()->search(f)});
connect(stream, &StoredResultsStream::finished, this, [this, url, stream]() {
const auto res = stream->resources();
connect(stream, &StoredResultsStream::finishedResources, this, [this, url](const QVector<AbstractResource*> &res) {
if (res.count() >= 1) {
emit openApplicationInternal(res.first());
} else {
......
......@@ -216,9 +216,9 @@ QString SnapBackend::displayName() const
void SnapBackend::refreshStates()
{
auto ret = new StoredResultsStream({populate(m_client.list())});
connect(ret, &StoredResultsStream::finished, this, [this, ret](){
connect(ret, &StoredResultsStream::finishedResources, this, [this] (const QVector<AbstractResource*>& resources){
for (auto res: qAsConst(m_resources)) {
if (ret->resources().contains(res))
if (resources.contains(res))
res->setState(AbstractResource::Installed);
else
res->setState(AbstractResource::None);
......
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