Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 4ff88014 authored by Eike Hein's avatar Eike Hein

Don't show appstream action if we can't find an app to open appstream:// URLs.

Summary: BUG:383292

Reviewers: #plasma, broulik, apol

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D7227
parent acfa86c7
......@@ -40,6 +40,7 @@
#include <KJob>
#include <KLocalizedString>
#include <KMimeTypeTrader>
#include <KProtocolInfo>
#include <KRun>
#include <KSycoca>
#include <KShell>
......@@ -146,11 +147,22 @@ Q_GLOBAL_STATIC(AppStream::Pool, appstreamPool)
QVariantList appstreamActions(const KService::Ptr &service)
{
QVariantList ret;
const KService::Ptr appStreamHandler = KMimeTypeTrader::self()->preferredService(QStringLiteral("x-scheme-handler/appstream"));
// Don't show action if we can't find any app to handle appstream:// URLs.
if (!appStreamHandler) {
if (!KProtocolInfo::isHelperProtocol(QStringLiteral("appstream"))
|| KProtocolInfo::exec(QStringLiteral("appstream")).isEmpty()) {
return ret;
}
}
if (!appstreamPool.exists()) {
appstreamPool->load();
}
QVariantList ret;
const auto components = appstreamPool->componentsById(service->desktopEntryName()+QLatin1String(".desktop"));
for(const auto &component: components) {
const QString componentId = component.id();
......
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