diff -r e7aa27f58ae1 -r 578830873419 emailuis/nmhswidget/inc/nmhswidgetemailengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emailuis/nmhswidget/inc/nmhswidgetemailengine.h Fri Apr 16 14:51:52 2010 +0300 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2009 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" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef NMHSWIDGETEMAILENGINE_H_ +#define NMHSWIDGETEMAILENGINE_H_ + +#include +class NmMessageEnvelope; +class NmFrameworkAdapter_stub; +//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; + +//Maximum value for unread count. Counting will stop when this limit is reached +const int KMaxUnreadCount = 999; + +class NmHsWidgetEmailEngine : public QObject + { + Q_OBJECT +public: + NmHsWidgetEmailEngine(); + ~NmHsWidgetEmailEngine(); + + int getEnvelopes(QList &list, int maxEnvelopeAmount); + int unreadCount(); + QString accountName(); + +public slots: + void updateData(); + void updateAccount(); + +signals: + void mailDataChanged(); + void accountNameChanged(const QString& accountName); + void unreadCountChanged(const int& unreadCount); + +private: + int calculateUnreadCount(QList envelopeList); + void resetEnvelopeList(); + void shrinkEnvelopeList(); + +private: + QString mAccountName; + int mUnreadCount; + QList mEnvelopeList; + + NmFrameworkAdapter_stub* m_stub_adapter; + + }; + +#endif /* NMHSWIDGETEMAILENGINE_H_ */