mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
new bottom panel containment with close button
This commit is contained in:
parent
504d1a8ae4
commit
0860194325
9 changed files with 197 additions and 0 deletions
|
|
@ -2,3 +2,4 @@
|
||||||
plasma_install_package(panel org.kde.phone.panel)
|
plasma_install_package(panel org.kde.phone.panel)
|
||||||
|
|
||||||
add_subdirectory(homescreen)
|
add_subdirectory(homescreen)
|
||||||
|
add_subdirectory(taskpanel)
|
||||||
|
|
|
||||||
22
containments/taskpanel/CMakeLists.txt
Normal file
22
containments/taskpanel/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
set(taskpanel_SRCS
|
||||||
|
taskpanel.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(plasma_containment_phone_taskpanel MODULE ${taskpanel_SRCS})
|
||||||
|
|
||||||
|
kcoreaddons_desktop_to_json(plasma_containment_phone_taskpanel package/metadata.desktop)
|
||||||
|
|
||||||
|
target_link_libraries(plasma_containment_phone_taskpanel
|
||||||
|
Qt5::Gui
|
||||||
|
Qt5::DBus
|
||||||
|
KF5::Plasma
|
||||||
|
Qt5::Qml
|
||||||
|
KF5::I18n
|
||||||
|
KF5::Service
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
install(TARGETS plasma_containment_phone_taskpanel DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
|
||||||
|
|
||||||
|
plasma_install_package(package org.kde.phone.taskpanel)
|
||||||
|
|
||||||
4
containments/taskpanel/Messages.sh
Executable file
4
containments/taskpanel/Messages.sh
Executable file
|
|
@ -0,0 +1,4 @@
|
||||||
|
#! /usr/bin/env bash
|
||||||
|
$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp
|
||||||
|
$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.phone.taskpanel.pot
|
||||||
|
rm -f rc.cpp
|
||||||
2
containments/taskpanel/package/code/close.js
Normal file
2
containments/taskpanel/package/code/close.js
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
workspace.activeClient.closeWindow();
|
||||||
38
containments/taskpanel/package/contents/ui/main.qml
Normal file
38
containments/taskpanel/package/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2015 Marco Martin <mart@kde.org>
|
||||||
|
*
|
||||||
|
* This program 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.
|
||||||
|
*
|
||||||
|
* This program 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, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import QtQuick 2.4
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
|
||||||
|
import org.kde.plasma.plasmoid 2.0
|
||||||
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
import org.kde.kquickcontrolsaddons 2.0
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: 600
|
||||||
|
height: 40
|
||||||
|
|
||||||
|
property Item toolBox
|
||||||
|
|
||||||
|
PlasmaComponents.ToolButton {
|
||||||
|
anchors.right: parent.right
|
||||||
|
iconSource: "window-close"
|
||||||
|
onClicked: plasmoid.nativeInterface.executeScript("close");
|
||||||
|
}
|
||||||
|
}
|
||||||
18
containments/taskpanel/package/metadata.desktop
Normal file
18
containments/taskpanel/package/metadata.desktop
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
|
Keywords=
|
||||||
|
Name=Phone Task panel
|
||||||
|
Type=Service
|
||||||
|
|
||||||
|
X-KDE-ServiceTypes=Plasma/Applet,Plasma/Containment
|
||||||
|
X-Plasma-API=declarativeappletscript
|
||||||
|
X-KDE-Library=plasma_containment_phone_taskpanel
|
||||||
|
X-KDE-PluginInfo-Author=Marco Martin
|
||||||
|
X-KDE-PluginInfo-Category=
|
||||||
|
X-KDE-PluginInfo-Email=mart@kde.org
|
||||||
|
X-KDE-PluginInfo-License=GPLv2+
|
||||||
|
X-KDE-PluginInfo-Name=org.kde.phone.taskpanel
|
||||||
|
X-KDE-PluginInfo-Version=
|
||||||
|
X-KDE-PluginInfo-Website=
|
||||||
|
X-Plasma-MainScript=ui/main.qml
|
||||||
|
X-Plasma-ContainmentType=Panel
|
||||||
66
containments/taskpanel/taskpanel.cpp
Normal file
66
containments/taskpanel/taskpanel.cpp
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2015 Marco Martin <mart@kde.org> *
|
||||||
|
* *
|
||||||
|
* This program 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. *
|
||||||
|
* *
|
||||||
|
* This program 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, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "taskpanel.h"
|
||||||
|
|
||||||
|
#include <QtQml>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDBusMessage>
|
||||||
|
#include <QDBusConnection>
|
||||||
|
|
||||||
|
#include <Plasma/Package>
|
||||||
|
|
||||||
|
static const QString s_kwinService = QStringLiteral("org.kde.KWin");
|
||||||
|
|
||||||
|
TaskPanel::TaskPanel(QObject *parent, const QVariantList &args)
|
||||||
|
: Plasma::Containment(parent, args)
|
||||||
|
{
|
||||||
|
setHasConfigurationInterface(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskPanel::~TaskPanel()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskPanel::executeScript(const QString &script)
|
||||||
|
{
|
||||||
|
//Plasma::Package p =
|
||||||
|
package().filePath("scripts", script + ".js");
|
||||||
|
QDBusMessage message = QDBusMessage::createMethodCall(s_kwinService, "/Scripting", QString(), "loadScript");
|
||||||
|
QList<QVariant> arguments;
|
||||||
|
arguments << QVariant("/opt/kde5qt5/share/plasma/plasmoids/org.kde.phone.taskpanel/code/close.js");
|
||||||
|
message.setArguments(arguments);
|
||||||
|
QDBusMessage reply = QDBusConnection::sessionBus().call(message);
|
||||||
|
if (reply.type() == QDBusMessage::ErrorMessage) {
|
||||||
|
qWarning() << reply.errorMessage();
|
||||||
|
} else {
|
||||||
|
const int id = reply.arguments().first().toInt();
|
||||||
|
QDBusConnection::sessionBus().connect(s_kwinService, "/" + QString::number(id), QString(), "print", this, SLOT(print(QString)));
|
||||||
|
QDBusConnection::sessionBus().connect(s_kwinService, "/" + QString::number(id), QString(), "printError", this, SLOT(print(QString)));
|
||||||
|
message = QDBusMessage::createMethodCall(s_kwinService, "/" + QString::number(id), QString(), "run");
|
||||||
|
reply = QDBusConnection::sessionBus().call(message);
|
||||||
|
if (reply.type() == QDBusMessage::ErrorMessage) {
|
||||||
|
qWarning() << reply.errorMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
K_EXPORT_PLASMA_APPLET_WITH_JSON(taskpanel, TaskPanel, "metadata.json")
|
||||||
|
|
||||||
|
#include "taskpanel.moc"
|
||||||
41
containments/taskpanel/taskpanel.h
Normal file
41
containments/taskpanel/taskpanel.h
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2015 Marco Martin <mart@kde.org> *
|
||||||
|
*
|
||||||
|
* *
|
||||||
|
* This program 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. *
|
||||||
|
* *
|
||||||
|
* This program 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, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef TASKPANEL_H
|
||||||
|
#define TASKPANEL_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <Plasma/Containment>
|
||||||
|
|
||||||
|
class TaskPanel : public Plasma::Containment
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
TaskPanel( QObject *parent, const QVariantList &args );
|
||||||
|
~TaskPanel();
|
||||||
|
|
||||||
|
Q_INVOKABLE void executeScript(const QString &script);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -20,3 +20,8 @@ var panel = new Panel("org.kde.phone.panel");
|
||||||
panel.addWidget("org.kde.plasma.networkmanagement");
|
panel.addWidget("org.kde.plasma.networkmanagement");
|
||||||
panel.addWidget("org.kde.plasma.battery");
|
panel.addWidget("org.kde.plasma.battery");
|
||||||
panel.height = 60;
|
panel.height = 60;
|
||||||
|
|
||||||
|
var bottomPanel = new Panel("org.kde.phone.taskpanel");
|
||||||
|
bottomPanel.location = "bottom";
|
||||||
|
bottomPanel.height = 80;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue