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
This commit is contained in:
Björn Feber 2019-10-21 19:25:08 +02:00
parent acbb200ac2
commit bbe0148db5
2 changed files with 8 additions and 28 deletions

View File

@ -122,7 +122,12 @@ void Containment::init()
QAction *configAction = actions()->action(QStringLiteral("configure")); QAction *configAction = actions()->action(QStringLiteral("configure"));
if (configAction) { 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")); QAction *appletBrowserAction = actions()->action(QStringLiteral("add widgets"));

View File

@ -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) { if (m_containment->containmentType() != Plasma::Types::DesktopContainment) {
addContainmentActions(containmentMenu, event); desktopMenu->addSeparator();
} addContainmentActions(desktopMenu, event);
if (!containmentMenu->isEmpty()) {
int enabled = 0;
//count number of real actions
QListIterator<QAction *> 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);
}
}
} }
if (m_containment->immutability() == Plasma::Types::Mutable && if (m_containment->immutability() == Plasma::Types::Mutable &&