homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsinstalledappsstate.cpp
changeset 90 3ac3aaebaee5
parent 86 e4f038c420f7
child 97 66b5fe3c07fd
equal deleted inserted replaced
86:e4f038c420f7 90:3ac3aaebaee5
    30 #include "hsmenueventfactory.h"
    30 #include "hsmenueventfactory.h"
    31 #include "hsmenuitemmodel.h"
    31 #include "hsmenuitemmodel.h"
    32 #include "hsinstalledappsstate.h"
    32 #include "hsinstalledappsstate.h"
    33 #include "hsaddappstocollectionstate.h"
    33 #include "hsaddappstocollectionstate.h"
    34 #include "hsmenumodetransition.h"
    34 #include "hsmenumodetransition.h"
       
    35 #include "hsmenuevent.h"
    35 
    36 
    36 /*!
    37 /*!
    37  \class HsInstalledAppsState
    38  \class HsInstalledAppsState
    38  \ingroup group_hsapplibrarystateplugin
    39  \ingroup group_hsapplibrarystateplugin
    39  \brief Manages displaying installed applications
    40  \brief Manages displaying installed applications
    69 
    70 
    70     const QString parentName =
    71     const QString parentName =
    71         parent() != 0 ? parent()->objectName() : QString("");
    72         parent() != 0 ? parent()->objectName() : QString("");
    72     setObjectName(parentName + "/installedappsstate");
    73     setObjectName(parentName + "/installedappsstate");
    73 
    74 
    74     connect(mBackKeyAction, SIGNAL(triggered()), SLOT(openAppLibrary()));
    75     connect(mBackKeyAction,
       
    76         SIGNAL(triggered()),
       
    77         this,
       
    78         SLOT(backFromInstalledView()));
    75 
    79 
    76     HSMENUTEST_FUNC_EXIT("HsInstalledAppsState::construct");
    80     HSMENUTEST_FUNC_EXIT("HsInstalledAppsState::construct");
       
    81 }
       
    82 
       
    83 void HsInstalledAppsState::onEntry(QEvent *event)
       
    84 {
       
    85     qDebug("HsInstalledAppsState::onEntry()");
       
    86     HSMENUTEST_FUNC_ENTRY("HsInstalledAppsState::onEntry");
       
    87     QState::onEntry(event);
       
    88 
       
    89     if (event->type() == HsMenuEvent::eventType()) {
       
    90         HsMenuEvent *menuEvent = static_cast<HsMenuEvent *>(event);
       
    91         QVariantMap data = menuEvent->data();
       
    92         mCollectionId = data.value(Hs::itemIdKey).toInt();
       
    93         mCollectionType = data.value(Hs::entryTypeNameKey).toString();
       
    94     }
       
    95 
       
    96     HSMENUTEST_FUNC_EXIT("HsInstalledAppsState::onEntry");
    77 }
    97 }
    78 
    98 
    79 /*!
    99 /*!
    80  Method seting menu options.
   100  Method seting menu options.
    81  */
   101  */
    85 
   105 
    86     mViewOptions->clearActions();
   106     mViewOptions->clearActions();
    87 
   107 
    88     mViewOptions->addAction(hbTrId("txt_applib_opt_task_switcher"),
   108     mViewOptions->addAction(hbTrId("txt_applib_opt_task_switcher"),
    89                         this, SLOT(openTaskSwitcher()));
   109                         this, SLOT(openTaskSwitcher()));
    90     mViewOptions->addAction(hbTrId("txt_applib_opt_installation_log"),
       
    91                         this, SLOT(openInstallationLog()));
       
    92     if (mModel->rowCount() > 0) {
   110     if (mModel->rowCount() > 0) {
    93 
   111 
    94         mLatestOnTopMenuAction = mViewOptions->addAction(
   112         mLatestOnTopMenuAction = mViewOptions->addAction(
    95             hbTrId("txt_applib_menu_sort_by_latest_on_top"),
   113             hbTrId("txt_applib_menu_sort_by_latest_on_top"),
    96             this, SLOT(latestOnTopMenuAction()));
   114             this, SLOT(latestOnTopMenuAction()));
   105             mOldestOnTopMenuAction->setVisible(false);
   123             mOldestOnTopMenuAction->setVisible(false);
   106         } else {
   124         } else {
   107             mLatestOnTopMenuAction->setVisible(false);
   125             mLatestOnTopMenuAction->setVisible(false);
   108         }
   126         }
   109     }
   127     }
       
   128     mViewOptions->addAction(hbTrId("txt_applib_opt_installation_log"),
       
   129                         this, SLOT(openInstallationLog()));
   110     mMenuView->view()->setMenu(mViewOptions);
   130     mMenuView->view()->setMenu(mViewOptions);
   111     HSMENUTEST_FUNC_EXIT("HsInstalledAppsState::setMenuOptions");
   131     HSMENUTEST_FUNC_EXIT("HsInstalledAppsState::setMenuOptions");
   112 }
   132 }
   113 
   133 
   114 /*!
   134 /*!
   227     setMenuOptions();
   247     setMenuOptions();
   228     mMenuView->activate();
   248     mMenuView->activate();
   229 }
   249 }
   230 
   250 
   231 /*!
   251 /*!
       
   252  Menu softkey back action slot
       
   253  */
       
   254 #ifdef COVERAGE_MEASUREMENT
       
   255 #pragma CTC SKIP
       
   256 #endif //COVERAGE_MEASUREMENT
       
   257 void HsInstalledAppsState::backFromInstalledView()
       
   258 {
       
   259     machine()->postEvent(
       
   260         HsMenuEventFactory::createBackFromInstalledViewEvent(
       
   261         mCollectionId, mCollectionType));
       
   262 }
       
   263 #ifdef COVERAGE_MEASUREMENT
       
   264 #pragma CTC ENDSKIP
       
   265 #endif //COVERAGE_MEASUREMENT
       
   266 
       
   267 /*!
   232  Open installation log.
   268  Open installation log.
   233  */
   269  */
   234 void HsInstalledAppsState::openInstallationLog()
   270 void HsInstalledAppsState::openInstallationLog()
   235 {
   271 {
   236     machine()->postEvent(
   272     machine()->postEvent(