|
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 NMAPIENGINE_H |
|
19 #define NMAPIENGINE_H |
|
20 |
|
21 #include "nmcommon.h" |
|
22 #include "nmapiprivateclasses.h" |
|
23 |
|
24 class NmApiDataPluginFactory; |
|
25 |
|
26 namespace EmailClientApi |
|
27 { |
|
28 class NmApiMailbox; |
|
29 class NmApiFolder; |
|
30 class NmApiMessageEnvelope; |
|
31 } |
|
32 |
|
33 class NmApiEngine : public QObject |
|
34 { |
|
35 Q_OBJECT |
|
36 public: |
|
37 static NmApiEngine* instance(); |
|
38 static void releaseInstance(NmApiEngine *&engine); |
|
39 |
|
40 void listMailboxes(QList<EmailClientApi::NmApiMailbox> &mailboxList); |
|
41 |
|
42 void listFolders(const quint64 mailboxId, QList<EmailClientApi::NmApiFolder> &folderList); |
|
43 void listEnvelopes(const quint64 mailboxId, const quint64 folderId, |
|
44 QList<EmailClientApi::NmApiMessageEnvelope> &messageEnvelopeList); |
|
45 |
|
46 bool getEnvelopeById( |
|
47 const quint64 mailboxId, |
|
48 const quint64 folderId, |
|
49 const quint64 envelopeId, |
|
50 EmailClientApi::NmApiMessageEnvelope &envelope); |
|
51 |
|
52 bool getMailboxById(const quint64 mailboxId, EmailClientApi::NmApiMailbox &mailbox); |
|
53 |
|
54 void startCollectingEvents(); |
|
55 |
|
56 signals: |
|
57 /*! |
|
58 It contains info about event in emailstore. |
|
59 |
|
60 \arg Contains info about event and related object (message or mailbox list) |
|
61 */ |
|
62 void emailStoreEvent(NmApiMessage message); |
|
63 |
|
64 private slots: |
|
65 void mailboxChangedArrived(NmMailboxEvent, const QList<NmId> &mailboxIds); |
|
66 void messageChangedArrived( |
|
67 NmMessageEvent messageEvent, |
|
68 const NmId &folderId, |
|
69 const QList<NmId> &messageIds, |
|
70 const NmId &mailboxId); |
|
71 |
|
72 private: |
|
73 NmApiEngine(); |
|
74 virtual ~NmApiEngine(); |
|
75 |
|
76 private: |
|
77 static NmApiEngine *mInstance;//!<Static instance of NmApiEngine. There can be only one instance of engine |
|
78 static quint32 mReferenceCount;//!<Count of refences to engine instance |
|
79 |
|
80 NmApiDataPluginFactory *mFactory;//!<Plugin factory. Is needed to get plugins for emails |
|
81 }; |
|
82 |
|
83 #endif /* NMAPIENGINE_H */ |