MCPcopy Create free account
hub / github.com/KDE/kdevelop / actionsForApplications

Method actionsForApplications

plugins/openwith/openwithplugin.cpp:312–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310}
311
312QList<QAction*> OpenWithPlugin::actionsForApplications(QWidget* parent)
313{
314 const auto services = KApplicationTrader::queryByMimeType(m_mimeType);
315 QList<QAction*> actions;
316 actions.reserve(services.size());
317
318 for (const auto& service : services) {
319 const bool isDefault = m_defaultOpener.isValid() && service == m_defaultOpener;
320 auto* action = createAction(service->name(), service->icon(), parent, isDefault);
321 connect(action, &QAction::triggered, this, [this, service]() {
322 openApplication(service);
323 });
324 actions << action;
325 }
326
327 // queryByMimeType returns the preferred service in the first position, let's keep it there
328 const auto sortOffset = 1;
329 return sortedActions(std::move(actions), sortOffset);
330}
331
332void OpenWithPlugin::openDefault() const
333{

Callers

nothing calls this directly

Calls 7

createActionFunction · 0.85
sortedActionsFunction · 0.85
reserveMethod · 0.45
sizeMethod · 0.45
isValidMethod · 0.45
nameMethod · 0.45
iconMethod · 0.45

Tested by

no test coverage detected