homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuviewbuilder.cpp
changeset 97 66b5fe3c07fd
parent 86 e4f038c420f7
child 98 e6f74eb7f69f
equal deleted inserted replaced
95:32e56106abf2 97:66b5fe3c07fd
    31 
    31 
    32 #include "hsmenuviewbuilder.h"
    32 #include "hsmenuviewbuilder.h"
    33 #include "hsmenustates_global.h"
    33 #include "hsmenustates_global.h"
    34 
    34 
    35 static const char* DOCUMENT_BASE_NAME_MAP
    35 static const char* DOCUMENT_BASE_NAME_MAP
    36         [InvalidStateContext][InvalidOperationalContext] =
    36         [InvalidOperationalContext] =
    37                             /*HsItemViewContext,    HsEmptyLabelContext*/
    37                             /*HsItemViewContext,    HsEmptyLabelContext*/
    38 {
    38 {
    39 /*HsAllAppsContext*/        {"listview",             "listview"},
    39      "labeledlistview",     "emptylabeledview"
    40 /*HsAllCollectionsContext*/ {"listview",             "listview"},
       
    41 /*HsInstalledAppsContext*/  {"labeledlistview",     "emptylabeledview"},
       
    42 /*HsCollectionContext*/     {"labeledlistview",     "emptylabeledview"}
       
    43 };
    40 };
    44 
    41 
    45 static const QString DOCUMENT_NAME_PREFIX(QLatin1String(":/xml/"));
    42 static const QString DOCUMENT_NAME_PREFIX(QLatin1String(":/xml/"));
    46 static const QString DOCUMENT_NAME_EXT(QLatin1String(".docml"));
    43 static const QString DOCUMENT_NAME_EXT(QLatin1String(".docml"));
    47 static const QString COMMON_OBJECTS_DOCUMENT_BASE_NAME(
    44 static const QString COMMON_OBJECTS_DOCUMENT_BASE_NAME(
   182  Memory ownership is not changed.
   179  Memory ownership is not changed.
   183  */
   180  */
   184 HbToolBarExtension *HsMenuViewBuilder::toolBarExtension() const
   181 HbToolBarExtension *HsMenuViewBuilder::toolBarExtension() const
   185 {
   182 {
   186     return mToolBarExtension;
   183     return mToolBarExtension;
       
   184 }
       
   185 
       
   186 /*!
       
   187  \return Pointer to the toolbar extension action.
       
   188  The pointer is valid until the HsMenuViewBuilder instance is destroyed.
       
   189  Memory ownership is not changed.
       
   190  */
       
   191 HbAction *HsMenuViewBuilder::toolBarExtensionAction() const
       
   192 {
       
   193     return mToolBarExtensionAction;
   187 }
   194 }
   188 
   195 
   189 /*!
   196 /*!
   190  \return Action group for \a allAppsState and \a allCollectionsState action.
   197  \return Action group for \a allAppsState and \a allCollectionsState action.
   191  */
   198  */
   227     mCommonObjectsLoader = parseDocument(COMMON_OBJECTS_DOCUMENT_BASE_NAME);
   234     mCommonObjectsLoader = parseDocument(COMMON_OBJECTS_DOCUMENT_BASE_NAME);
   228 
   235 
   229     mToolBar->addAction(allAppsAction());
   236     mToolBar->addAction(allAppsAction());
   230     mToolBar->addAction(allCollectionsAction());
   237     mToolBar->addAction(allCollectionsAction());
   231     mToolBar->addAction(searchAction());
   238     mToolBar->addAction(searchAction());
       
   239     mToolBarExtensionAction = mToolBar->addExtension(mToolBarExtension);
       
   240     mToolBarExtensionAction->setIcon(HbIcon("qtg_mono_store"));
       
   241     mToolBarExtensionAction->setVisible(false);
   232 
   242 
   233     mToolBarActionGroup = new QActionGroup(allAppsAction());
   243     mToolBarActionGroup = new QActionGroup(allAppsAction());
   234 
   244 
   235     allAppsAction()->setActionGroup(mToolBarActionGroup);
   245     allAppsAction()->setActionGroup(mToolBarActionGroup);
   236     allCollectionsAction()->setActionGroup(mToolBarActionGroup);
   246     allCollectionsAction()->setActionGroup(mToolBarActionGroup);
   304  \return Document loader with objects for current context.
   314  \return Document loader with objects for current context.
   305  */
   315  */
   306 QSharedPointer<HbDocumentLoader> HsMenuViewBuilder::readContextConfiguration()
   316 QSharedPointer<HbDocumentLoader> HsMenuViewBuilder::readContextConfiguration()
   307 {
   317 {
   308     const QLatin1String documentName(
   318     const QLatin1String documentName(
   309             DOCUMENT_BASE_NAME_MAP[mStateContext][mOperationalContext]);
   319             DOCUMENT_BASE_NAME_MAP[mOperationalContext]);
   310 
   320 
   311     QSharedPointer<HbDocumentLoader> loader =
   321     QSharedPointer<HbDocumentLoader> loader =
   312             parseDocument(QString(documentName));
   322             parseDocument(QString(documentName));
   313 
   323 
   314     return loader;
   324     return loader;