equal
deleted
inserted
replaced
23 |
23 |
24 class NmMessageEnvelope; |
24 class NmMessageEnvelope; |
25 class NmDataPluginFactory; |
25 class NmDataPluginFactory; |
26 class NmDataPluginInterface; |
26 class NmDataPluginInterface; |
27 class QPluginLoader; |
27 class QPluginLoader; |
|
28 class QTimer; |
28 |
29 |
|
30 //Three seconds |
|
31 const int NmHsWidgetEmailEngineUpdateTimerValue = 3000; |
29 |
32 |
30 |
33 enum NmHsWidgetEmailEngineExceptionCode |
31 enum NmHsWidgetEmailEngineErrorCode |
|
32 { |
34 { |
33 NmEngineNoErr, |
35 NmEngineExcFailure, |
34 NmEngineErrNotFound, |
36 NmEngineExcAccountDeleted |
35 NmEngineErrFailure |
|
36 }; |
37 }; |
37 |
|
38 //Maximum amount of envelopes that can be provided to client in getData function |
|
39 //This is also the amount of envelopes that is kept in mData all the time |
|
40 const int KMaxNumberOfEnvelopesProvided = 2; |
|
41 |
|
42 //Maximum value for unread count. Counting will stop when this limit is reached |
|
43 const int KMaxUnreadCount = 999; |
|
44 |
38 |
45 class NmHsWidgetEmailEngine : public QObject |
39 class NmHsWidgetEmailEngine : public QObject |
46 { |
40 { |
47 Q_OBJECT |
41 Q_OBJECT |
|
42 |
48 public: |
43 public: |
49 NmHsWidgetEmailEngine( const NmId& monitoredMailboxId ); |
44 NmHsWidgetEmailEngine( const NmId& monitoredMailboxId ); |
|
45 bool initialize(); |
50 ~NmHsWidgetEmailEngine(); |
46 ~NmHsWidgetEmailEngine(); |
51 |
47 |
52 int getEnvelopes(QList<NmMessageEnvelope> &list, int maxEnvelopeAmount); |
48 int getEnvelopes(QList<NmMessageEnvelope> &list, int maxEnvelopeAmount); |
53 int unreadCount(); |
49 int unreadCount(); |
54 QString accountName(); |
50 QString accountName(); |
65 //Activity control |
61 //Activity control |
66 void suspend(); |
62 void suspend(); |
67 void activate(); |
63 void activate(); |
68 void launchMailAppInboxView(); |
64 void launchMailAppInboxView(); |
69 void launchMailAppMailViewer(const NmId &messageId); |
65 void launchMailAppMailViewer(const NmId &messageId); |
|
66 void handleUpdateTimeout(); |
70 |
67 |
71 signals: |
68 signals: |
72 void mailDataChanged(); |
69 void mailDataChanged(); |
73 void accountNameChanged(const QString& accountName); |
70 void accountNameChanged(const QString& accountName); |
74 void unreadCountChanged(const int& unreadCount); |
71 void unreadCountChanged(const int& unreadCount); |
75 void errorOccured(NmHsWidgetEmailEngineErrorCode err); |
72 void exceptionOccured(const int& err); |
76 |
73 |
77 private: |
74 private: |
78 void constructNmPlugin(); |
75 bool constructNmPlugin(); |
79 void updateData(); |
76 bool updateData(); |
80 void updateAccount(); |
77 bool updateAccount(); |
81 void resetEnvelopeList(); |
78 void resetEnvelopeList(); |
82 |
79 |
83 private: |
80 private: |
84 NmId mMailboxId; |
81 NmId mMailboxId; |
85 NmId mFolderId; |
82 NmId mFolderId; |
90 NmDataPluginFactory* mFactory; |
87 NmDataPluginFactory* mFactory; |
91 //suspension variables |
88 //suspension variables |
92 bool mAccountEventReceivedWhenSuspended; |
89 bool mAccountEventReceivedWhenSuspended; |
93 bool mMessageEventReceivedWhenSuspended; |
90 bool mMessageEventReceivedWhenSuspended; |
94 bool mSuspended; |
91 bool mSuspended; |
|
92 QTimer* mUpdateTimer; |
95 }; |
93 }; |
96 |
94 |
97 #endif /* NMHSWIDGETEMAILENGINE_H_ */ |
95 #endif /* NMHSWIDGETEMAILENGINE_H_ */ |