emailuis/nmailui/src/nmmailboxserviceinterface.cpp
changeset 74 6c59112cfd31
parent 68 83cc6bae1de8
equal deleted inserted replaced
69:4e54af54a4a1 74:6c59112cfd31
    65     NmId mailboxNmId(data.toULongLong());
    65     NmId mailboxNmId(data.toULongLong());
    66 
    66 
    67     mAsyncReqId = setCurrentRequestAsync();
    67     mAsyncReqId = setCurrentRequestAsync();
    68 
    68 
    69     // Make sure that app stays background if user presses back in message list view
    69     // Make sure that app stays background if user presses back in message list view
    70     bool visible = mApplication->updateVisibilityState();
    70     bool visible = false;
       
    71     if(mApplication){
       
    72         visible = mApplication->updateVisibilityState();
       
    73     }
    71 
    74 
    72     if (mailboxExistsById(mailboxNmId)) {
    75     if (mailboxExistsById(mailboxNmId)) {
    73         // Fetch inbox id
    76         // Fetch inbox id
    74         NmId inboxId = mUiEngine.standardFolderId(mailboxNmId, NmFolderInbox);
    77         NmId inboxId = mUiEngine.standardFolderId(mailboxNmId, NmFolderInbox);
    75         // Bring the application to the foreground.
    78         // Bring the application to the foreground.
   120     \return True if a mailbox with the given ID exists, false otherwise.
   123     \return True if a mailbox with the given ID exists, false otherwise.
   121 */
   124 */
   122 bool NmMailboxServiceInterface::mailboxExistsById(const NmId &mailboxId) const
   125 bool NmMailboxServiceInterface::mailboxExistsById(const NmId &mailboxId) const
   123 {
   126 {
   124     NM_FUNCTION;
   127     NM_FUNCTION;
   125 
   128     //model needs to be refreshed because in some cases, new mailbox
       
   129     //has not been dynamically inserted into the model yet, 
       
   130     //thus returning incorrect count.
       
   131     mUiEngine.refreshMailboxListModel();
       
   132     
   126     const NmMailboxListModel& mailboxListModel = mUiEngine.mailboxListModel();
   133     const NmMailboxListModel& mailboxListModel = mUiEngine.mailboxListModel();
   127     int mailboxCount = mailboxListModel.rowCount();
   134     int mailboxCount = mailboxListModel.rowCount();
   128 
   135 
   129     QModelIndex modelIndex;
   136     QModelIndex modelIndex;
   130     QVariant mailbox;
   137     QVariant mailbox;