This is a common snippet of code in applets. It prevents applet from
re-expanding again when user clicks on the compact representation when
the applet is already expanded and located on a desktop containment.
Instead of using a ScrollView just for the battery items, convert the
existing ColumnLayout to the header of the ListView. Then everything
works magically :)
Co-Authored-By: Carl Schwan <carl@carlschwan.eu>
Power profile labels are gone and replaced with only two descriptive
icons, and now there's only one of label at the top of the slider,
which aligns with what `BrightnessItem`s do.
Padding of the header is handled now entirely within the header itself.
Kernel developers have said that charge limits are approximate, not
exact[1]. As a result, if for example you have a charge limit of 80%,
your battery might actually stop charging anywhere between 78-82%. But
if we only list the charge limit itself, it looks to users like a KDE
bug when the battery stops charging at any number other than that limit.
To alleviate that, this commit adjusts the text to indicate that the
charge limit is appropximate.
[1] https://bugzilla.kernel.org/show_bug.cgi?id=215531#c3
When we are using a charge threshold, the kernel may stop charging
within a percentage point of the actual threshold and this is
considered correct behavior, so we have to handle that. See
https://bugzilla.kernel.org/show_bug.cgi?id=215531.
Also, Upower may give us a status of "Not charging" rather than
"Fully charged", so we need to account for that as well. See
https://gitlab.freedesktop.org/upower/upower/-/issues/142.
BUG: 435931
No more one/many hints discrimination. They can all live happy together,
under single Repeater, using model directly. When the model will
migrate to a real Qt AbstractModel subclass (e.g. QML ListModel),
delegate's properties code will need to be adjusted again though.
Pass down laptop's lid action inhibition all the way from the top-level
file to reduce dependency on sketchy context properties and make
components more self-contained.
"Fix" as in "repair and make it right". This commit actually makes
header dynamic as it was always supposed to be. Wrongly fixed height
with dummy empty padding at the bottom was the result of incorrectly
applied anchors within Container[1]'s contentChildren.
[1]: PlasmoidHeading is a TabBar which inherits from Container and Control.
Technically it doesn't matter, since they are mutually exclusive anyway.
But for the upcoming refactoring it will be a bit easier to see what's
going on if they'll be close to each other.
Typically we have properties on top, then functions, then signal
handlers, then child items, then the onCompleted: block. The Battery
Monitor didn't conform to that, so this commit makes it do so. There are
no actual code changes; stuff is simply moved around for greater clarity
and style standardization.
f9e39815d ("applets/batterymonitor: Improve for desktop systems") changed the
plasmoid to use a plain icon instead of the CompactRepresentation if there are
no batteries.
While 471cc3745 ("applets/batterymonitor: fix CompactRepresentation") brought
the use of the CompactRepresentation back, the plain icon is still used.
For the case that there are no batteries and brightness controls available,
it fell back to "battery", which has no symbolic variant. Change that to use
the symbolic "video-display-brightness" as well.
BUG: 448520
This reverts commit 354f7da871.
Somehow it prevents inhibitions from being visible in the UI. Since the
reason is not yet understood, let's revert for now to prevent releasing
a regression while we investigate.
CCMAIL: me@ratijas.tk
In the process, the onWheel handler is moved up to the main file so that
it gains write access to the screenBrightness property. This is how
other scrollable applets handle the same situation.
In the CompactRepresentation, we can use existing top-level properties
instead of defining and redefining a bunch of new properties at
various levels, which makes the code harder to read and more indirect.
f9e39815dc introduced a few regressions by
blowing away the custom CompactRepresentation when there are no
batteries. This introduced a race condition that sometimes set the icon
incorrectly and also broke scrolling on the applet to change the volume.
This commit fixes those issues by using the existing infrastructure for
the CompactPepresentation, but simply swapping out its custom battery
icon for normal icon when there are no batteries.
They both say the same thing, but the "broken battery" message is more
descriptive and actionable, so we can show only that.
BUG: 442906
FIXED-IN: 5.24
As it was so far, it looked like the system was malfunctioning because
we were showing a battery with a big fat red mark. If there's no battery
we can show the default icon.
As for the name, we only say "battery and brightness" when there's
both of them. Otherwise we show either title.
If neither batteries nor brightness are available, we mark the applet as
passive so people can at least still access the power management blocking
checkbox which lives here.
BUG: 415073
FIXED-IN: 5.24