davidedmundson created this revision. davidedmundson added a reviewer: Plasma. Restricted Application added a project: Plasma. Restricted Application added a subscriber: plasma-devel.
REVISION SUMMARY When updating a menu we would always delete all the actions and recreate them. This caused a problem that we would also be deleting submenus and recreating them, meaning when we update the applet's submenu before showing it, our submenu will always be destroyed. This patch uses the DBusMenuItem IDs to re-use existing QAction / QMenu objects and only create new instances when needed. It should also be (in theory) faster as there's a lot less object creation every update. Also replace QSignalMapper with a lambda and replace replace QMap<int, QPointer<QAction*> with QMap<int, QAction*> and a lambda to do cleanup on deletion. TEST PLAN Tweked the applet to update before showing Original QMenu object used before showing still has all the items REPOSITORY R120 Plasma Workspace REVISION DETAIL https://phabricator.kde.org/D4057 AFFECTED FILES libdbusmenuqt/dbusmenuimporter.cpp EMAIL PREFERENCES https://phabricator.kde.org/settings/panel/emailpreferences/ To: davidedmundson, #plasma Cc: plasma-devel, lesliezhai, ali-mohamed, jensreuterberg, abetts, andreaska, sebas