emailservices/nmailbase/src/nmmessage.cpp
changeset 20 ecc8def7944a
parent 18 578830873419
child 23 2dc6caa42ec3
--- a/emailservices/nmailbase/src/nmmessage.cpp	Fri Apr 16 14:51:52 2010 +0300
+++ b/emailservices/nmailbase/src/nmmessage.cpp	Mon May 03 12:23:15 2010 +0300
@@ -123,6 +123,18 @@
 /*!
     Returns pointer to plain text body, if plain text body is not found
     returns null pointer. Ownership of message part object is not transferred.
+    Do not delete returned pointer. Non-modifying version.
+ */
+const NmMessagePart *NmMessage::plainTextBodyPart() const
+{
+    const NmMessagePart *ret = NULL;
+    ret = findContentPart(NmContentTypeTextPlain);
+    return ret;
+}
+
+/*!
+    Returns pointer to plain text body, if plain text body is not found
+    returns null pointer. Ownership of message part object is not transferred.
     Do not delete returned pointer.
  */
 NmMessagePart *NmMessage::plainTextBodyPart()
@@ -135,6 +147,18 @@
 /*!
     Returns pointer to html body, if html body is not found
     returns null pointer. Ownership of message part object is not transferred.
+    Do not delete returned pointer. Non-modifying version.
+ */
+const NmMessagePart *NmMessage::htmlBodyPart() const
+{
+    const NmMessagePart *ret = NULL;
+    ret = findContentPart(NmContentTypeTextHtml);
+    return ret;
+}
+
+/*!
+    Returns pointer to html body, if html body is not found
+    returns null pointer. Ownership of message part object is not transferred.
     Do not delete returned pointer.
  */
 NmMessagePart *NmMessage::htmlBodyPart()
@@ -181,7 +205,7 @@
 * 
 * @param flat list of attachments to be filled
 */        
-void NmMessage::attachmentList(QList<NmMessagePart*> &parts)
+void NmMessage::attachmentList(QList<NmMessagePart*> &parts) const
 {
     parts.clear();
     appendAttachments(parts);
@@ -193,23 +217,23 @@
     }
     else {
         // find plain text body part from the list
-        NmMessagePart* txtPart = findContentPart(NmContentTypeTextPlain);
+        const NmMessagePart* txtPart = findContentPart(NmContentTypeTextPlain);
         if ( txtPart ) {
             // remove plain text body part from attachment list
-            for ( int ii = parts.count() - 1; ii >= 0; --ii ) {
-                if ( parts.at(ii)->id() == txtPart->id() ) {
-                    parts.removeAt(ii);
+            for ( int i = parts.count() - 1; i >= 0; --i ) {
+                if ( parts.at(i)->id() == txtPart->id() ) {
+                    parts.removeAt(i);
                     break;
                 }
             }
         }
         // find  html body part from the list
-        NmMessagePart* htmlPart = findContentPart(NmContentTypeTextHtml);
+        const NmMessagePart* htmlPart = findContentPart(NmContentTypeTextHtml);
         if ( htmlPart ) {
             // remove html body part from attachment list
-            for ( int ii = parts.count() - 1; ii >= 0; --ii ) {
-                if ( parts.at(ii)->id() == htmlPart->id() ) {
-                    parts.removeAt(ii);
+            for ( int i = parts.count() - 1; i >= 0; --i ) {
+                if ( parts.at(i)->id() == htmlPart->id() ) {
+                    parts.removeAt(i);
                     break;
                 }
             }