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 NMAPIENVELOPELISTING_H_ |
|
19 #define NMAPIENVELOPELISTING_H_ |
|
20 |
|
21 #include <QList> |
|
22 |
|
23 #include <nmapimessagetask.h> |
|
24 #include <nmapidef.h> |
|
25 |
|
26 class QObject; |
|
27 |
|
28 class NmApiEngine; |
|
29 |
|
30 // list messages in particular folder. |
|
31 namespace EmailClientApi |
|
32 { |
|
33 class NmApiEnvelopeListingPrivate; |
|
34 class NmApiMessageEnvelope; |
|
35 |
|
36 class NMAPI_EXPORT NmApiEnvelopeListing : public NmApiMessageTask |
|
37 { |
|
38 Q_OBJECT |
|
39 public: |
|
40 /*! |
|
41 Constructor of class. It set start values. |
|
42 */ |
|
43 NmApiEnvelopeListing(QObject *parent, const quint64 folderId, const quint64 mailboxId); |
|
44 |
|
45 /*! |
|
46 Destructor of class. It release engine to be safe if manual releasing won't work. |
|
47 */ |
|
48 ~NmApiEnvelopeListing(); |
|
49 |
|
50 enum {EnvelopeListingFailed = -1}; |
|
51 |
|
52 /*! |
|
53 \brief Returns results after envelopesListed signal is received. |
|
54 |
|
55 Caller gets ownership of envelopes. Returns true if results were available. |
|
56 Before calling this method, cancel and start should be called, |
|
57 because after second call it returns empty list. |
|
58 It also at start clear inputlist of NmApiMessageEnvelope. |
|
59 |
|
60 \param envelopes envelopes |
|
61 */ |
|
62 bool getEnvelopes(QList<EmailClientApi::NmApiMessageEnvelope> &envelopes); |
|
63 |
|
64 /*! |
|
65 \brief Return info if listing is running |
|
66 */ |
|
67 bool isRunning() const; |
|
68 signals: |
|
69 /*! |
|
70 Emitted when listing is available, count is number of envelopes found |
|
71 or EnvelopeListingFailed if listing failed |
|
72 */ |
|
73 void envelopesListed(qint32 count); |
|
74 |
|
75 public slots: |
|
76 /*! |
|
77 \brief Starts gathering envelopes list. |
|
78 |
|
79 In first turn it will get whole folderlist. |
|
80 If start works, it do nothing. |
|
81 |
|
82 To asynchronous operation ce be used \sa QTimer::singleShot on this method. |
|
83 Example: |
|
84 \code |
|
85 QTimer::singleShot(0,nmEnvelopeListing,SLOT(start()); |
|
86 \endcode |
|
87 |
|
88 */ |
|
89 bool start(); |
|
90 |
|
91 /*! |
|
92 \brief Stop gathering envelope list. |
|
93 |
|
94 In first it change state of listing. |
|
95 Then it release engine. |
|
96 On end it clears list of envelopes and emits \sa NmApiMessageTask::canceled() signal. |
|
97 */ |
|
98 void cancel(); |
|
99 |
|
100 private: |
|
101 NmApiEnvelopeListingPrivate *mListingPrivate; |
|
102 }; |
|
103 } |
|
104 |
|
105 #endif /* NMAPIENVELOPELISTING_H_ */ |
|