diff --git a/containmentactions/contextmenu/menu.cpp b/containmentactions/contextmenu/menu.cpp index 9e657e855..4ecea07a6 100644 --- a/containmentactions/contextmenu/menu.cpp +++ b/containmentactions/contextmenu/menu.cpp @@ -70,7 +70,6 @@ Menu::~Menu() m_moveToLayoutMenu->deleteLater(); //! actions - m_preferenceAction->deleteLater(); m_printAction->deleteLater(); m_removeAction->deleteLater(); m_quitApplication->deleteLater(); @@ -151,9 +150,9 @@ void Menu::makeActions() connect(m_moveToLayoutMenu, &QMenu::triggered, this, &Menu::moveToLayout); //! Configure Latte - m_preferenceAction = new QAction(QIcon::fromTheme("configure"), i18nc("global settings window", "&Configure Latte..."), this); - this->containment()->actions()->addAction(Latte::Data::ContextMenu::PREFERENCESACTION, m_preferenceAction); - connect(m_preferenceAction, &QAction::triggered, [=](){ + m_actions[Latte::Data::ContextMenu::PREFERENCESACTION] = new QAction(QIcon::fromTheme("configure"), i18nc("global settings window", "&Configure Latte..."), this); + this->containment()->actions()->addAction(Latte::Data::ContextMenu::PREFERENCESACTION, m_actions[Latte::Data::ContextMenu::PREFERENCESACTION]); + connect(m_actions[Latte::Data::ContextMenu::PREFERENCESACTION], &QAction::triggered, [=](){ QDBusInterface iface("org.kde.lattedock", "/Latte", "", QDBusConnection::sessionBus()); if (iface.isValid()) { @@ -221,7 +220,7 @@ QList Menu::contextualActions() actions << m_actions[Latte::Data::ContextMenu::SECTIONACTION]; //actions << m_printAction; actions << m_layoutsAction; - actions << m_preferenceAction; + actions << m_actions[Latte::Data::ContextMenu::PREFERENCESACTION]; actions << m_quitApplication; actions << m_actions[Latte::Data::ContextMenu::SEPARATOR1ACTION]; @@ -280,8 +279,6 @@ QAction *Menu::action(const QString &name) return m_layoutsAction; } else if (name == Latte::Data::ContextMenu::MOVEVIEWACTION) { return m_moveAction; - } else if (name == Latte::Data::ContextMenu::PREFERENCESACTION) { - return m_preferenceAction; } else if (name == Latte::Data::ContextMenu::QUITLATTEACTION) { return m_quitApplication; } else if (name == Latte::Data::ContextMenu::REMOVEVIEWACTION) { diff --git a/containmentactions/contextmenu/menu.h b/containmentactions/contextmenu/menu.h index dabdfd0d3..69bc980cf 100644 --- a/containmentactions/contextmenu/menu.h +++ b/containmentactions/contextmenu/menu.h @@ -55,7 +55,6 @@ private: QHash m_actions; - QAction *m_preferenceAction{nullptr}; QAction *m_printAction{nullptr}; QAction *m_removeAction{nullptr}; QAction *m_quitApplication{nullptr};