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 (Kicker::canEdit(service->entryPath())) { | ||||
128 | actionList << Kicker::createSeparatorActionItem(); | ||||
broulik: You always add a separator at the end, so this isn't strictly neccessary (QMenu is smart enough… | |||||
129 | | ||||
130 | QVariantMap editAction = Kicker::createActionItem(i18n("Edit Application..."), "editApplication"); | ||||
131 | editAction["icon"] = "kmenuedit"; // TODO: Using the KMenuEdit icon might be misleading. | ||||
132 | actionList << editAction; | ||||
133 | } | ||||
134 | | ||||
135 | if (service->isApplication()) { | ||||
136 | actionList << Kicker::appstreamActions(service); | ||||
137 | } | ||||
125 | } | 138 | } | ||
126 | 139 | | |||
127 | return actionList; | 140 | return actionList; | ||
128 | } | 141 | } | ||
129 | 142 | | |||
130 | return QVariant(); | 143 | return QVariant(); | ||
131 | } | 144 | } | ||
132 | 145 | | |||
Show All 11 Lines | 152 | { | |||
144 | Plasma::QueryMatch match = m_matches.at(row); | 157 | Plasma::QueryMatch match = m_matches.at(row); | ||
145 | 158 | | |||
146 | if (!match.isEnabled()) { | 159 | if (!match.isEnabled()) { | ||
147 | return false; | 160 | return false; | ||
148 | } | 161 | } | ||
149 | 162 | | |||
150 | QObject *appletInterface = static_cast<RunnerModel *>(parent())->appletInterface(); | 163 | QObject *appletInterface = static_cast<RunnerModel *>(parent())->appletInterface(); | ||
151 | 164 | | |||
152 | KService::Ptr service = KService::serviceByStorageId(match.data().toString()); | 165 | const KService::Ptr service = KService::serviceByStorageId(match.data().toString()); | ||
153 | 166 | | |||
154 | if (Kicker::handleAddLauncherAction(actionId, appletInterface, service)) { | 167 | if (Kicker::handleAddLauncherAction(actionId, appletInterface, service)) { | ||
155 | return true; | 168 | return true; | ||
169 | } else if (actionId == "editApplication" && Kicker::canEdit(service->entryPath())) { | ||||
170 | Kicker::edit(service->entryPath(), service->menuId()); | ||||
171 | | ||||
172 | return true; | ||||
173 | } else if (actionId == "manageApplication") { | ||||
174 | return QDesktopServices::openUrl(QUrl(argument.toString())); | ||||
156 | } else if (actionId == QLatin1String("_kicker_jumpListAction")) { | 175 | } else if (actionId == QLatin1String("_kicker_jumpListAction")) { | ||
157 | return KRun::run(argument.toString(), {}, nullptr, service ? service->name() : QString(), service ? service->icon() : QString()); | 176 | return KRun::run(argument.toString(), {}, nullptr, service ? service->name() : QString(), service ? service->icon() : QString()); | ||
158 | } else if (actionId == QLatin1String("_kicker_recentDocument") | 177 | } else if (actionId == QLatin1String("_kicker_recentDocument") | ||
159 | || actionId == QLatin1String("_kicker_forgetRecentDocuments")) { | 178 | || actionId == QLatin1String("_kicker_forgetRecentDocuments")) { | ||
160 | return Kicker::handleRecentDocumentAction(service, actionId, argument); | 179 | return Kicker::handleRecentDocumentAction(service, actionId, argument); | ||
161 | } | 180 | } | ||
162 | 181 | | |||
163 | if (!actionId.isEmpty()) { | 182 | 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)