add containmentactions
parent
35643ac5f3
commit
d3756e0ce1
@ -0,0 +1 @@
|
||||
add_subdirectory(contextmenu)
|
@ -0,0 +1,16 @@
|
||||
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_containmentactions_lattecontextmenu\")
|
||||
|
||||
set(contextmenu_SRCS
|
||||
menu.cpp
|
||||
)
|
||||
|
||||
add_library(plasma_containmentactions_lattecontextmenu MODULE ${contextmenu_SRCS})
|
||||
|
||||
kcoreaddons_desktop_to_json(plasma_containmentactions_lattecontextmenu plasma-containmentactions-lattecontextmenu.desktop)
|
||||
|
||||
target_link_libraries(plasma_containmentactions_lattecontextmenu
|
||||
Qt5::Widgets
|
||||
KF5::Plasma)
|
||||
|
||||
install(TARGETS plasma_containmentactions_lattecontextmenu DESTINATION ${KDE_INSTALL_PLUGINDIR})
|
||||
install(FILES plasma-containmentactions-lattecontextmenu.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
|
@ -0,0 +1,2 @@
|
||||
#! /usr/bin/env bash
|
||||
$XGETTEXT *.cpp -o $podir/plasma_containmentactions_lattecontextmenu.pot
|
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright 2018 Michail Vourlakos <mvourlakos@gmail.com>
|
||||
*
|
||||
* This file is part of Latte-Dock
|
||||
*
|
||||
* Latte-Dock is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Latte-Dock is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "menu.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QDebug>
|
||||
|
||||
#include <Plasma/Containment>
|
||||
#include <Plasma/Corona>
|
||||
#include <Plasma/ServiceJob>
|
||||
|
||||
Menu::Menu(QObject *parent, const QVariantList &args)
|
||||
: Plasma::ContainmentActions(parent, args)
|
||||
{
|
||||
}
|
||||
|
||||
Menu::~Menu()
|
||||
{
|
||||
qDeleteAll(m_actions);
|
||||
}
|
||||
|
||||
void Menu::makeMenu()
|
||||
{
|
||||
qDeleteAll(m_actions);
|
||||
m_actions.clear();
|
||||
|
||||
QAction *action = new QAction(QIcon::fromTheme("edit"), "Print Message...", this);
|
||||
connect(action, &QAction::triggered, [ = ]() {
|
||||
qDebug() << "Action Trigerred !!!";
|
||||
});
|
||||
|
||||
m_actions << action;
|
||||
/*foreach (const QString &id, m_consumer.activities(KActivities::Info::Running)) {
|
||||
KActivities::Info info(id);
|
||||
QAction *action = new QAction(QIcon::fromTheme(info.icon()), info.name(), this);
|
||||
action->setData(id);
|
||||
|
||||
if (id == m_consumer.currentActivity()) {
|
||||
QFont font = action->font();
|
||||
font.setBold(true);
|
||||
action->setFont(font);
|
||||
}
|
||||
|
||||
connect(action, &QAction::triggered, [ = ]() {
|
||||
switchTo(action);
|
||||
});
|
||||
|
||||
m_actions << action;
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
QList<QAction *> Menu::contextualActions()
|
||||
{
|
||||
makeMenu();
|
||||
|
||||
return m_actions;
|
||||
}
|
||||
|
||||
K_EXPORT_PLASMA_CONTAINMENTACTIONS_WITH_JSON(lattecontextmenu, Menu, "plasma-containmentactions-lattecontextmenu.json")
|
||||
|
||||
#include "menu.moc"
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2018 Michail Vourlakos <mvourlakos@gmail.com>
|
||||
*
|
||||
* This file is part of Latte-Dock
|
||||
*
|
||||
* Latte-Dock is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Latte-Dock is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MENU_H
|
||||
#define MENU_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <Plasma/ContainmentActions>
|
||||
|
||||
class QAction;
|
||||
|
||||
class Menu : public Plasma::ContainmentActions {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Menu(QObject *parent, const QVariantList &args);
|
||||
~Menu() override;
|
||||
|
||||
QList<QAction *> contextualActions() override;
|
||||
|
||||
private Q_SLOTS:
|
||||
void makeMenu();
|
||||
|
||||
private:
|
||||
QList<QAction *>m_actions;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,16 @@
|
||||
[Desktop Entry]
|
||||
Name=Standard Latte Menu
|
||||
Comment=The latte menu that normally shows on right-click
|
||||
|
||||
Type=Service
|
||||
Icon=help-contextual
|
||||
ServiceTypes=Plasma/ContainmentActions
|
||||
X-KDE-Library=plasma_containmentactions_lattecontextmenu
|
||||
X-KDE-PluginInfo-Author=Michail Vourlakos
|
||||
X-KDE-PluginInfo-Email=mvourlakos@gmail.com
|
||||
X-KDE-PluginInfo-Name=org.kde.latte.contextmenu
|
||||
X-KDE-PluginInfo-Version=0.1
|
||||
X-KDE-PluginInfo-Website=https://github.com/psifidotos/Latte-Dock/
|
||||
X-KDE-PluginInfo-Depends=
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
@ -0,0 +1,5 @@
|
||||
[Panel]
|
||||
Containment=org.kde.latte.containment
|
||||
|
||||
[Panel][ContainmentActions]
|
||||
RightButton;NoModifier=org.kde.latte.contextmenu
|
@ -1,12 +0,0 @@
|
||||
[Panel]
|
||||
Containment=org.kde.latte.containment
|
||||
# TODO
|
||||
#ToolBox=audoban.toolbox.candildock
|
||||
|
||||
[Panel][ContainmentActions]
|
||||
# TODO
|
||||
RightButton;NoModifier=
|
||||
#MidButton;NoModifier=
|
||||
|
||||
[Theme]
|
||||
Theme=default
|
Loading…
Reference in New Issue