|
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: Search view. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef HSSEARCHVIEW_H |
|
19 #define HSSEARCHVIEW_H |
|
20 |
|
21 #include <QModelIndex> |
|
22 #include <QScopedPointer> |
|
23 |
|
24 #include <HbShrinkingVkbHost> |
|
25 |
|
26 #include "hsmenustates_global.h" |
|
27 #include "hsmenuviewbuilder.h" |
|
28 |
|
29 class QSortFilterProxyModel; |
|
30 class HsMainWindow; |
|
31 class HbAbstractViewItem; |
|
32 class HbLineEdit; |
|
33 class HbSearchPanel; |
|
34 |
|
35 HS_STATES_TEST_CLASS(MenuStatesTest) |
|
36 |
|
37 class HsSearchView : public QObject |
|
38 { |
|
39 Q_OBJECT |
|
40 |
|
41 HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest) |
|
42 |
|
43 public: |
|
44 |
|
45 HsSearchView( |
|
46 HsMenuViewBuilder &builder, |
|
47 HsStateContext stateContext, |
|
48 HsMainWindow &mainWindow); |
|
49 ~HsSearchView(); |
|
50 |
|
51 void setSearchPanelVisible(bool visible); |
|
52 bool isActive() const; |
|
53 private: |
|
54 |
|
55 QModelIndex firstVisibleItemIndex(const HbListView *view) const; |
|
56 void searchBegins(); |
|
57 |
|
58 void connectSearchItemViewsSignals(); |
|
59 void disconnectSearchItemViewsSignals(); |
|
60 |
|
61 void connectSearchPanelSignals(); |
|
62 |
|
63 void disconnectSearchPanelSignals(); |
|
64 |
|
65 void searchFinished(); |
|
66 |
|
67 signals: |
|
68 void activated(const QModelIndex &index); |
|
69 void longPressed(HbAbstractViewItem *item, const QPointF &coords); |
|
70 |
|
71 public slots: |
|
72 void hideSearchPanel(); |
|
73 void activatedProxySlot(const QModelIndex &index); |
|
74 void longPressedProxySlot( |
|
75 HbAbstractViewItem *item, const QPointF &coords); |
|
76 |
|
77 private slots: |
|
78 void findItem(QString criteriaStr); |
|
79 private: |
|
80 void setOriginatingContext(); |
|
81 void setSearchContext(); |
|
82 void initSearchPanel(HbSearchPanel &searchPanel); |
|
83 HbLineEdit *searchPanelLineEdit(HbSearchPanel &searchPanel) const; |
|
84 |
|
85 private: |
|
86 |
|
87 QModelIndex mSearchViewInitialIndex; |
|
88 QModelIndex mIndexToScrollAfterSearchDone; |
|
89 QModelIndex mSearchViewLongPressedIndex; |
|
90 QSortFilterProxyModel *mProxyModel; // owned |
|
91 HbView *mSearchView; |
|
92 HbListView *mSearchListView; |
|
93 HbSearchPanel *mSearchPanel; |
|
94 const HsStateContext mStateContext; |
|
95 HsOperationalContext mAfterSearchContext; |
|
96 HsMenuViewBuilder &mBuilder; |
|
97 HsMainWindow &mMainWindow; |
|
98 HbListView *mListView; |
|
99 QScopedPointer<HbShrinkingVkbHost> mVkbHost; |
|
100 |
|
101 }; |
|
102 |
|
103 #endif /* HSSEARCHVIEW_H_ */ |