equal
deleted
inserted
replaced
55 mSettingsLaunched(false), |
55 mSettingsLaunched(false), |
56 mPreviousModelCount(0), |
56 mPreviousModelCount(0), |
57 mIsFirstSyncInMessageList(true) |
57 mIsFirstSyncInMessageList(true) |
58 { |
58 { |
59 NM_FUNCTION; |
59 NM_FUNCTION; |
60 |
60 qApp->installEventFilter(this); |
61 loadViewLayout(); |
61 loadViewLayout(); |
62 createToolBar(); |
62 createToolBar(); |
63 initTreeView(); |
63 initTreeView(); |
64 setMailboxName(); |
64 setMailboxName(); |
65 setFolderName(); |
65 setFolderName(); |
72 { |
72 { |
73 NM_FUNCTION; |
73 NM_FUNCTION; |
74 |
74 |
75 delete mDocumentLoader; |
75 delete mDocumentLoader; |
76 mWidgetList.clear(); |
76 mWidgetList.clear(); |
|
77 mOptionsMenulist.clear(); |
77 if (mItemContextMenu){ |
78 if (mItemContextMenu){ |
78 mItemContextMenu->clearActions(); |
79 mItemContextMenu->clearActions(); |
79 } |
80 } |
80 delete mItemContextMenu; |
81 delete mItemContextMenu; |
81 } |
82 } |
372 folder selection handling within current mailbox |
373 folder selection handling within current mailbox |
373 */ |
374 */ |
374 void NmMessageListView::folderSelected() |
375 void NmMessageListView::folderSelected() |
375 { |
376 { |
376 NM_FUNCTION; |
377 NM_FUNCTION; |
|
378 |
|
379 NM_TIMESTAMP("NmMessageListView::folderSelected start ***"); |
377 |
380 |
378 // Reload view contents with new startparams if mailbox or folder |
381 // Reload view contents with new startparams if mailbox or folder |
379 // id is different than current values. |
382 // id is different than current values. |
380 if (mStartParam && (mStartParam->mailboxId()!=mSelectedMailboxId|| |
383 if (mStartParam && (mStartParam->mailboxId()!=mSelectedMailboxId|| |
381 mStartParam->folderId()!=mSelectedFolderId)){ |
384 mStartParam->folderId()!=mSelectedFolderId)){ |
392 // are deleted within reloadViewContents function |
395 // are deleted within reloadViewContents function |
393 reloadViewContents(startParam); |
396 reloadViewContents(startParam); |
394 // Set folder text to status bar |
397 // Set folder text to status bar |
395 setFolderName(); |
398 setFolderName(); |
396 } |
399 } |
|
400 NM_TIMESTAMP("NmMessageListView::folderSelected end ***"); |
397 } |
401 } |
398 |
402 |
399 |
403 |
400 /*! |
404 /*! |
401 Long keypress handling |
405 Long keypress handling |
505 |
509 |
506 menu()->clearActions(); |
510 menu()->clearActions(); |
507 NmActionRequest request(this, NmActionOptionsMenu, NmActionContextViewMessageList, |
511 NmActionRequest request(this, NmActionOptionsMenu, NmActionContextViewMessageList, |
508 NmActionContextDataNone, mStartParam->mailboxId(), mStartParam->folderId() ); |
512 NmActionContextDataNone, mStartParam->mailboxId(), mStartParam->folderId() ); |
509 NmUiExtensionManager &extMngr = mApplication.extManager(); |
513 NmUiExtensionManager &extMngr = mApplication.extManager(); |
510 QList<NmAction*> list; |
514 mOptionsMenulist.clear(); |
511 extMngr.getActions(request, list); |
515 extMngr.getActions(request, mOptionsMenulist); |
512 for (int i=0;i<list.count();i++) { |
516 for (int i=0;i<mOptionsMenulist.count();i++) { |
513 menu()->addAction(list[i]); |
517 menu()->addAction(mOptionsMenulist[i]); |
514 } |
518 } |
515 } |
519 } |
516 |
520 |
517 /*! |
521 /*! |
518 handleActionCommand. From NmMenuObserver, extension manager calls this |
522 handleActionCommand. From NmMenuObserver, extension manager calls this |
799 mUiEngine.enableSyncIndicator(false); |
803 mUiEngine.enableSyncIndicator(false); |
800 } |
804 } |
801 } |
805 } |
802 } |
806 } |
803 |
807 |
|
808 /*! |
|
809 Handle application background event. |
|
810 In this case the menu has to be closed. |
|
811 */ |
|
812 bool NmMessageListView::eventFilter(QObject *obj, QEvent *event) |
|
813 { |
|
814 if (obj == qApp) |
|
815 { |
|
816 // Close menu if application is switched to background, e.g. deactivated |
|
817 if (event && event->type() == QEvent::ApplicationDeactivate) |
|
818 { |
|
819 // Close options menu if it active |
|
820 HbMenu *optionsMenu = menu(); |
|
821 if (optionsMenu && optionsMenu->isVisible()) { |
|
822 // Close any submenus that might be open |
|
823 for (int i=0 ; i<mOptionsMenulist.count() ; i++) { |
|
824 NmAction *menuItem = mOptionsMenulist[i]; |
|
825 if (menuItem && menuItem->menu()) { |
|
826 menuItem->menu()->close(); |
|
827 } |
|
828 } |
|
829 // Close options menu |
|
830 optionsMenu->close(); |
|
831 } |
|
832 else if (mItemContextMenu && mItemContextMenu->isVisible()) { |
|
833 // Close and delete item contextmenu if open |
|
834 mItemContextMenu->clearActions(); |
|
835 delete mItemContextMenu; |
|
836 mItemContextMenu=NULL; |
|
837 } |
|
838 } |
|
839 } |
|
840 return mApplication.eventFilter(obj, event); |
|
841 } |
|
842 |
|
843 |
|
844 |