emailservices/nmailagent/inc/nmmailagent.h
changeset 43 99bcbff212ad
parent 40 2c62ef3caffd
child 44 c2d07d913565
equal deleted inserted replaced
42:139d4b7b2938 43:99bcbff212ad
    21 #include <nmcommon.h>
    21 #include <nmcommon.h>
    22 
    22 
    23 class NmMailbox;
    23 class NmMailbox;
    24 class NmDataPluginFactory;
    24 class NmDataPluginFactory;
    25 class NmDataPluginInterface;
    25 class NmDataPluginInterface;
       
    26 class HbIndicator;
       
    27 class XQSystemToneService;
    26 
    28 
    27 class NmMailboxInfo
    29 class NmMailboxInfo
    28 {
    30 {
    29 public:
    31 public:
    30     NmId mId;
    32     NmId mId;
    39     int mInboxChangedMessages;
    41     int mInboxChangedMessages;
    40     int mInboxDeletedMessages;
    42     int mInboxDeletedMessages;
    41     QList<NmId> mUnreadMailIdList;
    43     QList<NmId> mUnreadMailIdList;
    42     int mOutboxMails;
    44     int mOutboxMails;
    43     bool mActive;
    45     bool mActive;
       
    46     QDateTime mLastSeenTime;
    44 
    47 
    45     NmMailboxInfo();
    48     NmMailboxInfo();
    46 };
    49 };
    47 
    50 
    48 class NmMailAgent : public QObject
    51 class NmMailAgent : public QObject
    64 
    67 
    65     void handleMessageEvent(
    68     void handleMessageEvent(
    66             NmMessageEvent event,
    69             NmMessageEvent event,
    67             const NmId &folderId,
    70             const NmId &folderId,
    68             const QList<NmId> &messageIds,
    71             const QList<NmId> &messageIds,
    69             const NmId& mailboxId);
    72             const NmId &mailboxId);
    70 
    73 
    71     void handleSyncStateEvent(
    74     void handleSyncStateEvent(
    72             NmSyncState state,
    75             NmSyncState state,
    73             const NmOperationCompletionEvent &event);
    76             const NmOperationCompletionEvent &event);
    74 
    77 
    75     void handleConnectionEvent(NmConnectState state, const NmId mailboxId, int errorcode);
    78     void handleConnectionEvent(NmConnectState state, const NmId mailboxId, int errorcode);
    76 
    79 
    77     void delayedStart();
    80     void delayedStart();
    78 
    81 
    79     void enableAlertTone();
    82     void enableAlertTone();
       
    83     
       
    84     void indicatorActivated(const QString &type, const QVariantMap &data);
    80 
    85 
    81 private:
    86 private:
    82 
    87 
    83     void initMailboxStatus();
    88     void initMailboxStatus();
    84 
    89 
    85     bool updateUnreadCount(const NmId &mailboxId, NmMailboxInfo &mailboxInfo);
    90     bool updateUnreadCount(const NmId &mailboxId, NmMailboxInfo &mailboxInfo);
    86 
    91 
    87     int getOutboxCount(const NmId& mailboxId);
    92     int getOutboxCount(const NmId &mailboxId);
    88 
    93 
    89     int getIndicatorIndex();
    94     NmMailboxInfo *getMailboxByType(const QString &type);
    90 
    95 
       
    96     int getFreeIndicatorIndex();
       
    97     
       
    98     int getTotalUnreadCount() const;
       
    99 
       
   100     bool updateUnreadIndicator();
       
   101     
       
   102     bool updateUnreadIndicator(bool active);
       
   103     
    91     bool updateIndicator(bool active,
   104     bool updateIndicator(bool active,
    92         const NmMailboxInfo& mailboxInfo);
   105         const NmMailboxInfo& mailboxInfo);
    93 
   106 
    94     NmMailboxInfo* getMailboxInfo(const NmId &id);
   107     NmMailboxInfo* getMailboxInfo(const NmId &id);
    95 
   108 
   106     static QStringList pluginFolders();
   119     static QStringList pluginFolders();
   107 
   120 
   108     bool getMessageUnreadInfo(const NmId &folderId,
   121     bool getMessageUnreadInfo(const NmId &folderId,
   109         const NmId &messageId, const NmId &mailboxId, bool &unreadMessage);
   122         const NmId &messageId, const NmId &mailboxId, bool &unreadMessage);
   110 
   123 
   111     void playAlertTone();
   124     bool playAlertTone();
       
   125 
       
   126     void updateSendIndicator();
       
   127     
       
   128     bool launchMailbox(quint64 mailboxId);
   112 
   129 
   113 private: // data
   130 private: // data
   114 
   131 
       
   132     HbIndicator *mIndicator;
       
   133     XQSystemToneService *mSystemTone;
   115     NmDataPluginFactory *mPluginFactory;
   134     NmDataPluginFactory *mPluginFactory;
   116     QList<NmMailboxInfo*> mMailboxes;
   135     QList<NmMailboxInfo*> mMailboxes;
   117     bool mSendingState;
       
   118     bool mAlertToneAllowed;
   136     bool mAlertToneAllowed;
       
   137     int mLastOutboxCount;
       
   138     bool mUnreadIndicatorActive;
   119 };
   139 };
   120 
   140 
   121 
   141 
   122 #endif // NMMAILAGENT_H
   142 #endif // NMMAILAGENT_H