diff --git a/applets/CMakeLists.txt b/applets/CMakeLists.txt index a8d424e..40726f5 100644 --- a/applets/CMakeLists.txt +++ b/applets/CMakeLists.txt @@ -1,5 +1,2 @@ - plasma_install_package(clock org.kde.phone.clock) plasma_install_package(notifications org.kde.phone.notifications) - -add_subdirectory(battery) diff --git a/applets/battery/CMakeLists.txt b/applets/battery/CMakeLists.txt deleted file mode 100644 index a7f39f4..0000000 --- a/applets/battery/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -plasma_install_package(package org.kde.plasma.phone.battery) diff --git a/applets/battery/Messages.sh b/applets/battery/Messages.sh deleted file mode 100755 index 72996c8..0000000 --- a/applets/battery/Messages.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /usr/bin/env bash -$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp -$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.plasma.phone.battery.pot -rm -f rc.cpp diff --git a/applets/battery/package/contents/ui/ExpandedRepresentation.qml b/applets/battery/package/contents/ui/ExpandedRepresentation.qml deleted file mode 100644 index a313ebf..0000000 --- a/applets/battery/package/contents/ui/ExpandedRepresentation.qml +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright 2011 Sebastian Kügler - * Copyright 2011 Viranch Mehta - * Copyright 2013-2015 Kai Uwe Broulik - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 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 Library 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 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 org.kde.kquickcontrolsaddons 2.0 -import org.kde.plasma.workspace.components 2.0 - -FocusScope { - id: dialog - focus: true - - //property alias model: batteryList.model - property bool pluggedIn - - property int remainingTime - - property bool isBrightnessAvailable: false // FIXME: brightness... - - property QtObject model: pmSource.data["Battery0"] - - Component.onCompleted: { - // setup handler on slider value manually to avoid change on creation - - brightnessSlider.valueChanged.connect(function() { - batterymonitor.screenBrightness = brightnessSlider.value - }) - } - - Column { - id: settingsColumn - anchors.fill: parent - spacing: Math.round(units.gridUnit / 2) - - PlasmaComponents.Label { - // this is just for metrics, TODO use TextMetrics in 5.4 instead - id: percentageMeasurementLabel - text: i18nc("Used for measurement", "100%") - visible: false - } - RowLayout { - id: infoRow - width: parent.width - spacing: units.gridUnit - - BatteryIcon { - id: batteryIcon - Layout.alignment: Qt.AlignTop - width: units.iconSizes.large - height: width - batteryType: model["Type"] - percent: pmSource.data["Battery0"]["Percent"] - hasBattery: true - pluggedIn: pmSource.data["Battery0"]["State"] === "Charging" - } - - Column { - Layout.fillWidth: true - Layout.alignment: Qt.AlignTop - - - RowLayout { - width: parent.width - height: units.gridUnit - spacing: units.smallSpacing - -// Rectangle { -// color: "blue" -// opacity: 0.4 -// anchors.fill: parent -// } - - PlasmaComponents.Label { - id: batteryNameLabel - Layout.fillWidth: true - height: implicitHeight - elide: Text.ElideRight - text: model["Pretty Name"] - } - - PlasmaComponents.Label { - text: stringForBatteryState(pmSource.data["Battery0"]) - height: implicitHeight - //visible: model["Is Power Supply"] - opacity: 0.6 - } - - PlasmaComponents.Label { - id: batteryPercent - height: paintedHeight - horizontalAlignment: Text.AlignRight - //visible: batteryItem.isPresent - text: i18nc("Placeholder is battery percentage", "%1%", pmSource.data["Battery"]["Percent"]) - } - } - - PlasmaComponents.ProgressBar { - width: parent.width - minimumValue: 0 - maximumValue: 100 - visible: model["Plugged in"] - value: Number(pmSource.data["Battery0"]["Percent"]) - } - } - } - - RowLayout { - - visible: isBrightnessAvailable - - property alias icon: brightnessIcon.source - property alias label: brightnessLabel.text - property alias value: brightnessSlider.value - property alias maximumValue: brightnessSlider.maximumValue - width: parent.width - - // KeyNavigation.tab: keyboardBrightnessSlider - // KeyNavigation.backtab: batteryList - - // Manually dragging the slider around breaks the binding - spacing: units.gridUnit - - PlasmaCore.IconItem { - id: brightnessIcon - source: "video-display-brightness" - Layout.alignment: Qt.AlignTop - width: units.iconSizes.medium - height: width - } - - Column { - id: brightnessColumn - Layout.fillWidth: true - Layout.alignment: Qt.AlignTop - spacing: 0 - - PlasmaComponents.Label { - id: brightnessLabel - width: parent.width - height: paintedHeight - text: i18n("Screen Brightness") - } - - PlasmaComponents.Slider { - id: brightnessSlider - width: parent.width - // Don't allow the slider to turn off the screen - // Please see https://git.reviewboard.kde.org/r/122505/ for more information - value: batterymonitor.screenBrightness - minimumValue: maximumValue > 100 ? 1 : 0 - maximumValue: batterymonitor.maximumScreenBrightness - stepSize: 1 - } - } - Connections { - target: batterymonitor - onScreenBrightnessChanged: brightnessSlider.value = batterymonitor.screenBrightness - } - } - /* - PlasmaExtras.Heading { - anchors { - left: parent.left - leftMargin: -Math.round(units.gridUnit / 2) - right: parent.right - } - level: 3 - opacity: 0.6 - visible: !isBrightnessAvailable - text: i18n("Changing screen brightness is not supported") - wrapMode: Text.Wrap - } - */ - } -} diff --git a/applets/battery/package/contents/ui/battery.qml b/applets/battery/package/contents/ui/battery.qml deleted file mode 100644 index e08f936..0000000 --- a/applets/battery/package/contents/ui/battery.qml +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright 2011, 2015 Sebastian Kügler - * Copyright 2011 Viranch Mehta - * Copyright 2013-2015 Kai Uwe Broulik - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 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 Library 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.2 -import QtQuick.Layouts 1.1 -import org.kde.plasma.plasmoid 2.0 -import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.components 2.0 as PlasmaComponents -import org.kde.plasma.workspace.components 2.0 - - -Item { - id: batterymonitor - width: units.gridUnit * 11 - height: units.gridUnit * 11 - Plasmoid.switchWidth: units.gridUnit * 10 - Plasmoid.switchHeight: units.gridUnit * 10 - - LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft - LayoutMirroring.childrenInherit: true - - property bool disableBrightnessUpdate: false - - property int screenBrightness - readonly property int maximumScreenBrightness: pmSource.data["PowerDevil"] ? pmSource.data["PowerDevil"]["Maximum Screen Brightness"] || 0 : 0 - - - onScreenBrightnessChanged: { - if (disableBrightnessUpdate) { - return; - } - var service = pmSource.serviceForSource("PowerDevil"); - var operation = service.operationDescription("setBrightness"); - operation.brightness = screenBrightness; - // show OSD only when the plasmoid isn't expanded since the moving slider is feedback enough - operation.silent = plasmoid.expanded - service.startOperationCall(operation); - } - - function action_powerdevilkcm() { - // FIXME: replace - KCMShell.open(["powerdevilprofilesconfig", "powerdevilactivitiesconfig", "powerdevilglobalconfig"]); - } - - function updateBrightness(rootItem, source) { - if (!source.data["PowerDevil"]) { - print("No powerdevil"); - return; - } - - // we don't want passive brightness change send setBrightness call - rootItem.disableBrightnessUpdate = true; - - if (typeof source.data["PowerDevil"]["Screen Brightness"] === 'number') { - rootItem.screenBrightness = source.data["PowerDevil"]["Screen Brightness"]; - } - rootItem.disableBrightnessUpdate = false; - } - - Component.onCompleted: { - updateBrightness(batterymonitor, pmSource); - plasmoid.removeAction("configure"); - plasmoid.setAction("powerdevilkcm", i18n("&Configure Power Saving..."), "preferences-system-power-management"); - } - - function updateLogic() { - plasmoid.status = plasmoidStatus(); -// Logic.updateTooltip(batterymonitor.remainingTime); - } - - function stringForBatteryState(batteryData) { - if (batteryData["Plugged in"]) { - switch(batteryData["State"]) { - case "NoCharge": return i18n("Not Charging"); - case "Discharging": return i18n("Discharging"); - case "FullyCharged": return i18n("Fully Charged"); - default: return i18n("Charging"); - } - } else { - return i18nc("Battery is currently not present in the bay","Not present"); - } - } - - function plasmoidStatus() { - var status = PlasmaCore.Types.PassiveStatus; - if (powermanagementDisabled) { - status = PlasmaCore.Types.ActiveStatus; - } - - if (pmSource.data["Battery"]["Has Cumulative"]) { - if (pmSource.data["Battery"]["State"] !== "Charging" && pmSource.data["Battery"]["Percent"] <= 5) { - status = PlasmaCore.Types.NeedsAttentionStatus - } else if (pmSource.data["Battery"]["State"] !== "FullyCharged") { - status = PlasmaCore.Types.ActiveStatus - } - } - - return status; - } - - Plasmoid.compactRepresentation: MouseArea { - Layout.minimumWidth: batteryLayout.implicitWidth - Layout.minimumHeight: batteryLayout.implicitHeight - - property bool wasExpanded: false - onPressed: { - if (mouse.button == Qt.LeftButton) { - wasExpanded = plasmoid.expanded; - } else if (mouse.button == Qt.MiddleButton) { - muteVolume(); - } - } - onClicked: { - if (mouse.button == Qt.LeftButton) { - plasmoid.expanded = !wasExpanded; - } - } - RowLayout { - id: batteryLayout - anchors.fill: parent - spacing: -10 - PlasmaComponents.Label { - Layout.fillWidth: true - Layout.fillHeight: true - font.pixelSize: theme.smallestFont.pixelSize - text: pmSource.data["Battery"]["Percent"] - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - } - BatteryIcon { - id: batteryIcon - Layout.minimumWidth: height - Layout.maximumWidth: height - Layout.fillHeight: true - hasBattery: true - percent: pmSource.data["Battery"]["Percent"] - pluggedIn: pmSource.data["Battery"]["State"] == "Charging" - //FIXME: AC Adapter is not present there - //pmSource.data["AC Adapter"]["Plugged in"] - // height: batteryContainer.iconSize - // width: height - } - } - } - - Plasmoid.fullRepresentation: ExpandedRepresentation { - - - } - - property QtObject pmSource: PlasmaCore.DataSource { - id: pmSource - engine: "powermanagement" - connectedSources: sources - onSourceAdded: { - disconnectSource(source); - connectSource(source); - } - onSourceRemoved: { - disconnectSource(source); - } - /* FIXME: Brightness-related, but needs support lower in the stack first - onDataChanged: { - updateBrightness(batterymonitor, pmSource) - } - Component.onCompleted: { - print("Connecting powerdevil"); - connectSource("PowerDevil"); - } - */ - } -} diff --git a/applets/battery/package/metadata.desktop b/applets/battery/package/metadata.desktop deleted file mode 100644 index 3d33b94..0000000 --- a/applets/battery/package/metadata.desktop +++ /dev/null @@ -1,24 +0,0 @@ -[Desktop Entry] -Name=Battery and Brightness -Comment=See the power status of your device -Encoding=UTF-8 -Keywords=Power Management;Battery;System;Energy;Device; -Icon=battery -Type=Service -X-KDE-ServiceTypes=Plasma/Applet,Plasma/PopupApplet -X-Plasma-API=declarativeappletscript - -X-Plasma-MainScript=ui/battery.qml -X-Plasma-NotificationArea=true -X-Plasma-Provides=org.kde.plasma.powermanagement - -X-KDE-PluginInfo-Author=Sebastian Kügler -X-KDE-PluginInfo-Category=System Information -X-KDE-PluginInfo-Email=sebas@kde.org -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-Name=org.kde.plasma.phone.battery -X-KDE-PluginInfo-Version=1.0 -X-KDE-PluginInfo-Website=http://vizZzion.org -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-EnabledByDefault=true -X-Plasma-DBusActivationService=org.kde.Solid.PowerManagement diff --git a/shell/contents/layout.js b/shell/contents/layout.js index 1363232..bc44beb 100644 --- a/shell/contents/layout.js +++ b/shell/contents/layout.js @@ -1,28 +1,28 @@ var desktopsArray = desktopsForActivity(currentActivity()); for (var j = 0; j < desktopsArray.length; j++) { desktopsArray[j].wallpaperPlugin = "org.kde.image"; //desktopsArray[j].name = "Homescreen" + (j > 0 ? " " + j : ""); desktopsArray[j].currentConfigGroup = ["Wallpaper", desktopsArray[j].wallpaperPlugin, "General"]; desktopsArray[j].writeConfig("Image", "org.kde.plasma.phone.lockers"); } desktopsArray[0].addWidget("org.kde.plasma.analogclock"); var panel = new Panel("org.kde.phone.panel"); panel.addWidget("org.kde.plasma.notifications"); panel.addWidget("org.kde.plasma.networkmanagement"); -panel.addWidget("org.kde.plasma.phone.battery"); +panel.addWidget("org.kde.plasma.battery"); panel.addWidget("org.kde.plasma.volume"); panel.height = 60; var bottomPanel = new Panel("org.kde.phone.taskpanel"); bottomPanel.location = "bottom"; if (screenGeometry(bottomPanel.screen).height > screenGeometry(bottomPanel.screen).width) bottomPanel.height = 150; else bottomPanel.height = 60;