35 #include <nmapifolder.h> |
35 #include <nmapifolder.h> |
36 #include "memailitemobserver.h" |
36 #include "memailitemobserver.h" |
37 |
37 |
38 using namespace EmailClientApi; |
38 using namespace EmailClientApi; |
39 |
39 |
40 enum TEmailDocType |
|
41 { |
|
42 EEmailTypeMail = 0, |
|
43 EEmailTypeFolder, |
|
44 EEmailTypeMailBox |
|
45 }; |
|
46 |
|
47 //How this works: |
40 //How this works: |
48 //1. List all mail boxes. |
41 //1. List all mail boxes. |
49 //2. In each mail box, list the folders |
42 //2. In each mail box, list the folders |
50 //3. In each folder, list the mails |
43 //3. In each folder, list the mails |
51 //4. Process each email |
44 //4. Process each email |
62 ~QEmailFetcher(); |
55 ~QEmailFetcher(); |
63 void StartHarvesting(); |
56 void StartHarvesting(); |
64 |
57 |
65 private: |
58 private: |
66 QEmailFetcher(MEmailItemObserver& aObserver ); |
59 QEmailFetcher(MEmailItemObserver& aObserver ); |
67 static void initialize(QEmailFetcher* aThis); //helper (2nd phase constructor). |
60 void initialize(); //helper (2nd phase constructor). |
68 void processNextMailbox(); |
61 void processNextMailbox(); |
69 void processNextFolder(); |
62 void processNextFolder(); |
70 void processNextEnvelope(); |
63 void processNextEnvelope(); |
71 void NotifyHarvestingComplete(); |
64 void NotifyHarvestingComplete(); |
72 CSearchDocument* getSearchDocument( const NmApiMessageEnvelope& aEnvelope ,quint64 aMailboxId, quint64 aFolderId ); |
65 CSearchDocument* getSearchDocumentL( const NmApiMessageEnvelope& aEnvelope ,quint64 aMailboxId, quint64 aFolderId ); |
73 CSearchDocument* getMailboxorfolderSearchDocument( quint64 aMailboxId, quint64 aFolderId, TEmailDocType aDocType, QString aFoldername ); |
|
74 public slots: //public since they need to be called by *other* objects. |
66 public slots: //public since they need to be called by *other* objects. |
75 void emailServiceIntialized( bool ); |
67 void emailServiceIntialized( bool ); |
76 void handleMailboxesListed( qint32 ); |
68 void handleMailboxesListed( qint32 ); |
77 void handleMailFoldersListed( qint32 ); |
69 void handleMailFoldersListed( qint32 ); |
78 void processMessages( qint32 ); |
70 void processMessages( qint32 ); |
79 //Connect to messageEvent signal |
71 //Connect to messageEvent signal |
80 void handleMessageEvent( NmApiMessageEvent aEvent, quint64 mailboxId, quint64 folderId, QList<quint64> messageList ); |
72 void handleMessageEvent( EmailClientApi::NmApiMessageEvent aEvent, quint64 mailboxId, quint64 folderId, QList<quint64> messageList ); |
81 //Connect to Mailbox event signal |
|
82 void handlemailboxEvent(EmailClientApi::NmApiMailboxEvent event, QList<quint64> id); |
|
83 |
73 |
84 private: |
74 private: |
85 MEmailItemObserver& iEmailObserver; //The parent/creator. Not owned. |
75 MEmailItemObserver& iEmailObserver; //The parent/creator. Not owned. |
86 NmApiEventNotifier* iEmailEventNotifier; //owned; triggers handleMessageEvent. |
76 NmApiEventNotifier* iEmailEventNotifier; //owned; triggers handleMessageEvent. |
87 NmApiEmailService* iEmailService; //owned. |
77 NmApiEmailService* iEmailService; //owned. |
88 NmApiMailboxListing* iMailBoxListings; //owned. |
78 NmApiMailboxListing* iMailBoxListings; //owned. |
89 NmApiFolderListing* iMailFolderList; //owned. |
79 NmApiFolderListing* iMailFolderList; //owned. |
90 NmApiEnvelopeListing* iEnvelopeListing; //owned. |
80 NmApiEnvelopeListing* iEnvelopeListing; //owned. |
91 NmApiMessageEnvelope* iMessageListing; //owned. |
|
92 |
81 |
93 //These are needed to asynchronously process *all* mailboxes/folders. |
82 //These are needed to asynchronously process *all* mailboxes/folders. |
94 int iCurrentMailboxIndex; |
83 int iCurrentMailboxIndex; |
95 int iCurrentFolderIndex; |
84 int iCurrentFolderIndex; |
96 QList<NmApiMailbox> iMailBoxes; |
85 QList<NmApiMailbox> iMailBoxes; |