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

improvements for view templates handling

This commit is contained in:
Michail Vourlakos 2021-02-13 21:12:32 +02:00
parent 7e92a79d4c
commit ea3d913757
5 changed files with 17 additions and 6 deletions

View File

@ -57,7 +57,6 @@ Manager::Manager(QObject *parent)
m_synchronizer = new Synchronizer(this);
if (m_corona) {
connect(m_synchronizer, &Synchronizer::centralLayoutsChanged, this, &Manager::centralLayoutsChanged);
connect(m_synchronizer, &Synchronizer::currentLayoutIsSwitching, this, &Manager::currentLayoutIsSwitching);
}

View File

@ -110,6 +110,7 @@ public slots:
signals:
void centralLayoutsChanged();
void syncedLaunchersChanged();
void viewTemplatesChanged();
void currentLayoutIsSwitching(QString layoutName);

View File

@ -678,6 +678,8 @@ bool Storage::exportTemplate(const Layout::GenericLayout *layout, Plasma::Contai
}
}
copied_conts.sync();
return true;
}

View File

@ -23,6 +23,7 @@
#include "../layout/abstractlayout.h"
#include "../layout/centrallayout.h"
#include "../layouts/importer.h"
#include "../layouts/manager.h"
#include "../layouts/storage.h"
#include "../tools/commontools.h"
#include "../view/view.h"
@ -52,6 +53,8 @@ Manager::~Manager()
void Manager::init()
{
connect(this, &Manager::viewTemplatesChanged, m_corona->layoutsManager(), &Latte::Layouts::Manager::viewTemplatesChanged);
initLayoutTemplates();
initViewTemplates();
}

View File

@ -542,13 +542,13 @@ Loader {
onActivated: {
var item = actionsModel.get(index);
if (item.actionId === "new:") {
if (item && item.actionId === "new:") {
latteView.layout.newView(item.templateId);
} else if (item.actionId === "export:") {
} else if (item && item.actionId === "export:") {
latteView.exportTemplate();
} else if (item.actionId === "copy:") {
} else if (item && item.actionId === "copy:") {
latteView.copyView();
} else if (item.actionId === "move:") {
} else if (item && item.actionId === "move:") {
var layouts = actionsComboBtn.centralLayoutsNames;
latteView.positioner.hideDockDuringMovingToLayout(layouts[index-1]);
}
@ -585,6 +585,11 @@ Loader {
}
}
Connections {
target: layoutsManager
onViewTemplatesChanged: actionsComboBtn.updateModel();
}
function updateModel() {
actionsModel.clear();
@ -622,7 +627,8 @@ Loader {
if (viewTemplateIds.length > 1) {
var viewTemplateNames = layoutsManager.viewTemplateNames();
for(var i=1; i<viewTemplateIds.length; ++i) {
for(var i=viewTemplateIds.length-1; i>=1; --i) {
//! add view templates on reverse
var viewtemplate = {
actionId: 'new:',
enabled: true,