diff --git a/plasma/applets/batterymonitor/contents/config/main.xml b/plasma/applets/batterymonitor/contents/config/main.xml deleted file mode 100644 index 5e9e31d7..00000000 --- a/plasma/applets/batterymonitor/contents/config/main.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - false - - - - diff --git a/plasma/applets/batterymonitor/contents/ui/BatteryItem.qml b/plasma/applets/batterymonitor/contents/ui/BatteryItem.qml index b4902fc9..8fc62711 100644 --- a/plasma/applets/batterymonitor/contents/ui/BatteryItem.qml +++ b/plasma/applets/batterymonitor/contents/ui/BatteryItem.qml @@ -40,8 +40,6 @@ Item { // UPower seems to set the Present property false when a device is added but not probed yet property bool isPresent: model["Plugged in"] - property int remainingTime - KLocale.Locale { id: locale } function updateSelection() { @@ -218,19 +216,6 @@ Item { Column { id: labelsColumn - Components.Label { - height: paintedHeight - width: parent.width - horizontalAlignment: Text.AlignRight - onPaintedWidthChanged: { - if (paintedWidth > parent.width) { parent.width = paintedWidth; } - } - // FIXME Bound to AC adapter plugged in, not battery charging, see below - text: pluggedIn ? i18n("Time To Full:") : i18n("Time To Empty:") - visible: remainingTimeLabel.visible - font.pointSize: theme.smallestFont.pointSize - color: "#99"+(theme.textColor.toString().substr(1)) - } Components.Label { height: paintedHeight width: parent.width @@ -270,17 +255,6 @@ Item { } Column { width: parent.width - labelsColumn.width - parent.spacing * 2 - Components.Label { // Remaining Time - id: remainingTimeLabel - height: paintedHeight - width: parent.width - elide: Text.ElideRight - // FIXME Uses overall remaining time, not bound to individual battery - text: locale.prettyFormatDuration(dialogItem.remainingTime) - visible: showRemainingTime && model["Is Power Supply"] && model["State"] != "FullyCharged" && text != "" && dialogItem.remainingTime > 0 - font.pointSize: theme.smallestFont.pointSize - color: "#99"+(theme.textColor.toString().substr(1)) - } Components.Label { // Capacity id: capacityLabel height: paintedHeight diff --git a/plasma/applets/batterymonitor/contents/ui/PopupDialog.qml b/plasma/applets/batterymonitor/contents/ui/PopupDialog.qml index 298929cc..a3c6d90f 100644 --- a/plasma/applets/batterymonitor/contents/ui/PopupDialog.qml +++ b/plasma/applets/batterymonitor/contents/ui/PopupDialog.qml @@ -32,9 +32,6 @@ FocusScope { property alias model: batteryList.model property bool pluggedIn - property int remainingTime - property bool showRemainingTime - property bool popupShown // somehow plasmoid.popupShowing isn't working property int pmSwitchWidth: padding.margins.left + pmSwitch.implicitWidth + padding.margins.right diff --git a/plasma/applets/batterymonitor/contents/ui/batterymonitor.qml b/plasma/applets/batterymonitor/contents/ui/batterymonitor.qml index 92829636..88db2abe 100644 --- a/plasma/applets/batterymonitor/contents/ui/batterymonitor.qml +++ b/plasma/applets/batterymonitor/contents/ui/batterymonitor.qml @@ -29,22 +29,15 @@ Item { property int minimumHeight: dialogItem.actualHeight property int maximumHeight: dialogItem.actualHeight - property bool show_remaining_time: false - LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft LayoutMirroring.childrenInherit: true Component.onCompleted: { plasmoid.aspectRatioMode = IgnoreAspectRatio updateLogic(); - plasmoid.addEventListener('ConfigChanged', configChanged); plasmoid.popupEvent.connect(popupEventSlot); } - function configChanged() { - show_remaining_time = plasmoid.readConfig("showRemainingTime"); - } - function updateLogic() { Logic.updateCumulative(); @@ -117,9 +110,6 @@ Item { anchors.fill: parent focus: true - showRemainingTime: show_remaining_time - remainingTime: Number(pmSource.data["Battery"]["Remaining msec"]) - pluggedIn: pmSource.data["AC Adapter"]["Plugged in"] property int cookie1: -1 diff --git a/plasma/dataengines/powermanagement/powermanagementengine.cpp b/plasma/dataengines/powermanagement/powermanagementengine.cpp index 158d4c53..369d2aa1 100644 --- a/plasma/dataengines/powermanagement/powermanagementengine.cpp +++ b/plasma/dataengines/powermanagement/powermanagementengine.cpp @@ -64,17 +64,8 @@ void PowermanagementEngine::init() connect(Solid::DeviceNotifier::instance(), SIGNAL(deviceRemoved(QString)), this, SLOT(deviceRemoved(QString))); - // FIXME This check doesn't work, connect seems to always return true, hence the hack below if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.freedesktop.PowerManagement")) { sourceRequestEvent("PowerDevil"); - - if (!QDBusConnection::sessionBus().connect("org.freedesktop.PowerManagement", - "/org/freedesktop/PowerManagement", - "org.freedesktop.PowerManagement", - "BatteryRemainingTimeChanged", this, - SLOT(batteryRemainingTimeChanged(qulonglong)))) { - kDebug() << "error connecting to remaining time changes"; - } } } @@ -136,14 +127,6 @@ bool PowermanagementEngine::sourceRequestEvent(const QString &name) setData("Battery", "Has Battery", !batterySources.isEmpty()); if (!batterySources.isEmpty()) { setData("Battery", "Sources", batterySources); - QDBusMessage msg = QDBusMessage::createMethodCall("org.freedesktop.PowerManagement", - "/org/freedesktop/PowerManagement", - "org.freedesktop.PowerManagement", - "BatteryRemainingTimeChanged"); - QDBusPendingReply reply = QDBusConnection::sessionBus().asyncCall(msg); - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); - QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - this, SLOT(batteryRemainingTimeReply(QDBusPendingCallWatcher*))); } m_sources = basicSourceNames() + batterySources; @@ -359,24 +342,6 @@ void PowermanagementEngine::deviceAdded(const QString& udi) } } -void PowermanagementEngine::batteryRemainingTimeChanged(qulonglong time) -{ - //kDebug() << "Remaining time 2:" << time; - setData("Battery", "Remaining msec", time); -} - -void PowermanagementEngine::batteryRemainingTimeReply(QDBusPendingCallWatcher *watcher) -{ - QDBusPendingReply reply = *watcher; - if (reply.isError()) { - kDebug() << "Error getting battery remaining time: " << reply.error().message(); - } else { - batteryRemainingTimeChanged(reply.value()); - } - - watcher->deleteLater(); -} - K_EXPORT_PLASMA_DATAENGINE(powermanagement, PowermanagementEngine) #include "moc_powermanagementengine.cpp" diff --git a/plasma/dataengines/powermanagement/powermanagementengine.h b/plasma/dataengines/powermanagement/powermanagementengine.h index 36542f9e..047408d1 100644 --- a/plasma/dataengines/powermanagement/powermanagementengine.h +++ b/plasma/dataengines/powermanagement/powermanagementengine.h @@ -60,8 +60,6 @@ private slots: void deviceRemoved(const QString& udi); void deviceAdded(const QString& udi); - void batteryRemainingTimeChanged(qulonglong time); - void batteryRemainingTimeReply(QDBusPendingCallWatcher*); private: QString batteryType(const Solid::Battery *battery);