Update of /cvsroot/mahogany/M/src/modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15835/src/modules

Modified Files:
        Filters.cpp 
Log Message:
shorten filter progress messages to take less space in the status bar and so 
increase the chance of being able to see the full message

Index: Filters.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/Filters.cpp,v
retrieving revision 1.198
retrieving revision 1.199
diff -b -u -2 -r1.198 -r1.199
--- Filters.cpp 13 Jul 2004 23:28:56 -0000      1.198
+++ Filters.cpp 30 Jun 2005 14:20:25 -0000      1.199
@@ -468,5 +468,5 @@
    void CreateProgressDialog();
    bool GetMessage();
-   void GetSenderSubject(String &from,String &subject);
+   void GetSenderSubject(String& from, String& subject);
    bool TreatAsJunk();
    String CreditsCommon();
@@ -2886,8 +2886,21 @@
 }
 
-void FilterRuleApply::GetSenderSubject(String &from,String &subject)
+void FilterRuleApply::GetSenderSubject(String& from, String& subject)
 {
    subject = MailFolder::DecodeHeader(m_parent->m_MailMessage->Subject());
-   from = MailFolder::DecodeHeader(m_parent->m_MailMessage->From());
+
+   AddressList_obj addrList(m_parent->m_MailMessage->GetAddressList(MAT_FROM));
+   Address *addr = addrList ? addrList->GetFirst() : NULL;
+   if ( addr )
+   {
+      // show just the personal name if any, otherwise show the address
+      from = addr->GetName();
+      if ( from.empty() )
+         from << _T('<') << addr->GetEMail() << _T('>');
+   }
+   else // no valid sender address
+   {
+      from = _("unknown sender");
+   }
 }
 
@@ -2904,7 +2917,11 @@
 String FilterRuleApply::CreditsCommon()
 {
-   String common;
-   common.Printf(_("Filtering message %u/%u"),
-      m_idx + 1, m_msgs.GetCount());
+   String common(_("Filtering message"));
+
+   // don't append "1/1" as it carries no useful information
+   const unsigned count = m_msgs.GetCount();
+   if ( count != 1 )
+      common += String::Format(_T(" %u/%u"), m_idx + 1, count);
+
    return common;
 }
@@ -2927,5 +2944,5 @@
          String from;
          String subject;
-         GetSenderSubject(from,subject);
+         GetSenderSubject(from, subject);
 
          textPD << _T('\n') << _("From: ") << from
@@ -2945,5 +2962,5 @@
       String from;
       String subject;
-      GetSenderSubject(from,subject);
+      GetSenderSubject(from, subject);
    
       textLog << _T(" (");
@@ -2956,4 +2973,12 @@
       if ( !subject.empty() )
       {
+         // the length of status bar text is limited under Windows and, anyhow,
+         // status bar is not that wide so truncate subjects to something
+         // reasonable
+         if ( subject.length() > 40 )
+         {
+            subject = subject.Left(18) + _T("...") + subject.Right(18);
+         }
+
          textLog << _("about '") << subject << '\'';
       }



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to