emailuis/nmailui/src/nmmailboxserviceinterface.cpp
changeset 74 6c59112cfd31
parent 68 83cc6bae1de8
--- a/emailuis/nmailui/src/nmmailboxserviceinterface.cpp	Wed Sep 15 17:47:19 2010 +0300
+++ b/emailuis/nmailui/src/nmmailboxserviceinterface.cpp	Thu Sep 30 11:43:07 2010 +0300
@@ -67,7 +67,10 @@
     mAsyncReqId = setCurrentRequestAsync();
 
     // Make sure that app stays background if user presses back in message list view
-    bool visible = mApplication->updateVisibilityState();
+    bool visible = false;
+    if(mApplication){
+        visible = mApplication->updateVisibilityState();
+    }
 
     if (mailboxExistsById(mailboxNmId)) {
         // Fetch inbox id
@@ -122,7 +125,11 @@
 bool NmMailboxServiceInterface::mailboxExistsById(const NmId &mailboxId) const
 {
     NM_FUNCTION;
-
+    //model needs to be refreshed because in some cases, new mailbox
+    //has not been dynamically inserted into the model yet, 
+    //thus returning incorrect count.
+    mUiEngine.refreshMailboxListModel();
+    
     const NmMailboxListModel& mailboxListModel = mUiEngine.mailboxListModel();
     int mailboxCount = mailboxListModel.rowCount();