plugins/battery: add battery charge info to the update signal
This commit is contained in:
parent
38afb807bf
commit
b5ac96ce5b
3 changed files with 3 additions and 3 deletions
|
@ -88,7 +88,7 @@ public:
|
||||||
~BatteryDbusInterface() override;
|
~BatteryDbusInterface() override;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void refreshedProxy();
|
void refreshedProxy(bool isCharging, int charge);
|
||||||
};
|
};
|
||||||
|
|
||||||
class KDECONNECTINTERFACES_EXPORT DeviceNotificationsDbusInterface
|
class KDECONNECTINTERFACES_EXPORT DeviceNotificationsDbusInterface
|
||||||
|
|
|
@ -123,7 +123,7 @@ bool BatteryPlugin::receivePacket(const NetworkPacket& np)
|
||||||
m_charge = np.get<int>(QStringLiteral("currentCharge"), -1);
|
m_charge = np.get<int>(QStringLiteral("currentCharge"), -1);
|
||||||
const int thresholdEvent = np.get<int>(QStringLiteral("thresholdEvent"), (int)ThresholdNone);
|
const int thresholdEvent = np.get<int>(QStringLiteral("thresholdEvent"), (int)ThresholdNone);
|
||||||
|
|
||||||
Q_EMIT refreshed();
|
Q_EMIT refreshed(m_isCharging, m_charge);
|
||||||
|
|
||||||
if (thresholdEvent == ThresholdBatteryLow && !m_isCharging) {
|
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"));
|
Daemon::instance()->sendSimpleNotification(QStringLiteral("batteryLow"), i18nc("device name: low battery", "%1: Low Battery", device()->name()), i18n("Battery at %1%", m_charge), QStringLiteral("battery-040"));
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
bool isCharging() const;
|
bool isCharging() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
Q_SCRIPTABLE void refreshed();
|
Q_SCRIPTABLE void refreshed(bool isCharging, int charge);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void slotChargeChanged();
|
void slotChargeChanged();
|
||||||
|
|
Loading…
Reference in a new issue