Bug 224091 - Preserve multiple whitespaces and whitespaces at the beginning of line
Summary: Preserve multiple whitespaces and whitespaces at the beginning of line
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kopete
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR wishlist
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
: 262320 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-01-24 22:21 UTC by Dmitry
Modified: 2024-09-18 18:28 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
patch to bug #224091 (1.23 KB, patch)
2010-05-10 02:09 UTC, Igor Poboiko
Details
Updated patch to bug 224091 (2.39 KB, patch)
2010-05-10 10:29 UTC, Igor Poboiko
Details
Updated patch to bug 224091 (2.65 KB, patch)
2010-05-10 12:44 UTC, Igor Poboiko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry 2010-01-24 22:21:23 UTC
Version:            (using KDE 4.3.4)
OS:                Linux
Installed from:    Debian testing/unstable Packages

I would like Kopete to send whitespaces ind messages 'as is' and not to trim them.
Current behaviour is:
'   line' is sent as 'line'
'white     space' is sent as 'white space'
The expected behaviour is:
'   line' is sent as '   line'
'white     space' is sent as 'white     space'

It may be not the default behaviour, but be enabled/disabled by a setting.
Comment 1 Igor Poboiko 2010-02-04 19:17:48 UTC
I can confirm it. Same there when I'm receiving a message with extra whitespaces, and it really annoys me.
Comment 2 Tenno Seremel 2010-04-19 23:38:32 UTC
*** This bug has been confirmed by popular vote. ***
Comment 3 Igor Poboiko 2010-05-10 02:09:50 UTC
Created attachment 43418 [details]
patch to bug #224091
Comment 4 Igor Poboiko 2010-05-10 02:10:16 UTC
First of all, sorry for my bad english, but I hope you will understand all what I tried to say :)

Kopete uses HTML in chat window. In HTML many whitespaces displays like one whitespace, so Kopete doesn't display it correctly.
Possible fix is to add tag <PRE> to all displaying messages, or to add 'white-space: pre' to default CSS.
After fixing first problem, Jabber (I tested on it) sends and receives messages with multiple whitespaces with no problems.

Second problem is in Oscar protocol. The message (I have entered) before sending is being formatted to some HTML format. Kopete use QTextDocument::setHtml(), and it trims all multiple whitespaces.
Possible fix is to call QTextDocument::setDefaultStyleSheet() with parameter '* { white-space: pre; }' like in first part of this problem.
After fixing it, whitespaces are not ignored in my Oscar messages.

Third problem is history plugin. In logs ($HOME/.kde4/share/apps/kopete/logs) messages stores with whitespaces, but kopete displays it without it. 
Same problem here - history plugin calls Kopete::Message::setHtmlBody() (plugins/history/historylogger.cpp, lines 611 and 618), which calls QTextDocument::setHtml(), which trims all whitespaces.
Possible fix is same - just call setDefaultStyleSheet(), but I don't know where to do it - in history plugin I can't call this method of Kopete::Message's QTextDocument because of incapsulation (or can? I can be wrong..)

And see attached patch:)
Comment 5 Igor Poboiko 2010-05-10 10:28:25 UTC
Ok, I think the right way to fix problem with history plugin is to call setDefaultStyleSheet in Kopete::Message::Private constructor (which has QTextDocument field). See attached patch.
Comment 6 Igor Poboiko 2010-05-10 10:29:21 UTC
Created attachment 43423 [details]
Updated patch to bug 224091
Comment 7 Igor Poboiko 2010-05-10 12:44:42 UTC
Created attachment 43425 [details]
Updated patch to bug 224091

It is definitely bad idea to set 'white-space: pre;' to ALL HTML tags in chat-window CSS; we need to do it only for KopeteMessageBody.
Comment 8 Tenno Seremel 2010-08-09 13:16:27 UTC
Use white-space: pre-wrap; for message text instead.

However file transfer message HTML code goes into message too. So... it must _not_ contain line breaks (currently it does) or at least there should be a class (class="transfer-block" or similar) for this to reset white-space to normal for it.
Comment 9 Igor Poboiko 2011-01-06 17:31:19 UTC
*** Bug 262320 has been marked as a duplicate of this bug. ***
Comment 10 Christoph Cullmann 2024-09-18 18:28:46 UTC
Dear user, unfortunately Kopete is no longer maintained.

Please migrate to another solution, e.g. for Jabber a possibility is Kaidan, for Matrix a candidate is NeoChat.