homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuview.h
changeset 77 4b195f3bea29
parent 55 03646e8da489
child 85 35368b604b28
--- a/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuview.h	Tue Jul 06 14:06:53 2010 +0300
+++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuview.h	Wed Aug 18 09:40:07 2010 +0300
@@ -21,10 +21,12 @@
 #include <QObject>
 #include <QModelIndex>
 #include <QAbstractItemView>
+#include <QScopedPointer>
 #include <QSortFilterProxyModel>
 #include <HbAbstractItemView>
 #include "hsmenustates_global.h"
 #include "hsmenuviewbuilder.h"
+#include "hssearchview.h"
 #include "hsapp_defs.h"
 
 class QPointF;
@@ -32,100 +34,74 @@
 class HbView;
 class HbMainWindow;
 class HbAction;
-class HbAbstractItemView;
 class HbListView;
 class HbGroupBox;
 class HbWidget;
-class HbStaticVkbHost;
+class HbShrinkingVkbHost;
+class HsMainWindow;
 class HsMenuItemModel;
 
+HS_STATES_TEST_CLASS(MenuStatesTest)
 
-HS_STATES_TEST_CLASS(MenuStatesTest)
 
 class HsMenuView: public QObject
 {
     Q_OBJECT
 
 public:
-    HsMenuView(HsMenuViewBuilder &builder, HsViewContext viewContext);
+    HsMenuView(HsMenuViewBuilder &builder, HsStateContext stateContext,
+               HsMainWindow& mainWindow);
     ~HsMenuView();
 
-    void setSearchPanelVisible(bool visible);
-    void setContext(HsViewContext viewContext,
-                    HsOperationalContext context);
-
     HbView *view() const;
 
     HbListView *listView() const;
-    HbPushButton *collectionButton() const;
+    HbPushButton *contentButton() const;
 
     void activate();
     void inactivate();
 
     HbGroupBox *viewLabel() const;
 
-    void setModel(HsMenuItemModel *model);
+    void setModel(QAbstractItemModel *model);
+    QAbstractItemModel *model() const;
 
-
+    void reset(HsOperationalContext operationalContext);
 signals:
     void activated(const QModelIndex &index);
     void longPressed(HbAbstractViewItem *item, const QPointF &coords);
-
+    void listViewChange();
 public slots:
 
-    void activatedProxySlot(const QModelIndex &index);
-    void longPressedProxySlot(HbAbstractViewItem *item,
-                              const QPointF &coords);
-
     void showSearchPanel();
     void hideSearchPanel();
 
     void disableSearch(bool disable);
 
-
 private slots:
     void scrollToRow(int row,
                      QAbstractItemView::ScrollHint hint =
                          QAbstractItemView::PositionAtTop);
-    void findItem(QString criteriaStr);
-
-    void vkbOpened();
-    void vkbClosed();
 
 private:
 
-    QModelIndex firstVisibleItemIndex(const HbListView *view) const;
-
-    void connectSearchPanelSignals();
-    void disconnectSearchPanelSignals();
-    void connectSearchItemViewsSignals();
-    void disconnectSearchItemViewsSignals();
-
-    void searchFinished();
-    void searchBegins();
     HbAbstractItemView::ScrollHint convertScrollHint(
         QAbstractItemView::ScrollHint hint);
 
+    void switchBuilderContext();
+    void synchronizeCache();
 private:
-
-    const HsViewContext mViewContext;
     HsMenuViewBuilder &mBuilder;
-
-    QModelIndex mSearchViewInitialIndex;
-    QModelIndex mIndexToScrollAfterSearchDone;
-    QModelIndex mSearchViewLongPressedIndex;
+    const HsStateContext mStateContext;
+    HsOperationalContext mOperationalContext;
+    HsMainWindow &mMainWindow;
 
-    QSortFilterProxyModel *mProxyModel; // owned
-
-    HbView *mView;
-    HbListView *mListView;
-    HbGroupBox *mViewLabel;
+    HbView *mView; // once this is constructed it is not NULL
+    HbListView *mListView; // may be NULL in some contexts
+    HbGroupBox *mViewLabel; // may be NULL in some contexts
+    HbPushButton *mAddContentButton; // may be NULL in some contexts
 
-    HbListView *mSearchListView;
-    HbSearchPanel *mSearchPanel;
-    HbStaticVkbHost* mVkbHost;
-
-    HbPushButton *mCollectionButton;
+    QScopedPointer<HsSearchView> mHsSearchView;
 
     HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest)
 };