applets/notes: Workaround initialization bug (+minor code improvements)
list of changes, in the order from boring to interesting, so better read from the bottom:
Set more efficient background for TextArea
Clean up unnecessary id
Explicitly specify arguments in signal handlers
Injection of parameters into signal handlers is deprecated. Use JavaScript functions with formal parameters instead.
Fix check on attached object Window
Attached objects always exist whenever you query, set or bind them or their properties. This particular line of code meant to check if item is presented in a window, to guard next subexpression that reads flags.
Move DocumentHandler inside full representation
PlasmoidItem's setting preloadFullRepresentation: true
causes a glitch
of initialization order: full representation component is created
immediately when the toggle is flipped ON, which is practically right
in the middle on QML Engine being busy creating PlasmoidItem as a whole
and populating its properties and bindings. Essentially there is a risk
of observing something normally unobservable: QML objects' id references
may be null on read! So the signal handler onCfgFontPointSizeChanged in
TextArea was failing on start with an error
main.qml:214: TypeError: Value is null and could not be converted to an object
which can be interpreted as "I know that documentHandler
is an object
property, it exists and I can try to read it, but currently its value
is null". That definitely is not something that's supposed to ever
happen in QML land, but something that can be easily patched up in
applet. Besides, there is no reason why DocumentHandler should exist
outside of full representation component, and relocation simplifies its
bindings by getting rid of conditionals (which theoretically were not
needed anyway due to preloading in the first place).