Verified Commit 407647c3 authored by Jonah Brüchert's avatar Jonah Brüchert 🌳

Remove Ubuntu Touch specific developer settings

parent e3513fb9
......@@ -24,21 +24,6 @@ install(FILES develsettings.desktop DESTINATION ${SERVICES_INSTALL_DIR})
kpackage_install_package(package kcm_settings_devel kcms)
########### helper ###############
###DEVELOPER MODE
###Developed mode adb
add_executable(active-developermode-helper developermodehelper.cpp ${helper_mocs})
target_link_libraries(active-developermode-helper
Qt5::Core
KF5::Auth
)
install(TARGETS active-developermode-helper DESTINATION ${KAUTH_HELPER_INSTALL_DIR})
kauth_install_helper_files(active-developermode-helper org.kde.active.developermode root)
kauth_install_actions(org.kde.active.developermode active_dev_developermode.actions)
###SSH
add_executable(active-sshd-helper sshdhelper.cpp ${helper_mocs})
target_link_libraries(active-sshd-helper
......@@ -50,16 +35,3 @@ install(TARGETS active-sshd-helper DESTINATION ${KAUTH_HELPER_INSTALL_DIR})
kauth_install_helper_files(active-sshd-helper org.kde.active.sshdcontrol root)
kauth_install_actions(org.kde.active.sshdcontrol active_dev_sshd.actions)
###Writable Filesystem
add_executable(active-writablefilesystem-helper writablefilesystemhelper.cpp ${helper_mocs})
target_link_libraries(active-writablefilesystem-helper
Qt5::Core
KF5::Auth
)
install(TARGETS active-writablefilesystem-helper DESTINATION ${KAUTH_HELPER_INSTALL_DIR})
kauth_install_helper_files(active-writablefilesystem-helper org.kde.active.writablefilesystem root)
kauth_install_actions(org.kde.active.writablefilesystem active_dev_writablefilesystem.actions)
[Domain]
Name=Developer mode
Name[ast]=Mou desendolcador
Name[ca]=Mode desenvolupador
Name[ca@valencia]=Mode desenvolupador
Name[cs]=Vývojářský režim
Name[da]=Udviklertilstand
Name[de]=Entwicklermodus
Name[el]=Λειτουργία προγραμματιστή
Name[en_GB]=Developer mode
Name[es]=Modo desarrollador
Name[fi]=Kehitystila
Name[fr]=Mode développeur
Name[gl]=Modo de desenvolvedor
Name[it]=Modalità sviluppatore
Name[nl]=Modus ontwikkelaar
Name[pl]=Tryb programisty
Name[pt]=Modo de desenvolvimento
Name[pt_BR]=Modo desenvolvedor
Name[sl]=Razvojni način
Name[sv]=Utvecklingsläge
Name[uk]=Режим розробника
Name[x-test]=xxDeveloper modexx
Name[zh_CN]=开发者模式
Icon=applications-development
[org.kde.active.developermode.enable]
Name=Activate the developer mode
Name[ast]=Activar el mou desendolcador
Name[ca]=Activa el mode desenvolupador
Name[ca@valencia]=Activa el mode desenvolupador
Name[cs]=Aktivovat vývojářský režim
Name[da]=Aktivér udviklertilstanden
Name[de]=Aktiviert den Entwicklermodus
Name[el]=Ενεργοποίηση της λειτουργίας προγραμματιστή
Name[en_GB]=Activate the developer mode
Name[es]=Activar el modo desarrollador
Name[fi]=Aktivoi kehitystilan
Name[fr]=Activer le mode développeur
Name[gl]=Activar o modo de desenvolvedor
Name[it]=Attiva la modalità sviluppatore
Name[nl]=De modus ontwikkelaar activeren
Name[pl]=Włącz tryb programisty
Name[pt]=Activar o modo de desenvolvimento
Name[pt_BR]=Ativar o modo desenvolvedor
Name[sl]=Omogoči razvojni način
Name[sv]=Aktivera utvecklingsläge
Name[uk]=Задіяти режим розробника
Name[x-test]=xxActivate the developer modexx
Name[zh_CN]=激活开发者模式
Description=Enable shell and debug access via USB
Description[ast]=Activa l'accesu al shell y depuración per USB
Description[ca]=Activa l'intèrpret d'ordres i depura l'accés mitjançant USB
Description[ca@valencia]=Activa l'intèrpret d'ordres i depura l'accés mitjançant USB
Description[da]=Aktivér skal- og fejlsøgningsadgang via USB
Description[el]=Ενεργοποίηση πρόσβασης σε κέλυφος και αποσφαλμάτωση με USB
Description[en_GB]=Enable shell and debug access via USB
Description[es]=Activar el acceso a la consola y a la depuración vía USB
Description[fi]=Ota käyttöön komentotulkki ja vianpaikannus USB:n kautta
Description[fr]=Activer le shell et l'accès de débogage par USB
Description[gl]=Activar o intérprete de ordes e o acceso de depuración por USB
Description[it]=Abilita la shell e l'accesso al debug attraverso l'USB
Description[nl]=Toegang tot shell en debug via USB inschakelen
Description[pl]=Włącza powłokę i diagnostykę dostepu przez USB
Description[pt]=Activar a consola e o acesso de depuração por USB
Description[pt_BR]=Habilita o shell e acesso de depuração via USB
Description[sl]=Omogoči lupino in razhroščevalni dostop preko USB-ja
Description[sv]=Aktiverar skal och felsökningsåtkomst via USB
Description[uk]=Увімкнути оболонку і діагностичний доступ за допомогою USB
Description[x-test]=xxEnable shell and debug access via USBxx
Description[zh_CN]=允许通过 USB 的命令行及调试访问
Policy=yes
[org.kde.active.developermode.disable]
Name=Deactivate the developer mode
Name[ast]=Desactivar el mou desendolcador
Name[ca]=Desactiva el mode desenvolupador
Name[ca@valencia]=Desactiva el mode desenvolupador
Name[cs]=Deaktivovat vývojářský režim
Name[da]=Deaktivér udviklertilstanden
Name[de]=Deaktiviert den Entwicklermodus
Name[el]=Απενεργοποίηση της λειτουργίας προγραμματιστή
Name[en_GB]=Deactivate the developer mode
Name[es]=Desactivar el modo desarrollador
Name[fi]=Passivoi kehitystila
Name[fr]=Désactiver le mode développeur
Name[gl]=Desactivar o modo de desenvolvedor
Name[it]=Disattiva la modalità sviluppatore
Name[nl]=De modus ontwikkelaar deactiveren
Name[pl]=Wyłącz tryb programisty
Name[pt]=Desactivar o modo de desenvolvimento
Name[pt_BR]=Desativar o modo desenvolvedor
Name[sl]=Onemogoči razvojni način
Name[sv]=Inaktivera utvecklingsläge
Name[uk]=Вимкнути режим розробника
Name[x-test]=xxDeactivate the developer modexx
Name[zh_CN]=关闭开发者模式
Description=Disables shell and debug access via USB
Description[ast]=Desactiva l'accesu al shell y depuración per USB
Description[ca]=Desactiva l'intèrpret d'ordres i depura l'accés mitjançant USB
Description[ca@valencia]=Desactiva l'intèrpret d'ordres i depura l'accés mitjançant USB
Description[da]=Deaktivér skal- og fejlsøgningsadgang via USB
Description[el]=Απεεργοποίηση πρόσβασης σε κέλυφος και αποσφαλμάτωση με USB
Description[en_GB]=Disables shell and debug access via USB
Description[es]=Desactivar el acceso a la consola y a la depuración vía USB
Description[fi]=Poistaa käytöstä USB:n kautta toimivan komentotulkin ja vianpaikannuksen
Description[fr]=Désactiver le shell et l'accès de débogage par USB
Description[gl]=Desactiva o intérprete de ordes e o acceso de depuración por USB
Description[it]=Disabilita la shell e l'accesso al debug attraverso l'USB
Description[nl]=Toegang tot shell en debug via USB uitschakelen
Description[pl]=Wyłącza powłokę i diagnostykę dostepu przez USB
Description[pt]=Desactivar a consola e o acesso de depuração por USB
Description[pt_BR]=Desabilita o shell e acesso de depuração via USB
Description[sl]=Onemogoči lupino in razhroščevalni dostop preko USB-ja
Description[sv]=Inaktiverar skal och felsökningsåtkomst via USB
Description[uk]=Вимкнути оболонку і діагностичний доступ за допомогою USB
Description[x-test]=xxDisables shell and debug access via USBxx
Description[zh_CN]=禁止通过 USB 的命令行及调试访问
Policy=yes
[Domain]
Name=Writable filesystem
Name[ast]=Sistema de ficheros escribibles
Name[ca]=Sistema de fitxers amb escriptura
Name[ca@valencia]=Sistema de fitxers amb escriptura
Name[cs]=Zapisovatelný souborový systém
Name[da]=Skrivbart filsystem
Name[de]=Beschreibbares Dateisystem
Name[el]=Εγγράψιμο σύστημα αρχείων
Name[en_GB]=Writable filesystem
Name[es]=Sistema de archivos con permiso de escritura
Name[fi]=Kirjoitettava tiedostojärjestelmä
Name[fr]=Système de fichiers inscriptible
Name[gl]=Sistema de ficheiros escribíbel
Name[it]=File system scrivibile
Name[nl]=Beschrijfbaar bestandssysteem
Name[pl]=Zapisywalny system plików
Name[pt]=Sistema de ficheiros para escrita
Name[pt_BR]=Sistema de arquivos para gravação
Name[sl]=Zapisljiv datotečni sistem
Name[sv]=Skrivbart filsystem
Name[uk]=Запис для файлової системи
Name[x-test]=xxWritable filesystemxx
Name[zh_CN]=可写入的文件系统
Icon=drive-harddisk
[org.kde.active.writablefilesystem.detect]
Name=Detect if filesystem is writable
Name[ast]=Deteutar si'l sistema de ficheros ye escribible
Name[ca]=Detecta si es pot escriure al sistema de fitxers
Name[ca@valencia]=Detecta si es pot escriure al sistema de fitxers
Name[cs]=Zjistit, zda lze na souborový systém zapisovat
Name[da]=Detektér om filsystemet er skrivbart
Name[el]=Εξακρίβωση αν το σύστημα αρχείων είναι εγγράψιμο
Name[en_GB]=Detect if filesystem is writable
Name[es]=Detectar si se puede escribir en el sistema de archivos
Name[fi]=Tunnistaa, onko tiedostojärjestelmä kirjoitettava
Name[fr]=Détecte si le système de fichiers est inscriptible
Name[gl]=Detectar se o sistema de ficheiros é escribíbel
Name[it]=Rileva se il file system è scrivibile
Name[nl]=Detecteer of bestandssysteem beschrijfbaar is
Name[pl]=Wykryj, jeśli system plików jest zapisywalny
Name[pt]=Detecta se é possível escrever no sistema de ficheiros
Name[pt_BR]=Detecta se é possível gravar no sistema de arquivos
Name[sl]=Zaznaj, če je datotečni sistem zapisljiv
Name[sv]=Detektera om filsystem är skrivbart
Name[uk]=Визначити, чи можливий запис для файлової системи
Name[x-test]=xxDetect if filesystem is writablexx
Name[zh_CN]=检测文件系统是否可写
Description=Detects if the root filesystem writable
Description[ast]=Deteuta si'l sistema de ficheros raigañu ye escribible
Description[ca]=Detecta si es pot escriure al sistema de fitxers arrel
Description[ca@valencia]=Detecta si es pot escriure al sistema de fitxers arrel
Description[cs]=Zjistí, zda lze do kořene souborového systému zapisovat
Description[da]=Detektér om rodfilsystemet er skrivbart
Description[el]=Εξακρίβωση αν το σύστημα αρχείων root είναι εγγράψιμο
Description[en_GB]=Detects if the root filesystem writable
Description[es]=Detectar si se puede escribir en el sistema de archivos raíz
Description[fi]=Tunnistaa, onko juuritiedostojärjestelmä kirjoitettava
Description[gl]=Detecta se o sistema de ficheiros raíz é escribíbel
Description[it]=Rileva se il file system di root è scrivibile
Description[nl]=Detecteert of rootbestandssysteem beschrijfbaar is
Description[pl]=Wykrywa, czy główny system plików jest zapisywalny
Description[pt]=Detecta se é possível escrever no sistema de ficheiros de raiz
Description[pt_BR]=Detecta se é possível gravar no sistema de arquivos raiz
Description[sl]=Zazna, če je korenski datotečni sistem zapisljiv
Description[sv]=Detekterar om rotfilsystemet är skrivbart
Description[uk]=Визначити, чи є коренева файлова система придатною до запису
Description[x-test]=xxDetects if the root filesystem writablexx
Description[zh_CN]=检测根文件系统是否可写
Policy=yes
[org.kde.active.writablefilesystem.enable]
Name=Enable writable filesystem
Name[ast]=Activar sistema de ficheros escribible
Name[ca]=Activa poder escriure al sistema de fitxers
Name[ca@valencia]=Activa poder escriure al sistema de fitxers
Name[cs]=Povolit zapisovatelný souborový systém
Name[da]=Aktivér skrivbart filsystem
Name[de]=Beschreibbares Dateisystem aktivieren
Name[el]=Ενεργοποίηση εγγράψιμου συστήματος αρχείων
Name[en_GB]=Enable writable filesystem
Name[es]=Activar la escritura en el sistema de archivos
Name[fi]=Käytä kirjoitettavaa tiedostojärjestelmää
Name[gl]=Activar o sistema de ficheiros escribíbel
Name[it]=Abilita il file system scrivibile
Name[nl]=Beschrijfbaar bestandssysteem inschakelen
Name[pl]=Włącz zapisywalny system plików
Name[pt]=Activar o sistema de ficheiros para escrita
Name[pt_BR]=Ativar o sistema de arquivos para gravação
Name[sl]=Omogoči zapisljiv datotečni sistem
Name[sv]=Aktivera skrivbart filsystem
Name[uk]=Увімкнути запис для файлової системи
Name[x-test]=xxEnable writable filesystemxx
Name[zh_CN]=开启可写入文件系统
Description=Makes the root filesystem writable
Description[ast]=Fai que'l sistema de ficheros raigañu seya escribible
Description[ca]=Fa que es pugui escriure al sistema de fitxers arrel
Description[ca@valencia]=Fa que es puga escriure al sistema de fitxers arrel
Description[cs]=Přepne kořen souborového systému do režimu pro zápis
Description[da]=Gør rodfilsystemet skrivbart
Description[el]=Κάνει το σύστημα αρχείων root εγγράψιμο
Description[en_GB]=Makes the root filesystem writable
Description[es]=Hacer que se pueda escribir en el sistema de archivos raíz
Description[fi]=Tee juuritiedostojärjestelmästä kirjoitettava
Description[gl]=Fai escribíbel o sistema de ficheiros raíz
Description[it]=Rende scrivibile il file system di root
Description[nl]=Maakt het rootbestandssysteem beschrijfbaar
Description[pl]=Czyni główny system plików zapisywalnym
Description[pt]=Permite escrever no sistema de ficheiros de raiz
Description[pt_BR]=Permite gravar no sistema de arquivos raiz
Description[sl]=Pretvori korenski datotečni sistem v zapisljiv
Description[sv]=Gör rotfilsystemet skrivbart
Description[uk]=Зробити файлову систему доступною для запису
Description[x-test]=xxMakes the root filesystem writablexx
Description[zh_CN]=使根文件系统可写
Policy=yes
[org.kde.active.writablefilesystem.disable]
Name=Disable writable filesystem
Name[ast]=Desactivar sistema de ficheros escribible
Name[ca]=Desactiva poder escriure al sistema de fitxers
Name[ca@valencia]=Desactiva poder escriure al sistema de fitxers
Name[cs]=Vypnout zapisovatelný souborový systém
Name[da]=Deaktivér skrivbart filsystem
Name[de]=Beschreibbares Dateisystem deaktivieren
Name[el]=Απενεργοποίηση εγγράψιμου συστήματος αρχείων
Name[en_GB]=Disable writable filesystem
Name[es]=Desactivar la escritura en el sistema de archivos
Name[fi]=Poista kirjoitettava tiedostojärjestelmä käytöstä
Name[gl]=Desactivar o sistema de ficheiros escribíbel
Name[it]=Disabilita il file system scrivibile
Name[nl]=Beschrijfbaar bestandssysteem uitschakelen
Name[pl]=Wyłącz zapisywalny system plików
Name[pt]=Desactivar o sistema de ficheiros para escrita
Name[pt_BR]=Desativar o sistema de arquivos para gravação
Name[sl]=Onemogoči zapisljiv datotečni sistem
Name[sv]=Inaktivera skrivbart filsystem
Name[uk]=Вимкнути запис для файлової системи
Name[x-test]=xxDisable writable filesystemxx
Name[zh_CN]=禁止可写入文件系统
Description=Makes the root filesystem read only
Description[ast]=Fai que'l sistema de ficheros raigañu seya de namái llectura
Description[ca]=Fa que el sistema de fitxers arrel sigui de només lectura
Description[ca@valencia]=Fa que el sistema de fitxers arrel siga de només lectura
Description[cs]=Přepne kořen souborového systému do režimu pouze pro čtení
Description[da]=Gør rodfilsystemet skrivebeskyttet
Description[el]=Κάνει το σύστημα αρχείων root για ανάγνωση μόνο
Description[en_GB]=Makes the root filesystem read only
Description[es]=Hacer que el sistema de archivos raíz sea de solo lectura
Description[fi]=Tee juuritiedostojärjestelmästä vain luettava
Description[gl]=Fai de só lectura o sistema de ficheiros raíz
Description[it]=Rende a sola lettura il file system di root
Description[nl]=Maakt het rootbestandssysteem alleen-lezen
Description[pl]=Czyni główny system plików tylko do odczytu
Description[pt]=Impede de escrever no sistema de ficheiros de raiz
Description[pt_BR]=Impede a gravação no sistema de arquivos raiz
Description[sl]=Pretvori korenski datotečni sistem v samo za branje
Description[sv]=Gör rotfilsystemet skrivskyddat
Description[uk]=Зробити кореневу файлову систему придатною лише для читання
Description[x-test]=xxMakes the root filesystem read onlyxx
Description[zh_CN]=使根文件系统只读
Policy=yes
/*
* Copyright 2012 Aaron Seigo <aseigo@kde.org>
* Copyright 2016 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 "developermodehelper.h"
#include <QProcess>
#include <QFile>
#include <QDebug>
DeveloperModeHelper::DeveloperModeHelper(QObject *parent)
: QObject(parent)
{
}
ActionReply DeveloperModeHelper::enable(const QVariantMap &args)
{
Q_UNUSED(args)
QStringList enableArgs;
enableArgs << "persist.sys.usb.config" << "mtp,adb";
int rv = QProcess::execute("setprop", enableArgs);
QFile file("/userdata/.adb_onlock");
const bool created = file.open(QIODevice::WriteOnly);
file.close();
if (rv == 0 && created) {
return ActionReply::SuccessReply();
} else {
return ActionReply::HelperErrorReply();
}
}
ActionReply DeveloperModeHelper::disable(const QVariantMap &args)
{
Q_UNUSED(args)
QStringList disableArgs;
disableArgs << "persist.sys.usb.config" << "mtp";
int rv = QProcess::execute("setprop", disableArgs);
bool deleted = true;
if (QFile::exists("/userdata/.adb_onlock")) {
deleted = QFile::remove("/userdata/.adb_onlock");
}
if (rv == 0 && deleted) {
return ActionReply::SuccessReply();
} else {
return ActionReply::HelperErrorReply();
}
}
KAUTH_HELPER_MAIN("org.kde.active.developermode", DeveloperModeHelper)
/*
* Copyright 2012 Aaron Seigo <aseigo@kde.org>
* Copyright 2016 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 DEVELOPERMODE_HELPER_H
#define DEVELOPERMODE_HELPER_H
#include <kauth.h>
using namespace KAuth;
class DeveloperModeHelper : public QObject
{
Q_OBJECT
public:
DeveloperModeHelper(QObject *parent = 0);
public slots:
ActionReply enable(const QVariantMap &map);
ActionReply disable(const QVariantMap &map);
};
#endif // INTEGRATION_HELPER_H
......@@ -44,10 +44,7 @@
K_PLUGIN_FACTORY_WITH_JSON(DevelSettingsFactory, "develsettings.json", registerPlugin<DevelSettings>();)
DevelSettings::DevelSettings(QObject* parent, const QVariantList& args)
: KQuickAddons::ConfigModule(parent, args),
m_developerModeEnabled(false),
m_writableFilesystemEnabled(false)
{
: KQuickAddons::ConfigModule(parent, args) {
// TODO: should probably not rely on systemctl, but be put into a platform specific backend?
const int rv = QProcess::execute("systemctl is-enabled sshd.service");
m_sshEnabled = rv == 0;
......@@ -57,66 +54,12 @@ DevelSettings::DevelSettings(QObject* parent, const QVariantList& args)
about->addAuthor(i18n("Sebastian Kügler"), QString(), "sebas@kde.org");
setAboutData(about);
setButtons(Apply | Default);
QTimer::singleShot(0, this, &DevelSettings::checkWritableFilesystem);
QStringList getPropArgs;
getPropArgs << "persist.sys.usb.config";
m_getpropProcess.start("getprop", getPropArgs);
connect(&m_getpropProcess, &QProcess::readyReadStandardOutput, this, [this]() {
QString output = m_getpropProcess.readAllStandardOutput();
m_developerModeEnabled = output.contains("adb");
emit enableDeveloperModeChanged(m_developerModeEnabled);
});
}
DevelSettings::~DevelSettings()
{
}
void DevelSettings::checkWritableFilesystem()
{
KAuth::Action action("org.kde.active.writablefilesystem.detect");
action.setHelperId("org.kde.active.writablefilesystem");
qDebug() << "Action" << action.name() << action.details() << "valid:" << action.isValid();
auto reply = action.execute();
reply->exec();
m_writableFilesystemEnabled = reply->data().value("writable").toBool();
}
void DevelSettings::setDeveloperModeEnabled(bool enable)
{
if (m_developerModeEnabled != enable) {
const bool was = m_developerModeEnabled;
m_developerModeEnabled = enable;
//TODO: this really should be non-blocking ...
KAuth::Action action(m_developerModeEnabled ? "org.kde.active.developermode.enable"
: "org.kde.active.developermode.disable");
action.setHelperId("org.kde.active.developermode");
qDebug() << "Action" << action.name() << action.details() << "valid:" << action.isValid();
auto job = action.execute();
job->exec();
if (job->error()) {
m_developerModeEnabled = !m_developerModeEnabled;
qWarning()<< "KAuth returned an error code:" << job->errorString() << "enabled" << m_developerModeEnabled;
}
if (was != m_developerModeEnabled) {
KConfigGroup confGroup(KSharedConfig::openConfig(), "General");
confGroup.writeEntry("DeveloperModeEnabled", m_developerModeEnabled);
emit enableDeveloperModeChanged(m_developerModeEnabled);
}
}
}
bool DevelSettings::isDeveloperModeEnabled()
{
return m_developerModeEnabled;
}
bool DevelSettings::sshEnabled() const
{
return m_sshEnabled;
......@@ -148,36 +91,4 @@ void DevelSettings::enableSsh(bool enable)
}
}
void DevelSettings::setWritableFilesystemEnabled(bool enable)
{
if (m_writableFilesystemEnabled != enable) {
const bool was = m_writableFilesystemEnabled;
m_writableFilesystemEnabled = enable;
//TODO: this really should be non-blocking ...
KAuth::Action action(m_writableFilesystemEnabled ? "org.kde.active.writablefilesystem.enable"
: "org.kde.active.writablefilesystem.disable");
action.setHelperId("org.kde.active.writablefilesystem");
qDebug() << "Action" << action.name() << action.details() << "valid:" << action.isValid();
auto job = action.execute();
job->exec();
if (job->error()) {
m_writableFilesystemEnabled = !m_writableFilesystemEnabled;
qWarning()<< "KAuth returned an error code:" << job->errorString() << "enabled" << m_writableFilesystemEnabled;
}
if (was != m_writableFilesystemEnabled) {
KConfigGroup confGroup(KSharedConfig::openConfig(), "General");
confGroup.writeEntry("WritableFilesystemEnabled", m_writableFilesystemEnabled);
emit enableWritableFilesystemChanged(m_writableFilesystemEnabled);
}
}
}
bool DevelSettings::isWritableFilesystemEnabled()
{
return m_writableFilesystemEnabled;
}
#include "develsettings.moc"
\ No newline at end of file
#include "develsettings.moc"
......@@ -29,40 +29,24 @@
class DevelSettings : public KQuickAddons::ConfigModule
{
Q_OBJECT
Q_PROPERTY(bool developerModeEnabled READ isDeveloperModeEnabled WRITE setDeveloperModeEnabled NOTIFY enableDeveloperModeChanged)
Q_PROPERTY(bool sshEnabled READ sshEnabled WRITE enableSsh NOTIFY enableSshChanged)
Q_PROPERTY(bool writableFilesystemEnabled READ isWritableFilesystemEnabled WRITE setWritableFilesystemEnabled NOTIFY enableWritableFilesystemChanged)
public:
DevelSettings(QObject* parent, const QVariantList& args);
virtual ~DevelSettings();
void setDeveloperModeEnabled(bool enable);
bool isDeveloperModeEnabled();
bool sshEnabled() const;
void enableSsh(bool enable);
void setWritableFilesystemEnabled(bool enable);
bool isWritableFilesystemEnabled();
private Q_SLOTS:
void checkWritableFilesystem();
Q_SIGNALS:
void enableDeveloperModeChanged(bool enable);
void enableSshChanged(bool enabled);
void showTerminalChanged(bool shown);
void enableWritableFilesystemChanged(bool enable);
private:
bool m_developerModeEnabled;
bool m_sshEnabled;
bool m_terminalShown;
bool m_writableFilesystemEnabled;
bool m_cursorVisible;
QString m_terminalApp;
QProcess m_getpropProcess;
};
#endif
\ No newline at end of file
#endif
......@@ -22,16 +22,12 @@
import QtQuick 2.2
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import QtQuick.Controls 2.0 as Controls
Item {
id: develModule
objectName: "develModule"
width: 800; height: 500
// ActiveSettings.DevelSettings {
// id: settings
// }
......@@ -49,39 +45,13 @@ Item {
leftMargin: 0
}
PlasmaComponents.Label {
text: i18n("Enable Developer mode:")
Layout.fillWidth: true
}
PlasmaComponents.Switch {
id: developerMode
checked: kcm.developerModeEnabled
onClicked: {
kcm.developerModeEnabled = developerMode.checked;
}
}
PlasmaComponents.Label {
text: i18n("Writable filesystem:")
Layout.fillWidth: true
}
PlasmaComponents.Switch {
id: writableFilesystem
checked: kcm.writableFilesystemEnabled
onClicked: {
kcm.writableFilesystemEnabled = writableFilesystem.checked;
}
}
PlasmaComponents.Label {
Controls.Label {
id: timeZoneLabel
text: i18n("Allow remote SSH access:")
Layout.fillWidth: true
}
PlasmaComponents.Switch {
Controls.Switch {
id: ssh
checked: kcm.sshEnabled
onClicked: {
......
/*
* Copyright 2012 Aaron Seigo <aseigo@kde.org>
* 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 02110-1301, USA.
*/
#include "writablefilesystemhelper.h"
#include <QProcess>
#include <QFile>
#include <QDebug>
WritableFilesystemHelper::WritableFilesystemHelper(QObject *parent)
: QObject(parent)
{
}
ActionReply WritableFilesystemHelper::detect(const QVariantMap &args)
{
Q_UNUSED(args)
ActionReply reply = ActionReply::SuccessReply();
reply.addData("writable", QFile::exists("/userdata/.writable_image"));
return reply;
}
ActionReply WritableFilesystemHelper::enable(const QVariantMap &args)
{
Q_UNUSED(args)
QFile file("/userdata/.writable_image");
const bool created = file.open(QIODevice::WriteOnly);
file.close();
if (created) {
return ActionReply::SuccessReply();
} else {
return ActionReply::HelperErrorReply();
}
}
ActionReply WritableFilesystemHelper::disable(const QVariantMap &args)
{