New qt patch. Can it go into qt-copy?

Stephen Kelly steveire at gmail.com
Thu Nov 6 20:13:46 GMT 2008


Hi,

I have patched this bug:
http://trolltech.com/developer/task-tracker/index_html?id=227495&method=entry

The simple way to reproduce is to use demos/textedit to open a file
containing 

<p>Foo</p>
<br />
<p>Bar</p>

and it seems that you get two empty blocks between foo and bar instead of
just one. In fact, there is only one block between them, but it 
contains a QChar::LineSeparator, so you get a newline for that *and* a
newline at the end of the block.

It causes issues with kmail sending/saving with the wrong number of line
breaks:
http://bugs.kde.org/show_bug.cgi?id=86925
(I think kmail already has some workarounds, they don't seem to work well.)

If you use a textedit to create an empty, line qt outputs <p
style="-qt-paragraph-type:empty;" ></p> instead of <br />. That style gets
special treatment from qt so that when imported again, the correct number
of linebreaks appear in the QTextEdit.

My patch changes QTextHtmlParser to change a br element into an empty
paragraph node before insertion into the QTextEdit.

The unit test fails before patching and passes after patching. However, as
we don't have any other unit tests for html import, I don't know if it
causes any regressions. So, please comment if you think I can put it in to
qt-copy. The unit test has been added to kdereview/richtextbuilders as
testImportWithHorizontalTraversal.

This has also been sent to qt-bugs.

Best regards,

Steve.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug227495.patch
Type: text/x-diff
Size: 1432 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20081106/798e3529/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug227495unittest.cpp
Type: text/x-objcsrc
Size: 638 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20081106/798e3529/attachment.bin>


More information about the kde-core-devel mailing list