Bug 420920

Summary: Tooltip and popup of battery applet show different battery levels
Product: [Plasma] plasmashell Reporter: Patrick Silva <bugseforuns>
Component: Power and Battery widgetAssignee: Kai Uwe Broulik <kde>
Status: RESOLVED FIXED    
Severity: normal CC: nate, plasma-bugs
Priority: NOR    
Version: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: screen recording
Mismatched percentages

Description Patrick Silva 2020-05-02 20:34:16 UTC
Created attachment 128100 [details]
screen recording

STEPS TO REPRODUCE
1. disconnect the ac adapter from your laptop
2. use your device during a few minutes/hours or just wait for the battery level to decrease
3. reconnect the ac adapter to your device and wait for your battery to be charged
4. observe the battery level hovering over the battery applet in systray.
Also click on such applet and observe the percentage of "Charging".

OBSERVED RESULT
Tooltip and popup of battery applet show different battery levels.
Watch the attached screen recording please.

EXPECTED RESULT
Tooltip and popup of battery applet should show the same battery level

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.18.80
KDE Frameworks Version: 5.70.0
Qt Version: 5.14.2
Comment 1 Nate Graham 2020-05-07 14:08:16 UTC
If you enable the percentage display on the tray icon, which number does it show?
Comment 2 Patrick Silva 2020-05-07 14:46:13 UTC
(In reply to Nate Graham from comment #1)
> If you enable the percentage display on the tray icon, which number does it
> show?

Tray icon and its popup show the same battery level.
Tooltip shows another (and incorrect) battery level.
Comment 3 Kai Uwe Broulik 2020-05-07 14:48:58 UTC
Both tray icon and tooltip use pmSource.data.Battery.Percent - so I don't see why the icon would be correct and the tooltip not. If any, the icons hould be wrong as well :/
Comment 4 Nate Graham 2020-05-07 17:45:45 UTC
Just reproduced this myself! :(
Comment 5 Nate Graham 2020-05-07 17:46:00 UTC
Created attachment 128238 [details]
Mismatched percentages
Comment 6 Nate Graham 2020-05-07 17:59:37 UTC
The tooltip is accessing the information using `pmSource.data.Battery.Percent` rather than `pmSource.data["Battery"]["Percent"]` which is used by the pop-up and the tray icon overlay. But switching the tooltip to using the same access method fix it. How odd. Could it be an issue where the toolTipMainText: condition doesn't get updated when the value changes due the complex logic in it?
Comment 7 Nate Graham 2020-05-11 17:26:14 UTC
Will be fixed with https://phabricator.kde.org/D29633
Comment 8 Kai Uwe Broulik 2020-05-12 13:31:25 UTC
Git commit ddefcfb7c901dc31a356fc1089d69122ac89f9e4 by Kai Uwe Broulik.
Committed on 12/05/2020 at 13:30.
Pushed by broulik into branch 'master'.

[Battery Monitor] Fix toolTipMainText when plugged in

It only had a return value for "NoCharge" since the else case was only for not plugged in, resulting in it effectively returning undefined,
throwing during assignment "cannot assign [undefined] to string" and leaving whatever text happened to be shown last.

Differential Revision: https://phabricator.kde.org/D29633

M  +8    -4    applets/batterymonitor/package/contents/ui/batterymonitor.qml

https://commits.kde.org/plasma-workspace/ddefcfb7c901dc31a356fc1089d69122ac89f9e4