homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuviewbuilder.cpp
changeset 71 1db7cc813a4e
parent 69 87476091b3f5
child 86 e4f038c420f7
equal deleted inserted replaced
69:87476091b3f5 71:1db7cc813a4e
    19 #include <QActionGroup>
    19 #include <QActionGroup>
    20 #include <QGraphicsWidget>
    20 #include <QGraphicsWidget>
    21 #include <HbAction>
    21 #include <HbAction>
    22 #include <HbGroupBox>
    22 #include <HbGroupBox>
    23 #include <HbListView>
    23 #include <HbListView>
    24 #include <HbSearchPanel>
       
    25 #include <HbPushButton>
    24 #include <HbPushButton>
    26 #include <HbToolBar>
    25 #include <HbToolBar>
    27 #include <HbView>
    26 #include <HbView>
    28 #include <HbWidget>
    27 #include <HbWidget>
    29 #include <HbStaticVkbHost>
    28 #include <HbStaticVkbHost>
    34 #include "hsmenuviewbuilder.h"
    33 #include "hsmenuviewbuilder.h"
    35 #include "hsmenustates_global.h"
    34 #include "hsmenustates_global.h"
    36 
    35 
    37 static const char* DOCUMENT_BASE_NAME_MAP
    36 static const char* DOCUMENT_BASE_NAME_MAP
    38         [InvalidStateContext][InvalidOperationalContext] =
    37         [InvalidStateContext][InvalidOperationalContext] =
    39     /*HsItemViewContext,    HsSearchContext,    HsButtonContext,    HsEmptyLabelContext*/
    38     /*HsItemViewContext,    HsButtonContext,    HsEmptyLabelContext*/
    40 {
    39 {
    41 /*HsAllAppsContext*/        {"listview", "searchlistview", "listview", "listview"},
    40 /*HsAllAppsContext*/        {"listview", "listview", "listview"},
    42 /*HsAllCollectionsContext*/ {"listview", "searchlistview", "listview", "listview"},
    41 /*HsAllCollectionsContext*/ {"listview", "listview", "listview"},
    43 /*HsInstalledAppsContext*/  {"labeledlistview", "labeledlistview",
    42 /*HsInstalledAppsContext*/  {"labeledlistview", "labeledlistview",
    44                                 "labeledlistview", "emptylabeledview"},
    43         "emptylabeledview"},
    45 /*HsCollectionContext*/     {"labeledlistview", "searchlabeledlistview",
    44 /*HsCollectionContext*/     {"labeledlistview", "addcontentlabeledview",
    46                                 "addcontentlabeledview", "emptylabeledview"}
    45         "emptylabeledview"}
    47 };
    46 };
    48 
    47 
    49 static const QString DOCUMENT_NAME_PREFIX(QLatin1String(":/xml/"));
    48 static const QString DOCUMENT_NAME_PREFIX(QLatin1String(":/xml/"));
    50 static const QString DOCUMENT_NAME_EXT(QLatin1String(".docml"));
    49 static const QString DOCUMENT_NAME_EXT(QLatin1String(".docml"));
    51 static const QString COMMON_OBJECTS_DOCUMENT_BASE_NAME(
    50 static const QString COMMON_OBJECTS_DOCUMENT_BASE_NAME(
    52         QLatin1String("common_objects"));
    51         QLatin1String("common_objects"));
    53 static const QString VIEW_NAME(QLatin1String("view"));
    52 static const QString VIEW_NAME(QLatin1String("view"));
    54 static const QString LIST_VIEW_NAME(QLatin1String("listView"));
    53 static const QString LIST_VIEW_NAME(QLatin1String("listView"));
    55 static const QString VIEW_LABEL_NAME(QLatin1String("label"));
    54 static const QString VIEW_LABEL_NAME(QLatin1String("label"));
    56 static const QString SEARCH_PANEL_NAME(QLatin1String("searchPanel"));
       
    57 static const QString ADD_CONTENT_BUTTON_NAME(QLatin1String("addContentButton"));
    55 static const QString ADD_CONTENT_BUTTON_NAME(QLatin1String("addContentButton"));
    58 
    56 
    59 /*!
    57 /*!
    60     \class HsMenuViewBuilder
    58     \class HsMenuViewBuilder
    61     \ingroup group_hsmenustateplugin
    59     \ingroup group_hsmenustateplugin
    69 
    67 
    70 
    68 
    71 
    69 
    72 
    70 
    73 /*!
    71 /*!
    74  \return Pointer to the view resulting from last \a build call or NULL if 
    72  \return Pointer to the view resulting from last \a build call or NULL if
    75  the \a build has not yet been called.
    73  the \a build has not yet been called.
    76  Memory ownership is not changed.
    74  Memory ownership is not changed.
    77  */
    75  */
    78 HbView *HsMenuViewBuilder::currentView()
    76 HbView *HsMenuViewBuilder::currentView()
    79 {
    77 {
    85     }
    83     }
    86     return view;
    84     return view;
    87 }
    85 }
    88 
    86 
    89 /*!
    87 /*!
    90  \return Pointer to list view resulting from last \a build call or NULL if 
    88  \return Pointer to list view resulting from last \a build call or NULL if
    91  the \a build has not yet been called.
    89  the \a build has not yet been called.
    92  The pointer is valid until the HsMenuViewBuilder instance is destroyed.
    90  The pointer is valid until the HsMenuViewBuilder instance is destroyed.
    93  Memory ownership is not changed.
    91  Memory ownership is not changed.
    94  */
    92  */
    95 HbListView *HsMenuViewBuilder::currentListView()
    93 HbListView *HsMenuViewBuilder::currentListView()
   100 
    98 
   101     return listView;
    99     return listView;
   102 }
   100 }
   103 
   101 
   104 /*!
   102 /*!
   105  \return Pointer to the view label resulting from last \a build call. It is 
   103  \return Pointer to the view label resulting from last \a build call. It is
   106  guaranteed to be not NULL if the \a build was called for the context
   104  guaranteed to be not NULL if the \a build was called for the context
   107  related to view including label.
   105  related to view including label.
   108  The pointer is valid until the HsMenuViewBuilder instance is destroyed.
   106  The pointer is valid until the HsMenuViewBuilder instance is destroyed.
   109  Memory ownership is not changed.
   107  Memory ownership is not changed.
   110  */
   108  */
   113     HbGroupBox *viewLabel =
   111     HbGroupBox *viewLabel =
   114             qobject_cast<HbGroupBox *>(
   112             qobject_cast<HbGroupBox *>(
   115                     currentLoader()->findWidget(VIEW_LABEL_NAME));
   113                     currentLoader()->findWidget(VIEW_LABEL_NAME));
   116 
   114 
   117     return viewLabel;
   115     return viewLabel;
   118 }
       
   119 
       
   120 /*!
       
   121  \return Pointer to the search panel resulting from last \a build call. It is
       
   122  guaranteed to be not NULL if the \a build was called for the context
       
   123  related to view including label.
       
   124  The pointer is valid until the HsMenuViewBuilder instance is destroyed.
       
   125  Memory ownership is not changed.
       
   126  */
       
   127 HbSearchPanel *HsMenuViewBuilder::currentSearchPanel()
       
   128 {
       
   129     HbSearchPanel *searchPanel =
       
   130             qobject_cast<HbSearchPanel *>(currentLoader()->findWidget(
       
   131                         SEARCH_PANEL_NAME));
       
   132     return searchPanel;
       
   133 
       
   134 }
   116 }
   135 
   117 
   136 /*!
   118 /*!
   137  \return Pointer to the 'Add content' button resulting from last
   119  \return Pointer to the 'Add content' button resulting from last
   138  \a build call. It is
   120  \a build call. It is
   250 
   232 
   251 /*!
   233 /*!
   252   Loads non-context sensitive objects.
   234   Loads non-context sensitive objects.
   253  */
   235  */
   254 HsMenuViewBuilder::HsMenuViewBuilder():
   236 HsMenuViewBuilder::HsMenuViewBuilder():
   255     DOCUMENT_FILE_NAME(":/xml/applibrary.docml"),
       
   256     ALL_APPS_ACTION_NAME("allAppsAction"),
   237     ALL_APPS_ACTION_NAME("allAppsAction"),
   257     ALL_COLLECTIONS_ACTION_NAME("allCollectionsAction"),
   238     ALL_COLLECTIONS_ACTION_NAME("allCollectionsAction"),
   258     SEARCH_ACTION_NAME("searchAction"),
   239     SEARCH_ACTION_NAME("searchAction"),
   259     OVI_STORE_ACTION_NAME("oviStoreAction"),
   240     OVI_STORE_ACTION_NAME("oviStoreAction"),
   260     OPERATOR_ACTION_NAME("operatorAction"),
   241     OPERATOR_ACTION_NAME("operatorAction"),
   261     SEARCH_PANEL_NAME("searchPanel"),
       
   262     BUTTON_NAME("collectionButton"),
       
   263     TOOL_BAR_NAME("toolBar"),
       
   264     mToolBar(new HbToolBar),
   242     mToolBar(new HbToolBar),
   265     mToolBarExtension(new HbToolBarExtension),
   243     mToolBarExtension(new HbToolBarExtension),
   266     mStateContext(HsAllAppsContext),
   244     mStateContext(HsAllAppsContext),
   267     mOperationalContext(HsItemViewContext)
   245     mOperationalContext(HsItemViewContext)
   268 {
   246 {