Changeset View
Changeset View
Standalone View
Standalone View
applets/kicker/plugin/runnermatchesmodel.cpp
Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Line(s) | 95 | foreach (QAction *action, m_runnerManager->actionsForMatch(match)) { | |||
---|---|---|---|---|---|
99 | 99 | | |||
100 | actionList << item; | 100 | actionList << item; | ||
101 | } | 101 | } | ||
102 | 102 | | |||
103 | if (!actionList.isEmpty()) { | 103 | if (!actionList.isEmpty()) { | ||
104 | actionList << Kicker::createSeparatorActionItem(); | 104 | actionList << Kicker::createSeparatorActionItem(); | ||
105 | } | 105 | } | ||
106 | 106 | | |||
107 | KService::Ptr service = KService::serviceByStorageId(match.data().toString()); | 107 | const KService::Ptr service = KService::serviceByStorageId(match.data().toString()); | ||
108 | | ||||
108 | if (service) { | 109 | if (service) { | ||
109 | const QVariantList &jumpListActions = Kicker::jumpListActions(service); | 110 | const QVariantList &jumpListActions = Kicker::jumpListActions(service); | ||
110 | if (!jumpListActions.isEmpty()) { | 111 | if (!jumpListActions.isEmpty()) { | ||
111 | actionList << jumpListActions << Kicker::createSeparatorActionItem(); | 112 | actionList << jumpListActions << Kicker::createSeparatorActionItem(); | ||
112 | } | 113 | } | ||
113 | 114 | | |||
114 | QObject *appletInterface = static_cast<RunnerModel *>(parent())->appletInterface(); | 115 | QObject *appletInterface = static_cast<RunnerModel *>(parent())->appletInterface(); | ||
115 | 116 | | |||
116 | const QVariantList &addLauncherActions = Kicker::createAddLauncherActionList(appletInterface, service); | 117 | const QVariantList &addLauncherActions = Kicker::createAddLauncherActionList(appletInterface, service); | ||
117 | if (!addLauncherActions.isEmpty()) { | 118 | if (!addLauncherActions.isEmpty()) { | ||
118 | actionList << addLauncherActions << Kicker::createSeparatorActionItem(); | 119 | actionList << addLauncherActions << Kicker::createSeparatorActionItem(); | ||
119 | } | 120 | } | ||
120 | 121 | | |||
121 | const QVariantList &recentDocuments = Kicker::recentDocumentActions(service); | 122 | const QVariantList &recentDocuments = Kicker::recentDocumentActions(service); | ||
122 | if (!recentDocuments.isEmpty()) { | 123 | if (!recentDocuments.isEmpty()) { | ||
123 | actionList << recentDocuments << Kicker::createSeparatorActionItem(); | 124 | actionList << recentDocuments << Kicker::createSeparatorActionItem(); | ||
124 | } | 125 | } | ||
126 | | ||||
127 | if (service->isApplication()) { | ||||
128 | actionList << Kicker::createSeparatorActionItem(); | ||||
broulik: You always add a separator at the end, so this isn't strictly neccessary (QMenu is smart enough… | |||||
129 | actionList << Kicker::editApplicationAction(service); | ||||
130 | actionList << Kicker::appstreamActions(service); | ||||
131 | } | ||||
125 | } | 132 | } | ||
126 | 133 | | |||
127 | return actionList; | 134 | return actionList; | ||
128 | } | 135 | } | ||
129 | 136 | | |||
130 | return QVariant(); | 137 | return QVariant(); | ||
131 | } | 138 | } | ||
132 | 139 | | |||
Show All 11 Lines | 146 | { | |||
144 | Plasma::QueryMatch match = m_matches.at(row); | 151 | Plasma::QueryMatch match = m_matches.at(row); | ||
145 | 152 | | |||
146 | if (!match.isEnabled()) { | 153 | if (!match.isEnabled()) { | ||
147 | return false; | 154 | return false; | ||
148 | } | 155 | } | ||
149 | 156 | | |||
150 | QObject *appletInterface = static_cast<RunnerModel *>(parent())->appletInterface(); | 157 | QObject *appletInterface = static_cast<RunnerModel *>(parent())->appletInterface(); | ||
151 | 158 | | |||
152 | KService::Ptr service = KService::serviceByStorageId(match.data().toString()); | 159 | const KService::Ptr service = KService::serviceByStorageId(match.data().toString()); | ||
153 | 160 | | |||
154 | if (Kicker::handleAddLauncherAction(actionId, appletInterface, service)) { | 161 | if (Kicker::handleAddLauncherAction(actionId, appletInterface, service)) { | ||
155 | return true; | 162 | return true; | ||
163 | } else if (Kicker::handleEditApplicationAction(actionId, service)) { | ||||
164 | return true; | ||||
165 | } else if (Kicker::handleAppstreamActions(actionId, argument)) { | ||||
166 | return true; | ||||
156 | } else if (actionId == QLatin1String("_kicker_jumpListAction")) { | 167 | } else if (actionId == QLatin1String("_kicker_jumpListAction")) { | ||
157 | return KRun::run(argument.toString(), {}, nullptr, service ? service->name() : QString(), service ? service->icon() : QString()); | 168 | return KRun::run(argument.toString(), {}, nullptr, service ? service->name() : QString(), service ? service->icon() : QString()); | ||
158 | } else if (actionId == QLatin1String("_kicker_recentDocument") | 169 | } else if (actionId == QLatin1String("_kicker_recentDocument") | ||
159 | || actionId == QLatin1String("_kicker_forgetRecentDocuments")) { | 170 | || actionId == QLatin1String("_kicker_forgetRecentDocuments")) { | ||
160 | return Kicker::handleRecentDocumentAction(service, actionId, argument); | 171 | return Kicker::handleRecentDocumentAction(service, actionId, argument); | ||
161 | } | 172 | } | ||
162 | 173 | | |||
163 | if (!actionId.isEmpty()) { | 174 | if (!actionId.isEmpty()) { | ||
▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines |
You always add a separator at the end, so this isn't strictly neccessary (QMenu is smart enough to collapse double separators, though)