Upgrading Widgets from plasma-workspace
Pavel
mars at altlinux.org
Mon Mar 4 12:55:45 GMT 2019
Good day. Need your help.
I am Upgrading Widgets from plasma-workspace and faced a number of
problems.
I will show the modernization goals using the example of the
diskactivity widget, designed to visualize hard drive activity:
1) At the moment when the widget is first loaded after installation,
all the checkboxes are selected in the settings (checked = true).
- It is necessary to make the widget display only real disk devices
(not virtual, not loop or ram) by default.
2) When the user tries to disable all checkboxes in the widget
settings, this does not work. After the last checkbox is turned off, all
checkboxes are turned on again (the default mode). I can’t disable all
checkboxes at the same time.
- I need to make sure that after disabling all settings the widget is
empty.
I decided to do this using the widget's initialization flag
(widget_initialized). By default, widget_initialized = false.
When you first start the widget, when it has loaded all its settings,
the value of the flag widget_initialized = true is set to
Component.onCompleted.
And if the widget_initialized flag is set to true, then all subsequent
changes are considered to be made by the user.
The widget_initialized flag allows to distinguish the first launch of
the widget from the case when the user cleared all settings.
Is there any other way to do this? Suppose using the API? Is there any
specialized API that allows you to achieve a similar result? Preferably
available from QML. Or maybe this API can be added somewhere?
Thank you!
--
With best regards, Pavel Moseev
mars at basealt.ru
mars at altlinux.org
More information about the Plasma-devel
mailing list