Commit 99fdd201 authored by David Edmundson's avatar David Edmundson Committed by Nate Graham
Browse files

Set add panel as an explicit menu of a panel action

This allows QtWayland to guess the parent correctly when displaying the
submenu. It also simplifies some code into a common path.

BUG: 432250


(cherry picked from commit 44a072b8)
parent fc86d383
......@@ -1746,19 +1746,19 @@ void ShellCorona::checkAddPanelAction(const QStringList &sycocaChanges)
QList<KPluginMetaData> templates = KPackage::PackageLoader::self()->findPackages(QStringLiteral("Plasma/LayoutTemplate"), QString(), filter);
if (panelContainmentPlugins.count() + templates.count() == 1) {
m_addPanelAction = new QAction(i18n("Add Panel"), this);
m_addPanelAction->setData(Plasma::Types::AddAction);
m_addPanelAction = new QAction(this);
connect(m_addPanelAction, SIGNAL(triggered(bool)), this, SLOT(addPanel()));
} else if (!panelContainmentPlugins.isEmpty()) {
m_addPanelAction = new QAction(this);
m_addPanelsMenu.reset(new QMenu);
m_addPanelAction = m_addPanelsMenu->menuAction();
m_addPanelAction->setText(i18n("Add Panel"));
m_addPanelAction->setData(Plasma::Types::AddAction);
m_addPanelAction->setMenu(m_addPanelsMenu.data());
connect(m_addPanelsMenu.data(), &QMenu::aboutToShow, this, &ShellCorona::populateAddPanelsMenu);
connect(m_addPanelsMenu.data(), SIGNAL(triggered(QAction *)), this, SLOT(addPanel(QAction *)));
}
if (m_addPanelAction) {
m_addPanelAction->setText(i18n("Add Panel"));
m_addPanelAction->setData(Plasma::Types::AddAction);
m_addPanelAction->setIcon(QIcon::fromTheme(QStringLiteral("list-add")));
actions()->addAction(QStringLiteral("add panel"), m_addPanelAction);
}
......
Supports Markdown
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