[Kde-pim] Text formatting stripped from text pasted into kmail composer.

Thomas McGuire Thomas.McGuire at gmx.net
Thu Mar 13 21:46:34 GMT 2008



On Monday 10 March 2008, Stephen Kelly wrote:
> Hi,
>
> Pasting html into a kmail composer window strips all of the text character
> formatting.
>
> For example, put this in Kate and open it in konqueror:
>
> <html>
> <body>
> <p>
> one <b>two</b> <i>three</i> <u>four</u>.
> </p>
> </body>
> </html>
>
> Copy and paste into kmail(4) and the formatting is stripped. It can be
> readded, but I'm not sure why it was removed at all.
>
> Copy and pasting into kjots or qt-copy/demos/textedit does not remove the
> formatting. Is this intended? Where in the code does it happen?

Ok, I have fixed this in rev. 785315, thanks for noticing. Two different 
reasons: slotPaste() in the composer was buggy, and rich text formatting 
wasn't enabled under certain circumstances.

> A second issue I'm looking for a workaround for is a link formatting issue.
>
> This came up while I was trying to make it possible to insert change or
> remove a link in the kmail composer (and kjots).
>
> Apply the attached patch, and start the kmail composer. Turn a word into a
> link with the new manage link action. Notice that the word hasn't changed
> formatting (eg blue+underline). Save as draft and reopen. Notice that the
> link text is now formatted as expected. This was submitted to qt-bugs, but
> I've so far only had an auto-reply (auto issue number #201993). Also,
> removing the link doesn't unformat the text. Any ideas for a workaround?

Thanks very much for the patch, Stephen!
For inserting links, I now use insertHtml with <a href=...>...</a>, that works 
great.
For removing formatting, cursor.setCharFormat( cursor.block().charFormat() );

I've modified the patch in some other places:
- Insert a space after inserting the link so that the user can type away 
  without the link formatting
- Don't check the URL, for example www.test.de is a valid URL (for me), but
  KUrl doesn't like it.
- Set focus to the lineedits of the link edit dialog
- other small things

Attached the revised version of your patch. What do you think?
In my opinion it's ready to go into KDEPIM, not sure how we could share this. 
Any ideas?

Regards,
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: links.diff
Type: text/x-diff
Size: 10595 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20080313/ca47af93/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20080313/ca47af93/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list