1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-23 13:33:50 +03:00

context:SwitchLayouts action in hash

This commit is contained in:
Michail Vourlakos 2021-06-08 20:35:15 +03:00
parent 7314f40e93
commit 6c10be18a3
2 changed files with 9 additions and 16 deletions

View File

@ -67,7 +67,8 @@ Menu::~Menu()
m_moveToLayoutMenu->deleteLater();
//! clear menu actions that have been created from submenus
m_actions.remove(Latte::Data::ContextMenu::ADDVIEWACTION)
m_actions.remove(Latte::Data::ContextMenu::ADDVIEWACTION);
m_actions.remove(Latte::Data::ContextMenu::LAYOUTSACTION);
//! actions
qDeleteAll(m_actions.values());
@ -116,11 +117,11 @@ void Menu::makeActions()
//! Layouts submenu
m_switchLayoutsMenu = new QMenu;
m_layoutsAction = m_switchLayoutsMenu->menuAction();
m_layoutsAction->setText(i18n("&Layouts"));
m_layoutsAction->setIcon(QIcon::fromTheme("user-identity"));
m_layoutsAction->setStatusTip(i18n("Switch to another layout"));
this->containment()->actions()->addAction(Latte::Data::ContextMenu::LAYOUTSACTION, m_layoutsAction);
m_actions[Latte::Data::ContextMenu::LAYOUTSACTION] = m_switchLayoutsMenu->menuAction();
m_actions[Latte::Data::ContextMenu::LAYOUTSACTION]->setText(i18n("&Layouts"));
m_actions[Latte::Data::ContextMenu::LAYOUTSACTION]->setIcon(QIcon::fromTheme("user-identity"));
m_actions[Latte::Data::ContextMenu::LAYOUTSACTION]->setStatusTip(i18n("Switch to another layout"));
this->containment()->actions()->addAction(Latte::Data::ContextMenu::LAYOUTSACTION, m_actions[Latte::Data::ContextMenu::LAYOUTSACTION]);
connect(m_switchLayoutsMenu, &QMenu::aboutToShow, this, &Menu::populateLayouts);
connect(m_switchLayoutsMenu, &QMenu::triggered, this, &Menu::switchToLayout);
@ -218,7 +219,7 @@ QList<QAction *> Menu::contextualActions()
actions << m_actions[Latte::Data::ContextMenu::SECTIONACTION];
//actions << m_actions[Latte::Data::ContextMenu::PRINTACTION];
actions << m_layoutsAction;
actions << m_actions[Latte::Data::ContextMenu::LAYOUTSACTION];
actions << m_actions[Latte::Data::ContextMenu::PREFERENCESACTION];
actions << m_actions[Latte::Data::ContextMenu::QUITLATTEACTION];
@ -272,9 +273,7 @@ QList<QAction *> Menu::contextualActions()
QAction *Menu::action(const QString &name)
{
if (name == Latte::Data::ContextMenu::LAYOUTSACTION) {
return m_layoutsAction;
} else if (name == Latte::Data::ContextMenu::MOVEVIEWACTION) {
if (name == Latte::Data::ContextMenu::MOVEVIEWACTION) {
return m_moveAction;
}
@ -313,10 +312,6 @@ void Menu::updateVisibleActions()
return;
}
//! LAYOUTSACTION
// m_layoutsAction->setVisible(m_actionsAlwaysShown.contains(Data::ContextMenu::LAYOUTSACTION
// || ()))
m_actions[Latte::Data::ContextMenu::EDITVIEWACTION]->setVisible(!configuring);
m_actions[Latte::Data::ContextMenu::EXPORTVIEWTEMPLATEACTION]->setVisible(configuring);
m_moveAction->setVisible(configuring);

View File

@ -56,8 +56,6 @@ private:
QHash<QString, QAction *> m_actions;
QMenu *m_addViewMenu{nullptr};
QAction *m_layoutsAction{nullptr};
QMenu *m_switchLayoutsMenu{nullptr};
QAction *m_moveAction{nullptr};