homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsinstalledappsstate.cpp
changeset 62 341166945d65
parent 55 03646e8da489
child 63 52b0f64eeb51
--- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsinstalledappsstate.cpp	Thu Jun 24 13:11:40 2010 +0100
+++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsinstalledappsstate.cpp	Fri Jun 25 19:19:22 2010 +0300
@@ -78,7 +78,7 @@
 HsInstalledAppsState::HsInstalledAppsState(HsMenuViewBuilder &menuViewBuilder,
         HsMainWindow &mainWindow,
         QState *parent):
-    QState(parent),
+    HsBaseViewState(parent),
     mMenuView(menuViewBuilder, HsInstalledAppsContext),
     mInstalledAppsModel(0),
     mSecondarySoftkeyAction(new HbAction(Hb::BackNaviAction, this)),
@@ -175,9 +175,6 @@
     connect(mInstalledAppsModel, SIGNAL(empty(bool)),this,
             SLOT(setEmptyLabelVisibility(bool)));
 
-    mMenuView.viewLabel()->setHeading(
-        hbTrId("txt_applib_subtitle_installed"));
-
     HSMENUTEST_FUNC_EXIT("HsInstalledAppsState::stateEntered");
 }
 
@@ -192,11 +189,21 @@
                SLOT(setEmptyLabelVisibility(bool)));
 
     mMenuView.setSearchPanelVisible(false);
+
+    disconnect(&mMenuView,
+            SIGNAL(activated(QModelIndex)), this,
+            SLOT(listItemActivated(QModelIndex)));
+    disconnect(&mMenuView,
+            SIGNAL(longPressed(HbAbstractViewItem *, QPointF)), this,
+            SLOT(listItemLongPressed(HbAbstractViewItem *, QPointF)));
+
     mMenuView.inactivate();
 
     if (mContextMenu)
         mContextMenu->close();
     
+    HsBaseViewState::stateExited();
+    
     HSMENUTEST_FUNC_EXIT("HsInstalledAppsState::stateExited");
     qDebug("AllAppsState::stateExited()");
 }
@@ -250,29 +257,31 @@
 {
     HSMENUTEST_FUNC_ENTRY("HsInstalledAppsState::listItemLongPressed");
 
-    // create context menu
-    mContextMenu = new HbMenu();
-
-    HbAction *uninstallAction = mContextMenu->addAction(
-                                    hbTrId("txt_common_menu_delete"));
-    HbAction *appDetailsAction(NULL);
-    uninstallAction->setData(UninstallContextAction);
-    
-    QSharedPointer<const CaEntry> entry = mInstalledAppsModel->entry(item->modelIndex());
     EntryFlags flags = item->modelIndex().data(
                            CaItemModel::FlagsRole).value<EntryFlags> ();
+    if (!(flags & UninstallEntryFlag)) {
+        // create context menu
+        mContextMenu = new HbMenu();
+
+        HbAction *uninstallAction = mContextMenu->addAction(
+                                    hbTrId("txt_common_menu_delete"));
+        HbAction *appDetailsAction(NULL);
+        uninstallAction->setData(UninstallContextAction);
     
-    if (!(entry->attribute(componentIdAttributeName()).isEmpty()) && 
-            (flags & RemovableEntryFlag) ) {
-        appDetailsAction = mContextMenu->addAction(hbTrId(
-                                                "txt_common_menu_details"));
-        appDetailsAction->setData(AppDetailsContextAction);
-    }      
+        QSharedPointer<const CaEntry> entry = mInstalledAppsModel->entry(item->modelIndex());
+    
+        if (!(entry->attribute(componentIdAttributeName()).isEmpty()) &&
+                (flags & RemovableEntryFlag) ) {
+            appDetailsAction = mContextMenu->addAction(hbTrId(
+                                                    "txt_common_menu_details"));
+            appDetailsAction->setData(AppDetailsContextAction);
+        }
 
-    mContextModelIndex = item->modelIndex();
-    mContextMenu->setPreferredPos(coords);
-    mContextMenu->setAttribute(Qt::WA_DeleteOnClose);
-    mContextMenu->open(this, SLOT(contextMenuAction(HbAction*)));
+        mContextModelIndex = item->modelIndex();
+        mContextMenu->setPreferredPos(coords);
+        mContextMenu->setAttribute(Qt::WA_DeleteOnClose);
+        mContextMenu->open(this, SLOT(contextMenuAction(HbAction*)));
+    }
     
     
     HSMENUTEST_FUNC_EXIT("HsInstalledAppsState::listItemLongPressed");