homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuview.cpp
changeset 55 03646e8da489
parent 51 4785f57bf3d4
child 60 30f14686fb04
child 62 341166945d65
equal deleted inserted replaced
51:4785f57bf3d4 55:03646e8da489
    22 #include <HbGroupBox>
    22 #include <HbGroupBox>
    23 #include <HbListView>
    23 #include <HbListView>
    24 #include <HbMainWindow>
    24 #include <HbMainWindow>
    25 #include <HbInstance>
    25 #include <HbInstance>
    26 #include <HbSearchPanel>
    26 #include <HbSearchPanel>
       
    27 #include <HbPushButton>
    27 #include <HbToolBar>
    28 #include <HbToolBar>
    28 #include <HbView>
    29 #include <HbView>
    29 #include <HbToolBarExtension>
    30 #include <HbToolBarExtension>
    30 #include <HbStaticVkbHost>
    31 #include <HbStaticVkbHost>
    31 
    32 
    72 
    73 
    73     mView = mBuilder.currentView();
    74     mView = mBuilder.currentView();
    74     mListView = mBuilder.currentListView();
    75     mListView = mBuilder.currentListView();
    75     mViewLabel= mBuilder.currentViewLabel();
    76     mViewLabel= mBuilder.currentViewLabel();
    76 
    77 
       
    78     mCollectionButton = mBuilder.collectionButton();
       
    79 
    77     mProxyModel->setFilterRole(CaItemModel::TextRole);
    80     mProxyModel->setFilterRole(CaItemModel::TextRole);
    78     mProxyModel->setFilterKeyColumn(1);
    81     mProxyModel->setFilterKeyColumn(1);
    79     mProxyModel->setSortRole(CaItemModel::TextRole);
    82     mProxyModel->setSortRole(CaItemModel::TextRole);
    80 
    83 
    81     mVkbHost = new HbStaticVkbHost(mView);
    84     mVkbHost = new HbStaticVkbHost(mView);
   184     }
   187     }
   185     HSMENUTEST_FUNC_EXIT("HsMenuView::setSearchPanelVisible");
   188     HSMENUTEST_FUNC_EXIT("HsMenuView::setSearchPanelVisible");
   186 }
   189 }
   187 
   190 
   188 /*!
   191 /*!
       
   192     Makes the UI to show or hide view add collection button
       
   193     \param visibility When true button will be shown,
       
   194      otherwise it will be hidden.
       
   195  */
       
   196 void HsMenuView::setContext(HsViewContext viewContext,
       
   197                             HsOperationalContext context)
       
   198 {
       
   199     mBuilder.setViewContext(viewContext);
       
   200     mBuilder.setOperationalContext(context);
       
   201     mBuilder.build();
       
   202 }
       
   203 
       
   204 
       
   205 /*!
   189 \return View widget of the menu view.
   206 \return View widget of the menu view.
   190  */
   207  */
   191 HbView *HsMenuView::view() const
   208 HbView *HsMenuView::view() const
   192 {
   209 {
   193     return mView;
   210     return mView;
   197 \return List view widget of the menu view.
   214 \return List view widget of the menu view.
   198  */
   215  */
   199 HbListView *HsMenuView::listView() const
   216 HbListView *HsMenuView::listView() const
   200 {
   217 {
   201     return mListView;
   218     return mListView;
       
   219 }
       
   220 
       
   221 /*!
       
   222 \return Collection button
       
   223  */
       
   224 HbPushButton *HsMenuView::collectionButton() const
       
   225 {
       
   226     return mCollectionButton;
   202 }
   227 }
   203 
   228 
   204 /*!
   229 /*!
   205  Makes search panel visible.
   230  Makes search panel visible.
   206  Equivalent to \a setSearchPanelVisible(true)
   231  Equivalent to \a setSearchPanelVisible(true)
   228     HSMENUTEST_FUNC_EXIT("HsMenuView::hideSearchPanel");
   253     HSMENUTEST_FUNC_EXIT("HsMenuView::hideSearchPanel");
   229 }
   254 }
   230 #ifdef COVERAGE_MEASUREMENT
   255 #ifdef COVERAGE_MEASUREMENT
   231 #pragma CTC ENDSKIP
   256 #pragma CTC ENDSKIP
   232 #endif //COVERAGE_MEASUREMENT
   257 #endif //COVERAGE_MEASUREMENT
       
   258 
       
   259 /*!
       
   260  Disable or enable search action button.
       
   261  \param disable If true action is disabled.
       
   262  */
       
   263 void HsMenuView::disableSearch(bool disable)
       
   264 {
       
   265     mBuilder.searchAction()->setDisabled(disable);
       
   266 }
   233 
   267 
   234 /*!
   268 /*!
   235  Scrolls item view to requested row.
   269  Scrolls item view to requested row.
   236  \param row The row which is to get at the position pointed by \a hint.
   270  \param row The row which is to get at the position pointed by \a hint.
   237  \param hint Position in the view the row should be scrolled to.
   271  \param hint Position in the view the row should be scrolled to.
   334     qDebug
   368     qDebug
   335     () << QString("hsmenuview::findItem: %1").arg(criteriaStr);
   369     () << QString("hsmenuview::findItem: %1").arg(criteriaStr);
   336     HSMENUTEST_FUNC_ENTRY("hsmenuview::findItem");
   370     HSMENUTEST_FUNC_ENTRY("hsmenuview::findItem");
   337 
   371 
   338     if ("" != criteriaStr) {
   372     if ("" != criteriaStr) {
       
   373         mProxyModel->invalidate();
       
   374         mProxyModel->setSourceModel(mListView->model());
   339         mProxyModel->setFilterRegExp(QRegExp(criteriaStr,
   375         mProxyModel->setFilterRegExp(QRegExp(criteriaStr,
   340                                              Qt::CaseInsensitive, QRegExp::FixedString));
   376                                              Qt::CaseInsensitive, QRegExp::FixedString));
   341         mSearchListView->scrollTo(mProxyModel->index(0,0),
   377         mSearchListView->scrollTo(mProxyModel->index(0,0),
   342                                   HbAbstractItemView::PositionAtTop);
   378                                   HbAbstractItemView::PositionAtTop);
   343     } else {
   379     } else {