Bug 375314

Summary: "Toggle HTML Display Mode" button does not work with HTML enabled by default
Product: [Applications] kmail2 Reporter: Matthijs <mtijink.bugs>
Component: commands and actionsAssignee: kdepim bugs <kdepim-bugs>
Status: CONFIRMED ---    
Severity: normal CC: info, jsardid, null
Priority: NOR    
Version: 5.4.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Matthijs 2017-01-19 20:00:23 UTC
I set KMail to display HTML email by default. This works fine, but since switching to a dark colorscheme, some e-mails are a bit problematic.

So I added the "Toggle HTML Display Mode" button to my toolbar, but it does not work: KMail shows the HTML email with the button either enabled or disabled. 

I tested the feature with HTML email disabled by default, and then it does work.
Comment 1 null 2020-04-09 15:15:46 UTC
I can reproduce this bug with KMail 5.9.2 (Qt 5.11.2 / KF 5.51) as well as KMail 5.14.40 (Qt 5.14.1 / KF 5.69), i.e. if "Prefer HTML" is turned on globally, activating the toggle HTML action to temporarily switch to plain text does nothing.

This is regardless of whether I use the toolbar action, a shortcut or by clicking on the HTML status bar itself.

FWIW, sometimes the following message is logged after every click on the HTML status bar, although I'm not sure whether this is related at all:
WebEnginePage::javaScriptConsoleMessage lineNumber:  19  message:  "Uncaught TypeError: Cannot read property 'compareDocumentPosition' of null"
Comment 2 Geert Janssens 2024-10-23 08:51:37 UTC
I ran into this issue today as well. I am currently using KMail 5.24.5 (23.08.5) on Fedora 39. This version no longer has a toolbar action to toggle html any more, only the HTML status bar.

I see the same behaviour Matthijs explains:

* If HTML mail is enabled by default (regardless whether that's globally enabled or for the current folder) it's impossible to switch to the plain text version. Clicks on the HTML status bar have no effect.
* If HTML mail is disabled by default (again regardless of whether that's globally disabled or only for the current folder) one can toggle the display mode by clicking on the HTML status bar. In this configuration I toggling works both ways, that is from text view to html view and with a subsequent click from html view back to text view.

I  would love to see this fixed. I generally prefer html view, but some mails fail to render in html view (which I reported in Bug 495004). So my only option in that case is to look at the plain text view (until the other bug is fixed). As it stands this is very cumbersome right now because the toggle actions isn't working.