Get rid of ProcessRunner

Use KCMShell singleton in kquickcontrolsaddons
Also while at it honor kiosk restriction

Differential Revision: https://phabricator.kde.org/D9759
This commit is contained in:
Kai Uwe Broulik 2018-01-09 16:33:02 +01:00
parent 0c2ed278b9
commit 1c3a45fd95
5 changed files with 5 additions and 80 deletions

View file

@ -6,7 +6,6 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}
set(kdeconnectdeclarativeplugin_SRC
kdeconnectdeclarativeplugin.cpp
responsewaiter.cpp
processrunner.cpp
)
set(kdeconnectdeclarativeplugin_MOC

View file

@ -28,7 +28,6 @@
#include "objectfactory.h"
#include "responsewaiter.h"
#include "processrunner.h"
#include "interfaces/devicessortproxymodel.h"
#include "interfaces/devicesmodel.h"
@ -85,7 +84,6 @@ void KdeConnectDeclarativePlugin::registerTypes(const char* uri)
qmlRegisterType<DevicesModel>(uri, 1, 0, "DevicesModel");
qmlRegisterType<NotificationsModel>(uri, 1, 0, "NotificationsModel");
qmlRegisterType<DBusAsyncResponse>(uri, 1, 0, "DBusAsyncResponse");
qmlRegisterType<ProcessRunner>(uri, 1, 0, "ProcessRunner");
qmlRegisterType<DevicesSortProxyModel>(uri, 1, 0, "DevicesSortProxyModel");
qmlRegisterUncreatableType<MprisDbusInterface>(uri, 1, 0, "MprisDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess"));
qmlRegisterUncreatableType<LockDeviceDbusInterface>(uri, 1, 0, "LockDeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess"));

View file

@ -1,35 +0,0 @@
/***************************************************************************
* Copyright (C) 2013 by Eike Hein <hein@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 "processrunner.h"
#include <QProcess>
ProcessRunner::ProcessRunner(QObject* parent) : QObject(parent)
{
}
ProcessRunner::~ProcessRunner()
{
}
void ProcessRunner::runKdeconnectKCM()
{
QProcess::startDetached(QStringLiteral("kcmshell5"), QStringList() << QStringLiteral("kcm_kdeconnect"));
}

View file

@ -1,36 +0,0 @@
/***************************************************************************
* Copyright (C) 2013 by Eike Hein <hein@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 PROCESSRUNNER_H
#define PROCESSRUNNER_H
#include <QObject>
class ProcessRunner : public QObject
{
Q_OBJECT
public:
explicit ProcessRunner(QObject* parent = nullptr);
~ProcessRunner() override;
Q_INVOKABLE void runKdeconnectKCM();
};
#endif

View file

@ -21,6 +21,7 @@
import QtQuick 2.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.plasmoid 2.0
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kdeconnect 1.0
Item
@ -49,16 +50,14 @@ Item
Plasmoid.preferredRepresentation: isConstrained ? Plasmoid.compactRepresentation : Plasmoid.fullRepresentation
ProcessRunner {
id: processRunner
}
function action_launchkcm() {
processRunner.runKdeconnectKCM();
KCMShell.open("kcm_kdeconnect");
}
Component.onCompleted: {
plasmoid.removeAction("configure");
plasmoid.setAction("launchkcm", i18n("KDE Connect Settings..."), "configure");
if (KCMShell.authorize("kcm_kdeconnect.desktop").length > 0) {
plasmoid.setAction("launchkcm", i18n("KDE Connect Settings..."), "configure");
}
}
}