diff --git a/applets/kicker/plugin/actionlist.cpp b/applets/kicker/plugin/actionlist.cpp --- a/applets/kicker/plugin/actionlist.cpp +++ b/applets/kicker/plugin/actionlist.cpp @@ -319,9 +319,9 @@ Q_GLOBAL_STATIC(MenuEntryEditor, menuEntryEditor) -bool canEditApplication(const QString &entryPath) +bool canEditApplication(const KService::Ptr &service) { - return menuEntryEditor->canEdit(entryPath); + return (service->isApplication() && menuEntryEditor->canEdit(service->entryPath())); } void editApplication(const QString &entryPath, const QString &menuId) @@ -333,7 +333,7 @@ { QVariantList actionList; - if (canEditApplication(service->entryPath())) { + if (canEditApplication(service)) { QVariantMap editAction = Kicker::createActionItem(i18n("Edit Application..."), "editApplication"); editAction["icon"] = "kmenuedit"; // TODO: Using the KMenuEdit icon might be misleading. actionList << editAction; @@ -345,7 +345,7 @@ bool handleEditApplicationAction(const QString &actionId, const KService::Ptr &service) { - if (service && actionId == "editApplication" && canEditApplication(service->entryPath())) { + if (service && actionId == "editApplication" && canEditApplication(service)) { Kicker::editApplication(service->entryPath(), service->menuId()); return true; diff --git a/applets/kicker/plugin/runnermatchesmodel.cpp b/applets/kicker/plugin/runnermatchesmodel.cpp --- a/applets/kicker/plugin/runnermatchesmodel.cpp +++ b/applets/kicker/plugin/runnermatchesmodel.cpp @@ -102,13 +102,21 @@ actionList << item; } - if (!actionList.isEmpty()) { - actionList << Kicker::createSeparatorActionItem(); + // Only try to get a KService for matches from the services runner. Assuming + // that any other runner returns something we want to turn into a KService is + // unsafe, e.g. files from the Baloo runner might match a storageId just by + // accident, creating a dangerous false positive. + if (match.runner()->id() != QLatin1String("services")) { + return actionList; } const KService::Ptr service = KService::serviceByStorageId(match.data().toString()); if (service) { + if (!actionList.isEmpty()) { + actionList << Kicker::createSeparatorActionItem(); + } + const QVariantList &jumpListActions = Kicker::jumpListActions(service); if (!jumpListActions.isEmpty()) { actionList << jumpListActions << Kicker::createSeparatorActionItem();