diff --git a/applets/kicker/plugin/appentry.cpp b/applets/kicker/plugin/appentry.cpp --- a/applets/kicker/plugin/appentry.cpp +++ b/applets/kicker/plugin/appentry.cpp @@ -141,28 +141,27 @@ return true; } +#ifdef HAVE_APPSTREAMQT +Q_GLOBAL_STATIC(AppStream::Pool, appstreamPool) + QVariantList appstreamActions(const KService::Ptr &service) { -#ifdef HAVE_APPSTREAMQT - static AppStream::Pool pool; - if (!pool.load()) { - return {}; + if (!appstreamPool.exists()) { + appstreamPool->load(); } QVariantList ret; - const auto components = pool.componentsById(service->desktopEntryName()+QLatin1String(".desktop")); + const auto components = appstreamPool->componentsById(service->desktopEntryName()+QLatin1String(".desktop")); for(const auto &component: components) { const QString componentId = component.id(); QVariantMap appstreamAction = Kicker::createActionItem(i18nc("@action opens a software center with the application", "Manage '%1'...", component.name()), "manageApplication", QVariant(QStringLiteral("appstream://") + componentId)); appstreamAction[QStringLiteral("icon")] = QStringLiteral("applications-other"); ret << appstreamAction; } return ret; -#else - return {}; -#endif } +#endif QVariantList AppEntry::actions() const { @@ -202,9 +201,11 @@ actionList << editAction; } +#ifdef HAVE_APPSTREAMQT if (m_service->isApplication()) { actionList << appstreamActions(m_service); } +#endif QQmlPropertyMap *appletConfig = qobject_cast(appletInterface->property("configuration").value());