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

List:       kde-commits
Subject:    kdepim/plugins/kmail/bodypartformatter
From:       Till Adam <adam () kde ! org>
Date:       2005-04-19 10:39:32
Message-ID: 20050419103932.0051B651 () office ! kde ! org
[Download RAW message or body]

CVS commit by tilladam: 

If a text/calendar part does not have an encoding set, fall back to utf8
as per iCalendar standard, instead of using the KMail fallback encoding.

CCMAIL: "David Partain" <david.partain@ericsson.com>


  M +11 -1     text_calendar.cpp   1.35


--- kdepim/plugins/kmail/bodypartformatter/text_calendar.cpp  #1.34:1.35
@@ -90,5 +90,15 @@ class Formatter : public KMail::Interfac
       CalendarLocal cl( KPimPrefs::timezone() );
       KMInvitationFormatterHelper helper( bodyPart );
-      QString html = IncidenceFormatter::formatICalInvitation( bodyPart->asText(), &cl, &helper );
+      QString source;
+      /* If the bodypart does not have a charset specified, we need to fall back to
+         utf8, not the KMail fallback encoding, so get the contents as binary and decode
+         explicitely. */
+      if ( bodyPart->contentTypeParameter( "charset").isEmpty() ) {
+        const QByteArray &ba = bodyPart->asBinary();
+        source = QString::fromUtf8(ba);
+      } else {
+        source = bodyPart->asText();
+      }
+      QString html = IncidenceFormatter::formatICalInvitation( source, &cl, &helper );
 
       if ( html.isEmpty() ) return AsIcon;


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

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