From da3fbca4771feb18aa395728cf2dd4a284d722bd Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Tue, 16 Feb 2021 16:46:52 +0200 Subject: [PATCH] organize new>layout templates action menu --- .../settingsdialog/tablayoutshandler.cpp | 18 ++++++++++++++++-- app/templates/templatesmanager.cpp | 2 +- app/templates/templatesmanager.h | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/app/settings/settingsdialog/tablayoutshandler.cpp b/app/settings/settingsdialog/tablayoutshandler.cpp index 65985cc45..cad085bd2 100644 --- a/app/settings/settingsdialog/tablayoutshandler.cpp +++ b/app/settings/settingsdialog/tablayoutshandler.cpp @@ -36,6 +36,7 @@ #include "../../layouts/importer.h" #include "../../layouts/manager.h" #include "../../templates/templatesmanager.h" +#include "../../tools/commontools.h" //! Qt #include @@ -250,11 +251,14 @@ void TabLayouts::initLayoutTemplatesSubMenu() } /*Add Layout Templates for New Action*/ - Data::LayoutsTable templates = m_corona->templatesManager()->systemLayoutTemplates(); + Data::LayoutsTable templates = m_corona->templatesManager()->layoutTemplates(); + + bool customtemplateseparatoradded{false}; for (int i=0; iaddSeparator(); + customtemplateseparatoradded = true; } QAction *newlayout = m_layoutTemplatesSubMenu->addAction(templates[i].name); @@ -265,6 +269,16 @@ void TabLayouts::initLayoutTemplatesSubMenu() newLayout(templatename); }); } + + if (templates.rowCount() > 0) { + QAction *openTemplatesDirectory = m_layoutTemplatesSubMenu->addAction(i18n("Templates...")); + openTemplatesDirectory->setToolTip(i18n("Open templates directory")); + openTemplatesDirectory->setIcon(QIcon::fromTheme("edit")); + + connect(openTemplatesDirectory, &QAction::triggered, this, [&]() { + KIO::highlightInFileManager({QString(Latte::configPath() + "/latte/templates/Dock.layout.latte")}); + }); + } } Latte::Corona *TabLayouts::corona() const diff --git a/app/templates/templatesmanager.cpp b/app/templates/templatesmanager.cpp index d4e567731..3e550bf1c 100644 --- a/app/templates/templatesmanager.cpp +++ b/app/templates/templatesmanager.cpp @@ -131,7 +131,7 @@ Data::Layout Manager::layoutTemplateForName(const QString &layoutName) return Data::Layout(); } -Data::LayoutsTable Manager::systemLayoutTemplates() +Data::LayoutsTable Manager::layoutTemplates() { Data::LayoutsTable templates; diff --git a/app/templates/templatesmanager.h b/app/templates/templatesmanager.h index 7c675564a..e65eabc4f 100644 --- a/app/templates/templatesmanager.h +++ b/app/templates/templatesmanager.h @@ -65,7 +65,7 @@ public: Data::Layout layoutTemplateForName(const QString &layoutName); - Data::LayoutsTable systemLayoutTemplates(); + Data::LayoutsTable layoutTemplates(); Data::GenericTable viewTemplates(); //! creates a new layout with layoutName based on specific layout template and returns the new layout path