From bbe0148db5d13dad793c644104b0d4c2ba4dcd20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Feber?= Date: Mon, 21 Oct 2019 19:25:08 +0200 Subject: [PATCH] Improve panel options menu entries Summary: - Move "Panel Options" context menu items out of submenu - Rename "Configure Panel..." option See M144, T10047, T10190. This makes the panel customization options much more discoverable. Test Plan: Open the panel context menu. Reviewers: #plasma, #vdg, mart Reviewed By: #plasma, #vdg, mart Subscribers: davidedmundson, ngraham, #vdg, kde-frameworks-devel, #plasma Tags: #frameworks Maniphest Tasks: T10190, T11094, T10402 Differential Revision: https://phabricator.kde.org/D23951 --- src/plasma/containment.cpp | 7 ++++- .../qml/plasmoid/containmentinterface.cpp | 29 ++----------------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/src/plasma/containment.cpp b/src/plasma/containment.cpp index 25d3272b2..955c606e7 100644 --- a/src/plasma/containment.cpp +++ b/src/plasma/containment.cpp @@ -122,7 +122,12 @@ void Containment::init() QAction *configAction = actions()->action(QStringLiteral("configure")); if (configAction) { - configAction->setText(i18nc("%1 is the name of the applet", "Configure %1...", title())); + if (d->type == Types::PanelContainment || d->type == Types::CustomPanelContainment) { + configAction->setText(i18nc("%1 is the name of the containment", "Edit %1...", title())); + configAction->setIcon(QIcon::fromTheme(QStringLiteral("document-edit"))); + } else { + configAction->setText(i18nc("%1 is the name of the applet", "Configure %1...", title())); + } } QAction *appletBrowserAction = actions()->action(QStringLiteral("add widgets")); diff --git a/src/scriptengines/qml/plasmoid/containmentinterface.cpp b/src/scriptengines/qml/plasmoid/containmentinterface.cpp index 0900ddd08..95cc421b3 100644 --- a/src/scriptengines/qml/plasmoid/containmentinterface.cpp +++ b/src/scriptengines/qml/plasmoid/containmentinterface.cpp @@ -1129,34 +1129,9 @@ void ContainmentInterface::addAppletActions(QMenu *desktopMenu, Plasma::Applet * } } - QMenu *containmentMenu = new QMenu(i18nc("%1 is the name of the containment", "%1 Options", m_containment->title()), desktopMenu); if (m_containment->containmentType() != Plasma::Types::DesktopContainment) { - addContainmentActions(containmentMenu, event); - } - - if (!containmentMenu->isEmpty()) { - int enabled = 0; - //count number of real actions - QListIterator actionsIt(containmentMenu->actions()); - while (enabled < 3 && actionsIt.hasNext()) { - QAction *action = actionsIt.next(); - if (action->isVisible() && !action->isSeparator()) { - ++enabled; - } - } - - if (enabled) { - //if there is only one, don't create a submenu - if (enabled < 2) { - foreach (QAction *action, containmentMenu->actions()) { - if (action->isVisible() && !action->isSeparator()) { - desktopMenu->addAction(action); - } - } - } else { - desktopMenu->addMenu(containmentMenu); - } - } + desktopMenu->addSeparator(); + addContainmentActions(desktopMenu, event); } if (m_containment->immutability() == Plasma::Types::Mutable &&