Changeset View
Changeset View
Standalone View
Standalone View
applets/kicker/plugin/runnermatchesmodel.cpp
Show First 20 Lines • Show All 96 Lines • ▼ Show 20 Line(s) | 94 | } else if (role == Kicker::ActionListRole) { | |||
---|---|---|---|---|---|
97 | foreach (QAction *action, m_runnerManager->actionsForMatch(match)) { | 97 | foreach (QAction *action, m_runnerManager->actionsForMatch(match)) { | ||
98 | QVariantMap item = Kicker::createActionItem(action->text(), "runnerAction", | 98 | QVariantMap item = Kicker::createActionItem(action->text(), "runnerAction", | ||
99 | QVariant::fromValue<QObject *>(action)); | 99 | QVariant::fromValue<QObject *>(action)); | ||
100 | item["icon"] = action->icon(); | 100 | item["icon"] = action->icon(); | ||
101 | 101 | | |||
102 | actionList << item; | 102 | actionList << item; | ||
103 | } | 103 | } | ||
104 | 104 | | |||
105 | if (!actionList.isEmpty()) { | 105 | // Only try to get a KService for matches from the services runner. Assuming | ||
106 | actionList << Kicker::createSeparatorActionItem(); | 106 | // that any other runner returns something we want to turn into a KService is | ||
107 | // unsafe, e.g. files from the Baloo runner might match a storageId just by | ||||
108 | // accident, creating a dangerous false positive. | ||||
109 | if (match.runner()->id() != QLatin1String("services")) { | ||||
110 | return actionList; | ||||
107 | } | 111 | } | ||
108 | 112 | | |||
109 | const KService::Ptr service = KService::serviceByStorageId(match.data().toString()); | 113 | const KService::Ptr service = KService::serviceByStorageId(match.data().toString()); | ||
110 | 114 | | |||
111 | if (service) { | 115 | if (service) { | ||
116 | if (!actionList.isEmpty()) { | ||||
117 | actionList << Kicker::createSeparatorActionItem(); | ||||
118 | } | ||||
119 | | ||||
112 | const QVariantList &jumpListActions = Kicker::jumpListActions(service); | 120 | const QVariantList &jumpListActions = Kicker::jumpListActions(service); | ||
113 | if (!jumpListActions.isEmpty()) { | 121 | if (!jumpListActions.isEmpty()) { | ||
114 | actionList << jumpListActions << Kicker::createSeparatorActionItem(); | 122 | actionList << jumpListActions << Kicker::createSeparatorActionItem(); | ||
115 | } | 123 | } | ||
116 | 124 | | |||
117 | QObject *appletInterface = static_cast<RunnerModel *>(parent())->appletInterface(); | 125 | QObject *appletInterface = static_cast<RunnerModel *>(parent())->appletInterface(); | ||
118 | 126 | | |||
119 | const bool systemImmutable = appletInterface->property("immutability").toInt() == Plasma::Types::SystemImmutable; | 127 | const bool systemImmutable = appletInterface->property("immutability").toInt() == Plasma::Types::SystemImmutable; | ||
▲ Show 20 Lines • Show All 131 Lines • Show Last 20 Lines |