[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdepim/kmail
From: Bo Thorsen <bo () sonofthor ! dk>
Date: 2003-01-19 10:40:57
[Download RAW message or body]
CVS commit by thorsen:
New convenience method bodyToUnicode that returns a unicode QString with the message body.
M +12 -0 kmmsgpart.cpp 1.96
M +5 -0 kmmsgpart.h 1.33
--- kdepim/kmail/kmmsgpart.cpp #1.95:1.96
@@ -69,4 +69,16 @@ void KMMessagePart::setBodyFromUnicode(
}
+QString KMMessagePart::bodyToUnicode(const QTextCodec* codec) const {
+ if (codec == 0)
+ // No codec was given, so try the charset in the mail
+ codec = KMMessage::codecForName( charset() );
+ if (codec == 0)
+ // That also didn't work, so try a default one.
+ codec = QTextCodec::codecForName("iso-8859-1");
+ assert( codec );
+
+ return codec->toUnicode( bodyDecoded() );
+}
+
//-----------------------------------------------------------------------------
// Returns Base64 encoded MD5 digest of a QString
--- kdepim/kmail/kmmsgpart.h #1.32:1.33
@@ -10,4 +10,5 @@
template <typename T>
class QValueList;
+class QTextCodec;
class KMMessagePart
@@ -27,4 +28,8 @@ public:
**/
void setBodyFromUnicode( const QString & str );
+
+ /** Returns the body part decoded to unicode.
+ **/
+ QString bodyToUnicode(const QTextCodec* codec=0) const;
/** Returns body as decoded string. Assumes that content-transfer-encoding
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic