homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsallappsstate.cpp
changeset 96 458d8c8d9580
parent 92 6727c5d0afc7
equal deleted inserted replaced
92:6727c5d0afc7 96:458d8c8d9580
   111 void HsAllAppsState::setMenuOptions()
   111 void HsAllAppsState::setMenuOptions()
   112 {
   112 {
   113     HSMENUTEST_FUNC_ENTRY("HsAllAppsState::setMenuOptions");
   113     HSMENUTEST_FUNC_ENTRY("HsAllAppsState::setMenuOptions");
   114     mViewOptions->clearActions();
   114     mViewOptions->clearActions();
   115     mViewOptions->addAction(hbTrId("txt_applib_opt_task_switcher"),
   115     mViewOptions->addAction(hbTrId("txt_applib_opt_task_switcher"),
   116                            static_cast<HsBaseViewState*>(this), SLOT(openTaskSwitcher()));
   116         static_cast<HsBaseViewState*>(this), SLOT(openTaskSwitcher()));
   117     mViewOptions->addAction(hbTrId("txt_applib_opt_add_to_collection"),
   117     mViewOptions->addAction(hbTrId("txt_applib_opt_add_to_collection"),
   118                            this, SLOT(addToCollection()));
   118         this, SLOT(addToCollection()));
   119     mViewOptions->addAction(hbTrId("txt_applib_opt_check_software_updates"),
       
   120                            static_cast<HsBaseViewState*>(this), SLOT(checkSoftwareUpdates()));
       
   121 
       
   122     mAscendingMenuAction =
   119     mAscendingMenuAction =
   123         mViewOptions->addAction(hbTrId("txt_applib_menu_sort_by_ascending"),
   120         mViewOptions->addAction(hbTrId("txt_applib_menu_sort_by_ascending"),
   124                             this, SLOT(ascendingMenuAction()));
   121                             this, SLOT(ascendingMenuAction()));
   125 
       
   126     mDescendingMenuAction =
   122     mDescendingMenuAction =
   127         mViewOptions->addAction(hbTrId("txt_applib_menu_sort_by_descending"),
   123         mViewOptions->addAction(hbTrId("txt_applib_menu_sort_by_descending"),
   128                             this, SLOT(descendingMenuAction()));
   124             this, SLOT(descendingMenuAction()));
   129 
   125     mViewOptions->addAction(hbTrId("txt_applib_opt_check_software_updates"),
   130     mViewOptions->addAction(hbTrId("txt_applib_opt_view_installed_applications"),
   126         static_cast<HsBaseViewState*>(this), SLOT(checkSoftwareUpdates()));
   131                            this, SLOT(openInstalledView()));
   127     mViewOptions->addAction(
       
   128         hbTrId("txt_applib_opt_view_installed_applications"),
       
   129         static_cast<HsBaseViewState*>(this), SLOT(openInstalledView()));
   132 
   130 
   133     if (mSortAttribute == Hs::AscendingNameHsSortAttribute) {
   131     if (mSortAttribute == Hs::AscendingNameHsSortAttribute) {
   134         mAscendingMenuAction->setVisible(false);
   132         mAscendingMenuAction->setVisible(false);
   135     } else {
   133     } else {
   136         mDescendingMenuAction->setVisible(false);
   134         mDescendingMenuAction->setVisible(false);
   213         HsMenuEventFactory::createAddAppsFromApplicationsViewEvent(
   211         HsMenuEventFactory::createAddAppsFromApplicationsViewEvent(
   214             mSortAttribute));
   212             mSortAttribute));
   215 }
   213 }
   216 
   214 
   217 /*!
   215 /*!
   218  Triggers event so that a installed applications state is entered.
       
   219  \retval void
       
   220  */
       
   221 #ifdef COVERAGE_MEASUREMENT
       
   222 #pragma CTC SKIP
       
   223 #endif //COVERAGE_MEASUREMENT
       
   224 void HsAllAppsState::openInstalledView()
       
   225 {
       
   226     machine()->postEvent(HsMenuEventFactory::createOpenInstalledViewEvent());
       
   227 }
       
   228 #ifdef COVERAGE_MEASUREMENT
       
   229 #pragma CTC ENDSKIP
       
   230 #endif //COVERAGE_MEASUREMENT
       
   231 
       
   232 /*!
       
   233  Method seting context menu options.
   216  Method seting context menu options.
   234  */
   217  */
   235 void HsAllAppsState::setContextMenuOptions(HbAbstractViewItem *item, EntryFlags flags)
   218 void HsAllAppsState::setContextMenuOptions(HbAbstractViewItem *item, EntryFlags flags)
   236 {
   219 {
   237     HbAction *openAction = mContextMenu->addAction(hbTrId(
   220     HbAction *openAction = mContextMenu->addAction(hbTrId(
   246         hbTrId("txt_applib_menu_add_to_collection"));
   229         hbTrId("txt_applib_menu_add_to_collection"));
   247 
   230 
   248     addToCollectionAction->setData(
   231     addToCollectionAction->setData(
   249         Hs::AddToCollectionFromApplicationsViewContextAction);
   232         Hs::AddToCollectionFromApplicationsViewContextAction);
   250 
   233 
   251     HbAction *uninstallAction = mContextMenu->addAction(
       
   252         hbTrId("txt_common_menu_delete"));
       
   253     uninstallAction->setData(Hs::UninstallContextAction);
       
   254     HbAction *appSettingsAction(NULL);
   234     HbAction *appSettingsAction(NULL);
   255     HbAction *appDetailsAction(NULL);
   235     HbAction *appDetailsAction(NULL);
   256 
   236 
   257     // check conditions and hide irrelevant menu items
   237     // check conditions and hide irrelevant menu items
   258     QSharedPointer<const CaEntry> entry = mModel->entry(item->modelIndex());
   238     QSharedPointer<const CaEntry> entry = mModel->entry(item->modelIndex());
   260     if (!(entry->attribute(Hs::appSettingsPlugin).isEmpty())) {
   240     if (!(entry->attribute(Hs::appSettingsPlugin).isEmpty())) {
   261         appSettingsAction = mContextMenu->addAction(
   241         appSettingsAction = mContextMenu->addAction(
   262             hbTrId("txt_common_menu_settings"));
   242             hbTrId("txt_common_menu_settings"));
   263         appSettingsAction->setData(Hs::AppSettingContextAction);
   243         appSettingsAction->setData(Hs::AppSettingContextAction);
   264     }
   244     }
       
   245 
       
   246     HbAction *uninstallAction = mContextMenu->addAction(
       
   247         hbTrId("txt_common_menu_delete"));
       
   248     uninstallAction->setData(Hs::UninstallContextAction);
       
   249 
   265     if (!(entry->attribute(Hs::componentIdAttributeName).isEmpty()) &&
   250     if (!(entry->attribute(Hs::componentIdAttributeName).isEmpty()) &&
   266             (flags & RemovableEntryFlag) ) {
   251             (flags & RemovableEntryFlag) ) {
   267         appDetailsAction = mContextMenu->addAction(
   252         appDetailsAction = mContextMenu->addAction(
   268             hbTrId("txt_common_menu_details"));
   253             hbTrId("txt_common_menu_details"));
   269         appDetailsAction->setData(Hs::AppDetailsContextAction);
   254         appDetailsAction->setData(Hs::AppDetailsContextAction);