diff --git a/applets/batterymonitor/package/contents/config/config.qml b/applets/batterymonitor/package/contents/config/config.qml deleted file mode 100644 index 5b7303849..000000000 --- a/applets/batterymonitor/package/contents/config/config.qml +++ /dev/null @@ -1,30 +0,0 @@ -/*************************************************************************** - * Copyright 2016 Marco Martin * - * * - * 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 . * - ***************************************************************************/ - -import QtQuick 2.0 - -import org.kde.plasma.configuration 2.0 - -ConfigModel { - ConfigCategory { - name: i18n("General") - icon: "battery" - source: "ConfigGeneral.qml" - } -} diff --git a/applets/batterymonitor/package/contents/ui/ConfigGeneral.qml b/applets/batterymonitor/package/contents/ui/ConfigGeneral.qml deleted file mode 100644 index cb739309a..000000000 --- a/applets/batterymonitor/package/contents/ui/ConfigGeneral.qml +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2016 Marco Martin - * - * 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.0 -import QtQuick.Controls 2.5 -import org.kde.kirigami 2.4 as Kirigami - -Item { - id: root - - width: pageColumn.width - height: pageColumn.height - - property alias cfg_showPercentage: showPercentage.checked - - Kirigami.FormLayout { - id: pageColumn - anchors.left: parent.left - anchors.right: parent.right - - CheckBox { - id: showPercentage - text: i18n("Show percentage") - } - } -} diff --git a/applets/batterymonitor/package/contents/ui/batterymonitor.qml b/applets/batterymonitor/package/contents/ui/batterymonitor.qml index 71ba2d3ce..22215113f 100644 --- a/applets/batterymonitor/package/contents/ui/batterymonitor.qml +++ b/applets/batterymonitor/package/contents/ui/batterymonitor.qml @@ -149,7 +149,7 @@ Item { }); } - function action_powerdevilkcm() { + function action_configure() { KCMShell.openSystemSettings("powerdevilprofilesconfig"); } @@ -157,19 +157,31 @@ Item { KCMShell.openInfoCenter("kcm_energyinfo"); } + function action_showPercentage() { + if (!plasmoid.configuration.showPercentage) { + plasmoid.configuration.showPercentage = true; + } else { + plasmoid.configuration.showPercentage = false; + } + } + Component.onCompleted: { Logic.updateBrightness(batterymonitor, pmSource); Logic.updateInhibitions(batterymonitor, pmSource) if (batterymonitor.kcmEnergyInformationAuthorized) { - plasmoid.setAction("energyinformationkcm", i18n("&Show Energy Information..."), "battery"); + plasmoid.setAction("energyinformationkcm", i18n("&Show Energy Information..."), "documentinfo"); } + plasmoid.setAction("showPercentage", i18n("Show Battery Percentage on Icon"), "format-number-percent"); + plasmoid.action("showPercentage").checkable = true; + plasmoid.action("showPercentage").checked = Qt.binding(() => {return plasmoid.configuration.showPercentage;}); + if (batterymonitor.kcmAuthorized) { - plasmoid.setAction("powerdevilkcm", i18n("&Configure Power Saving..."), "preferences-system-power-management"); + plasmoid.removeAction("configure"); + plasmoid.setAction("configure", i18n("&Configure Energy Saving..."), "configure", "alt+d, s"); } } - property QtObject pmSource: PlasmaCore.DataSource { id: pmSource engine: "powermanagement"