homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsinstalledappsstate.cpp
changeset 96 458d8c8d9580
parent 92 6727c5d0afc7
--- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsinstalledappsstate.cpp	Fri Sep 17 08:27:54 2010 +0300
+++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsinstalledappsstate.cpp	Mon Oct 04 00:07:25 2010 +0300
@@ -32,6 +32,7 @@
 #include "hsinstalledappsstate.h"
 #include "hsaddappstocollectionstate.h"
 #include "hsmenumodetransition.h"
+#include "hsmenuevent.h"
 
 /*!
  \class HsInstalledAppsState
@@ -71,11 +72,30 @@
         parent() != 0 ? parent()->objectName() : QString("");
     setObjectName(parentName + "/installedappsstate");
 
-    connect(mBackKeyAction, SIGNAL(triggered()), SLOT(openAppLibrary()));
+    connect(mBackKeyAction,
+        SIGNAL(triggered()),
+        this,
+        SLOT(backFromInstalledView()));
 
     HSMENUTEST_FUNC_EXIT("HsInstalledAppsState::construct");
 }
 
+void HsInstalledAppsState::onEntry(QEvent *event)
+{
+    qDebug("HsInstalledAppsState::onEntry()");
+    HSMENUTEST_FUNC_ENTRY("HsInstalledAppsState::onEntry");
+    QState::onEntry(event);
+
+    if (event->type() == HsMenuEvent::eventType()) {
+        HsMenuEvent *menuEvent = static_cast<HsMenuEvent *>(event);
+        QVariantMap data = menuEvent->data();
+        mCollectionId = data.value(Hs::itemIdKey).toInt();
+        mCollectionType = data.value(Hs::entryTypeNameKey).toString();
+    }
+
+    HSMENUTEST_FUNC_EXIT("HsInstalledAppsState::onEntry");
+}
+
 /*!
  Method seting menu options.
  */
@@ -87,8 +107,6 @@
 
     mViewOptions->addAction(hbTrId("txt_applib_opt_task_switcher"),
                         this, SLOT(openTaskSwitcher()));
-    mViewOptions->addAction(hbTrId("txt_applib_opt_installation_log"),
-                        this, SLOT(openInstallationLog()));
     if (mModel->rowCount() > 0) {
 
         mLatestOnTopMenuAction = mViewOptions->addAction(
@@ -107,6 +125,8 @@
             mLatestOnTopMenuAction->setVisible(false);
         }
     }
+    mViewOptions->addAction(hbTrId("txt_applib_opt_installation_log"),
+                        this, SLOT(openInstallationLog()));
     mMenuView->view()->setMenu(mViewOptions);
     HSMENUTEST_FUNC_EXIT("HsInstalledAppsState::setMenuOptions");
 }
@@ -229,6 +249,22 @@
 }
 
 /*!
+ Menu softkey back action slot
+ */
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT
+void HsInstalledAppsState::backFromInstalledView()
+{
+    machine()->postEvent(
+        HsMenuEventFactory::createBackFromInstalledViewEvent(
+        mCollectionId, mCollectionType));
+}
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT
+
+/*!
  Open installation log.
  */
 void HsInstalledAppsState::openInstallationLog()