Currently, action submenus (X-KDE-Submenu) have no icons.
This patch makes it inherit the icon of the first action.
There will always be at least one action, since empty submenus are
eliminated earlier in the function.
If the icon of the first action is empty, it will gracefully revert to
old behavior (not having an icon).

Please find the single-line patch attached (I have little desire to make
yet another account in phabricator, especially for such a small patch,
and was encouraged to send the patch via email on irc).
diff --git a/src/widgets/kfileitemactions.cpp b/src/widgets/kfileitemactions.cpp
index f5f4a55a..f487002a 100644
--- a/src/widgets/kfileitemactions.cpp
+++ b/src/widgets/kfileitemactions.cpp
@@ -165,6 +165,7 @@ int KFileItemActionsPrivate::insertServicesSubmenus(const QMap<QString, ServiceL
         QMenu *actionSubmenu = new QMenu(menu);
         actionSubmenu->setTitle(it.key());
         actionSubmenu->menuAction()->setObjectName(QStringLiteral("services_submenu")); // for the unittest
+        actionSubmenu->setIcon(QIcon::fromTheme(it.value().first().icon()))
         menu->addMenu(actionSubmenu);
         count += insertServices(it.value(), actionSubmenu, isBuiltin);
     }

Attachment: 0xEB24BAD412DE2823.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to