Bug 112474 - HTML display in composer does not correspond to viewer display
Summary: HTML display in composer does not correspond to viewer display
Status: RESOLVED WORKSFORME
Alias: None
Product: kmail
Classification: Applications
Component: composer (show other bugs)
Version: 1.8.2
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2005-09-12 14:51 UTC by Jens
Modified: 2009-08-24 12:05 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jens 2005-09-12 14:51:37 UTC
Version:           1.8.2 (using KDE 3.4.2 Level "b" , SUSE 9.3 UNSUPPORTED)
Compiler:          gcc version 3.3.5 20050117 (prerelease) (SUSE Linux)
OS:                Linux (i686) release 2.6.11.4-21.8-default

Hi,

when writing a mail and deciding I want to underline and/or emphasize some text, I switch to HTML mode. However, this HTML mode lacks certain features, which cause the mail to display differently in KMail's viewer, compared to the editor.
This is not what the user expects and is therefore bad for usability.

I would like to try to code this myself, but I would need somebody to point me to the place in KMail's source code where the text-to-HTML conversion is done.


Here's my list:

1. The automatic line breaks for paragraphs are gone.
   The editor shows them, the viewer does not.

Suggestion: Flow text in the editor as well, when the user switches to HTML mode. Just like in any other HTML editor.

2. KMail inserts "<p> ... </p>" whenever the users uses ENTER. 
   This causes KMail to insert lots and lots of empty
   "<p></p>" HTML paragraphs in text that has been formatted
   in paragraphs with empty lines in between.
   However, the "<p>" tag already *contains* spaces in
   between.

Suggestion: Convert single linebreaks to "<br/>", double linebreaks to "<p>..</p>", and n-tuple linebreaks to "n" <br/> tags.
Optionally, use "<p>..</p>" only for paragraphs that *would* have had line breaks inserted in the plain text version (ie not for single-line paragraphs).

3. KMail does not color, or emphasize, quoted text any more.
   What's more, it separates each line of quoted text into
   its own "<p>...</p>" tags. This rips the text apart, makes
   it harder to distinguish from non-quoted text (because
   the color is missing) and thus destroys legibility.

Suggestions:

a. Prepend quoted text like other GUI editors do.
   Something like "<p style='border-left: solid 5px $COLOR;
   padding-left: 10px; color: $COLOR'> ... </p>
   where $COLOR is taken from the KMail configuration.
   This works also for several levels of quoting.
b. If there is no empty line between quoted and non-quoted
   text, maybe "<div style='...'>" can be used instead.
c. Keep linebreaks within quoted text, use "<br/>".
   It is probably far too dangerous to reformat quoted text.


4. (Wish) Replace "*", "/" and "_" tags commonly used in
   email for emphasis with appropriate HTML formatting.
   This should work in both directions, and can possibly be 
   done with a regular expression:

   $text =~ #\b\*(\w+)\*\b#<b>$1</b>#g;
   $text =~ #\b_(\w+)_\b#<i>$1</i>#g;
   $text =~ #\b/(\w+)/\b#<u>$1</u>#g;

   (which may need to be more sophisticated... just an idea)


If this sounds feasible, I will prepare a couple examples displaying these bugs/issues and how possible solutions could look like, and I'd be willing to try and code them myself.

Please respond.
Thanks :-)


Jens
Comment 1 Jens 2005-09-12 14:55:35 UTC
Addendum:
If you save your HTML formatted mail in the Drafts folder (in my case, an IMAP folder) and re-open it for editing, all HTML formatting is lost!

Jens
Comment 2 Romain Henriet 2006-11-13 15:57:00 UTC
 In Kmail 1.9.5,HTML formatting seems to only disapear when reopening a draft that contains non english letters, such as éèçàù.
 What's more, these letter are replaced by codes : "é" becomes "=E9" for instance.
This is very annoying because the message becomes incomprehensible and has to be rewritten.

Romain.
Comment 3 Jaime Torres 2008-09-18 13:20:28 UTC
In kmail 1.10.1, the composed mail looks equal to the viewed mail. And it remains the same in every forlder, regarding the characters it has in the html message body.
Comment 4 jos poortvliet 2008-11-29 20:07:27 UTC
When writing a html mail and closing (save as draft) doesn't give problems, it shows the email just as I wrote it. Opening it again doubles the free space between lines in the editor compared to the previous time I wrote and viewed it. Weird enough, closing it - viewer sees it as original. Opening again gives the double lines again. So this bug still seems to exist in KMail 1.10.90, KDE 4.2 beta 1.
Comment 5 Thomas McGuire 2009-08-23 19:40:16 UTC
> When writing a html mail and closing (save as draft) doesn't give problems, it shows the email just as I wrote it. Opening it again doubles the free space between lines in the editor compared to the previous time I wrote and viewed it

Jos, that particular bug is fixed in kdelibs 4.3.1.
Comment 6 jos poortvliet 2009-08-24 08:05:34 UTC
@Thomas: tnx! How close are we to fixing this whole bugreport?
Comment 7 Thomas McGuire 2009-08-24 12:05:50 UTC
> @Thomas: tnx! How close are we to fixing this whole bugreport?

Well, this bug is a mix of many different issues, so I can't really say. Since most of those issues are reported elsewhere, let's close this bug.

As I said, linebreaks work fine, although <p> is still used instead of <br>.

I recently added quote coloring for HTML mails to the reader widget (in KDE 4.4), so that is also fixed.