Commit 8297ea2b authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

No need to show a list for appstream://

If the user wants a different source, there's UI in the application page
to do so.
The delegates don't specify the source anyway.
parent b65429d9
......@@ -217,7 +217,30 @@ void DiscoverObject::openLocalPackage(const QUrl& localfile)
void DiscoverObject::openApplication(const QUrl& url)
{
Q_ASSERT(!url.isEmpty());
Q_EMIT openUrl(url);
rootObject()->setProperty("defaultStartup", false);
auto action = new OneTimeAction(
[this, 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();
qDebug() << "results..." << res;
if (res.count() == 1) {
emit openApplicationInternal(res.first());
} else {
rootObject()->setProperty("defaultStartup", true);
showPassiveNotification(i18n("Couldn't open %1", url.toDisplayString()));
}
});
}
, this);
if (ResourcesModel::global()->backends().isEmpty()) {
connect(ResourcesModel::global(), &ResourcesModel::backendsChanged, action, &OneTimeAction::trigger);
} else {
action->trigger();
}
}
void DiscoverObject::integrateObject(QObject* object)
......
......@@ -76,7 +76,6 @@ class DiscoverObject : public QObject
Q_SIGNALS:
void openSearch(const QString &search);
void openApplicationInternal(AbstractResource* app);
void openUrl(const QUrl& url);
void listMimeInternal(const QString& mime);
void listCategoryInternal(Category* cat);
......
......@@ -97,10 +97,6 @@ Kirigami.ApplicationWindow
Navigation.clearStack()
Navigation.openApplication(app)
}
onOpenUrl: {
currentTopLevel = topBrowsingComp;
Navigation.openUrlResources(url)
}
onListMimeInternal: {
currentTopLevel = topBrowsingComp;
Navigation.openApplicationMime(mime)
......
......@@ -27,11 +27,6 @@ function openApplicationListSource(origin) {
openApplicationList({ originFilter: origin, title: origin, allBackends: true })
}
function openUrlResources(uri) {
clearStack()
openApplicationList({ resourcesUrl: uri, title: uri, allBackends: true })
}
function openApplicationMime(mime) {
clearStack()
openApplicationList({ mimeTypeFilter: mime, title: i18n("Resources for '%1'", mime) })
......
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