The value of previousItemInFocusChain is appletContainer when the applet
is on desktop, but we don't want to establish hidden tab focus relation
between appletContainer and the last battery item, so use `Keys.onTabPressed`
instead.
1. Add arrow key navigation support
2. Imrpove a11y description for battery items, so messages like "Your
battery is unhealthy" can be read by a screen reader.
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.
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.
The plan is to eventually transition it to some sort of reactive model,
e.g. ListModel or C++ based one. Meanwhile, a simple js array of
objects is fine too, but is should be explicit and documented.
Pass remainingTime property explicitly instead of looking up the
top-most item via implicit scoping / context. It doesn't work well
especially in ListView delegates. Besides, there already was such
property in the PopupDialog, although it was unused until now.
Amends 7d0f1a014c, this time for real
ScrollView+ListView duo gained a small padding between its delegates and
a scrollbar, but only when the scrollbar is visible. It solves the
problem of content 'sticking' to the scrollbar, and keeps right side
aligned when there is no scroll.
It also behaves as intended under RTL layout mirroring, out of the box.
No visually observable changes, again. But it replaces most of the
anchors tweaking with a simple QtQuick.Layout interface.
You might've noticed how
topMargin: PlasmaCore.Units.gridUnit
got replaced with a different-looking
Layout.topMargin: PlasmaCore.Units.smallSpacing * 2
but that's all according to the plan, since this ScrollView is now
inside a ColumnLayout which has its own spacing that adds up.
Also, settingsColumn id is removed because it became unused.
Would you ever polish something before dividing it by zero?
Well, at least this is somehow justifiable. Anchors were too horrible to
deal with, even for a rewriting. Now they are all in one place, sorted
out, and no more manual width setting.
Replaces Math.round(PlasmaCore.Units.gridUnit / 2) with smallSpacing * 2
for better performance. This is not equal to largeSpacing, which is
deprecated for this very same reason anyway.
This change may result in slightly more dense layout on your system,
because the wrong formula was used before.
Fixes the following error:
plasmoids/org.kde.plasma.battery/contents/ui/PowerProfileItem.qml:137:
TypeError: Cannot read property 'label' of undefined
Profile data was moved to the root component where it makes most sense.
Other chunks of code were aggregated into read-only properties nearby.
It greatly simplified the rest of code in the file.
Took a while to figure out actual structure of the data that comes from
plasma data engine, so now it's somehow documented for future reference.
Optimize previous patch that introduced extra margins for the battery's
progress bar in order to make its labels visually match the distance of
brightness sliders on top of it.
This patch moves `referenceSlider` property to the root component of
BatteryItem.qml, so that an existing item can be passed from the
outside. It keeps the default value there just in case, but it won't be
instantiated by QML engine when the property is overriden at component
declaration. (Note: this won't be true if the slider had an id set.)
Since we are defining some properties on the top-level component, we
might as well move the `extraMargin` here, so that the actual
ProgressBar component now won't have any properties on its own, and
thus QML engine won't create an extra runtime QML type just for it.
In most cases the port is trivial and can even simplify the code like in
the case of the system tray applet. In the case of notifications applet,
this is causing a bigger refactor and it's now also using a TextArea
that provides the automatic scrolling when selecting behavior.
CCBUG: 437155
Sets the profiles via the wrapped ui in powerdevil if available.
If the performance profile is inhibited, the second half of the slider
will look disabled and it will be impossible to move it to performance.
Co-authored-by: Kai Uwe Broulik <kde@privat.broulik.de>
The power management inhibition UI is currently somewhat confusing to
users because it's not clear that the checkbox is a local override for
the permanent settings set elsewhere in System Settings.
A good sign that the UI is sub-optimal is that we refer to it as "power
management inhibition" internally and in our developer conversations,
but the UI expresses the opposite: *allowing* power management, not
inhibiting it. This conflicts in the user's mind with the UI in System
Settings that is also expressed in terms of allowing it. It is further
confused by the fact that the message about apps suppressing power
management is phrased in terms of being an temporary override, and that
we also show an unrelated message about the battery charge limit (if set)
in the same place where we're notifying the user about power management
inhibition.
Let's clarify this UI by doing the following:
- Re-word the checkbox's label to emphasize that it's a local override
for the settings that were set elsewhere
- Move the charge level message into the battery item itself, since
that's what it affects
- Slightly re-word the message for when apps are inhibiting power
management to emphasize that power management can be inhibited
automatically by apps in additionto manually by the user
BUG: 435827
FIXED-IN: 5.22
The context property version is slower to access and won't be supported
in Qt6. Let's port away from it and use the singleton version instead.
Here was my full process for making this change:
1. Made the change with `find . -name '*.qml' | xargs perl -pi -e 's/units\./PlasmaCore\.Units\./g'`
2. Verified no more occurrences with `grep -r " units."`
3. Made sure this didn't change any comments in a silly way by inspecting the output of `git diff | grep "+ " | grep "//"`
4. Manually inspected the full git diff to make sure there were no other unintentional or silly changes (there were none)
5. verified that all changed files have the PlasmaCore import with the correct name with `for FILE in `git status | grep modified | cut -d ":" -f 3`; do grep -q "as PlasmaCore" $FILE || echo "$FILE needs the PlasmaCore import"; done`
Qt 5.15 introduced new syntax for defining Connections. Fix warnings like this one:
QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
At the moment, in the battery widget, the slider displays the brightness of the screen, but
it doesn't have text labels, so it's quite difficult to determine the brightness of the
screen. Adding a label over the slider that will display the current screen brightness as a
percentage will make this applet more descriptive and handy.
Summary:
This patch implements part of the mockup at T10470 by putting the power management
checkbox and settings button in a heading area visually connected to the titlebar.
In the process, I fixed a problem with the power management checkbox to make the layout's
spacing work: the checkbox now has text of its own, instead of living in a mouse area
with a separate label.
Test Plan:
{F8254807}
{F8254808}
Reviewers: #vdg, #plasma, broulik, niccolove, manueljlin
Reviewed By: #vdg, manueljlin
Subscribers: plasma-devel
Tags: #plasma
Maniphest Tasks: T10470
Differential Revision: https://phabricator.kde.org/D29116
Summary: With other two patches, this aims to make leftMargin consistent in widgets (See https://phabricator.kde.org/D26945 and https://phabricator.kde.org/D26944)
Test Plan:
System tray
Before:
{F7977382}
After:
{F7977379}
Notifications
Before:
{F7977359}
After:
{F7977357}
Battery monitor
Before:
{F7977362}
After:
{F7977361}
Self reminder: networkmanager is still slightly badly aligned
Reviewers: #vdg, #plasma, ngraham
Reviewed By: #vdg, ngraham
Subscribers: gvgeo, ngraham, plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D26946
Summary:
Use QQC2.Slider, so that we have a moved signal. This way we can only
issue new brightnesses when the user actually interacts with it.
Don't adapt to the system brightness until we have finished interacting
with it.
Test Plan:
Manual testing, flickering is very much reduced both when scrolling over the
compact plasmoid as well as the slider.
Reviewers: #plasma, broulik
Reviewed By: #plasma, broulik
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D26035
Summary:
BUG: 345940
Move the "Enable Power Management" checkbox to the top of the window to match other applets (bluetooth, network)
Reviewers: #plasma_workspaces, broulik, mck182, davidedmundson, mart
Reviewed By: #plasma_workspaces, davidedmundson, mart
Subscribers: mart, jensreuterberg, davidedmundson, plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D8607
Calculate the plasmoid status and tooltips in a binding rather than invoking
Logic.updateFoo manually; this way we can have the QML engine do what it can do best.
Unfortunately it cannot look inside JS objects, so we cannot have the inhibitions
be handled the same way.
Use Layouts where applicable and clean up a bit. Makes the code much easier to follow.
Also drop meaningless percentage for brightness as suggested by the usability team.
Prevent a "You don't say" moment, only show the OSD when using the mousewheel on the tray icon
to provide feedback. Also make it more finegrained and allow 5% steps on the tray icon