Skip to content
Verified Commit 23351429 authored by ivan tkachenko's avatar ivan tkachenko 🗯
Browse files

TextArea,ContextMenu: Fix and rework Sonnet based spellchecker

This patch somewhat simplifies data flow and state management of spell
checker in TextArea.

Sonnet.Settings becomes a global instance, so default state can be
synchronized between text fields for which user did not toggle spell
checking explicitly. This is actually interesting, as Sonnet.Settings
does not emit signals across all instances, so a force-refresh (READ)
might be required to receive updates values.

Both Instantiator of spellchecker highlighter and the highlighter itself
are not being toggled from the context menu anymore. Now everything
routes through TextArea instance's Kirigami.SpellChecking.enabled state,
which also ensures that binding to defaults breaks when user explicitly
toggles spellchecker from a context menu item. This also makes it
possible to programmatically force spellchecker highlighter to be
active on a read-only text area, however a context menu still won't
show any spellchecker actions in that case.

Test plan:

- Open Kirigami Gallery, navigate to "Text Field" page.
- Open System Settings -> Spell Check KCM -> toggle "Automatic spell
  checking enabled by default" checkbox, click Apply.
- Open new instance of Kirigami Gallery app -> go to Text Field page.

If you have any dictionaries installed, in one of the two app instances
you should see lots of red words highlighted.

- Toggle the Spell Check checkbox on the page.
- Right click on the text area, toggle Spell Check menu item.

Both ways to toggle spellchecker should work.
parent aa9c96dc
Pipeline #483544 passed with stage
in 1 minute and 9 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment