Bug 129554

Summary: all-headers display should always use direction=ltr
Product: [Applications] kmail Reporter: Levy, Chen <kde>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Allways use ltr for all-headers dispaly

Description Levy, Chen 2006-06-21 09:47:02 UTC
Version:           1.9.3 (using KDE KDE 3.5.3)
Installed from:    Ubuntu Packages
OS:                Linux

In brief
--------
With Right-to-Left (rtl) languages all-headers display of a message is hard to parse visually.

The source of the problem
-------------------------
When KMail displays all-headers of a message, it set the headers directionality like this:

QString dir = QApplication::reverseLayout() ? "rtl" : "ltr" ;

So with rtl languages the headers are displayed as r2l text.
However none of the headers are passed through i18n(), and thus the result is Latin headers whit the direction of a r2l language. This combination is very hard to parse visually.

Note that not using i18n() for all-headers display, is the right thing to do. Typically a user asks for all-headers to debug a mail problem, and wants to be as close to the mail protocols as possible.

The solution
------------
When displaying all-headers, always use ltr as direction, regardless of QApplication::reverseLayout().
Comment 1 Levy, Chen 2006-06-21 09:52:45 UTC
Created attachment 16737 [details]
Allways use ltr for all-headers dispaly

I suspect that the <dir/> wrapping is not needed inside the if statement.
However, I kept it in place so the change will be minimal.
Comment 2 Ingo Klöcker 2006-06-21 23:56:07 UTC
SVN commit 553736 by kloecker:

Fix bug 129554 (all-headers display should always use direction=ltr)

Patch by Chen Levy. Thanks.

BUG: 129554


 M  +6 -2      headerstyle.cpp  


--- branches/KDE/3.5/kdepim/kmail/headerstyle.cpp #553735:553736
@@ -247,15 +247,19 @@
       dateString = message->dateStr();
     }
 
-    QString headerStr = QString("<div class=\"header\" dir=\"%1\">").arg(dir);
+    QString headerStr;
 
     if ( strategy->headersToDisplay().isEmpty()
          && strategy->defaultPolicy() == HeaderStrategy::Display ) {
-      // crude way to emulate "all" headers:
+      // crude way to emulate "all" headers - Note: no strings have
+      // i18n(), so direction should always be ltr.
+      headerStr= QString("<div class=\"header\" dir=\"ltr\">");
       headerStr += formatAllMessageHeaders( message );
       return headerStr + "</div>";
     }
 
+    headerStr = QString("<div class=\"header\" dir=\"%1\">").arg(dir);
+
     //case HdrLong:
     if ( strategy->showHeader( "subject" ) )
       headerStr += QString("<div dir=\"%1\"><b style=\"font-size:130%\">" +