Commit ad97508a authored by David Redondo's avatar David Redondo 🏎
Browse files

Hardcode icons for default plasma components

Unfortunately are components free to choose their unique component name any way
they like, that means we have no chance to reasonably map a KService/icon to a
component if its identifier is chosen badly. For presentation purposes we can
at least hardcode some icons for components that are active in a default plasma
parent e7c8cb4e
......@@ -113,7 +113,23 @@ Component ShortcutsModel::loadComponent(const QList<KGlobalShortcutInfo> &info)
const QString type = service && service->isApplication() ? i18n("Applications") : i18n("System Services");
const QString icon = service && !service->icon().isEmpty() ? service->icon() : componentUnique;
QString icon;
static const QHash<QString, QString> hardCodedIcons = {
{"ActivityManager", "preferences-desktop-activities"},
{"KDE Keyboard Layout Switcher", "input-keyboard"},
{"krunner.desktop", "krunner"},
{"org_kde_powerdevil", "preferences-system-power-management"}
if(service && !service->icon().isEmpty()) {
icon = service->icon();
} else if (hardCodedIcons.contains(componentUnique)) {
icon = hardCodedIcons[componentUnique];
} else {
icon = componentUnique;
Component c{componentUnique, componentFriendly, type, icon, QVector<Shortcut>(), false, false};
for (const auto &action : info) {
const QString &actionUnique = action.uniqueName();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment