homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsbaseviewstate.cpp
changeset 96 458d8c8d9580
parent 92 6727c5d0afc7
--- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsbaseviewstate.cpp	Fri Sep 17 08:27:54 2010 +0300
+++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsbaseviewstate.cpp	Mon Oct 04 00:07:25 2010 +0300
@@ -329,55 +329,58 @@
         static_cast<Hs::HsContextAction>(action->data().toInt());
 
     const int itemId = mContextModelIndex.data(CaItemModel::IdRole).toInt();
-
-    switch (command) {
-        case Hs::AddToHomeScreenContextAction:
-            addToHomeScreen(itemId);
-            break;
-        case Hs::AddToCollectionFromApplicationsViewContextAction:
-            // Addding a specific application to
-            // an existing collection via item specific menu.
-            machine()->postEvent(
-                HsMenuEventFactory::createAddAppsFromApplicationsViewEvent(
-                    Hs::NoHsSortAttribute, itemId));
-            break;
-        case Hs::AddToCollectionFromCollectionViewContextAction:
-            machine()->postEvent(
-                HsMenuEventFactory::createAddAppsFromCollectionViewEvent(
-                    -1, itemId));
-            break;
-        case Hs::UninstallContextAction:
-            machine()->postEvent(
-                HsMenuEventFactory::createUninstallApplicationEvent(
-                    itemId));
-            break;
-        case Hs::AppSettingContextAction:
-            machine()->postEvent(
-                HsMenuEventFactory::createAppSettingsViewEvent(itemId));
-            break;
-        case Hs::AppDetailsContextAction:
-            machine()->postEvent(
-                HsMenuEventFactory::createAppDetailsViewEvent(itemId));
-            break;
-        case Hs::OpenAppContextAction:
-            launchItem(mContextModelIndex);
-            break;
-        case Hs::RenameCollectionContextAction:
-            machine()->postEvent(
-                HsMenuEventFactory::createRenameCollectionEvent(itemId));
-            break;
-        case Hs::DeleteCollectionContextAction:
-             machine()->postEvent(
-                HsMenuEventFactory::createDeleteCollectionEvent(itemId));
-            break;
-        case Hs::OpenCollectionContextAction:
-            openCollection(mContextModelIndex);
-            break;
-        default:
-            break;
+    
+    if (itemId > 0) {
+        switch (command) {
+            case Hs::AddToHomeScreenContextAction:
+                addToHomeScreen(itemId);
+                break;
+            case Hs::AddToCollectionFromApplicationsViewContextAction:
+                // Addding a specific application to
+                // an existing collection via item specific menu.
+                machine()->postEvent(
+                    HsMenuEventFactory::createAddAppsFromApplicationsViewEvent(
+                        Hs::NoHsSortAttribute, itemId));
+                break;
+            case Hs::AddToCollectionFromCollectionViewContextAction:
+                machine()->postEvent(
+                    HsMenuEventFactory::createAddAppsFromCollectionViewEvent(
+                        -1, itemId));
+                break;
+            case Hs::UninstallContextAction:
+                machine()->postEvent(
+                    HsMenuEventFactory::createUninstallApplicationEvent(
+                        itemId));
+                break;
+            case Hs::AppSettingContextAction:
+                machine()->postEvent(
+                    HsMenuEventFactory::createAppSettingsViewEvent(itemId));
+                break;
+            case Hs::AppDetailsContextAction:
+                machine()->postEvent(
+                    HsMenuEventFactory::createAppDetailsViewEvent(itemId));
+                break;
+            case Hs::OpenAppContextAction:
+                launchItem(mContextModelIndex);
+                break;
+            case Hs::RenameCollectionContextAction:
+                machine()->postEvent(
+                    HsMenuEventFactory::createRenameCollectionEvent(itemId));
+                break;
+            case Hs::DeleteCollectionContextAction:
+                 machine()->postEvent(
+                    HsMenuEventFactory::createDeleteCollectionEvent(itemId));
+                break;
+            case Hs::OpenCollectionContextAction:
+                openCollection(mContextModelIndex);
+                break;
+            default:
+                break;
+        }
+        HsMenuService::touch(itemId);
+    } else {
+        closeContextMenu();
     }
-    
-    HsMenuService::touch(itemId);
 }
 
 /*!
@@ -461,3 +464,16 @@
             *mMenuMode, Hs::AddHsMenuMode, addModeState));
 }
 
+/*!
+ Triggers event so that an installed applications state is entered.
+ */
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC SKIP
+#endif //COVERAGE_MEASUREMENT
+void HsBaseViewState::openInstalledView()
+{
+    machine()->postEvent(HsMenuEventFactory::createOpenInstalledViewEvent());
+}
+#ifdef COVERAGE_MEASUREMENT
+#pragma CTC ENDSKIP
+#endif //COVERAGE_MEASUREMENT