Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
KDE Connect
Commits
b5ac96ce
Verified
Commit
b5ac96ce
authored
Dec 13, 2020
by
Jason Nader
🇦🇽
Browse files
plugins/battery: add battery charge info to the update signal
parent
38afb807
Pipeline
#43984
passed with stage
in 5 minutes and 40 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
interfaces/dbusinterfaces.h
View file @
b5ac96ce
...
...
@@ -88,7 +88,7 @@ public:
~
BatteryDbusInterface
()
override
;
Q_SIGNALS:
void
refreshedProxy
();
void
refreshedProxy
(
bool
isCharging
,
int
charge
);
};
class
KDECONNECTINTERFACES_EXPORT
DeviceNotificationsDbusInterface
...
...
plugins/battery/batteryplugin.cpp
View file @
b5ac96ce
...
...
@@ -123,7 +123,7 @@ bool BatteryPlugin::receivePacket(const NetworkPacket& np)
m_charge
=
np
.
get
<
int
>
(
QStringLiteral
(
"currentCharge"
),
-
1
);
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
)
{
Daemon
::
instance
()
->
sendSimpleNotification
(
QStringLiteral
(
"batteryLow"
),
i18nc
(
"device name: low battery"
,
"%1: Low Battery"
,
device
()
->
name
()),
i18n
(
"Battery at %1%"
,
m_charge
),
QStringLiteral
(
"battery-040"
));
...
...
plugins/battery/batteryplugin.h
View file @
b5ac96ce
...
...
@@ -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
();
...
...
Jason Nader
🇦🇽
@edkytitnedi
mentioned in commit
fce8bc1e
·
Dec 13, 2020
mentioned in commit
fce8bc1e
mentioned in commit fce8bc1e53e1ff30b4bf24febb373f4da10345b5
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment