Commit 9eafbd28 authored by Nate Graham's avatar Nate Graham
Browse files

[applets/batterymonitor] Overhaul configuration and actions

Right now the applet puts the entries to open the KCM and Energy Info
page in a hamburger menu, while the Configure button opens the applet's
own settings window which has only one item in it. This emphasizes the
less important thing, while de-emphasizing the more important thing.

We can solve this by making the applet's configure button open the KCM
instead of the applet configuration window. This makes the configuration
window inaccessible, so we delete it and move its one setting into the
hamburger menu along with "Show Energy Information". This is okay as
these two are lesser-used settings.

Overall this should make the actions easier to access and use, and more
relevant to the user.

BUG: 407560
FIXED-IN: 5.22
parent 62f8e352
/***************************************************************************
* 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 . *
***************************************************************************/
import QtQuick 2.0
import org.kde.plasma.configuration 2.0
ConfigModel {
ConfigCategory {
name: i18n("General")
icon: "battery"
source: "ConfigGeneral.qml"
}
}
/*
* 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 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")
}
}
}
......@@ -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"
......
Supports Markdown
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