From 5e55abbff514b188e6b14f6b1ea29635ce5332b6 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Fri, 27 Aug 2021 08:29:54 +0300 Subject: [PATCH] context:use restore() provided function containment() is not accessible during the containment actions constructor. We now use the provided ::restore() function in order to load the actions BUG:441448 --- containmentactions/contextmenu/menu.cpp | 7 +++++-- containmentactions/contextmenu/menu.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/containmentactions/contextmenu/menu.cpp b/containmentactions/contextmenu/menu.cpp index 6ad286d32..0576edb6b 100644 --- a/containmentactions/contextmenu/menu.cpp +++ b/containmentactions/contextmenu/menu.cpp @@ -56,7 +56,6 @@ enum LatteConfigPage Menu::Menu(QObject *parent, const QVariantList &args) : Plasma::ContainmentActions(parent, args) { - makeActions(); } Menu::~Menu() @@ -75,8 +74,12 @@ Menu::~Menu() m_actions.clear(); } -void Menu::makeActions() +void Menu::restore(const KConfigGroup &config) { + if (!m_actions.isEmpty()) { + return; + } + m_actions[Latte::Data::ContextMenu::SECTIONACTION] = new QAction(this); m_actions[Latte::Data::ContextMenu::SECTIONACTION]->setSeparator(true); m_actions[Latte::Data::ContextMenu::SECTIONACTION]->setText("Latte"); diff --git a/containmentactions/contextmenu/menu.h b/containmentactions/contextmenu/menu.h index 311c3fd26..fa7587286 100644 --- a/containmentactions/contextmenu/menu.h +++ b/containmentactions/contextmenu/menu.h @@ -30,10 +30,10 @@ class Menu : public Plasma::ContainmentActions ~Menu() override; QList contextualActions() override; + void restore(const KConfigGroup &) override; QAction *action(const QString &name); private Q_SLOTS: - void makeActions(); void populateLayouts(); void populateMoveToLayouts(); void populateViewTemplates();