Bug 305045

Summary: does not right align a text written in right-to-left languages inside chat window.
Product: [Frameworks and Libraries] telepathy Reporter: Ashkan Ghassemi <ghassemi>
Component: text-uiAssignee: Telepathy Bugs <kde-telepathy-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: emilsedgh, kde, rohan
Priority: NOR    
Version: 0.4.1   
Target Milestone: Future   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 0.5.2

Description Ashkan Ghassemi 2012-08-12 21:54:39 UTC
Does not right align a text written in Farsi (and possibly all other right-to-left languages) inside conversation window. Surprisingly however, it works perfectly fine inside text input box.

Reproducible: Always

Steps to Reproduce:
1. Open a chat window.
2. Type your text in Farsi (or other rtl languages) and send the message.

Actual Results:  
ktp-text-ui left-aligns the message.

Expected Results:  
ktp-text-ui should align the message right.
Comment 1 David Edmundson 2012-08-12 22:22:55 UTC
Confirming. 
Do you know if it worked in Kopete?
Comment 2 Ashkan Ghassemi 2012-08-12 22:33:16 UTC
Just checked and it works as expected in Kopete (Version 1.3.0 Using KDE Development Platform 4.9.00) and earlier versions as far as I can remember.
Comment 3 David Edmundson 2012-08-12 22:39:57 UTC
Thanks! Should be possible for us to fix then.
Comment 4 David Edmundson 2012-08-13 08:41:41 UTC
looked at Kopete code, 

their HTML as
<li class="NextIncomingMessage" style="direction: %messageDirection%;">%message%</li>

where %messageDirection% is either rtl or ltr.

Unfortunately this appears to be a Kopete additional hack, which means we can't support it AND support raw Adium themes which we've been trying.

Unless, instead we just changed some global CSS?
Comment 5 Emil Sedgh 2012-08-13 09:03:39 UTC
No, changing global css would not help, as it means that English messages will be RTL'ed.
Comment 6 Emil Sedgh 2012-08-13 09:14:58 UTC
According to Adium's wiki [1], it supports %messageDirection% as well.
[1] http://trac.adium.im/wiki/CreatingMessageStyles
Comment 7 David Edmundson 2012-08-16 01:57:38 UTC
You're right in theory. Unfortunately Adium "specifications" are a complete pile of unenforced rubbish. 

The default themes we ship (one being the Adium default too!) make no reference to it.

Tasks:
1) Check latest mecurial code from Adium, and grep Renkoo for %messageDirection%
2) Make sure we correctly set %messageDirection% in our code.
use QString::isRightToLeft() on messageBody to determine direction
Comment 8 Rohan Garg 2012-10-11 08:25:34 UTC
Had a look at the latest code, Renkoo still does not have messageDirection
Comment 9 Emil Sedgh 2012-11-23 12:31:07 UTC
Git commit 0da8c4c297f2316168ccff271775458691e24d97 by Emil Sedgh.
Committed on 23/11/2012 at 13:23.
Pushed by esedgh into branch 'master'.

Add proper messageDirection depending on message.isRightToLeft()
Makes ktp-text-ui, rtl friendly.
Fun fact: I looked at Adium to see how they do it. According to their changelog, Kopete implemented the feature originally.
Circle of life? ;)

M  +0    -10   lib/adium-theme-content-info.cpp
M  +0    -3    lib/adium-theme-content-info.h
M  +8    -0    lib/adium-theme-message-info.cpp
M  +3    -0    lib/adium-theme-message-info.h
M  +6    -3    lib/adium-theme-view.cpp

http://commits.kde.org/telepathy-text-ui/0da8c4c297f2316168ccff271775458691e24d97
Comment 10 David Edmundson 2012-11-24 13:12:07 UTC
Git commit c6dfac3184c66d517ced6475d8cbd6512763d431 by David Edmundson, on behalf of Emil Sedgh.
Committed on 23/11/2012 at 13:23.
Pushed by davidedmundson into branch 'kde-telepathy-0.5'.

Add proper messageDirection depending on message.isRightToLeft()
Makes ktp-text-ui, rtl friendly.
Fun fact: I looked at Adium to see how they do it. According to their changelog, Kopete implemented the feature originally.
Circle of life? ;)

Conflicts:
	lib/adium-theme-message-info.h

M  +0    -10   lib/adium-theme-content-info.cpp
M  +0    -3    lib/adium-theme-content-info.h
M  +8    -0    lib/adium-theme-message-info.cpp
M  +3    -0    lib/adium-theme-message-info.h
M  +6    -3    lib/adium-theme-view.cpp

http://commits.kde.org/telepathy-text-ui/c6dfac3184c66d517ced6475d8cbd6512763d431