|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef NMMESSAGELISTVIEW_H_ |
|
19 #define NMMESSAGELISTVIEW_H_ |
|
20 |
|
21 #include "nmbaseview.h" |
|
22 #include <nmactionobserver.h> |
|
23 #include <QModelIndex> |
|
24 |
|
25 class HbTreeView; |
|
26 class HbLabel; |
|
27 class HbMenu; |
|
28 class NmUiEngine; |
|
29 class HbDocumentLoader; |
|
30 class NmApplication; |
|
31 class NmUiStartParam; |
|
32 class NmMessageListModel; |
|
33 class NmMailboxListModel; |
|
34 class HbAbstractViewItem; |
|
35 class NmActionResponse; |
|
36 class NmMessageListModelItem; |
|
37 class HbIconItem; |
|
38 class HbGroupBox; |
|
39 |
|
40 class NmMessageListView : public NmBaseView, public NmActionObserver |
|
41 { |
|
42 Q_OBJECT |
|
43 public: |
|
44 NmMessageListView( |
|
45 NmApplication &application, |
|
46 NmUiStartParam *startParam, |
|
47 NmUiEngine &uiEngine, |
|
48 NmMailboxListModel &mailboxListModel, |
|
49 NmMessageListModel *messageListModel, |
|
50 HbDocumentLoader *documentLoader, |
|
51 QGraphicsItem *parent = 0); |
|
52 ~NmMessageListView(); |
|
53 NmUiViewId nmailViewId() const; |
|
54 void viewReady(); |
|
55 NmFolderType folderType(); |
|
56 void okToExitView(); |
|
57 |
|
58 public: // From NmActionObserver |
|
59 void handleActionCommand(NmActionResponse &menuResponse); |
|
60 |
|
61 public slots: |
|
62 void reloadViewContents(NmUiStartParam *startParam); |
|
63 void refreshList(); |
|
64 |
|
65 private slots: |
|
66 void showItemContextMenu(HbAbstractViewItem *index, const QPointF &coords); |
|
67 void itemActivated(const QModelIndex &index); |
|
68 void handleSelection(); |
|
69 void createOptionsMenu(); |
|
70 void itemsAdded(const QModelIndex &parent, int start, int end); |
|
71 void itemsRemoved(); |
|
72 void showNoMessagesText(); |
|
73 void hideNoMessagesText(); |
|
74 void handleSyncStateEvent(NmSyncState syncState, const NmId & mailboxId); |
|
75 void folderSelected(); |
|
76 |
|
77 private: |
|
78 void loadViewLayout(); |
|
79 void initTreeView(); |
|
80 void setMailboxName(); |
|
81 void createToolBar(); |
|
82 void setFolderName(); |
|
83 void updateSyncIcon(); |
|
84 |
|
85 private: |
|
86 NmApplication &mApplication; |
|
87 HbTreeView *mMessageListWidget; // Not owned |
|
88 QObjectList mWidgetList; |
|
89 NmUiEngine &mUiEngine; |
|
90 NmMailboxListModel &mMailboxListModel; |
|
91 NmMessageListModel *mMessageListModel; // Not owned |
|
92 HbDocumentLoader *mDocumentLoader; // Owned |
|
93 HbMenu *mItemContextMenu; // Owned |
|
94 NmMessageListModelItem *mLongPressedItem; // Not owned |
|
95 HbLabel *mNoMessagesLabel; // Not owned |
|
96 HbGroupBox *mFolderLabel; // Not owned |
|
97 QModelIndex mActivatedIndex; |
|
98 bool mViewReady; |
|
99 NmFolderType mCurrentFolderType; |
|
100 bool mSettingsLaunched; |
|
101 NmId mSelectedFolderId; |
|
102 NmId mSelectedMailboxId; |
|
103 int mPreviousModelCount; |
|
104 bool mIsFirstSyncInMessageList; |
|
105 }; |
|
106 |
|
107 #endif /* NMMESSAGELISTVIEW_H_ */ |