homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuview.cpp
changeset 55 03646e8da489
parent 51 4785f57bf3d4
child 60 30f14686fb04
child 62 341166945d65
--- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuview.cpp	Thu May 27 12:46:08 2010 +0300
+++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuview.cpp	Fri Jun 11 13:30:16 2010 +0300
@@ -24,6 +24,7 @@
 #include <HbMainWindow>
 #include <HbInstance>
 #include <HbSearchPanel>
+#include <HbPushButton>
 #include <HbToolBar>
 #include <HbView>
 #include <HbToolBarExtension>
@@ -74,6 +75,8 @@
     mListView = mBuilder.currentListView();
     mViewLabel= mBuilder.currentViewLabel();
 
+    mCollectionButton = mBuilder.collectionButton();
+
     mProxyModel->setFilterRole(CaItemModel::TextRole);
     mProxyModel->setFilterKeyColumn(1);
     mProxyModel->setSortRole(CaItemModel::TextRole);
@@ -186,6 +189,20 @@
 }
 
 /*!
+    Makes the UI to show or hide view add collection button
+    \param visibility When true button will be shown,
+     otherwise it will be hidden.
+ */
+void HsMenuView::setContext(HsViewContext viewContext,
+                            HsOperationalContext context)
+{
+    mBuilder.setViewContext(viewContext);
+    mBuilder.setOperationalContext(context);
+    mBuilder.build();
+}
+
+
+/*!
 \return View widget of the menu view.
  */
 HbView *HsMenuView::view() const
@@ -202,6 +219,14 @@
 }
 
 /*!
+\return Collection button
+ */
+HbPushButton *HsMenuView::collectionButton() const
+{
+    return mCollectionButton;
+}
+
+/*!
  Makes search panel visible.
  Equivalent to \a setSearchPanelVisible(true)
  */
@@ -232,6 +257,15 @@
 #endif //COVERAGE_MEASUREMENT
 
 /*!
+ Disable or enable search action button.
+ \param disable If true action is disabled.
+ */
+void HsMenuView::disableSearch(bool disable)
+{
+    mBuilder.searchAction()->setDisabled(disable);
+}
+
+/*!
  Scrolls item view to requested row.
  \param row The row which is to get at the position pointed by \a hint.
  \param hint Position in the view the row should be scrolled to.
@@ -336,6 +370,8 @@
     HSMENUTEST_FUNC_ENTRY("hsmenuview::findItem");
 
     if ("" != criteriaStr) {
+        mProxyModel->invalidate();
+        mProxyModel->setSourceModel(mListView->model());
         mProxyModel->setFilterRegExp(QRegExp(criteriaStr,
                                              Qt::CaseInsensitive, QRegExp::FixedString));
         mSearchListView->scrollTo(mProxyModel->index(0,0),