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

viewsdialog:fixes for paste action

This commit is contained in:
Michail Vourlakos 2021-04-26 13:28:00 +03:00
parent ddd25a0215
commit 76bc442ade
3 changed files with 11 additions and 2 deletions

View File

@ -43,6 +43,11 @@ TemplatesKeeper::~TemplatesKeeper()
clear();
}
bool TemplatesKeeper::hasClipboardContents() const
{
return (m_clipboardViews.rowCount() > 0);
}
Latte::Data::ViewsTable TemplatesKeeper::clipboardContents() const
{
return m_clipboardViews;

View File

@ -52,6 +52,8 @@ public:
QString storedView(const QString &layoutCurrentId, const QString &viewId);
bool hasClipboardContents() const;
Latte::Data::ViewsTable clipboardContents() const;
void setClipboardContents(const Latte::Data::ViewsTable &views);

View File

@ -126,8 +126,10 @@ void Views::init()
m_view->addAction(m_cutAction);
m_view->addAction(m_copyAction);
m_view->addAction(m_pasteAction);
m_view->addAction(m_duplicateAction);
m_view->addAction(m_pasteAction);
onSelectionsChanged();
connect(m_view, &View::ViewsTableView::selectionsChanged, this, &Views::onSelectionsChanged);
connect(m_view, &QObject::destroyed, this, &Views::storeColumnWidths);
@ -297,7 +299,7 @@ void Views::onSelectionsChanged()
m_cutAction->setVisible(hasselectedview);
m_copyAction->setVisible(hasselectedview);
m_duplicateAction->setVisible(hasselectedview);
m_pasteAction->setVisible(!hasselectedview);
m_pasteAction->setEnabled(m_handler->layoutsController()->templatesKeeper()->hasClipboardContents());
}
int Views::viewsForRemovalCount() const