mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
add a native interface to execute command
and do the needed hw related things
This commit is contained in:
parent
e1133e04b6
commit
fe4ad093ec
8 changed files with 117 additions and 3 deletions
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
plasma_install_package(clock org.kde.phone.clock)
|
||||
plasma_install_package(notifications org.kde.phone.notifications)
|
||||
plasma_install_package(quicksettings org.kde.phone.quicksettings)
|
||||
|
||||
add_subdirectory(quicksettings)
|
||||
|
|
|
|||
19
applets/quicksettings/CMakeLists.txt
Normal file
19
applets/quicksettings/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
set(quicksettings_SRCS
|
||||
quicksettings.cpp
|
||||
)
|
||||
|
||||
add_library(plasma_applet_quicksettings MODULE ${quicksettings_SRCS})
|
||||
|
||||
kcoreaddons_desktop_to_json(plasma_applet_quicksettings package/metadata.desktop)
|
||||
|
||||
target_link_libraries(plasma_applet_quicksettings
|
||||
Qt5::Gui
|
||||
KF5::Plasma
|
||||
KF5::I18n)
|
||||
|
||||
|
||||
install(TARGETS plasma_applet_quicksettings DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
#install(FILES plasma-quicksettings-default.desktop DESTINATION ${SERVICES_INSTALL_DIR})
|
||||
|
||||
plasma_install_package(package org.kde.phone.quicksettings)
|
||||
|
||||
|
|
@ -61,7 +61,13 @@ RowLayout {
|
|||
MouseArea {
|
||||
id: labelMouseArea
|
||||
anchors.fill: parent
|
||||
onClicked: print("execute active-settings -m " + model.settingsModule)
|
||||
onClicked: {
|
||||
var command = "active-settings";
|
||||
if (model.settingsModule) {
|
||||
command += " -m " + model.settingsModule;
|
||||
}
|
||||
plasmoid.nativeInterface.executeCommand(command)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ X-KDE-PluginInfo-Author=Marco Martin
|
|||
X-KDE-PluginInfo-Email=mart@kde.org
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-Name=org.kde.phone.quicksettings
|
||||
X-KDE-Library=plasma_applet_quicksettings
|
||||
X-KDE-PluginInfo-Version=1.0
|
||||
X-KDE-PluginInfo-Website=plasma.kde.org
|
||||
X-KDE-ServiceTypes=Plasma/Applet
|
||||
43
applets/quicksettings/quicksettings.cpp
Normal file
43
applets/quicksettings/quicksettings.cpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/***************************************************************************
|
||||
* 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 "quicksettings.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QProcess>
|
||||
|
||||
QuickSettings::QuickSettings(QObject *parent, const QVariantList &args)
|
||||
: Plasma::Applet(parent, args)
|
||||
{
|
||||
setHasConfigurationInterface(true);
|
||||
}
|
||||
|
||||
QuickSettings::~QuickSettings()
|
||||
{
|
||||
}
|
||||
|
||||
void QuickSettings::executeCommand(const QString &command)
|
||||
{
|
||||
qWarning()<<"Executing"<<command;
|
||||
QProcess::startDetached(command);
|
||||
}
|
||||
|
||||
K_EXPORT_PLASMA_APPLET_WITH_JSON(quicksettings, QuickSettings, "metadata.json")
|
||||
|
||||
#include "quicksettings.moc"
|
||||
43
applets/quicksettings/quicksettings.h
Normal file
43
applets/quicksettings/quicksettings.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/***************************************************************************
|
||||
* 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 QUICKSETTINGS_H
|
||||
#define QUICKSETTINGS_H
|
||||
|
||||
|
||||
#include <Plasma/Applet>
|
||||
|
||||
|
||||
class QuickSettings : public Plasma::Applet
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QuickSettings( QObject *parent, const QVariantList &args );
|
||||
~QuickSettings();
|
||||
|
||||
public Q_SLOTS:
|
||||
void executeCommand(const QString &command);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -239,6 +239,7 @@ PlasmaCore.ColorScope {
|
|||
|
||||
PlasmaComponents.TabBar {
|
||||
id: tabBar
|
||||
visible: plasmoid.applets.count > 1
|
||||
anchors {
|
||||
left: parent.left
|
||||
top: parent.top
|
||||
|
|
@ -251,7 +252,7 @@ PlasmaCore.ColorScope {
|
|||
id: tabGroup
|
||||
anchors {
|
||||
left: parent.left
|
||||
top: tabBar.bottom
|
||||
top: plasmoid.applets.count > 1 ? tabBar.bottom : parent.top
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
margins: units.smallSpacing
|
||||
|
|
|
|||
Loading…
Reference in a new issue