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

List:       kde-commits
Subject:    proko2: kdepim/kmail
From:       Karl-Heinz Zimmer <khz () klaralvdalens-datakonsult ! se>
Date:       2004-07-01 0:18:24
Message-ID: 20040701001824.7619599A9 () office ! kde ! org
[Download RAW message or body]

CVS commit by khz: 

Save the XML attachment(s) of Kolab storage mails.


  M +21 -17    kmailicalifaceimpl.cpp   1.46.2.28


--- kdepim/kmail/kmailicalifaceimpl.cpp  #1.46.2.27:1.46.2.28
@@ -193,19 +193,15 @@ bool KMailICalIfaceImpl::updateAttachmen
 
       // create the new message part with data read from temp file
-      KMMessagePart *msgPart = new KMMessagePart;
-      msgPart->setName( fileName );
-      msgPart->setPartSpecifier( fileName );
-      if( url.fileEncoding().isEmpty() ){
-        QValueList<int> allowedCTEs;
-        msgPart->setBodyAndGuessCte( rawData, allowedCTEs );
-      }else{
-        msgPart->setContentTransferEncodingStr( "8bit" );
-        msgPart->setCharset( url.fileEncoding().latin1() );
-        msgPart->setBodyEncodedBinary( rawData );
-      }
-      msgPart->setType(DwMime::kTypeApplication);
-      msgPart->setSubtype(DwMime::kSubtypeOctetStream);
-      msgPart->setContentDisposition( QString("attachment;\n\tfilename=\"%1\"")
+      KMMessagePart msgPart;
+      msgPart.setName( fileName );
+      msgPart.setType(DwMime::kTypeText);
+      msgPart.setSubtype(DwMime::kSubtypePlain);
+      msgPart.setContentDisposition( QString("attachment;\n\tfilename=\"%1\"")
           .arg( fileName ).latin1() );
+      QValueList<int> dummy;
+      msgPart.setBodyAndGuessCte( rawData, dummy );
+      if( !url.fileEncoding().isEmpty() )
+        msgPart.setCharset( url.fileEncoding().latin1() );
+      msgPart.setPartSpecifier( fileName );
 
       // quickly searching for our message part: since Kolab parts are
@@ -214,5 +210,5 @@ bool KMailICalIfaceImpl::updateAttachmen
       while( part ){
         if( fileName == part->partId() ){
-          DwBodyPart* newPart = msg.createDWBodyPart( msgPart );
+          DwBodyPart* newPart = msg.createDWBodyPart( &msgPart );
           // Make sure the replacing body part is pointing
           // to the same next part as the original body part.
@@ -231,5 +227,7 @@ bool KMailICalIfaceImpl::updateAttachmen
 
       if( !bOK ){
-        msg.addBodyPart(msgPart);
+        kdDebug(5006) << "num: " << msg.numBodyParts() << endl;
+        msg.addBodyPart( &msgPart );
+        kdDebug(5006) << "num: " << msg.numBodyParts() << endl;
         kdDebug(5006) << "Attachment added." << endl;
         bOK = true;
@@ -302,7 +300,10 @@ Q_UINT32 KMailICalIfaceImpl::addIncidenc
   msg->setType( DwMime::kTypeMultipart );
   msg->setSubtype( DwMime::kSubtypeMixed );
-  msg->setHeaderField( "Content-Type", "Multipart/Mixed" );
   msg->setSubject( "[kolab data]" );
+  msg->setCharset( "8bit" );
   msg->setBody( "Your mailer can not display this format.\nSee http://www.kolab.org \
for details on the Kolab storage format." ); +    msg->setNeedsAssembly();
+    msg->setAutomaticFields( true );
+    msg->cleanupHeader();
 
   // Add all attachments by reading them from their temp. files
@@ -318,4 +319,7 @@ Q_UINT32 KMailICalIfaceImpl::addIncidenc
   if( bAttachOK ){
     // Mark the message as read and store it in the folder
+    msg->setNeedsAssembly();
+    msg->setAutomaticFields( true );
+    msg->cleanupHeader();
     msg->touch();
     if ( folder.addMsg( msg ) == 0 )


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

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