emailservices/nmailagent/inc/nmmailagent.h
changeset 65 478bc57ad291
parent 59 16ed8d08d0b1
equal deleted inserted replaced
59:16ed8d08d0b1 65:478bc57ad291
    17 
    17 
    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 #include <nmuieventsnotifier.h>
    22 
    23 
    23 class CHWRMVibra;
    24 class CHWRMVibra;
    24 class NmMailbox;
    25 class NmMailbox;
    25 class NmDataPluginFactory;
    26 class NmDataPluginFactory;
    26 class NmDataPluginInterface;
    27 class NmDataPluginInterface;
    27 class HbIndicator;
    28 class HbIndicator;
    28 class XQSystemToneService;
       
    29 class XQSettingsManager;
    29 class XQSettingsManager;
    30 class XQSettingsKey;
    30 class XQSettingsKey;
       
    31 
    31 
    32 
    32 class NmMailboxInfo
    33 class NmMailboxInfo
    33 {
    34 {
    34 public:
    35 public:
    35     NmId mId;
    36     NmId mId;
    41     NmSyncState mSyncState;
    42     NmSyncState mSyncState;
    42     NmConnectState mConnectState;
    43     NmConnectState mConnectState;
    43     int mInboxCreatedMessages;
    44     int mInboxCreatedMessages;
    44     int mInboxChangedMessages;
    45     int mInboxChangedMessages;
    45     int mInboxDeletedMessages;
    46     int mInboxDeletedMessages;
    46     QList<NmId> mUnreadMailIdList;
    47     QList<NmId> mMailIdList; // all messages
       
    48     QList<NmId> mNewUnreadMailIdList; // new unread messages
    47     int mOutboxMails;
    49     int mOutboxMails;
    48     bool mActive;
    50     bool mActive;
    49     bool mInboxActive;
       
    50 
    51 
    51     NmMailboxInfo();
    52     NmMailboxInfo();
    52 };
    53 };
    53 
    54 
    54 
    55 
    89 
    90 
    90     void valueChanged(const XQSettingsKey &key, const QVariant &value);
    91     void valueChanged(const XQSettingsKey &key, const QVariant &value);
    91 
    92 
    92     void delayedMailboxCreated(const NmId mailboxId);
    93     void delayedMailboxCreated(const NmId mailboxId);
    93     
    94     
       
    95     void handleViewStateChangedEvent(const NmUiEventsNotifier::NmUiEventType eventType,
       
    96                                      const NmUiViewId viewId,
       
    97                                      const NmId mailboxId);
       
    98 
    94 private:
    99 private:
    95 
   100 
    96     void initMailboxStatus();
   101     void initMailboxStatus();
    97 
   102 
    98     bool updateUnreadCount(const NmId &mailboxId, NmMailboxInfo &mailboxInfo);
   103     bool updateUnreadCount(const NmId &mailboxId, NmMailboxInfo &mailboxInfo);
   119     NmMailboxInfo *createMailboxInfo(const NmMailbox &mailbox,
   124     NmMailboxInfo *createMailboxInfo(const NmMailbox &mailbox,
   120         NmDataPluginInterface *plugin);
   125         NmDataPluginInterface *plugin);
   121 
   126 
   122     bool removeMailboxInfo(const NmId &id);
   127     bool removeMailboxInfo(const NmId &id);
   123 
   128 
       
   129     bool updateMailboxState(const NmId &mailboxId);
       
   130     
   124     bool updateMailboxState(const NmId &mailboxId,
   131     bool updateMailboxState(const NmId &mailboxId,
   125         bool active, bool refreshAlways);
   132         bool active, bool refreshAlways);
   126 
   133 
   127     static QStringList pluginFolders();
   134     static QStringList pluginFolders();
   128 
   135 
   131 
   138 
   132     bool playAlertTone();
   139     bool playAlertTone();
   133 
   140 
   134     void updateSendIndicator();
   141     void updateSendIndicator();
   135     
   142     
       
   143     void resetMailboxState(NmMailboxInfo *info); 
       
   144 
   136     void storeMailboxActive(const NmId &mailboxId, bool active);
   145     void storeMailboxActive(const NmId &mailboxId, bool active);
   137     
   146 
   138     bool isMailboxActive(const NmId &mailboxId);
   147     bool isMailboxActive(const NmId &mailboxId);
   139     
   148 
   140     void deleteStoredMailboxActivity(const NmId &mailboxId);
   149     void deleteStoredMailboxActivity(const NmId &mailboxId);
   141 
   150 
   142     bool launchMailbox(quint64 mailboxId);
   151     bool launchMailbox(quint64 mailboxId);
   143 
   152 
   144     void handleMessageCreatedEvent(const NmId &folderId, const QList<NmId> &messageIds,
   153     void handleMessageCreatedEvent(const NmId &folderId, const QList<NmId> &messageIds,
   145         const NmId &mailboxId, bool &updateNeeded, bool &activate);
   154         const NmId &mailboxId);
   146 
   155 
   147     void handleMessageChangedEvent(const NmId &folderId, const QList<NmId> &messageIds,
   156     void handleMessageChangedEvent(const NmId &folderId, const QList<NmId> &messageIds,
   148         const NmId &mailboxId, bool &updateNeeded, bool &activate);
   157         const NmId &mailboxId);
   149 
   158 
   150     void handleMessageDeletedEvent(const NmId &folderId, const QList<NmId> &messageIds,
   159     void handleMessageDeletedEvent(const NmId &folderId, const QList<NmId> &messageIds,
   151         const NmId &mailboxId, bool &updateNeeded, bool &activate);
   160         const NmId &mailboxId);
   152 
   161 
   153 private: // data
   162 private: // data
   154 
   163 
   155     HbIndicator *mIndicator; // Owned;
   164     HbIndicator *mIndicator; // Owned;
   156     XQSystemToneService *mSystemTone; // Owned.
       
   157     NmDataPluginFactory *mPluginFactory; // Not owned (singleton).
   165     NmDataPluginFactory *mPluginFactory; // Not owned (singleton).
   158     QList<NmMailboxInfo*> mMailboxes;
   166     QList<NmMailboxInfo*> mMailboxes;
   159     CHWRMVibra *mVibra; // Owned.
   167     CHWRMVibra *mVibra; // Owned.
       
   168     XQSettingsManager *mSettingManager; // Owned.
       
   169     NmUiEventsNotifier *mUiEventsNotifier; // Owned.
   160     bool mAlertToneAllowed;
   170     bool mAlertToneAllowed;
   161     int mLastOutboxCount;
   171     int mLastOutboxCount;
   162     bool mUnreadIndicatorActive;
   172     bool mUnreadIndicatorActive;
   163     XQSettingsManager *mSettingManager; // Owned.
       
   164     int mSilenceMode;
   173     int mSilenceMode;
   165 };
   174 };
   166 
   175 
   167 
   176 
   168 #endif // NMMAILAGENT_H
   177 #endif // NMMAILAGENT_H