|
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 #ifndef NMAPIFOLDERLISTING_H_ |
|
19 #define NMAPIFOLDERLISTING_H_ |
|
20 |
|
21 #include <nmapimessagetask.h> |
|
22 #include <nmapidef.h> |
|
23 |
|
24 class NmApiEngine; |
|
25 |
|
26 namespace EmailClientApi |
|
27 { |
|
28 |
|
29 class NmApiFolderListingPrivate; |
|
30 class NmApiMailbox; |
|
31 class NmApiFolder; |
|
32 /*! |
|
33 \class Class for creating list of all folders |
|
34 */ |
|
35 class NMAPI_EXPORT NmApiFolderListing : public NmApiMessageTask |
|
36 { |
|
37 Q_OBJECT |
|
38 public: |
|
39 /*! |
|
40 Constructor of class. |
|
41 */ |
|
42 NmApiFolderListing(QObject *parent, const quint64 &mailboxId); |
|
43 /*! |
|
44 Destructor of class. |
|
45 */ |
|
46 ~NmApiFolderListing(); |
|
47 |
|
48 enum {FolderListingFailed = -1}; |
|
49 |
|
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); |
|
58 |
|
59 /*! |
|
60 \brief Returns info if listing is running |
|
61 */ |
|
62 bool isRunning() const; |
|
63 |
|
64 signals: |
|
65 /*! |
|
66 emitted when listing is available, count is number of folders found |
|
67 or FolderListingFailed if listing failed |
|
68 */ |
|
69 void foldersListed(qint32 count); |
|
70 |
|
71 public slots: |
|
72 /*! |
|
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(); |
|
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(); |
|
96 |
|
97 private: |
|
98 NmApiFolderListingPrivate *mFolderListing; |
|
99 }; |
|
100 } |
|
101 |
|
102 #endif /* NMAPIFOLDERLISTING_H_ */ |