[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdepim/kmail
From:       Till Adam <adam () kde ! org>
Date:       2005-02-28 19:50:47
Message-ID: 20050228195047.7F485148A2 () office ! kde ! org
[Download RAW message or body]

CVS commit by tilladam: 

And once more in HEAD: If there is no valid email address in the from but
a name, display it.


  M +15 -5     headerstyle.cpp   1.33


--- kdepim/kmail/headerstyle.cpp  #1.32:1.33
@@ -160,5 +160,8 @@ namespace KMail {
 
     if ( strategy->showHeader( "from" ) ) {
-      QString fromPart = KMMessage::emailAddrAsAnchor( message->from(), true );
+      QString fromStr = message->from();
+      if ( fromStr.isEmpty() ) // no valid email in from, maybe just a name
+        fromStr = message->fromStrip(); // let's use that
+      QString fromPart = KMMessage::emailAddrAsAnchor( fromStr, true );
       if ( !vCardName.isEmpty() )
         fromPart += "&nbsp;&nbsp;<a href=\"" + vCardName + "\">" + i18n("[vCard]") + "</a>";
@@ -278,6 +281,9 @@ namespace KMail {
 
     if ( strategy->showHeader( "from" ) ) {
+      QString fromStr = message->from();
+      if ( fromStr.isEmpty() ) // no valid email in from, maybe just a name
+        fromStr = message->fromStrip(); // let's use that
       headerStr.append(i18n("From: ") +
-                       KMMessage::emailAddrAsAnchor(message->from(),FALSE));
+          KMMessage::emailAddrAsAnchor( fromStr, false) );
       if ( !vCardName.isEmpty() )
         headerStr.append("&nbsp;&nbsp;<a href=\"" + vCardName +
@@ -585,9 +591,12 @@ namespace KMail {
     // the mailto: URLs can contain %3 etc., therefore usage of multiple
     // QString::arg is not possible
-    if ( strategy->showHeader( "from" ) )
+    if ( strategy->showHeader( "from" ) ) {
+      QString fromStr = message->from();
+      if ( fromStr.isEmpty() ) // no valid email in from, maybe just a name
+        fromStr = message->fromStrip(); // let's use that
       headerStr += QString("<tr><th>%1</th>\n"
                            "<td>")
                            .arg(i18n("From: "))
-                 + KMMessage::emailAddrAsAnchor(message->from(),FALSE)
+                 + KMMessage::emailAddrAsAnchor( fromStr, false )
                  + ( !vCardName.isEmpty() ? "&nbsp;&nbsp;<a href=\"" + vCardName + "\">"
                                 + i18n("[vCard]") + "</a>"
@@ -604,4 +613,5 @@ namespace KMail {
                                 + ")")
                  + "</td></tr>\n";
+    }
     // to line
     if ( strategy->showHeader( "to" ) )


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic