homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsallcollectionsstate.cpp
changeset 61 2b1b11a301d2
parent 55 03646e8da489
child 63 52b0f64eeb51
child 77 4b195f3bea29
--- a/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsallcollectionsstate.cpp	Wed Jun 23 18:03:36 2010 +0300
+++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsallcollectionsstate.cpp	Tue Jul 06 14:06:53 2010 +0300
@@ -77,7 +77,7 @@
     HsMenuModeWrapper &menuMode,
     HsMainWindow &mainWindow,
     QState *parent):
-    QState(parent),
+    HsBaseViewState(parent),
     mSortAttribute(CustomHsSortAttribute),
     mMenuView(menuViewBuilder, HsAllCollectionsContext),
     mMenuMode(menuMode),
@@ -230,7 +230,9 @@
 void HsAllCollectionsState::normalModeEntered()
 {
     setMenuOptions();
-
+    connect(&mMainWindow, SIGNAL(viewIsReady()),
+        &mMainWindow, SLOT(saveActivity()),
+        Qt::UniqueConnection);
     connect(&mMenuView,
             SIGNAL(activated(QModelIndex)),
             SLOT(listItemActivated(QModelIndex)));
@@ -266,7 +268,10 @@
 void HsAllCollectionsState::stateExited()
 {
     HSMENUTEST_FUNC_ENTRY("HsAllCollectionsState::stateExited");
-
+    
+    disconnect(&mMainWindow, SIGNAL(viewIsReady()),
+               &mMainWindow, SLOT(saveActivity()));
+    
     mMenuView.setSearchPanelVisible(false);
 
     mMenuView.disconnect(this);
@@ -275,6 +280,8 @@
 
     if (mContextMenu)
         mContextMenu->close();
+    
+    HsBaseViewState::stateExited();
 
     HSMENUTEST_FUNC_EXIT("HsAllCollectionsState::stateExited");
     qDebug("AllCollectionsState::stateExited()");
@@ -305,7 +312,7 @@
 
     mMenuView.setSearchPanelVisible(false);
 
-    machine()->postEvent(HsMenuEventFactory::createOpenCollectionEvent(id,
+    machine()->postEvent(HsMenuEventFactory::createOpenCollectionFromAppLibraryEvent(id,
                          collectionType));
     HSMENUTEST_FUNC_EXIT("HsAllCollectionsState::listItemActivated");
 }
@@ -319,7 +326,7 @@
     const int itemId = index.data(CaItemModel::IdRole).toInt();
     machine()->postEvent(
         HsMenuEventFactory::createAddToHomeScreenEvent(
-            itemId, mMenuMode.getHsMenuMode()));
+            itemId, mMenuMode.getHsMenuMode(), mMenuMode.getHsToken()));
 }
 
 /*!
@@ -335,7 +342,7 @@
     const int itemId = item->modelIndex().data(CaItemModel::IdRole).toInt();
     machine()->postEvent(
         HsMenuEventFactory::createAddToHomeScreenEvent(itemId,
-                mMenuMode.getHsMenuMode()));
+                mMenuMode.getHsMenuMode(), mMenuMode.getHsToken()));
 }
 
 /*!
@@ -391,7 +398,7 @@
         case AddToHomeScreenContextAction:
             machine()->postEvent(
                 HsMenuEventFactory::createAddToHomeScreenEvent(
-                    itemId, mMenuMode.getHsMenuMode()));
+                    itemId, mMenuMode.getHsMenuMode(), mMenuMode.getHsToken()));
             break;
         case RenameContextAction:
             machine()->postEvent(
@@ -475,3 +482,4 @@
     emit sortOrderChanged(mSortAttribute);
     HSMENUTEST_FUNC_EXIT("HsAllCollectionsState::descendingMenuAction");
 }
+