File kmail_load_non-multipart_non-text_bodies.diff of Package kdepim3

Index: kmail/imapaccountbase.cpp
===================================================================
--- kmail/imapaccountbase.cpp	(revision 647532)
+++ kmail/imapaccountbase.cpp	(working copy)
@@ -1030,7 +1031,7 @@
     msg->deleteBodyParts();
     // make the parts and fill the mBodyPartList
     constructParts( stream, 1, 0, 0, msg->asDwMessage() );
-    if ( mBodyPartList.count() == 1 ) // we directly set the body later
+    if ( mBodyPartList.count() == 1 ) // we directly set the body later, at partsToLoad below
       msg->deleteBodyParts();
 
     if ( !as )
@@ -1056,6 +1057,12 @@
         ++partsToLoad;
       }
     }
+    // if the only body part is not text, part->loadPart() would return false
+    // and that part is never loaded, so make sure it loads. 
+    // it seems that TEXT does load the single body part even if it is not text/*
+    if ( mBodyPartList.count() == 1 && partsToLoad == 0 )
+        partsToLoad = 1;
+
     if ( (mBodyPartList.count() * 0.5) < partsToLoad )
     {
       // more than 50% of the parts have to be loaded anyway so it is faster
openSUSE Build Service is sponsored by