email_plat/nmail_client_api/inc/nmapifolderlisting.h
changeset 76 38bf5461e270
parent 74 6c59112cfd31
equal deleted inserted replaced
74:6c59112cfd31 76:38bf5461e270
    19 #define NMAPIFOLDERLISTING_H_
    19 #define NMAPIFOLDERLISTING_H_
    20 
    20 
    21 #include <nmapimessagetask.h>
    21 #include <nmapimessagetask.h>
    22 #include <nmapidef.h>
    22 #include <nmapidef.h>
    23 
    23 
    24 class NmApiEngine;
       
    25 
    24 
    26 namespace EmailClientApi
    25 namespace EmailClientApi
    27 {
    26 {
    28 
    27 class NmApiEngine;
    29 class NmApiFolderListingPrivate;
    28 class NmApiFolderListingPrivate;
    30 class NmApiMailbox;
    29 class NmApiMailbox;
    31 class NmApiFolder;
    30 class NmApiFolder;
    32 /*!
    31 
    33    \class Class for creating list of all folders
       
    34  */
       
    35 class NMAPI_EXPORT NmApiFolderListing : public NmApiMessageTask
    32 class NMAPI_EXPORT NmApiFolderListing : public NmApiMessageTask
    36 {
    33 {
    37     Q_OBJECT
    34     Q_OBJECT
    38 public:
    35 public:
    39     /*!
    36 
    40        Constructor of class. 
       
    41      */
       
    42     NmApiFolderListing(QObject *parent, const quint64 &mailboxId);
    37     NmApiFolderListing(QObject *parent, const quint64 &mailboxId);
    43     /*!
    38     virtual ~NmApiFolderListing();
    44        Destructor of class. 
       
    45      */
       
    46     ~NmApiFolderListing();
       
    47 
    39 
    48     enum {FolderListingFailed = -1};
    40     enum {FolderListingFailed = -1};
    49 
    41 
    50     /*! 
       
    51        \brief Returns results after foldersListed signal is received.
       
    52        
       
    53         Before calling this method, cancel and start should be called, 
       
    54         because after second call it returns empty list..
       
    55         It also at start clear inputlist of NmFolder.
       
    56      */
       
    57     bool getFolders(QList<EmailClientApi::NmApiFolder> &folders);
    42     bool getFolders(QList<EmailClientApi::NmApiFolder> &folders);
    58 
       
    59     /*!
       
    60        \brief Returns info if listing is running
       
    61      */
       
    62     bool isRunning() const;
    43     bool isRunning() const;
    63 
    44 
    64     signals:
    45 signals:
    65     /*!
    46 
    66        emitted when listing is available, count is number of folders found
       
    67        or FolderListingFailed if listing failed
       
    68      */
       
    69     void foldersListed(qint32 count);
    47     void foldersListed(qint32 count);
    70 
    48 
    71 public slots:
    49 public slots:
    72     /*!
    50 
    73        \brief Starts gathering folders list.
       
    74        
       
    75        In first turn it will get whole folderlist. 
       
    76        \todo After that it will wait for folder events.
       
    77        If start works, it do nothing.
       
    78        
       
    79        To asynchronous operation ce be used \sa QTimer::singleShot on this method.
       
    80        Example:
       
    81        <code> 
       
    82        QTimer::singleShot(0,nmFolderListing,SLOT(start());
       
    83        </code>
       
    84        
       
    85      */
       
    86     bool start();
    51     bool start();
    87 
       
    88     /*!
       
    89        \brief Stops gathering folder list.
       
    90        
       
    91        In first it change state of listing.
       
    92        Then it release engine.
       
    93        On end it clears list of folders and emits \sa NmApiMessageTask::canceled() signal.
       
    94      */
       
    95     void cancel();
    52     void cancel();
    96 
    53 
    97 private:
    54 private:
    98     NmApiFolderListingPrivate *mFolderListing;
    55     NmApiFolderListingPrivate *mFolderListing;
    99 };
    56 };