From a7e8cf4542c70402bd877bf3188b094dfd61b4c7 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Thu, 10 Jun 2021 09:04:56 +0300 Subject: [PATCH] context:add actions in context menu dynamically --- app/data/contextmenudata.h | 10 ++++++++++ containmentactions/contextmenu/menu.cpp | 18 +++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/app/data/contextmenudata.h b/app/data/contextmenudata.h index de7921a6c..ecaec0d29 100644 --- a/app/data/contextmenudata.h +++ b/app/data/contextmenudata.h @@ -27,6 +27,16 @@ static const char QUITLATTEACTION[] = "_quit_latte"; static const char SECTIONACTION[]= "_latte_section"; static const char SEPARATOR1ACTION[] = "_separator1"; +static QStringList ACTIONSEDITORDER = {LAYOUTSACTION, + PREFERENCESACTION, + QUITLATTEACTION, + SEPARATOR1ACTION, + ADDWIDGETSACTION, + ADDVIEWACTION, + MOVEVIEWACTION, + EXPORTVIEWTEMPLATEACTION, + REMOVEVIEWACTION}; + static QStringList ACTIONSALWAYSVISIBLE = {LAYOUTSACTION, PREFERENCESACTION, QUITLATTEACTION, diff --git a/containmentactions/contextmenu/menu.cpp b/containmentactions/contextmenu/menu.cpp index 96fabbfcd..6ad286d32 100644 --- a/containmentactions/contextmenu/menu.cpp +++ b/containmentactions/contextmenu/menu.cpp @@ -217,18 +217,11 @@ QList Menu::contextualActions() QList actions; actions << m_actions[Latte::Data::ContextMenu::SECTIONACTION]; - //actions << m_actions[Latte::Data::ContextMenu::PRINTACTION]; - actions << m_actions[Latte::Data::ContextMenu::LAYOUTSACTION]; - actions << m_actions[Latte::Data::ContextMenu::PREFERENCESACTION]; - actions << m_actions[Latte::Data::ContextMenu::QUITLATTEACTION]; - - actions << m_actions[Latte::Data::ContextMenu::SEPARATOR1ACTION]; - actions << m_actions[Latte::Data::ContextMenu::ADDWIDGETSACTION]; - actions << m_actions[Latte::Data::ContextMenu::ADDVIEWACTION]; - actions << m_actions[Latte::Data::ContextMenu::MOVEVIEWACTION]; - actions << m_actions[Latte::Data::ContextMenu::EXPORTVIEWTEMPLATEACTION]; + actions << m_actions[Latte::Data::ContextMenu::PRINTACTION]; + for(int i=0; isetVisible(false); + continue; } bool isvisible = m_actionsAlwaysShown.contains(actionName) || configuring;