homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsapplibrarystate.cpp
changeset 97 66b5fe3c07fd
parent 90 3ac3aaebaee5
child 98 e6f74eb7f69f
equal deleted inserted replaced
95:32e56106abf2 97:66b5fe3c07fd
    87  Constructor.
    87  Constructor.
    88  \param parent Owner.
    88  \param parent Owner.
    89  */
    89  */
    90 HsAppLibraryState::HsAppLibraryState(QState *parent) :
    90 HsAppLibraryState::HsAppLibraryState(QState *parent) :
    91     QState(parent), mAllAppsState(0),
    91     QState(parent), mAllAppsState(0),
    92     mHistoryTransaction(0), mAllCollectionsState(0), mCollectionState(0), 
    92     mHistoryTransaction(0), mAllCollectionsState(0), mCollectionState(0),
    93     mMenuMode(),mMainWindow(&mMenuMode)
    93     mMenuMode(),mMainWindow(&mMenuMode)
    94 {
    94 {
    95     construct();
    95     construct();
    96 }
    96 }
    97 
    97 
   112  */
   112  */
   113 void HsAppLibraryState::construct()
   113 void HsAppLibraryState::construct()
   114 {
   114 {
   115     HSMENUTEST_FUNC_ENTRY("HsAppLibraryState::construct");
   115     HSMENUTEST_FUNC_ENTRY("HsAppLibraryState::construct");
   116     setObjectName("homescreen.nokia.com/state/applibrarystate");
   116     setObjectName("homescreen.nokia.com/state/applibrarystate");
   117     
   117 
   118     mAllAppsState = new HsAllAppsState(
   118     mAllAppsState = new HsAllAppsState(
   119         mMenuViewBuilder, mMenuMode, mMainWindow, this);
   119         mMenuViewBuilder, mMenuMode, mMainWindow, this);
   120 
   120 
   121     mAllCollectionsState = new HsAllCollectionsState(mMenuViewBuilder,
   121     mAllCollectionsState = new HsAllCollectionsState(mMenuViewBuilder,
   122         mMenuMode, mMainWindow, this);
   122         mMenuMode, mMainWindow, this);
   165 
   165 
   166     HsMenuEventTransition *allViewToInstalledTransition =
   166     HsMenuEventTransition *allViewToInstalledTransition =
   167         new HsMenuEventTransition(HsMenuEvent::OpenInstalledView,
   167         new HsMenuEventTransition(HsMenuEvent::OpenInstalledView,
   168             mAllAppsState, mInstalledAppsState);
   168             mAllAppsState, mInstalledAppsState);
   169     mAllAppsState->addTransition(allViewToInstalledTransition);
   169     mAllAppsState->addTransition(allViewToInstalledTransition);
   170     
   170 
   171     HsMenuEventTransition *allCollectionsToInstalledTransition =
   171     HsMenuEventTransition *allCollectionsToInstalledTransition =
   172         new HsMenuEventTransition(HsMenuEvent::OpenInstalledView,
   172         new HsMenuEventTransition(HsMenuEvent::OpenInstalledView,
   173             mAllCollectionsState, mInstalledAppsState);
   173             mAllCollectionsState, mInstalledAppsState);
   174     mAllCollectionsState->addTransition(allCollectionsToInstalledTransition);
   174     mAllCollectionsState->addTransition(allCollectionsToInstalledTransition);
   175 
   175 
   223         // we are back from HS, scroll those views to top
   223         // we are back from HS, scroll those views to top
   224         mAllAppsState->setModel(mMenuMode.getHsMenuMode());
   224         mAllAppsState->setModel(mMenuMode.getHsMenuMode());
   225         mAllAppsState->scrollToBeginning();
   225         mAllAppsState->scrollToBeginning();
   226         mAllCollectionsState->scrollToBeginning();
   226         mAllCollectionsState->scrollToBeginning();
   227     }
   227     }
   228     
   228 
   229     HSMENUTEST_FUNC_EXIT("HsAppLibraryState::onEntry");
   229     HSMENUTEST_FUNC_EXIT("HsAppLibraryState::onEntry");
   230 }
   230 }
   231 
   231 
   232 /*!
   232 /*!
   233  Sets up Toolbar.
   233  Sets up Toolbar.
   242     HsOperatorHandler *const operatorHandler = new HsOperatorHandler(this);
   242     HsOperatorHandler *const operatorHandler = new HsOperatorHandler(this);
   243 
   243 
   244     if (operatorHandler->oviStorePresent()
   244     if (operatorHandler->oviStorePresent()
   245             && operatorHandler->operatorStorePresent()) {
   245             && operatorHandler->operatorStorePresent()) {
   246 
   246 
   247         //TODO HbToolBarExtension is not supported in docml currently
   247         mMenuViewBuilder.toolBarExtensionAction()->setVisible(true);
   248         //should be changed in future
       
   249         bool loaded = HbStyleLoader::registerFilePath(
   248         bool loaded = HbStyleLoader::registerFilePath(
   250                      ":/css/hsapplibrarystateplugin.css");
   249                      ":/css/hsapplibrarystateplugin.css");
   251         Q_ASSERT(loaded);
   250         Q_ASSERT(loaded);
   252 
   251 
       
   252         //TODO HbToolBarExtension is not supported in docml currently
       
   253         //should be changed in future
   253         HbToolBarExtension *const extension(
   254         HbToolBarExtension *const extension(
   254             mMenuViewBuilder.toolBarExtension());
   255                 mMenuViewBuilder.toolBarExtension());
   255         HbAction *const extensionAction(
       
   256             mMenuViewBuilder.toolBar()->addExtension(extension));
       
   257 
       
   258         extensionAction->setIcon(HbIcon("qtg_mono_store"));
       
   259 
   256 
   260         HbAction *const operatorAction(
   257         HbAction *const operatorAction(
   261             operatorHandler->prepareOperatorStoreAction(
   258                 operatorHandler->prepareOperatorStoreAction(
   262             mMenuViewBuilder.operatorAction()));
   259                         mMenuViewBuilder.operatorAction()));
   263         operatorAction->setText(hbTrId(operatorHandler->text().toLatin1()));
   260         operatorAction->setText(hbTrId(operatorHandler->text().toLatin1()));
   264 
   261 
   265         mMenuViewBuilder.oviStoreAction()->setText(hbTrId("txt_applib_grid_ovi_store"));
   262         mMenuViewBuilder.oviStoreAction()->setText(
       
   263                 hbTrId("txt_applib_grid_ovi_store"));
   266         if (operatorHandler->operatorStoreFirst()) {
   264         if (operatorHandler->operatorStoreFirst()) {
   267             extension->addAction(operatorAction);
   265             extension->addAction(operatorAction);
   268             extension->addAction(mMenuViewBuilder.oviStoreAction());
   266             extension->addAction(mMenuViewBuilder.oviStoreAction());
   269         } else {
   267         } else {
   270             extension->addAction(mMenuViewBuilder.oviStoreAction());
   268             extension->addAction(mMenuViewBuilder.oviStoreAction());
   271             extension->addAction(operatorAction);
   269             extension->addAction(operatorAction);
   272         }
   270         }
   273     } else if (operatorHandler->oviStorePresent()) {
   271     } else if (operatorHandler->oviStorePresent()) {
   274         mMenuViewBuilder.toolBar()->addAction(
   272         mMenuViewBuilder.toolBar()->addAction(
   275             mMenuViewBuilder.oviStoreAction());
   273                 mMenuViewBuilder.oviStoreAction());
   276     } else if (operatorHandler->operatorStorePresent()) {
   274     } else if (operatorHandler->operatorStorePresent()) {
   277         mMenuViewBuilder.toolBar()->addAction(
   275         mMenuViewBuilder.toolBar()->addAction(
   278         operatorHandler->prepareOperatorStoreAction(
   276                 operatorHandler->prepareOperatorStoreAction(
   279         mMenuViewBuilder.operatorAction()));
   277                         mMenuViewBuilder.operatorAction()));
   280     }
   278     }
   281 
   279 
   282     HbAction *const allCollectionsAction(
   280     HbAction *const allCollectionsAction(
   283         mMenuViewBuilder.allCollectionsAction());
   281             mMenuViewBuilder.allCollectionsAction());
   284 
   282 
   285     mAllAppsState->addTransition(
   283     mAllAppsState->addTransition(
   286         allCollectionsAction, SIGNAL(triggered()), mAllCollectionsState);
   284             allCollectionsAction, SIGNAL(triggered()), mAllCollectionsState);
   287     mCollectionState->addTransition(
   285     mCollectionState->addTransition(
   288         allCollectionsAction, SIGNAL(triggered()), mAllCollectionsState);
   286             allCollectionsAction, SIGNAL(triggered()), mAllCollectionsState);
   289 
   287 
   290     HbAction *const allAppsAction(mMenuViewBuilder.allAppsAction());
   288     HbAction *const allAppsAction(mMenuViewBuilder.allAppsAction());
   291 
   289 
   292     mAllCollectionsState->addTransition(
   290     mAllCollectionsState->addTransition(
   293         allAppsAction, SIGNAL(triggered()), mAllAppsState);
   291             allAppsAction, SIGNAL(triggered()), mAllAppsState);
   294     mCollectionState->addTransition(
   292     mCollectionState->addTransition(
   295         allAppsAction, SIGNAL(triggered()), mAllAppsState);
   293             allAppsAction, SIGNAL(triggered()), mAllAppsState);
   296 
   294 
   297     mAllAppsState->assignProperty(allAppsAction, "checked", true);
   295     mAllAppsState->assignProperty(allAppsAction, "checked", true);
   298     mAllCollectionsState->assignProperty(
   296     mAllCollectionsState->assignProperty(
   299         allCollectionsAction, "checked", true);
   297             allCollectionsAction, "checked", true);
   300     HSMENUTEST_FUNC_EXIT("HsAppLibraryState::constructToolbar");
   298     HSMENUTEST_FUNC_EXIT("HsAppLibraryState::constructToolbar");
   301 }
   299 }
   302 
   300 
   303 /*!
   301 /*!
   304  Clear toolbar latch
   302  Clear toolbar latch