Commit 31a4cdd8 authored by Alexander Lohnau's avatar Alexander Lohnau 💬 Committed by Nate Graham
Browse files

De-duplicate 'Uninstall or manage addons' option in the context menu of Kickoff

If we have multiple sources for the application, we end up with multiple entries.
This is not useful in any scenario, because the generated appstream URL
is exactly the same.

Consequently we should return from the function when we created the first action.

BUG: 448564


(cherry picked from commit 7024a328)
parent fb5656ea
Pipeline #134456 passed with stage
in 11 minutes and 50 seconds
......@@ -413,15 +413,13 @@ Q_GLOBAL_STATIC(AppStream::Pool, appstreamPool)
QVariantList appstreamActions(const KService::Ptr &service)
{
QVariantList ret;
#ifdef HAVE_APPSTREAMQT
const KService::Ptr appStreamHandler = KApplicationTrader::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;
return {};
}
}
......@@ -437,13 +435,14 @@ QVariantList appstreamActions(const KService::Ptr &service)
appStreamHandler->icon(),
"manageApplication",
QVariant(QLatin1String("appstream://") + componentId));
ret << appstreamAction;
// Only process the first element. In case we have system provided and flatpack sources we would end up with duplicated entries
return {appstreamAction};
}
#else
Q_UNUSED(service)
#endif
return ret;
return {};
}
bool handleAppstreamActions(const QString &actionId, const QVariant &argument)
......
Supports Markdown
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