emailservices/nmailagent/inc/nmmailagent.h
changeset 53 bf7eb7911fc5
parent 30 759dc5235cdb
child 48 10eaf342f539
equal deleted inserted replaced
30:759dc5235cdb 53:bf7eb7911fc5
    18 #ifndef NMMAILAGENT_H
    18 #ifndef NMMAILAGENT_H
    19 #define NMMAILAGENT_H
    19 #define NMMAILAGENT_H
    20 
    20 
    21 #include <nmcommon.h>
    21 #include <nmcommon.h>
    22 
    22 
       
    23 class CHWRMVibra;
    23 class NmMailbox;
    24 class NmMailbox;
    24 class NmDataPluginFactory;
    25 class NmDataPluginFactory;
    25 class NmDataPluginInterface;
    26 class NmDataPluginInterface;
    26 class HbIndicator;
    27 class HbIndicator;
    27 class XQSystemToneService;
    28 class XQSystemToneService;
       
    29 
    28 
    30 
    29 class NmMailboxInfo
    31 class NmMailboxInfo
    30 {
    32 {
    31 public:
    33 public:
    32     NmId mId;
    34     NmId mId;
    41     int mInboxChangedMessages;
    43     int mInboxChangedMessages;
    42     int mInboxDeletedMessages;
    44     int mInboxDeletedMessages;
    43     QList<NmId> mUnreadMailIdList;
    45     QList<NmId> mUnreadMailIdList;
    44     int mOutboxMails;
    46     int mOutboxMails;
    45     bool mActive;
    47     bool mActive;
    46     QDateTime mLastSeenTime;
    48     bool mInboxActive;
    47 
    49 
    48     NmMailboxInfo();
    50     NmMailboxInfo();
    49 };
    51 };
       
    52 
    50 
    53 
    51 class NmMailAgent : public QObject
    54 class NmMailAgent : public QObject
    52 {
    55 {
    53     Q_OBJECT
    56     Q_OBJECT
    54 
    57 
    78     void handleConnectionEvent(NmConnectState state, const NmId mailboxId, int errorcode);
    81     void handleConnectionEvent(NmConnectState state, const NmId mailboxId, int errorcode);
    79 
    82 
    80     void delayedStart();
    83     void delayedStart();
    81 
    84 
    82     void enableAlertTone();
    85     void enableAlertTone();
    83     
    86 
    84     void indicatorActivated(const QString &type, const QVariantMap &data);
    87     void indicatorActivated(const QString &type, const QVariantMap &data);
    85 
    88 
    86 private:
    89 private:
    87 
    90 
    88     void initMailboxStatus();
    91     void initMailboxStatus();
    92     int getOutboxCount(const NmId &mailboxId);
    95     int getOutboxCount(const NmId &mailboxId);
    93 
    96 
    94     NmMailboxInfo *getMailboxByType(const QString &type);
    97     NmMailboxInfo *getMailboxByType(const QString &type);
    95 
    98 
    96     int getFreeIndicatorIndex();
    99     int getFreeIndicatorIndex();
    97     
   100 
    98     int getTotalUnreadCount() const;
   101     int getTotalUnreadCount() const;
    99 
   102 
   100     bool updateUnreadIndicator();
   103     bool updateUnreadIndicator();
   101     
   104 
   102     bool updateUnreadIndicator(bool active);
   105     bool updateUnreadIndicator(bool active);
   103     
   106 
   104     bool updateIndicator(bool active,
   107     bool updateIndicator(bool active,
   105         const NmMailboxInfo& mailboxInfo);
   108         const NmMailboxInfo& mailboxInfo);
   106 
   109 
   107     NmMailboxInfo* getMailboxInfo(const NmId &id);
   110     NmMailboxInfo *getMailboxInfo(const NmId &id);
   108 
   111 
   109     NmMailboxInfo* createMailboxInfo(const NmId &id);
   112     NmMailboxInfo *createMailboxInfo(const NmId &id);
   110 
   113 
   111     NmMailboxInfo* createMailboxInfo(const NmMailbox &mailbox,
   114     NmMailboxInfo *createMailboxInfo(const NmMailbox &mailbox,
   112         NmDataPluginInterface *plugin);
   115         NmDataPluginInterface *plugin);
   113 
   116 
   114     bool removeMailboxInfo(const NmId &id);
   117     bool removeMailboxInfo(const NmId &id);
   115 
   118 
   116     bool updateMailboxState(const NmId &mailboxId,
   119     bool updateMailboxState(const NmId &mailboxId,
   123 
   126 
   124     bool playAlertTone();
   127     bool playAlertTone();
   125 
   128 
   126     void updateSendIndicator();
   129     void updateSendIndicator();
   127     
   130     
       
   131     void storeMailboxActive(const NmId &mailboxId, bool active);
       
   132     
       
   133     bool isMailboxActive(const NmId &mailboxId);
       
   134     
       
   135     void deleteStoredMailboxActivity(const NmId &mailboxId);
       
   136 
   128     bool launchMailbox(quint64 mailboxId);
   137     bool launchMailbox(quint64 mailboxId);
   129 
   138 
   130 private: // data
   139 private: // data
   131 
   140 
   132     HbIndicator *mIndicator;
   141     HbIndicator *mIndicator;
   133     XQSystemToneService *mSystemTone;
   142     XQSystemToneService *mSystemTone;
   134     NmDataPluginFactory *mPluginFactory;
   143     NmDataPluginFactory *mPluginFactory;
   135     QList<NmMailboxInfo*> mMailboxes;
   144     QList<NmMailboxInfo*> mMailboxes;
       
   145     CHWRMVibra *mVibra; // Owned
   136     bool mAlertToneAllowed;
   146     bool mAlertToneAllowed;
   137     int mLastOutboxCount;
   147     int mLastOutboxCount;
   138     bool mUnreadIndicatorActive;
   148     bool mUnreadIndicatorActive;
   139 };
   149 };
   140 
   150