homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsallappsstate.cpp
changeset 36 cdae8c6c3876
parent 35 f9ce957a272c
child 39 4e8ebe173323
equal deleted inserted replaced
35:f9ce957a272c 36:cdae8c6c3876
    78 //
    78 //
    79 void HsAllAppsState::setMenuOptions()
    79 void HsAllAppsState::setMenuOptions()
    80 {
    80 {
    81     HSMENUTEST_FUNC_ENTRY("HsAllAppsState::setMenuOptions");
    81     HSMENUTEST_FUNC_ENTRY("HsAllAppsState::setMenuOptions");
    82     HbMenu *const mOptions = new HbMenu();
    82     HbMenu *const mOptions = new HbMenu();
       
    83     mOptions->addAction(hbTrId("txt_applib_opt_task_switcher"),
       
    84                         this,
       
    85                         SLOT(openTaskSwitcher()));
    83     mOptions->addAction(hbTrId("txt_applib_opt_add_to_collection"),
    86     mOptions->addAction(hbTrId("txt_applib_opt_add_to_collection"),
    84                         this,
    87                         this,
    85                         SLOT(addToCollection()));
    88                         SLOT(addToCollection()));
    86 
    89 
    87     HbMenu *const sortMenu = mOptions->addMenu(hbTrId(
    90     HbMenu *const sortMenu = mOptions->addMenu(hbTrId(
   186 
   189 
   187     HSMENUTEST_FUNC_EXIT("HsAllAppsState::stateExited");
   190     HSMENUTEST_FUNC_EXIT("HsAllAppsState::stateExited");
   188     qDebug("AllAppsState::stateExited()");
   191     qDebug("AllAppsState::stateExited()");
   189 }
   192 }
   190 
   193 
       
   194 /*!
       
   195  Open task switcher.
       
   196  \retval true if operation is successful.
       
   197  */
       
   198 bool HsAllAppsState::openTaskSwitcher()
       
   199 {
       
   200     return HsMenuService::launchTaskSwitcher();
       
   201 }
       
   202 
   191 // ---------------------------------------------------------------------------
   203 // ---------------------------------------------------------------------------
   192 // ---------------------------------------------------------------------------
   204 // ---------------------------------------------------------------------------
   193 //
   205 //
   194 void HsAllAppsState::listItemActivated(const QModelIndex &index)
   206 void HsAllAppsState::listItemActivated(const QModelIndex &index)
   195 {
   207 {
   231 
   243 
   232 /*!
   244 /*!
   233  Handles long-item-pressed event in all apps view by showing context menu
   245  Handles long-item-pressed event in all apps view by showing context menu
   234  \param item the event pertains to
   246  \param item the event pertains to
   235  \param position at which context menu is shown
   247  \param position at which context menu is shown
   236  \retval void
       
   237  */
   248  */
   238 void HsAllAppsState::listItemLongPressed(HbAbstractViewItem *item,
   249 void HsAllAppsState::listItemLongPressed(HbAbstractViewItem *item,
   239         const QPointF &coords)
   250         const QPointF &coords)
   240 {
   251 {
   241     HSMENUTEST_FUNC_ENTRY("HsAllAppsState::listItemLongPressed");
   252     HSMENUTEST_FUNC_ENTRY("HsAllAppsState::listItemLongPressed");
   320  */
   331  */
   321 void HsAllAppsState::addToHomeScreen(const QModelIndex &index)
   332 void HsAllAppsState::addToHomeScreen(const QModelIndex &index)
   322 {
   333 {
   323     HSMENUTEST_FUNC_ENTRY("HsAllAppsState::addToHomeScreen");
   334     HSMENUTEST_FUNC_ENTRY("HsAllAppsState::addToHomeScreen");
   324     const CaEntry *entry = mAllAppsModel->entry(index);
   335     const CaEntry *entry = mAllAppsModel->entry(index);
   325 
   336     
       
   337     QMap<QString, QString> attributes = entry->attributes();
       
   338     
   326     machine()-> postEvent(HsMenuEventFactory::createAddToHomeScreenEvent(
   339     machine()-> postEvent(HsMenuEventFactory::createAddToHomeScreenEvent(
   327                               entry->id(), entry->entryTypeName(), entry->attribute(
   340                               entry->id(),
   328                                   widgetUriAttributeName()), entry->attribute(
   341                               entry->entryTypeName(),
   329                                   widgetLibraryAttributeName())));
   342                               entry->attribute(widgetUriAttributeName()),
       
   343                               entry->attribute(widgetLibraryAttributeName()),
       
   344                               &attributes));
       
   345 
   330     HSMENUTEST_FUNC_EXIT("HsAllAppsState::addToHomeScreen");
   346     HSMENUTEST_FUNC_EXIT("HsAllAppsState::addToHomeScreen");
   331 }
   347 }
   332 
   348 
   333 // ---------------------------------------------------------------------------
   349 // ---------------------------------------------------------------------------
   334 // ---------------------------------------------------------------------------
   350 // ---------------------------------------------------------------------------