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 NMAPIMAILBOXLISTING_H_ |
|
19 #define NMAPIMAILBOXLISTING_H_ |
|
20 |
|
21 |
|
22 #include <nmapimessagetask.h> |
|
23 #include <nmapidef.h> |
|
24 |
|
25 class QObject; |
|
26 |
|
27 namespace EmailClientApi |
|
28 { |
|
29 class NmApiMailboxListingPrivate; |
|
30 class NmApiMailbox; |
|
31 |
|
32 /*! |
|
33 \class Class for creating list of all mailboxes |
|
34 */ |
|
35 class NMAPI_EXPORT NmApiMailboxListing : public NmApiMessageTask |
|
36 { |
|
37 Q_OBJECT |
|
38 public: |
|
39 /*! |
|
40 Constructor of class. It set start values. |
|
41 */ |
|
42 NmApiMailboxListing(QObject *parent); |
|
43 /*! |
|
44 Destructor of class. It release engine to be safe if manual releasing won't work. |
|
45 */ |
|
46 ~NmApiMailboxListing(); |
|
47 |
|
48 enum {MailboxListingFailed = -1}; |
|
49 |
|
50 /*! |
|
51 \brief Returns results after mailboxesListed signal is received. |
|
52 |
|
53 Caller gets ownership of mailboxes. Returns true if results were available. |
|
54 Before calling this method, cancel and start should be called, |
|
55 because after second call it returns empty list. |
|
56 At start it clear inputlist of mailboxes. |
|
57 |
|
58 \return Return true if results were avaible |
|
59 \param mailboxes List of mailboxes to filled. On start is cleared. |
|
60 */ |
|
61 bool getMailboxes(QList<EmailClientApi::NmApiMailbox> &mailboxes); |
|
62 |
|
63 /*! |
|
64 \brief Return info if listing is running |
|
65 |
|
66 \return Return true if listing is running |
|
67 */ |
|
68 bool isRunning() const; |
|
69 |
|
70 signals: |
|
71 /*! |
|
72 |
|
73 emitted when listing is available, count is number of mailboxes found |
|
74 or MailboxListingFailed if listing failed |
|
75 |
|
76 \param count Count of mailboxes inside class. |
|
77 */ |
|
78 void mailboxesListed(qint32 count); |
|
79 |
|
80 public slots: |
|
81 /*! |
|
82 \brief Starts gathering mailbox list. |
|
83 |
|
84 In first turn it will get whole mailboxlist. |
|
85 Then it initialize core arguments and emits signal when ready. |
|
86 |
|
87 To asynchronous operation can be used \sa QTimer::singleShot on this method. |
|
88 Example: |
|
89 <code> |
|
90 QTimer::singleShot(0,nmMailboxListing,SLOT(start()); |
|
91 </code> |
|
92 |
|
93 \return Return true if everything go good and core of listing works good. |
|
94 |
|
95 */ |
|
96 bool start(); |
|
97 |
|
98 /*! |
|
99 \brief Stop gathering mailbox list. |
|
100 |
|
101 In first it change state of listing. |
|
102 Then it release engine. |
|
103 On end it clears list of mailboxes and emits \sa NmApiMessageTask::canceled() signal. |
|
104 */ |
|
105 void cancel(); |
|
106 |
|
107 private: |
|
108 NmApiMailboxListingPrivate *mNmApiMailboxListingPrivate; |
|
109 }; |
|
110 |
|
111 } |
|
112 |
|
113 #endif /* NMAPIMAILBOXLISTING_H_ */ |
|