Commit 08601943 authored by Marco Martin's avatar Marco Martin

new bottom panel containment with close button

parent 504d1a8a
......@@ -2,3 +2,4 @@
plasma_install_package(panel org.kde.phone.panel)
add_subdirectory(homescreen)
add_subdirectory(taskpanel)
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)
#! /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
workspace.activeClient.closeWindow();
/*
* 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");
}
}
\ No newline at end of file
[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
/***************************************************************************
* 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"
/***************************************************************************
* 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.battery");
panel.height = 60;
var bottomPanel = new Panel("org.kde.phone.taskpanel");
bottomPanel.location = "bottom";
bottomPanel.height = 80;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment