emailservices/nmclientapi/src/nmapienvelopelisting.cpp
changeset 43 99bcbff212ad
parent 23 2dc6caa42ec3
child 48 10eaf342f539
child 54 997a02608b3a
equal deleted inserted replaced
42:139d4b7b2938 43:99bcbff212ad
    13  *
    13  *
    14  * Description:
    14  * Description:
    15  *
    15  *
    16  */
    16  */
    17 
    17 
       
    18 #include "emailtrace.h"
    18 
    19 
    19 #include <nmapienvelopelisting.h>
    20 #include <nmapienvelopelisting.h>
    20 #include "nmapienvelopelisting_p.h"
    21 #include "nmapienvelopelisting_p.h"
    21 
    22 
    22 #include <nmapicommonheader.h>
    23 #include <nmapicommonheader.h>
    34     QObject *parent,
    35     QObject *parent,
    35     const quint64 folderId,
    36     const quint64 folderId,
    36     const quint64 mailboxId) :
    37     const quint64 mailboxId) :
    37     NmApiMessageTask(parent)
    38     NmApiMessageTask(parent)
    38 {
    39 {
       
    40     NM_FUNCTION;
       
    41     
    39     mListingPrivate = new NmApiEnvelopeListingPrivate(this);
    42     mListingPrivate = new NmApiEnvelopeListingPrivate(this);
    40     mListingPrivate->mailboxId = mailboxId;
    43     mListingPrivate->mailboxId = mailboxId;
    41     mListingPrivate->folderId = folderId;
    44     mListingPrivate->folderId = folderId;
    42     mListingPrivate->mIsRunning = false;
    45     mListingPrivate->mIsRunning = false;
    43 }
    46 }
    45 /*!
    48 /*!
    46    Destructor of class. It release engine to be safe if manual releasing won't work.
    49    Destructor of class. It release engine to be safe if manual releasing won't work.
    47  */
    50  */
    48 NmApiEnvelopeListing::~NmApiEnvelopeListing()
    51 NmApiEnvelopeListing::~NmApiEnvelopeListing()
    49 {
    52 {
       
    53     NM_FUNCTION;
       
    54     
    50     if (mListingPrivate->mIsRunning) {
    55     if (mListingPrivate->mIsRunning) {
    51         mListingPrivate->releaseEngine();
    56         mListingPrivate->releaseEngine();
    52     }
    57     }
    53 }
    58 }
    54 
    59 
    65    </code>
    70    </code>
    66    
    71    
    67  */
    72  */
    68 bool NmApiEnvelopeListing::start()
    73 bool NmApiEnvelopeListing::start()
    69 {
    74 {
       
    75     NM_FUNCTION;
       
    76     
    70     bool result = false;
    77     bool result = false;
    71 
    78 
    72     if (mListingPrivate->mIsRunning) {
    79     if (mListingPrivate->mIsRunning) {
    73         result = true;
    80         result = true;
    74     }
    81     }
    99    Then it release engine.
   106    Then it release engine.
   100    On end it clears list of envelopes and emits \sa NmApiMessageTask::canceled() signal.
   107    On end it clears list of envelopes and emits \sa NmApiMessageTask::canceled() signal.
   101  */
   108  */
   102 void NmApiEnvelopeListing::cancel()
   109 void NmApiEnvelopeListing::cancel()
   103 {
   110 {
       
   111     NM_FUNCTION;
       
   112     
   104     if (mListingPrivate->mIsRunning) {
   113     if (mListingPrivate->mIsRunning) {
   105         mListingPrivate->mIsRunning = false;
   114         mListingPrivate->mIsRunning = false;
   106         mListingPrivate->releaseEngine();
   115         mListingPrivate->releaseEngine();
   107         mListingPrivate->mEnvelopes.clear();
   116         mListingPrivate->mEnvelopes.clear();
   108 
   117 
   118     because after second calling it return empty list.
   127     because after second calling it return empty list.
   119     It also at start clear inputlist of NmMessageEnvelope.
   128     It also at start clear inputlist of NmMessageEnvelope.
   120  */
   129  */
   121 bool NmApiEnvelopeListing::getEnvelopes(QList<EmailClientApi::NmApiMessageEnvelope> &envelopes)
   130 bool NmApiEnvelopeListing::getEnvelopes(QList<EmailClientApi::NmApiMessageEnvelope> &envelopes)
   122 {
   131 {
       
   132     NM_FUNCTION;
       
   133     
   123     envelopes.clear();
   134     envelopes.clear();
   124 
   135 
   125     bool result = false;
   136     bool result = false;
   126 
   137 
   127     if (!mListingPrivate->mIsRunning) {
   138     if (!mListingPrivate->mIsRunning) {
   138 /*!
   149 /*!
   139    \brief Return info if listing is running
   150    \brief Return info if listing is running
   140  */
   151  */
   141 bool NmApiEnvelopeListing::isRunning() const
   152 bool NmApiEnvelopeListing::isRunning() const
   142 {
   153 {
       
   154     NM_FUNCTION;
       
   155     
   143     return mListingPrivate->mIsRunning;
   156     return mListingPrivate->mIsRunning;
   144 }
   157 }
   145 
   158 
   146 }
   159 }