emailservices/nmclientapi/src/nmapimailboxlisting.cpp
changeset 43 99bcbff212ad
parent 23 2dc6caa42ec3
child 48 10eaf342f539
equal deleted inserted replaced
42:139d4b7b2938 43:99bcbff212ad
    12  * Contributors:
    12  * Contributors:
    13  *
    13  *
    14  * Description:
    14  * Description:
    15  *
    15  *
    16  */
    16  */
       
    17 
       
    18 #include "emailtrace.h"
    17 
    19 
    18 #include <nmapimailboxlisting.h>
    20 #include <nmapimailboxlisting.h>
    19 
    21 
    20 #include <QObject>
    22 #include <QObject>
    21 
    23 
    35    Constructor of class. It set start values.
    37    Constructor of class. It set start values.
    36  */
    38  */
    37 NmApiMailboxListing::NmApiMailboxListing(QObject *parent) :
    39 NmApiMailboxListing::NmApiMailboxListing(QObject *parent) :
    38     NmApiMessageTask(parent)
    40     NmApiMessageTask(parent)
    39 {
    41 {
       
    42     NM_FUNCTION;
       
    43     
    40     mNmApiMailboxListingPrivate = new NmApiMailboxListingPrivate(this);
    44     mNmApiMailboxListingPrivate = new NmApiMailboxListingPrivate(this);
    41     mNmApiMailboxListingPrivate->mIsRunning = false;
    45     mNmApiMailboxListingPrivate->mIsRunning = false;
    42 }
    46 }
    43 
    47 
    44 /*!
    48 /*!
    45    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.
    46  */
    50  */
    47 NmApiMailboxListing::~NmApiMailboxListing()
    51 NmApiMailboxListing::~NmApiMailboxListing()
    48 {
    52 {
       
    53     NM_FUNCTION;
       
    54     
    49     if (mNmApiMailboxListingPrivate->mIsRunning) {
    55     if (mNmApiMailboxListingPrivate->mIsRunning) {
    50         mNmApiMailboxListingPrivate->releaseEngine();
    56         mNmApiMailboxListingPrivate->releaseEngine();
    51     }
    57     }
    52 }
    58 }
    53 
    59 
    61     \return Return true if results were avaible
    67     \return Return true if results were avaible
    62     \param mailboxes List of mailboxes to filled. On start is cleared. 
    68     \param mailboxes List of mailboxes to filled. On start is cleared. 
    63  */
    69  */
    64 bool NmApiMailboxListing::getMailboxes(QList<EmailClientApi::NmApiMailbox> &mailboxes)
    70 bool NmApiMailboxListing::getMailboxes(QList<EmailClientApi::NmApiMailbox> &mailboxes)
    65 {
    71 {
       
    72     NM_FUNCTION;
       
    73     
    66     mailboxes.clear();
    74     mailboxes.clear();
    67 
    75 
    68     bool result = false;
    76     bool result = false;
    69 
    77 
    70     if (!mNmApiMailboxListingPrivate->mIsRunning) {
    78     if (!mNmApiMailboxListingPrivate->mIsRunning) {
    99    \return Return true if everything go good and core of listing works good.
   107    \return Return true if everything go good and core of listing works good.
   100    
   108    
   101  */
   109  */
   102 bool NmApiMailboxListing::start()
   110 bool NmApiMailboxListing::start()
   103 {
   111 {
       
   112     NM_FUNCTION;
       
   113     
   104     bool result = false;
   114     bool result = false;
   105     if (mNmApiMailboxListingPrivate->mIsRunning) {
   115     if (mNmApiMailboxListingPrivate->mIsRunning) {
   106         result = true;
   116         result = true;
   107     }
   117     }
   108     else
   118     else
   131    Then it release engine.
   141    Then it release engine.
   132    On end it clears list of mailboxes and emits \sa NmApiMessageTask::canceled() signal.
   142    On end it clears list of mailboxes and emits \sa NmApiMessageTask::canceled() signal.
   133  */
   143  */
   134 void NmApiMailboxListing::cancel()
   144 void NmApiMailboxListing::cancel()
   135 {
   145 {
       
   146     NM_FUNCTION;
       
   147     
   136     if (mNmApiMailboxListingPrivate->mIsRunning) {
   148     if (mNmApiMailboxListingPrivate->mIsRunning) {
   137 
   149 
   138         mNmApiMailboxListingPrivate->mIsRunning = false;
   150         mNmApiMailboxListingPrivate->mIsRunning = false;
   139         mNmApiMailboxListingPrivate->releaseEngine();
   151         mNmApiMailboxListingPrivate->releaseEngine();
   140         mNmApiMailboxListingPrivate->mMailboxes.clear();
   152         mNmApiMailboxListingPrivate->mMailboxes.clear();
   148    
   160    
   149    \return Return true if listing is running
   161    \return Return true if listing is running
   150  */
   162  */
   151 bool NmApiMailboxListing::isRunning() const
   163 bool NmApiMailboxListing::isRunning() const
   152 {
   164 {
       
   165     NM_FUNCTION;
       
   166     
   153     return mNmApiMailboxListingPrivate->mIsRunning;
   167     return mNmApiMailboxListingPrivate->mIsRunning;
   154 }
   168 }
   155 
   169 
   156 }
   170 }
   157 
   171