emailservices/nmclientapi/src/nmapimessageenvelope.cpp
branchRCL_3
changeset 63 d189ee25cf9d
equal deleted inserted replaced
61:dcf0eedfc1a3 63:d189ee25cf9d
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: 
       
    15  *
       
    16  */
       
    17 
       
    18 #include "nmapiheaders.h"
       
    19 
       
    20 
       
    21 
       
    22 namespace EmailClientApi
       
    23 {
       
    24 /*!
       
    25    copying constructor for nmmessageenvelope
       
    26  */
       
    27 NmApiMessageEnvelope::NmApiMessageEnvelope(const NmApiMessageEnvelope &envelope) :
       
    28     d(envelope.d)
       
    29 {
       
    30     NM_FUNCTION;
       
    31 }
       
    32 
       
    33 /*!
       
    34    constructor for nmmessageenvelope
       
    35  */
       
    36 NmApiMessageEnvelope::NmApiMessageEnvelope()
       
    37 {
       
    38     NM_FUNCTION;
       
    39     
       
    40     d = new NmApiMessageEnvelopePrivate();
       
    41 }
       
    42 
       
    43 /*!
       
    44    destructor for nmmessageenvelope
       
    45  */
       
    46 NmApiMessageEnvelope::~NmApiMessageEnvelope()
       
    47 {
       
    48     NM_FUNCTION;
       
    49 }
       
    50 
       
    51 /*!
       
    52    Assignment operator
       
    53  */
       
    54 NmApiMessageEnvelope &NmApiMessageEnvelope::operator=(const NmApiMessageEnvelope &envelope)
       
    55 {
       
    56     NM_FUNCTION;
       
    57     
       
    58     if (this != &envelope) {
       
    59         d = envelope.d;
       
    60     }
       
    61     return *this;
       
    62 }
       
    63 
       
    64 /*!
       
    65    Compare data from \a envelope
       
    66  */
       
    67 bool NmApiMessageEnvelope::operator==(const NmApiMessageEnvelope &envelope)
       
    68 {
       
    69     NM_FUNCTION;
       
    70     
       
    71     bool retVal = false;
       
    72     if (this->d == envelope.d) {
       
    73         retVal = true;
       
    74     }
       
    75     return retVal;
       
    76 }
       
    77 
       
    78 /*!
       
    79    getter for id
       
    80  */
       
    81 quint64 NmApiMessageEnvelope::id() const
       
    82 {
       
    83     NM_FUNCTION;
       
    84     
       
    85     return d->id;
       
    86 }
       
    87 
       
    88 /*!
       
    89    getter for id of parent folder
       
    90  */
       
    91 quint64 NmApiMessageEnvelope::parentFolder() const
       
    92 {
       
    93     NM_FUNCTION;
       
    94     
       
    95     return d->parentFolder;
       
    96 }
       
    97 
       
    98 /*!
       
    99    getter for subject
       
   100  */
       
   101 QString NmApiMessageEnvelope::subject() const
       
   102 {
       
   103     NM_FUNCTION;
       
   104     
       
   105     return d->subject;
       
   106 }
       
   107 
       
   108 /*!
       
   109    getter for sender
       
   110  */
       
   111 QString NmApiMessageEnvelope::sender() const
       
   112 {
       
   113     NM_FUNCTION;
       
   114     
       
   115     return d->sender;
       
   116 }
       
   117 
       
   118 /*!
       
   119    getter for to recipients
       
   120  */
       
   121 void NmApiMessageEnvelope::getToRecipients(QList<EmailClientApi::NmApiEmailAddress> &toRecipients)
       
   122 {
       
   123     NM_FUNCTION;
       
   124     
       
   125     toRecipients = d->toRecipients;
       
   126 }
       
   127 
       
   128 /*!
       
   129    getter for cc recipients
       
   130  */
       
   131 void NmApiMessageEnvelope::getCcRecipients(QList<EmailClientApi::NmApiEmailAddress> &ccRecipients)
       
   132 {
       
   133     NM_FUNCTION;
       
   134     
       
   135     ccRecipients = d->ccRecipients;
       
   136 }
       
   137 
       
   138 /*!
       
   139    getter for sent time
       
   140  */
       
   141 QDateTime NmApiMessageEnvelope::sentTime() const
       
   142 {
       
   143     NM_FUNCTION;
       
   144     
       
   145     return d->sentTime;
       
   146 }
       
   147 
       
   148 /*!
       
   149    getter for is read flag
       
   150  */
       
   151 bool NmApiMessageEnvelope::isRead() const
       
   152 {
       
   153     NM_FUNCTION;
       
   154     
       
   155     return d->read;
       
   156 }
       
   157 
       
   158 /*!
       
   159    getter for has attachments flag
       
   160  */
       
   161 bool NmApiMessageEnvelope::hasAttachments() const
       
   162 {
       
   163     NM_FUNCTION;
       
   164     
       
   165     return d->attachments;
       
   166 }
       
   167 
       
   168 /*!
       
   169    getter for is forwarded flag
       
   170  */
       
   171 bool NmApiMessageEnvelope::isForwarded() const
       
   172 {
       
   173     NM_FUNCTION;
       
   174     
       
   175     return d->forwarded;
       
   176 }
       
   177 
       
   178 /*!
       
   179    getter for is replied flag
       
   180  */
       
   181 bool NmApiMessageEnvelope::isReplied() const
       
   182 {
       
   183     NM_FUNCTION;
       
   184     
       
   185     return d->replied;
       
   186 }
       
   187 
       
   188 /*!
       
   189    getter for content type
       
   190  */
       
   191 QString NmApiMessageEnvelope::contentType() const
       
   192 {
       
   193     NM_FUNCTION;
       
   194     
       
   195     return d->contentType;
       
   196 }
       
   197 
       
   198 /*!
       
   199    getter for plaintext body
       
   200  */
       
   201 void NmApiMessageEnvelope::getPlainTextBody(EmailClientApi::NmApiMessageBody &body)
       
   202 {
       
   203     NM_FUNCTION;
       
   204     
       
   205     body.setContent(d->plainText);
       
   206     body.setFetchedSize(d->fetchedSize);
       
   207     body.setTotalSize(d->totalSize);
       
   208 }
       
   209 
       
   210 /*!
       
   211    setter for id 
       
   212  */
       
   213 void NmApiMessageEnvelope::setId(quint64 id)
       
   214 {
       
   215     NM_FUNCTION;
       
   216     
       
   217     d->id = id;
       
   218 }
       
   219 
       
   220 /*!
       
   221    setter for parent folder 
       
   222  */
       
   223 void NmApiMessageEnvelope::setParentFolder(quint64 parentFolder)
       
   224 {
       
   225     NM_FUNCTION;
       
   226     
       
   227     d->parentFolder = parentFolder;
       
   228 }
       
   229 
       
   230 /*!
       
   231    setter for subject 
       
   232  */
       
   233 void NmApiMessageEnvelope::setSubject(const QString &subject)
       
   234 {
       
   235     NM_FUNCTION;
       
   236     
       
   237     d->subject = subject;
       
   238 }
       
   239 
       
   240 /*!
       
   241    setter for sender  
       
   242  */
       
   243 void NmApiMessageEnvelope::setSender(const QString &sender)
       
   244 {
       
   245     NM_FUNCTION;
       
   246     
       
   247     d->sender = sender;
       
   248 }
       
   249 
       
   250 /*!
       
   251    setter for to recipients 
       
   252  */
       
   253 void NmApiMessageEnvelope::setToRecipients(
       
   254     const QList<EmailClientApi::NmApiEmailAddress> &toRecipients)
       
   255 {
       
   256     NM_FUNCTION;
       
   257     
       
   258     d->toRecipients = toRecipients;
       
   259 }
       
   260 
       
   261 /*!
       
   262    setter for cc recipients 
       
   263  */
       
   264 void NmApiMessageEnvelope::setCcRecipients(
       
   265     const QList<EmailClientApi::NmApiEmailAddress> &ccRecipients)
       
   266 {
       
   267     NM_FUNCTION;
       
   268     
       
   269     d->ccRecipients = ccRecipients;
       
   270 }
       
   271 
       
   272 /*!
       
   273    setter for sent time 
       
   274  */
       
   275 void NmApiMessageEnvelope::setSentTime(QDateTime sentTime)
       
   276 {
       
   277     NM_FUNCTION;
       
   278     
       
   279     d->sentTime = sentTime;
       
   280 }
       
   281 
       
   282 /*!
       
   283    setter for is read flag
       
   284  */
       
   285 void NmApiMessageEnvelope::setIsRead(bool isRead)
       
   286 {
       
   287     NM_FUNCTION;
       
   288     
       
   289     d->read = isRead;
       
   290 }
       
   291 
       
   292 /*!
       
   293    setter for has attachments flag 
       
   294  */
       
   295 void NmApiMessageEnvelope::setHasAttachments(bool hasAttachments)
       
   296 {
       
   297     NM_FUNCTION;
       
   298     
       
   299     d->attachments = hasAttachments;
       
   300 }
       
   301 
       
   302 /*!
       
   303    setter for is forwarded flag 
       
   304  */
       
   305 void NmApiMessageEnvelope::setIsForwarded(bool isForwarded)
       
   306 {
       
   307     NM_FUNCTION;
       
   308     
       
   309     d->forwarded = isForwarded;
       
   310 }
       
   311 
       
   312 /*!
       
   313    setter for is replied flag 
       
   314  */
       
   315 void NmApiMessageEnvelope::setIsReplied(bool isReplied)
       
   316 {
       
   317     NM_FUNCTION;
       
   318     
       
   319     d->replied = isReplied;
       
   320 }
       
   321 
       
   322 /*!
       
   323    setter for content type 
       
   324  */
       
   325 void NmApiMessageEnvelope::setContentType(const QString &contentType)
       
   326 {
       
   327     NM_FUNCTION;
       
   328     
       
   329     d->contentType = contentType;
       
   330 }
       
   331 
       
   332 /*!
       
   333    setter for messages plain text 
       
   334  */
       
   335 void NmApiMessageEnvelope::setPlainText(const QString &plainText)
       
   336 {
       
   337     NM_FUNCTION;
       
   338     
       
   339     d->plainText = plainText;
       
   340 }
       
   341 
       
   342 /*!
       
   343    setter for messages total size 
       
   344  */
       
   345 void NmApiMessageEnvelope::setTotalSize(quint64 totalSize)
       
   346 {
       
   347     NM_FUNCTION;
       
   348     
       
   349     d->totalSize = totalSize;
       
   350 }
       
   351 
       
   352 /*!
       
   353    setter for messages fetched size 
       
   354  */
       
   355 void NmApiMessageEnvelope::setFetchedSize(quint64 fetchedSize)
       
   356 {
       
   357     NM_FUNCTION;
       
   358     
       
   359     d->fetchedSize = fetchedSize;
       
   360 }
       
   361 
       
   362 /*!
       
   363    getter for messages plain text 
       
   364  */
       
   365 QString NmApiMessageEnvelope::plainText() const
       
   366 {
       
   367     NM_FUNCTION;
       
   368     
       
   369     return d->plainText;
       
   370 }
       
   371 
       
   372 /*!
       
   373    getter for messages fetched size 
       
   374  */
       
   375 quint64 NmApiMessageEnvelope::totalSize() const
       
   376 {
       
   377     NM_FUNCTION;
       
   378     
       
   379     return d->totalSize;
       
   380 }
       
   381 
       
   382 /*!
       
   383    getter for messages fetched size 
       
   384  */
       
   385 quint64 NmApiMessageEnvelope::fetchedSize() const
       
   386 {
       
   387     NM_FUNCTION;
       
   388     
       
   389     return d->fetchedSize;
       
   390 }
       
   391 }
       
   392