homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuview.cpp
changeset 71 1db7cc813a4e
parent 69 87476091b3f5
child 81 7dd137878ff8
--- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuview.cpp	Fri Jul 23 13:47:57 2010 +0300
+++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuview.cpp	Fri Aug 06 13:36:36 2010 +0300
@@ -76,7 +76,7 @@
     connect(mListView,
             SIGNAL(longPressed(HbAbstractViewItem *, QPointF)),
             this, SIGNAL(longPressed(HbAbstractViewItem *, QPointF)));
-    
+
     connect(mHsSearchView.data(), SIGNAL(activated(QModelIndex)),
             this, SIGNAL(activated(QModelIndex)));
     connect(mHsSearchView.data(),
@@ -98,7 +98,7 @@
 
  \param model Model the view is to represent in HsItemViewMode.
  */
-void HsMenuView::setModel(HsMenuItemModel *model)
+void HsMenuView::setModel(QAbstractItemModel *model)
 {
     HSMENUTEST_FUNC_ENTRY("HsMenuView::setModel");
 
@@ -113,6 +113,7 @@
                         SIGNAL(listViewChange()));
         }
 
+        mListView->setItemPixmapCacheEnabled(true); // TODO: remove when enabled from default
         mListView->setModel(model, new HsListViewItem());
 
         if (mListView->model()) {
@@ -129,6 +130,13 @@
     HSMENUTEST_FUNC_EXIT("HsMenuView::setModel");
 }
 
+/*!
+ Returns model for list item view.
+ */
+QAbstractItemModel *HsMenuView::model() const
+{
+    return mListView->model();
+}
 
 /*!
 \return View widget of the menu view.
@@ -139,7 +147,7 @@
 }
 
 /*!
-\return List view widget of the menu view 
+\return List view widget of the menu view
  if available in the context or NULL otherwise.
  */
 HbListView *HsMenuView::listView() const
@@ -149,7 +157,7 @@
 
 /*!
     Returns label appropriate for the view.
-    \return Pointer to the label 
+    \return Pointer to the label
     if available in the context or NULL otherwise.
  */
 HbGroupBox *HsMenuView::viewLabel() const
@@ -158,7 +166,7 @@
 }
 
 /*!
-\return Collection button 
+\return Collection button
  if available in the context or NULL otherwise.
  */
 HbPushButton *HsMenuView::contentButton() const
@@ -281,21 +289,13 @@
     HbAction *const backKeyAction(mView->navigationAction());
 
     // now we can switch the context
-
-    if (operationalContext != HsSearchContext) {
-
-        mOperationalContext = operationalContext;
-        synchronizeCache();
+    mOperationalContext = operationalContext;
+    synchronizeCache();
 
-        if (mBuilder.currentViewLabel() != 0) {
-            mBuilder.currentViewLabel()->setHeading(viewLabelHeading);
-        }
-
-        mView->setNavigationAction(backKeyAction);
-
-    } else {
-        showSearchPanel();
+    if (mBuilder.currentViewLabel() != 0) {
+        mBuilder.currentViewLabel()->setHeading(viewLabelHeading);
     }
+    mView->setNavigationAction(backKeyAction);
 }
 
 /*!
@@ -304,7 +304,8 @@
  it is in context matching the current HsMenuView.
  */
 
-void HsMenuView::switchBuilderContext() {
+void HsMenuView::switchBuilderContext()
+{
     mBuilder.setStateContext(mStateContext);
     mBuilder.setOperationalContext(mOperationalContext);
 }