emailservices/nmclientapi/src/nmapifolderlisting.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 <nmapifolderlisting.h>
    20 #include <nmapifolderlisting.h>
    20 #include "nmapifolderlisting_p.h"
    21 #include "nmapifolderlisting_p.h"
    21 
    22 
    22 #include <nmapimailbox.h>
    23 #include <nmapimailbox.h>
    33    Constructor of class. It set start values.
    34    Constructor of class. It set start values.
    34  */
    35  */
    35 NmApiFolderListing::NmApiFolderListing(QObject *parent, const quint64 &nmMailboxId) :
    36 NmApiFolderListing::NmApiFolderListing(QObject *parent, const quint64 &nmMailboxId) :
    36     NmApiMessageTask(parent)
    37     NmApiMessageTask(parent)
    37 {
    38 {
       
    39     NM_FUNCTION;
       
    40     
    38     mFolderListing = new NmApiFolderListingPrivate(this);
    41     mFolderListing = new NmApiFolderListingPrivate(this);
    39     mFolderListing->mIsRunning = false;
    42     mFolderListing->mIsRunning = false;
    40     mFolderListing->mMailboxId = nmMailboxId;
    43     mFolderListing->mMailboxId = nmMailboxId;
    41 }
    44 }
    42 
    45 
    43 /*!
    46 /*!
    44    Destructor of class. It release engine to be safe if manual releasing won't work.
    47    Destructor of class. It release engine to be safe if manual releasing won't work.
    45  */
    48  */
    46 NmApiFolderListing::~NmApiFolderListing()
    49 NmApiFolderListing::~NmApiFolderListing()
    47 {
    50 {
       
    51     NM_FUNCTION;
       
    52     
    48     if (mFolderListing->mIsRunning) {
    53     if (mFolderListing->mIsRunning) {
    49         mFolderListing->releaseEngine();
    54         mFolderListing->releaseEngine();
    50     }
    55     }
    51 }
    56 }
    52 
    57 
    57     It clears list of folders after be called.
    62     It clears list of folders after be called.
    58     It also at start clear inputlist of NmFolder.
    63     It also at start clear inputlist of NmFolder.
    59  */
    64  */
    60 bool NmApiFolderListing::getFolders(QList<EmailClientApi::NmApiFolder> &folders)
    65 bool NmApiFolderListing::getFolders(QList<EmailClientApi::NmApiFolder> &folders)
    61 {
    66 {
       
    67     NM_FUNCTION;
       
    68     
    62     folders.clear();
    69     folders.clear();
    63     if (!mFolderListing->mIsRunning || mFolderListing->mFolders.isEmpty()) {
    70     if (!mFolderListing->mIsRunning || mFolderListing->mFolders.isEmpty()) {
    64         return false;
    71         return false;
    65     }
    72     }
    66     folders = mFolderListing->mFolders;
    73     folders = mFolderListing->mFolders;
    81    </code>
    88    </code>
    82    
    89    
    83  */
    90  */
    84 bool NmApiFolderListing::start()
    91 bool NmApiFolderListing::start()
    85 {
    92 {
       
    93     NM_FUNCTION;
       
    94     
    86     if (mFolderListing->mIsRunning) {
    95     if (mFolderListing->mIsRunning) {
    87         return true;
    96         return true;
    88     }
    97     }
    89 
    98 
    90     if (!mFolderListing->initializeEngine()) {
    99     if (!mFolderListing->initializeEngine()) {
   109    Then it release engine.
   118    Then it release engine.
   110    On end it clears list of folders and emits \sa NmApiMessageTask::canceled() signal.
   119    On end it clears list of folders and emits \sa NmApiMessageTask::canceled() signal.
   111  */
   120  */
   112 void NmApiFolderListing::cancel()
   121 void NmApiFolderListing::cancel()
   113 {
   122 {
       
   123     NM_FUNCTION;
       
   124     
   114     if (!mFolderListing->mIsRunning) {
   125     if (!mFolderListing->mIsRunning) {
   115         return;
   126         return;
   116     }
   127     }
   117 
   128 
   118     mFolderListing->mIsRunning = false;
   129     mFolderListing->mIsRunning = false;
   125 /*!
   136 /*!
   126    \brief Return info if listing is running
   137    \brief Return info if listing is running
   127  */
   138  */
   128 bool NmApiFolderListing::isRunning() const
   139 bool NmApiFolderListing::isRunning() const
   129 {
   140 {
       
   141     NM_FUNCTION;
       
   142     
   130     return mFolderListing->mIsRunning;
   143     return mFolderListing->mIsRunning;
   131 }
   144 }
   132 
   145 
   133 }
   146 }
   134 
   147