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