diff -r 578830873419 -r ecc8def7944a emailuis/nmhswidget/inc/nmhswidgetemailengine.h --- a/emailuis/nmhswidget/inc/nmhswidgetemailengine.h Fri Apr 16 14:51:52 2010 +0300 +++ b/emailuis/nmhswidget/inc/nmhswidgetemailengine.h Mon May 03 12:23:15 2010 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -19,8 +19,22 @@ #define NMHSWIDGETEMAILENGINE_H_ #include +#include "nmcommon.h" + class NmMessageEnvelope; -class NmFrameworkAdapter_stub; +class NmDataPluginFactory; +class NmDataPluginInterface; +class QPluginLoader; + + + +enum NmHsWidgetEmailEngineErrorCode + { + NmEngineNoErr, + NmEngineErrNotFound, + NmEngineErrFailure + }; + //Maximum amount of envelopes that can be provided to client in getData function //This is also the amount of envelopes that is kept in mData all the time const int KMaxNumberOfEnvelopesProvided = 2; @@ -32,7 +46,7 @@ { Q_OBJECT public: - NmHsWidgetEmailEngine(); + NmHsWidgetEmailEngine( const NmId& monitoredMailboxId ); ~NmHsWidgetEmailEngine(); int getEnvelopes(QList &list, int maxEnvelopeAmount); @@ -40,26 +54,44 @@ QString accountName(); public slots: - void updateData(); - void updateAccount(); + void handleMessageEvent( + NmMessageEvent event, + const NmId &folderId, + const QList &messageIds, + const NmId& mailboxId); + void handleMailboxEvent(NmMailboxEvent event, const QList &mailboxIds); + + //Activity control + void suspend(); + void activate(); + void launchMailAppInboxView(); + void launchMailAppMailViewer(const NmId &messageId); + signals: void mailDataChanged(); void accountNameChanged(const QString& accountName); void unreadCountChanged(const int& unreadCount); + void errorOccured(NmHsWidgetEmailEngineErrorCode err); private: - int calculateUnreadCount(QList envelopeList); + void constructNmPlugin(); + void updateData(); + void updateAccount(); void resetEnvelopeList(); - void shrinkEnvelopeList(); private: + NmId mMailboxId; + NmId mFolderId; QString mAccountName; int mUnreadCount; QList mEnvelopeList; - - NmFrameworkAdapter_stub* m_stub_adapter; - + NmDataPluginInterface *mEmailInterface; + NmDataPluginFactory* mFactory; + //suspension variables + bool mAccountEventReceivedWhenSuspended; + bool mMessageEventReceivedWhenSuspended; + bool mSuspended; }; #endif /* NMHSWIDGETEMAILENGINE_H_ */