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

Ingo Klöcker kloecker at kde.org
Fri Mar 14 21:49:39 GMT 2008


On Thursday 13 March 2008, Thomas McGuire wrote:
> 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?

Random comments:

i18n("Link") should have some context added so that the translators know 
that it is a URL link and whether it is meant as verb or as noun.

Please remove the "(C)" from the copyright headers of the klinkdialog 
files to be compliant with our Licensing Policy [1].

I'd remove the text and href parameters from the c'tor of KLinkDialog. 
Independently of this, there should be setters for text and href.

The code in klinkdialog.* is missing spaces after '(' and before ')'. If 
it is added to kdepim then it must adhere to our coding style.

I don't like setting a fixed minimum width. On small displays (think 
mobile phones) 450 is probably too much and on very high resolution 
displays it's to little. Since this problem affects basically all 
dialogs in KDE I'm wondering whether there is a KDE global minimum 
width for dialogs.

Is it really necessary to make the dialog modal? If it is modal it will 
probably not be possible to copy the link from the message preview 
pane.

It's a very simple dialog. Nevertheless I think using a UI file for 
defining the GUI is better than using a hand crafted GUI.

+    layout->setSpacing(0);
+    layout->setMargin(2);

This is forbidden. Use the constants KDialog::spacingHint() and 
KDialog::marginHint(). See the section "Standard compliance" in 
http://api.kde.org/4.0-api/kdelibs-apidocs/kdeui/html/classKDialog.html

I'd make KLinkDialog::text() return the href if text is empty. This way 
the user does not have to enter the URL twice if he does not want to 
insert a URL with a descriptive text.

href() is a very bad name for the method. Call it url() or linkUrl(). 
OTOH, if a method is called url() then I would assume that it returns a 
KUrl. Still href() should be renamed IMO. I'd go for linkUrl() (and 
linkText() for consistency).


Regards,
Ingo

[1] http://techbase.kde.org/Policies/Licensing_Policy
-------------- 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/20080314/e36b25fd/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