Commit f235bdd8 authored by Nate Graham's avatar Nate Graham 🔩

[Task Manager] Don't show redundant "Actions" header in context menu with nothing but actions in it

Summary:
Previously, the {nav Actions} header was always shown, even when the context menu
consisted of nothing but actions. This is unnecessary since a menu's normal state is
to show nothing but actions.

With this patch, the {nav Actions} header is only shown for context menus that have
more than one section.

Test Plan:
Context menu with only actions: {F6795048}

Context menu with nore than just actions: {F6795049}

Reviewers: broulik, #plasma, hein

Reviewed By: #plasma, hein

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D20846
parent 5ee0114c
......@@ -119,13 +119,18 @@ PlasmaComponents.ContextMenu {
var maximumWidth = LayoutManager.maximumContextMenuTextWidth();
sections.forEach(function (section) {
// Always show the "Actions:" header, since we visually merge
// This section with the one beneath it that shows universal actions
if (section["actions"].length > 0 || section["group"] == "actions") {
var sectionHeader = newMenuItem(menu);
sectionHeader.text = section["title"];
sectionHeader.section = true;
menu.addMenuItem(sectionHeader, startNewInstanceItem);
// Don't add the "Actions" header if the menu has nothing but actions
// in it, because then it's redundant (all menus have actions)
if (
(section["group"] != "actions") ||
(section["group"] == "actions" && (sections[0]["actions"].length > 0 || sections[1]["actions"].length > 0))
) {
var sectionHeader = newMenuItem(menu);
sectionHeader.text = section["title"];
sectionHeader.section = true;
menu.addMenuItem(sectionHeader, startNewInstanceItem);
}
}
for (var i = 0; i < section["actions"].length; ++i) {
......
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