|
|
|
@ -24,8 +24,8 @@
|
|
|
|
|
|
|
|
|
|
// Plasma
|
|
|
|
|
#include <Plasma/Containment>
|
|
|
|
|
#include <Plasma/ContainmentActions>
|
|
|
|
|
#include <Plasma/Corona>
|
|
|
|
|
#include <Plasma/ServiceJob>
|
|
|
|
|
|
|
|
|
|
const int MEMORYINDEX = 0;
|
|
|
|
|
const int ACTIVELAYOUTSINDEX = 1;
|
|
|
|
@ -74,6 +74,8 @@ void Menu::restore(const KConfigGroup &config)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto& containmentActions = this->containment()->containmentActions();
|
|
|
|
|
|
|
|
|
|
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");
|
|
|
|
@ -91,7 +93,7 @@ void Menu::restore(const KConfigGroup &config)
|
|
|
|
|
m_actions[Latte::Data::ContextMenu::ADDWIDGETSACTION] = new QAction(QIcon::fromTheme("list-add"), i18n("&Add Widgets..."), this);
|
|
|
|
|
m_actions[Latte::Data::ContextMenu::ADDWIDGETSACTION]->setStatusTip(i18n("Show Widget Explorer"));
|
|
|
|
|
connect(m_actions[Latte::Data::ContextMenu::ADDWIDGETSACTION], &QAction::triggered, this, &Menu::requestWidgetExplorer);
|
|
|
|
|
this->containment()->actions()->addAction(Latte::Data::ContextMenu::ADDWIDGETSACTION, m_actions[Latte::Data::ContextMenu::ADDWIDGETSACTION]);
|
|
|
|
|
this->containment()->setInternalAction(Latte::Data::ContextMenu::ADDWIDGETSACTION, m_actions[Latte::Data::ContextMenu::ADDWIDGETSACTION]);
|
|
|
|
|
|
|
|
|
|
/*connect(m_addWidgetsAction, &QAction::triggered, [ = ]() {
|
|
|
|
|
QDBusInterface iface("org.kde.plasmashell", "/PlasmaShell", "", QDBusConnection::sessionBus());
|
|
|
|
@ -104,13 +106,13 @@ void Menu::restore(const KConfigGroup &config)
|
|
|
|
|
//! Edit Dock/Panel...
|
|
|
|
|
m_actions[Latte::Data::ContextMenu::EDITVIEWACTION] = new QAction(QIcon::fromTheme("document-edit"), "Edit Dock...", this);
|
|
|
|
|
connect(m_actions[Latte::Data::ContextMenu::EDITVIEWACTION], &QAction::triggered, this, &Menu::requestConfiguration);
|
|
|
|
|
this->containment()->actions()->addAction(Latte::Data::ContextMenu::EDITVIEWACTION, m_actions[Latte::Data::ContextMenu::EDITVIEWACTION]);
|
|
|
|
|
this->containment()->setInternalAction(Latte::Data::ContextMenu::EDITVIEWACTION, m_actions[Latte::Data::ContextMenu::EDITVIEWACTION]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! Quit Application
|
|
|
|
|
m_actions[Latte::Data::ContextMenu::QUITLATTEACTION] = new QAction(QIcon::fromTheme("application-exit"), i18nc("quit application", "Quit &Latte"));
|
|
|
|
|
connect(m_actions[Latte::Data::ContextMenu::QUITLATTEACTION], &QAction::triggered, this, &Menu::quitApplication);
|
|
|
|
|
this->containment()->actions()->addAction(Latte::Data::ContextMenu::QUITLATTEACTION, m_actions[Latte::Data::ContextMenu::QUITLATTEACTION]);
|
|
|
|
|
this->containment()->setInternalAction(Latte::Data::ContextMenu::QUITLATTEACTION, m_actions[Latte::Data::ContextMenu::QUITLATTEACTION]);
|
|
|
|
|
|
|
|
|
|
//! Layouts submenu
|
|
|
|
|
m_switchLayoutsMenu = new QMenu;
|
|
|
|
@ -118,7 +120,7 @@ void Menu::restore(const KConfigGroup &config)
|
|
|
|
|
m_actions[Latte::Data::ContextMenu::LAYOUTSACTION]->setText(i18n("&Layouts"));
|
|
|
|
|
m_actions[Latte::Data::ContextMenu::LAYOUTSACTION]->setIcon(QIcon::fromTheme("user-identity"));
|
|
|
|
|
m_actions[Latte::Data::ContextMenu::LAYOUTSACTION]->setStatusTip(i18n("Switch to another layout"));
|
|
|
|
|
this->containment()->actions()->addAction(Latte::Data::ContextMenu::LAYOUTSACTION, m_actions[Latte::Data::ContextMenu::LAYOUTSACTION]);
|
|
|
|
|
this->containment()->setInternalAction(Latte::Data::ContextMenu::LAYOUTSACTION, m_actions[Latte::Data::ContextMenu::LAYOUTSACTION]);
|
|
|
|
|
|
|
|
|
|
connect(m_switchLayoutsMenu, &QMenu::aboutToShow, this, &Menu::populateLayouts);
|
|
|
|
|
connect(m_switchLayoutsMenu, &QMenu::triggered, this, &Menu::switchToLayout);
|
|
|
|
@ -129,7 +131,7 @@ void Menu::restore(const KConfigGroup &config)
|
|
|
|
|
m_actions[Latte::Data::ContextMenu::ADDVIEWACTION]->setText(i18n("&Add Dock/Panel"));
|
|
|
|
|
m_actions[Latte::Data::ContextMenu::ADDVIEWACTION]->setIcon(QIcon::fromTheme("list-add"));
|
|
|
|
|
m_actions[Latte::Data::ContextMenu::ADDVIEWACTION]->setStatusTip(i18n("Add dock or panel based on specific template"));
|
|
|
|
|
this->containment()->actions()->addAction(Latte::Data::ContextMenu::ADDVIEWACTION, m_actions[Latte::Data::ContextMenu::ADDVIEWACTION]);
|
|
|
|
|
this->containment()->setInternalAction(Latte::Data::ContextMenu::ADDVIEWACTION, m_actions[Latte::Data::ContextMenu::ADDVIEWACTION]);
|
|
|
|
|
|
|
|
|
|
connect(m_addViewMenu, &QMenu::aboutToShow, this, &Menu::populateViewTemplates);
|
|
|
|
|
connect(m_addViewMenu, &QMenu::triggered, this, &Menu::addView);
|
|
|
|
@ -140,14 +142,14 @@ void Menu::restore(const KConfigGroup &config)
|
|
|
|
|
m_actions[Latte::Data::ContextMenu::MOVEVIEWACTION]->setText("Move To Layout");
|
|
|
|
|
m_actions[Latte::Data::ContextMenu::MOVEVIEWACTION]->setIcon(QIcon::fromTheme("transform-move-horizontal"));
|
|
|
|
|
m_actions[Latte::Data::ContextMenu::MOVEVIEWACTION]->setStatusTip(i18n("Move dock or panel to different layout"));
|
|
|
|
|
this->containment()->actions()->addAction(Latte::Data::ContextMenu::MOVEVIEWACTION, m_actions[Latte::Data::ContextMenu::MOVEVIEWACTION]);
|
|
|
|
|
this->containment()->setInternalAction(Latte::Data::ContextMenu::MOVEVIEWACTION, m_actions[Latte::Data::ContextMenu::MOVEVIEWACTION]);
|
|
|
|
|
|
|
|
|
|
connect(m_moveToLayoutMenu, &QMenu::aboutToShow, this, &Menu::populateMoveToLayouts);
|
|
|
|
|
connect(m_moveToLayoutMenu, &QMenu::triggered, this, &Menu::moveToLayout);
|
|
|
|
|
|
|
|
|
|
//! Configure Latte
|
|
|
|
|
m_actions[Latte::Data::ContextMenu::PREFERENCESACTION] = new QAction(QIcon::fromTheme("configure"), i18nc("global settings window", "&Configure Latte..."), this);
|
|
|
|
|
this->containment()->actions()->addAction(Latte::Data::ContextMenu::PREFERENCESACTION, m_actions[Latte::Data::ContextMenu::PREFERENCESACTION]);
|
|
|
|
|
this->containment()->setInternalAction(Latte::Data::ContextMenu::PREFERENCESACTION, m_actions[Latte::Data::ContextMenu::PREFERENCESACTION]);
|
|
|
|
|
connect(m_actions[Latte::Data::ContextMenu::PREFERENCESACTION], &QAction::triggered, [=](){
|
|
|
|
|
QDBusInterface iface("org.kde.lattedock", "/Latte", "", QDBusConnection::sessionBus());
|
|
|
|
|
|
|
|
|
@ -165,7 +167,7 @@ void Menu::restore(const KConfigGroup &config)
|
|
|
|
|
iface.call("duplicateView", containment()->id());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this->containment()->actions()->addAction(Latte::Data::ContextMenu::DUPLICATEVIEWACTION, m_actions[Latte::Data::ContextMenu::DUPLICATEVIEWACTION]);
|
|
|
|
|
this->containment()->setInternalAction(Latte::Data::ContextMenu::DUPLICATEVIEWACTION, m_actions[Latte::Data::ContextMenu::DUPLICATEVIEWACTION]);
|
|
|
|
|
|
|
|
|
|
//! Export View Template Action
|
|
|
|
|
m_actions[Latte::Data::ContextMenu::EXPORTVIEWTEMPLATEACTION] = new QAction(QIcon::fromTheme("document-export"), "Export as Template...", this);
|
|
|
|
@ -176,7 +178,7 @@ void Menu::restore(const KConfigGroup &config)
|
|
|
|
|
iface.call("exportViewTemplate", containment()->id());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this->containment()->actions()->addAction(Latte::Data::ContextMenu::EXPORTVIEWTEMPLATEACTION, m_actions[Latte::Data::ContextMenu::EXPORTVIEWTEMPLATEACTION]);
|
|
|
|
|
this->containment()->setInternalAction(Latte::Data::ContextMenu::EXPORTVIEWTEMPLATEACTION, m_actions[Latte::Data::ContextMenu::EXPORTVIEWTEMPLATEACTION]);
|
|
|
|
|
|
|
|
|
|
//! Remove Action
|
|
|
|
|
m_actions[Latte::Data::ContextMenu::REMOVEVIEWACTION] = new QAction(QIcon::fromTheme("delete"), "Remove Dock", this);
|
|
|
|
@ -187,7 +189,7 @@ void Menu::restore(const KConfigGroup &config)
|
|
|
|
|
iface.call("removeView", containment()->id());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this->containment()->actions()->addAction(Latte::Data::ContextMenu::REMOVEVIEWACTION, m_actions[Latte::Data::ContextMenu::REMOVEVIEWACTION]);
|
|
|
|
|
this->containment()->setInternalAction(Latte::Data::ContextMenu::REMOVEVIEWACTION, m_actions[Latte::Data::ContextMenu::REMOVEVIEWACTION]);
|
|
|
|
|
|
|
|
|
|
//! Signals
|
|
|
|
|
connect(this->containment(), &Plasma::Containment::userConfiguringChanged, [=](){
|
|
|
|
|