[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

branches/work/kdepim-3.5.5+/kmail



SVN commit 643365 by winterz:

Show X-UserAgent and/or X-Mailer in the fancy header.
I sorta like it, although it does take up space.
Yes, we could add a config option.. but who wants
yet-another-config-option?

What do others think about it?
For now, I will keep this only in pim+ branch.  I won't move it into the
3.5 branch or trunk unless I get a resounding "Yes we want this"
from testers and core devs.

This patch provided by Fram Thieme.

CCMAIL: kmail-devel@kde.org,frank@fthieme.net,debian-qt-kde@lists.debian.org


 M  +2 -1      branches/work/kdepim-3.5.5+/kmail/headerstrategy.cpp  
 M  +30 -14    branches/work/kdepim-3.5.5+/kmail/headerstyle.cpp  


--- branches/work/kdepim-3.5.5+/kmail/headerstrategy.cpp #643364:643365
@@ -60,7 +60,8 @@
 
   static const char * richHeaders[] = {
     "subject", "date", "from", "cc", "bcc", "to",
-    "organization", "organisation", "reply-to"
+    "organization", "organisation", "reply-to",
+    "user-agent", "x-mailer"
   };
   static const int numRichHeaders = sizeof richHeaders / sizeof *richHeaders;
 
--- branches/work/kdepim-3.5.5+/kmail/headerstyle.cpp #643364:643365
@@ -541,7 +541,7 @@
         if ( facestring.length() < 993 ) {
           QByteArray facearray;
           KCodecs::base64Decode(facestring, facearray);
-    
+
           QImage faceimage;
           if ( faceimage.loadFromData( facearray, "png" ) ) {
             // Spec says image must be 48x48 pixels
@@ -659,31 +659,47 @@
     // to line
     if ( strategy->showHeader( "to" ) )
       headerStr.append(QString("<tr><th>%1</th>\n"
-                   "<td>%2</td></tr>\n")
-                            .arg(i18n("To: "))
-                            .arg(KMMessage::emailAddrAsAnchor(message->to(),FALSE)));
+                               "<td>%2</td></tr>\n")
+                       .arg(i18n("To: "))
+                       .arg(KMMessage::emailAddrAsAnchor(message->to(),FALSE)));
 
     // cc line, if any
     if ( strategy->showHeader( "cc" ) && !message->cc().isEmpty())
       headerStr.append(QString("<tr><th>%1</th>\n"
-                   "<td>%2</td></tr>\n")
-                              .arg(i18n("CC: "))
-                              .arg(KMMessage::emailAddrAsAnchor(message->cc(),FALSE)));
+                               "<td>%2</td></tr>\n")
+                       .arg(i18n("CC: "))
+                       .arg(KMMessage::emailAddrAsAnchor(message->cc(),FALSE)));
 
     // Bcc line, if any
     if ( strategy->showHeader( "bcc" ) && !message->bcc().isEmpty())
       headerStr.append(QString("<tr><th>%1</th>\n"
-                   "<td>%2</td></tr>\n")
-                              .arg(i18n("BCC: "))
-                              .arg(KMMessage::emailAddrAsAnchor(message->bcc(),FALSE)));
+                               "<td>%2</td></tr>\n")
+                       .arg(i18n("BCC: "))
+                       .arg(KMMessage::emailAddrAsAnchor(message->bcc(),FALSE)));
 
     if ( strategy->showHeader( "date" ) )
       headerStr.append(QString("<tr><th>%1</th>\n"
-                   "<td dir=\"%2\">%3</td></tr>\n")
-                            .arg(i18n("Date: "))
-                    .arg( directionOf( message->dateStr() ) )
-                            .arg(strToHtml(dateString)));
+                               "<td dir=\"%2\">%3</td></tr>\n")
+                       .arg(i18n("Date: "))
+                       .arg( directionOf( message->dateStr() ) )
+                       .arg(strToHtml(dateString)));
 
+    if ( strategy->showHeader( "user-agent" ) )
+      if ( !message->headerField("User-Agent").isEmpty() ) {
+        headerStr.append(QString("<tr><th>%1</th>\n"
+                                 "<td>%2</td></tr>\n")
+                         .arg(i18n("User-Agent: "))
+                         .arg( strToHtml( message->headerField("User-Agent") ) ) );
+      }
+
+    if ( strategy->showHeader( "x-mailer" ) )
+      if ( !message->headerField("X-Mailer").isEmpty() ) {
+        headerStr.append(QString("<tr><th>%1</th>\n"
+                                 "<td>%2</td></tr>\n")
+                         .arg(i18n("X-Mailer: "))
+                         .arg( strToHtml( message->headerField("X-Mailer") ) ) );
+      }
+
     // FIXME: Show status in synthetic header style field.  Decide whether this or current in brackets style is best and remove one.
     /*    if( strategy->showHeader( "status" ) )
       headerStr.append( QString( "<tr><th>%1</th>\n"



Reply to: