KMail/messagelib save mail as HTML

Hi, currently the email viewer only allows you to export the email as a PDF file. I would like to add the feature to save and open an HTML part in the email viewer.
My proposal was to expose the now removed open in browser code to KMail and add an additional save HTML method. In KMail the context menu would then get extended with “Open in Browser” and “Save HTML”.

My question is if someone has better ideas on how to integrate a HTML export in KMail?

Relevant issue: 126130 – [feature-request] add ability to save-as HTML

Would something like the FileHtmlWriter be helpful?

then

FileHtmlWriter writer("myfile.html");
DefaultRenderer renderer;
renderer.render(msg, writer);