Bug 434173

Summary: Konqueror automatic spell checking not working with WebEngine
Product: [Applications] konqueror Reporter: Linux User #330250 <andreas.thalhammer>
Component: webenginepartAssignee: Konqueror Bugs <konqueror-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: jsardid, klaus-dieter.fietze, miikka.veijonen, stefano.crocco
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Configure Spell Checking in Konqueror's Settings menu
Related system settings for the spell checker configuration
Related system settings for the spell checker configuration

Description Linux User #330250 2021-03-09 07:16:30 UTC
SUMMARY
In Konqueror, system-wide automatic spell checking does work only with the now depricated KHTML rendering engine, but it does not with either WebKit (never did, now depricated) or WebEngine (currently the only actively maintained engine).

KHTML can still be selected, but has a lot of other issues. Interestingly spell checking is working though.

WebEngine, or rather qtwebengine, works quite well, but without spell checking.

STEPS TO REPRODUCE
None. Just install and use Konqueror.

OBSERVED RESULT
Spell checking working in KDE applications after configuration in system-wide Plasma settings, e.g. in Kate, or even in Konqueror when KHTML is selected, but not in Konqueror with WebEngine.

EXPECTED RESULT
Spell checking should work.

SOFTWARE/OS VERSIONS
Linux: Gentoo Linux (rolling)
KDE Plasma Version: 20.08.3
KDE Frameworks Version: 5.77.0
Qt Version: 5.15.2
Konqueror Version: 20.08.3

ADDITIONAL INFORMATION
I also tried Debian GNU/Linux with KDE/Plasma and there the spell checking also didn't work in Konqueror.
I think this bug should close these two bug reports:
* Bug 342754
* Bug 341183
Both are for WebKit, which in the current version of KDE/Plasma has been replaced by WebEngine.
Comment 1 Klaus-Dieter Fietze 2021-05-12 07:30:48 UTC
I confirm the described behaviour. Would like to use spell checking in the webmail client but "Settings" --> "Configure Spell Checking" does not do anthing.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20210508
KDE Plasma Version: 5.21.5
KDE Frameworks Version: 5.81.0
Qt Version: 5.15.2
Konqueror Version: 21.04.0
webenginepart version: 21.04.0
Kernel Version: 5.12.0-2-default
OS Type: 64-bit
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-7700T CPU @ 2.90GHz
Memory: 7.6 GiB of RAM
Graphics Processor: Mesa DRI Intel® HD Graphics 630
Comment 2 Klaus-Dieter Fietze 2021-11-03 09:49:13 UTC
Created attachment 143161 [details]
Configure Spell Checking in Konqueror's Settings menu
Comment 3 Klaus-Dieter Fietze 2021-11-03 09:50:45 UTC
The spell check still does not work in Konqueror (though it works well in Kate).  
Past updates have brought some improvements, though. Now, the Konqueror settings menu lets you choose "Configure Spell Checking". However, when working in any text input window, right click opens a multiple choice, where you can enable spell checking, but when right clicking again, "Spell Checking Enabled" is ticked but the menu point "Languages" below does not offer any choice.

Operating System: openSUSE Tumbleweed 20211031  
KDE Plasma Version: 5.23.2  
KDE Frameworks Version: 5.87.0  
Qt Version: 5.15.2  
Kernel Version: 5.14.14-1-default (64-bit)  
Graphics Platform: X11  

Spell checker: Hunspell  
Dictionaries: myspell de, de_DE, en, en_GB, fr_FR, pt_BR  
(No ispell nor aspell installed.)
Comment 4 Klaus-Dieter Fietze 2021-11-03 09:55:33 UTC
Created attachment 143162 [details]
Related system settings for the spell checker configuration
Comment 5 Klaus-Dieter Fietze 2021-11-03 09:57:15 UTC
Created attachment 143163 [details]
Related system settings for the spell checker configuration
Comment 6 David Faure 2022-01-01 19:53:20 UTC
Git commit 7cc349a1d6a1ff7ed54fc887f1abf911b20b1398 by David Faure, on behalf of Stefano Crocco.
Committed on 01/01/2022 at 19:53.
Pushed by dfaure into branch 'master'.

Perform spellchecker setup on creation

M  +3    -11   webenginepart/src/spellcheckermanager.cpp
M  +0    -3    webenginepart/src/spellcheckermanager.h

https://invent.kde.org/network/konqueror/commit/7cc349a1d6a1ff7ed54fc887f1abf911b20b1398
Comment 7 Miikka 2023-08-28 12:33:26 UTC
This bug is still present in Debian 12 Konqueor (v. 4:22.12.3-1). The spell checking is not working.

I checked that the patch (which was mentioned in comment #6) is present in the Debian 12 Konqueror's source code, but the Spelling -> Languages context menu is still empty and it does nothing, even I can see my installed spell checking languages in "Spell Checking Configuration" window, see the screenshots: https://imgur.com/a/IDFHA1p

In Kate the spell checking is working just fine.
Comment 8 Stefano Crocco 2023-08-28 15:58:34 UTC
(In reply to Miikka from comment #7)
> This bug is still present in Debian 12 Konqueor (v. 4:22.12.3-1). The spell
> checking is not working.
> 
> I checked that the patch (which was mentioned in comment #6) is present in
> the Debian 12 Konqueror's source code, but the Spelling -> Languages context
> menu is still empty and it does nothing, even I can see my installed spell
> checking languages in "Spell Checking Configuration" window, see the
> screenshots: https://imgur.com/a/IDFHA1p
> 
> In Kate the spell checking is working just fine.

Unfortunately, even if it uses the same configuration dialog, spellchecking in Konqueror uses a different engine than other KDE applications, one which is included in the web engine itself. That engine needs dictionary files in a specific format and this has caused several bugs in the past (even if they haven't been posted here). These bugs have been fixed in a more recent version of Konqueror than you are using.

Depending on how Debian builds Konqueror, it's likely that there's no way to fix your issue except by building Konqueror from source yourself. The first thing you need to check is whether you have dictionary files with a .bdic extension. You can look for them using the command
find /usr -name '*.bdic'
Comment 9 Miikka 2023-08-28 16:25:15 UTC
(In reply to Stefano Crocco from comment #8)
> (In reply to Miikka from comment #7)
> > This bug is still present in Debian 12 Konqueor (v. 4:22.12.3-1). The spell
> > checking is not working.
> > 
> > I checked that the patch (which was mentioned in comment #6) is present in
> > the Debian 12 Konqueror's source code, but the Spelling -> Languages context
> > menu is still empty and it does nothing, even I can see my installed spell
> > checking languages in "Spell Checking Configuration" window, see the
> > screenshots: https://imgur.com/a/IDFHA1p
> > 
> > In Kate the spell checking is working just fine.
> 
> Unfortunately, even if it uses the same configuration dialog, spellchecking
> in Konqueror uses a different engine than other KDE applications, one which
> is included in the web engine itself. That engine needs dictionary files in
> a specific format and this has caused several bugs in the past (even if they
> haven't been posted here). These bugs have been fixed in a more recent
> version of Konqueror than you are using.
> 
> Depending on how Debian builds Konqueror, it's likely that there's no way to
> fix your issue except by building Konqueror from source yourself. The first
> thing you need to check is whether you have dictionary files with a .bdic
> extension. You can look for them using the command
> find /usr -name '*.bdic'

Oh, Ok. So it's not using Sonnet as its spell checking library then, like almost all other KDE apps are using?

I'm willing to have Finnish spell checking (besides to the English), but Finnish language can't be spell checked by using static dictionaries, and that's why there's a separate library called libvoikko to spell check Finnish properly. But that's not an issue for Sonnet (or for libenchant), because they are able to use libvoikko and couple of other special spell checking libraries as their "backend" besides to those static dictionaries.

To sum up: Konqueror supports only those static dictionaries, and there's no plans to implement Sonnet in Konqueror / in its web engine? If so, then I guess I'm out of luck to achieve my goal...
Comment 10 Stefano Crocco 2023-08-28 16:54:21 UTC
(In reply to Miikka from comment #9)
> (In reply to Stefano Crocco from comment #8)
> 
> Oh, Ok. So it's not using Sonnet as its spell checking library then, like
> almost all other KDE apps are using?
> 
> I'm willing to have Finnish spell checking (besides to the English), but
> Finnish language can't be spell checked by using static dictionaries, and
> that's why there's a separate library called libvoikko to spell check
> Finnish properly. But that's not an issue for Sonnet (or for libenchant),
> because they are able to use libvoikko and couple of other special spell
> checking libraries as their "backend" besides to those static dictionaries.
> 
> To sum up: Konqueror supports only those static dictionaries, and there's no
> plans to implement Sonnet in Konqueror / in its web engine? If so, then I
> guess I'm out of luck to achieve my goal...

I think it would be impossible to use Sonnet in Konqueror, because QtWebEngine (the web engine Konqueror uses) only provides very basic functionality for it to interact with the page. This has caused several other issues (for example, Konqueror can't support all proxy options supported by other KDE applications). Regarding spell checking, the documentation (https://doc.qt.io/qt-5.15/qtwebengine-features.html#spellchecker) states:

"To be able to check the spelling, the spellchecker needs dictionaries. It supports dictionaries from the Hunspell project, but they have to be compiled into a special binary format. A Hunspell dictionary consists of two files: a .dic file [...] an .aff file "

If Hunspell doesn't support Finnish, I think there's no way to make Konqueror have it as a spellchecking language. You could try creating a bug report for QtWebEngine at https://bugreports.qt.io/secure/Dashboard.jspa (you'll need to register before doing so).