Summary: | Allow for a single text/html part to be saved decoded (as html file) | ||
---|---|---|---|
Product: | [Applications] kmail2 | Reporter: | Bernhard E. Reiter <bernhard> |
Component: | commands and actions | Assignee: | kdepim bugs <kdepim-bugs> |
Status: | REPORTED --- | ||
Severity: | normal | CC: | pschwabauer |
Priority: | NOR | ||
Version: | 5.24.4 | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Bernhard E. Reiter
2024-01-15 15:21:04 UTC
A sister case is https://bugs.kde.org/show_bug.cgi?id=126130 for exporting a full email including everything as html. Currently, it is possible to save emails as mbox files by right-clicking on the message → "Save message". This opens a file dialog with the only possibility to filter for `.mbox` files. My proposal is to extend the filter to `.html` files and save the HTML part if the file extension is `.html`. This avoids the cluttering of the context menu and has similar behavior to Thunderbird, where I can select the wanted file type. This change would require refactoring in `messageviewer/utils/messageviewerutil`. `MessageViewer::Util::saveMessageInMboxAndGetUrl` would then check for the specified file extension of the user and extract and save the HTML part, if the extension is `.html`. (In reply to Paul Schwabauer from comment #2) > Currently, it is possible to save emails as mbox files by right-clicking on > the message → "Save message". > This opens a file dialog with the only possibility to filter for `.mbox` > files. My proposal is to extend the filter to `.html` files and save the > HTML part if the file extension is `.html`. But won't this be a different semantic, saving a full email against saving just one body part? - Regarding the message view: In `messagelib` there is already code that can save the HTML and open it with a browser: https://invent.kde.org/pim/messagelib/-/blob/c52d92a121d6678e96dcb8e00dbd9d61101dc67e/messageviewer/src/viewer/viewer_p.h#L488-L490 However, this code is hidden in a private class, and I can find no usage of it. My proposal would be to expose `ViewerPrivate::slotOpenInBrowser` in `Viewer` and add a new method `ViewerPrivate::exportToHtml` and `Viewer::exportToHtml` similar to the `exportToPdf` methods, that can be used by kmail. This change would require the extending of the context menu in kmail with "Export to HTML..." and "Open in browser". - Regarding the email/message structure view: Currently, it is not possible to save an HTML part in the message structure display, if the HTML is sent as a main body. To reproduce, open an HTML mail with the HTML as main body part and press CTRL-ALT-D to open the message structure display. Then right-click on the HTML part. If the HTML part is not at the top level, for example, with a multipart/alternative mail, it is possible to save, open and view the HTML part. However, this is not possible if the mail only consists of the HTML part. The reason is here: https://invent.kde.org/pim/messagelib/-/blob/c52d92a121d6678e96dcb8e00dbd9d61101dc67e/messageviewer/src/viewer/viewer_p.cpp#L1733-L1746. To fix this, the `isTopLevel()` check has to be removed. This change should have a minimal impact. Here is the fix for the message structure viewer: https://invent.kde.org/pim/messagelib/-/merge_requests/188 |