From fce8bc1e53e1ff30b4bf24febb373f4da10345b5 Mon Sep 17 00:00:00 2001 From: Jason Nader Date: Sun, 13 Dec 2020 21:28:23 +0900 Subject: [PATCH] plugins/battery: add battery charge info to the update signal (cherry picked from commit b5ac96ce5b1c95e1dc9ca57b23c81da09f1fd490) --- interfaces/dbusinterfaces.h | 2 +- plugins/battery/batteryplugin.cpp | 2 +- plugins/battery/batteryplugin.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interfaces/dbusinterfaces.h b/interfaces/dbusinterfaces.h index 370d7951c..c1b4dce7c 100644 --- a/interfaces/dbusinterfaces.h +++ b/interfaces/dbusinterfaces.h @@ -88,7 +88,7 @@ public: ~BatteryDbusInterface() override; Q_SIGNALS: - void refreshedProxy(); + void refreshedProxy(bool isCharging, int charge); }; class KDECONNECTINTERFACES_EXPORT DeviceNotificationsDbusInterface diff --git a/plugins/battery/batteryplugin.cpp b/plugins/battery/batteryplugin.cpp index 5bbc616d1..15c6b28cc 100644 --- a/plugins/battery/batteryplugin.cpp +++ b/plugins/battery/batteryplugin.cpp @@ -123,7 +123,7 @@ bool BatteryPlugin::receivePacket(const NetworkPacket& np) m_charge = np.get(QStringLiteral("currentCharge"), -1); const int thresholdEvent = np.get(QStringLiteral("thresholdEvent"), (int)ThresholdNone); - Q_EMIT refreshed(); + Q_EMIT refreshed(m_isCharging, m_charge); if (thresholdEvent == ThresholdBatteryLow && !m_isCharging) { Daemon::instance()->sendSimpleNotification(QStringLiteral("batteryLow"), i18nc("device name: low battery", "%1: Low Battery", device()->name()), i18n("Battery at %1%", m_charge), QStringLiteral("battery-040")); diff --git a/plugins/battery/batteryplugin.h b/plugins/battery/batteryplugin.h index 23143954f..853154d6e 100644 --- a/plugins/battery/batteryplugin.h +++ b/plugins/battery/batteryplugin.h @@ -31,7 +31,7 @@ public: bool isCharging() const; Q_SIGNALS: - Q_SCRIPTABLE void refreshed(); + Q_SCRIPTABLE void refreshed(bool isCharging, int charge); private: void slotChargeChanged();