emailuis/nmailui/src/nmmailboxserviceinterface.cpp
changeset 43 99bcbff212ad
parent 40 2c62ef3caffd
child 47 f83bd4ae1fe3
equal deleted inserted replaced
42:139d4b7b2938 43:99bcbff212ad
    51 /*!
    51 /*!
    52     Class desctructor.
    52     Class desctructor.
    53 */
    53 */
    54 NmMailboxServiceInterface::~NmMailboxServiceInterface()
    54 NmMailboxServiceInterface::~NmMailboxServiceInterface()
    55 {
    55 {
       
    56     NM_FUNCTION;
    56 }
    57 }
    57 
    58 
    58 
    59 
    59 /*!
    60 /*!
    60     Called by some external application when the content of a mailbox needs to
    61     Called by some external application when the content of a mailbox needs to
    61     be viewed.
    62     be viewed.
    62     \param data The ID of the mailbox to open.
    63     \param data The ID of the mailbox to open.
    63 */
    64 */
    64 void NmMailboxServiceInterface::displayInboxByMailboxId(QVariant data)
    65 void NmMailboxServiceInterface::displayInboxByMailboxId(QVariant data)
    65 {
    66 {
    66     NMLOG("NmMailboxServiceInterface::displayInboxByMailboxId()");
    67     NM_FUNCTION;
    67 
    68 
    68 #ifndef NM_WINS_ENV
    69 #ifndef NM_WINS_ENV
    69 
    70 
    70     // Get the given ID and convert it into NmId type.
    71     // Get the given ID and convert it into NmId type.
    71     NmId mailboxNmId(data.toULongLong());
    72     NmId mailboxNmId(data.toULongLong());
    72 
    73 
    73     mAsyncReqId = setCurrentRequestAsync();
    74     mAsyncReqId = setCurrentRequestAsync();
       
    75 
       
    76     // Make sure that app stays background if user presses back in message list view
       
    77     bool visible = mApplication->updateVisibilityState();
    74 
    78 
    75     // Verify that the ID matches one of the existing mailboxes.
    79     // Verify that the ID matches one of the existing mailboxes.
    76     if (mailboxExistsById(mailboxNmId)) {
    80     if (mailboxExistsById(mailboxNmId)) {
    77 
    81 
    78         // Get standard folder inbox id.
    82         // Get standard folder inbox id.
    99     }
   103     }
   100     else {
   104     else {
   101         // No mailbox found with the given ID.
   105         // No mailbox found with the given ID.
   102 
   106 
   103         // if started as embedded, do not hide the app
   107         // if started as embedded, do not hide the app
   104 		if (!XQServiceUtil::isEmbedded()) {
   108 		if (!XQServiceUtil::isEmbedded() && !visible) {
   105 			XQServiceUtil::toBackground(true);
   109 			XQServiceUtil::toBackground(true);
   106 		}
   110 		}
   107 
   111 
   108         completeRequest(mAsyncReqId, 1);
   112         completeRequest(mAsyncReqId, 1);
   109 
   113 
   122     \param mailboxId The mailbox ID to look for.
   126     \param mailboxId The mailbox ID to look for.
   123     \return True if a mailbox with the given ID exists, false otherwise.
   127     \return True if a mailbox with the given ID exists, false otherwise.
   124 */
   128 */
   125 bool NmMailboxServiceInterface::mailboxExistsById(const NmId &mailboxId) const
   129 bool NmMailboxServiceInterface::mailboxExistsById(const NmId &mailboxId) const
   126 {
   130 {
   127     NMLOG("NmMailboxServiceInterface::mailboxExistsById()");
   131     NM_FUNCTION;
   128 
   132 
   129     const NmMailboxListModel& mailboxListModel = mUiEngine.mailboxListModel();
   133     const NmMailboxListModel& mailboxListModel = mUiEngine.mailboxListModel();
   130     int mailboxCount = mailboxListModel.rowCount();
   134     int mailboxCount = mailboxListModel.rowCount();
   131 
   135 
   132     QModelIndex modelIndex;
   136     QModelIndex modelIndex;