diff -r 4e54af54a4a1 -r 6c59112cfd31 emailuis/nmailui/src/nmmessagelistview.cpp --- a/emailuis/nmailui/src/nmmessagelistview.cpp Wed Sep 15 17:47:19 2010 +0300 +++ b/emailuis/nmailui/src/nmmessagelistview.cpp Thu Sep 30 11:43:07 2010 +0300 @@ -57,7 +57,7 @@ mIsFirstSyncInMessageList(true) { NM_FUNCTION; - + qApp->installEventFilter(this); loadViewLayout(); createToolBar(); initTreeView(); @@ -74,6 +74,7 @@ delete mDocumentLoader; mWidgetList.clear(); + mOptionsMenulist.clear(); if (mItemContextMenu){ mItemContextMenu->clearActions(); } @@ -374,6 +375,8 @@ void NmMessageListView::folderSelected() { NM_FUNCTION; + + NM_TIMESTAMP("NmMessageListView::folderSelected start ***"); // Reload view contents with new startparams if mailbox or folder // id is different than current values. @@ -394,6 +397,7 @@ // Set folder text to status bar setFolderName(); } + NM_TIMESTAMP("NmMessageListView::folderSelected end ***"); } @@ -507,10 +511,10 @@ NmActionRequest request(this, NmActionOptionsMenu, NmActionContextViewMessageList, NmActionContextDataNone, mStartParam->mailboxId(), mStartParam->folderId() ); NmUiExtensionManager &extMngr = mApplication.extManager(); - QList list; - extMngr.getActions(request, list); - for (int i=0;iaddAction(list[i]); + mOptionsMenulist.clear(); + extMngr.getActions(request, mOptionsMenulist); + for (int i=0;iaddAction(mOptionsMenulist[i]); } } @@ -801,3 +805,40 @@ } } +/*! + Handle application background event. + In this case the menu has to be closed. +*/ +bool NmMessageListView::eventFilter(QObject *obj, QEvent *event) +{ + if (obj == qApp) + { + // Close menu if application is switched to background, e.g. deactivated + if (event && event->type() == QEvent::ApplicationDeactivate) + { + // Close options menu if it active + HbMenu *optionsMenu = menu(); + if (optionsMenu && optionsMenu->isVisible()) { + // Close any submenus that might be open + for (int i=0 ; imenu()) { + menuItem->menu()->close(); + } + } + // Close options menu + optionsMenu->close(); + } + else if (mItemContextMenu && mItemContextMenu->isVisible()) { + // Close and delete item contextmenu if open + mItemContextMenu->clearActions(); + delete mItemContextMenu; + mItemContextMenu=NULL; + } + } + } + return mApplication.eventFilter(obj, event); +} + + +