kmail
kmgroupware.cppGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include "kmgroupware.h"
00038 #include "kmmessage.h"
00039 #include "kmmsgpart.h"
00040 #include "libkcal/incidenceformatter.h"
00041 #include <kdebug.h>
00042 #include <mimelib/enum.h>
00043 #include <assert.h>
00044
00045
00046 bool vPartFoundAndDecoded( KMMessage* msg, QString& s )
00047 {
00048 assert( msg );
00049
00050 if( ( DwMime::kTypeText == msg->type() && ( DwMime::kSubtypeVCal == msg->subtype() ||
00051 DwMime::kSubtypeXVCard == msg->subtype() ) ) ||
00052 ( DwMime::kTypeApplication == msg->type() &&
00053 DwMime::kSubtypeOctetStream == msg->subtype() ) )
00054 {
00055 s = QString::fromUtf8( msg->bodyDecoded() );
00056 return true;
00057 } else if( DwMime::kTypeMultipart == msg->type() &&
00058 (DwMime::kSubtypeMixed == msg->subtype() ) ||
00059 (DwMime::kSubtypeAlternative == msg->subtype() ))
00060 {
00061
00062 DwBodyPart* dwPart = msg->findDwBodyPart( DwMime::kTypeApplication,
00063 DwMime::kSubtypeMsTNEF );
00064 if( !dwPart )
00065 dwPart = msg->findDwBodyPart( DwMime::kTypeApplication,
00066 DwMime::kSubtypeOctetStream );
00067 if( dwPart ){
00068
00069 KMMessagePart msgPart;
00070 KMMessage::bodyPart(dwPart, &msgPart);
00071 s = KCal::IncidenceFormatter::msTNEFToVPart( msgPart.bodyDecodedBinary() );
00072 return !s.isEmpty();
00073 } else {
00074 dwPart = msg->findDwBodyPart( DwMime::kTypeText, DwMime::kSubtypeVCal );
00075 if (dwPart) {
00076 KMMessagePart msgPart;
00077 KMMessage::bodyPart(dwPart, &msgPart);
00078 s = msgPart.body();
00079 return true;
00080 }
00081 }
00082 }else if( DwMime::kTypeMultipart == msg->type() &&
00083 DwMime::kSubtypeMixed == msg->subtype() ) {
00084
00085 }
00086
00087 return false;
00088 }
|