24 #include <QScopedPointer> |
24 #include <QScopedPointer> |
25 #include <QSortFilterProxyModel> |
25 #include <QSortFilterProxyModel> |
26 #include <HbAbstractItemView> |
26 #include <HbAbstractItemView> |
27 #include "hsmenustates_global.h" |
27 #include "hsmenustates_global.h" |
28 #include "hsmenuviewbuilder.h" |
28 #include "hsmenuviewbuilder.h" |
|
29 #include "hssearchview.h" |
29 #include "hsapp_defs.h" |
30 #include "hsapp_defs.h" |
30 |
31 |
31 class QPointF; |
32 class QPointF; |
32 class QActionGroup; |
33 class QActionGroup; |
33 class HbView; |
34 class HbView; |
34 class HbMainWindow; |
35 class HbMainWindow; |
35 class HbAction; |
36 class HbAction; |
36 class HbAbstractItemView; |
|
37 class HbListView; |
37 class HbListView; |
38 class HbGroupBox; |
38 class HbGroupBox; |
39 class HbWidget; |
39 class HbWidget; |
40 class HbShrinkingVkbHost; |
40 class HbShrinkingVkbHost; |
|
41 class HsMainWindow; |
41 class HsMenuItemModel; |
42 class HsMenuItemModel; |
42 |
43 |
|
44 HS_STATES_TEST_CLASS(MenuStatesTest) |
43 |
45 |
44 HS_STATES_TEST_CLASS(MenuStatesTest) |
|
45 |
46 |
46 class HsMenuView: public QObject |
47 class HsMenuView: public QObject |
47 { |
48 { |
48 Q_OBJECT |
49 Q_OBJECT |
49 |
50 |
50 public: |
51 public: |
51 HsMenuView(HsMenuViewBuilder &builder, HsViewContext viewContext); |
52 HsMenuView(HsMenuViewBuilder &builder, HsStateContext stateContext, |
|
53 HsMainWindow& mainWindow); |
52 ~HsMenuView(); |
54 ~HsMenuView(); |
53 |
|
54 void setSearchPanelVisible(bool visible); |
|
55 void setContext(HsViewContext viewContext, |
|
56 HsOperationalContext context); |
|
57 |
55 |
58 HbView *view() const; |
56 HbView *view() const; |
59 |
57 |
60 HbListView *listView() const; |
58 HbListView *listView() const; |
61 HbPushButton *collectionButton() const; |
59 HbPushButton *contentButton() const; |
62 |
60 |
63 void activate(); |
61 void activate(); |
64 void inactivate(); |
62 void inactivate(); |
65 |
63 |
66 HbGroupBox *viewLabel() const; |
64 HbGroupBox *viewLabel() const; |
67 |
65 |
68 void setModel(HsMenuItemModel *model); |
66 void setModel(HsMenuItemModel *model); |
69 |
67 |
70 |
68 void reset(HsOperationalContext operationalContext); |
71 signals: |
69 signals: |
72 void activated(const QModelIndex &index); |
70 void activated(const QModelIndex &index); |
73 void longPressed(HbAbstractViewItem *item, const QPointF &coords); |
71 void longPressed(HbAbstractViewItem *item, const QPointF &coords); |
74 |
72 void listViewChange(); |
75 public slots: |
73 public slots: |
76 |
|
77 void activatedProxySlot(const QModelIndex &index); |
|
78 void longPressedProxySlot(HbAbstractViewItem *item, |
|
79 const QPointF &coords); |
|
80 |
74 |
81 void showSearchPanel(); |
75 void showSearchPanel(); |
82 void hideSearchPanel(); |
76 void hideSearchPanel(); |
83 |
77 |
84 void disableSearch(bool disable); |
78 void disableSearch(bool disable); |
85 |
79 |
86 |
|
87 private slots: |
80 private slots: |
88 void scrollToRow(int row, |
81 void scrollToRow(int row, |
89 QAbstractItemView::ScrollHint hint = |
82 QAbstractItemView::ScrollHint hint = |
90 QAbstractItemView::PositionAtTop); |
83 QAbstractItemView::PositionAtTop); |
91 void findItem(QString criteriaStr); |
|
92 |
84 |
93 private: |
85 private: |
94 |
86 |
95 QModelIndex firstVisibleItemIndex(const HbListView *view) const; |
|
96 |
|
97 void connectSearchPanelSignals(); |
|
98 void disconnectSearchPanelSignals(); |
|
99 void connectSearchItemViewsSignals(); |
|
100 void disconnectSearchItemViewsSignals(); |
|
101 |
|
102 void searchFinished(); |
|
103 void searchBegins(); |
|
104 HbAbstractItemView::ScrollHint convertScrollHint( |
87 HbAbstractItemView::ScrollHint convertScrollHint( |
105 QAbstractItemView::ScrollHint hint); |
88 QAbstractItemView::ScrollHint hint); |
106 |
89 |
|
90 void switchBuilderContext(); |
|
91 void synchronizeCache(); |
107 private: |
92 private: |
|
93 HsMenuViewBuilder &mBuilder; |
|
94 const HsStateContext mStateContext; |
|
95 HsOperationalContext mOperationalContext; |
|
96 HsMainWindow &mMainWindow; |
108 |
97 |
109 const HsViewContext mViewContext; |
98 HbView *mView; // once this is constructed it is not NULL |
110 HsMenuViewBuilder &mBuilder; |
99 HbListView *mListView; // may be NULL in some contexts |
|
100 HbGroupBox *mViewLabel; // may be NULL in some contexts |
|
101 HbPushButton *mAddContentButton; // may be NULL in some contexts |
111 |
102 |
112 QModelIndex mSearchViewInitialIndex; |
103 QScopedPointer<HsSearchView> mHsSearchView; |
113 QModelIndex mIndexToScrollAfterSearchDone; |
|
114 QModelIndex mSearchViewLongPressedIndex; |
|
115 |
|
116 QSortFilterProxyModel *mProxyModel; // owned |
|
117 |
|
118 HbView *mView; |
|
119 HbListView *mListView; |
|
120 HbGroupBox *mViewLabel; |
|
121 |
|
122 HbListView *mSearchListView; |
|
123 HbSearchPanel *mSearchPanel; |
|
124 QScopedPointer<HbShrinkingVkbHost> mVkbHost; |
|
125 |
|
126 HbPushButton *mCollectionButton; |
|
127 |
104 |
128 HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest) |
105 HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest) |
129 }; |
106 }; |
130 |
107 |
131 |
108 |