homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmenuviewbuilder.cpp
changeset 92 6727c5d0afc7
parent 77 4b195f3bea29
equal deleted inserted replaced
85:35368b604b28 92:6727c5d0afc7
    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 <HbPushButton>
       
    25 #include <HbToolBar>
    24 #include <HbToolBar>
    26 #include <HbView>
    25 #include <HbView>
    27 #include <HbWidget>
    26 #include <HbWidget>
    28 #include <HbStaticVkbHost>
    27 #include <HbStaticVkbHost>
    29 #include <HbMainWindow>
    28 #include <HbMainWindow>
    33 #include "hsmenuviewbuilder.h"
    32 #include "hsmenuviewbuilder.h"
    34 #include "hsmenustates_global.h"
    33 #include "hsmenustates_global.h"
    35 
    34 
    36 static const char* DOCUMENT_BASE_NAME_MAP
    35 static const char* DOCUMENT_BASE_NAME_MAP
    37         [InvalidStateContext][InvalidOperationalContext] =
    36         [InvalidStateContext][InvalidOperationalContext] =
    38     /*HsItemViewContext,    HsButtonContext,    HsEmptyLabelContext*/
    37                             /*HsItemViewContext,    HsEmptyLabelContext*/
    39 {
    38 {
    40 /*HsAllAppsContext*/        {"listview", "listview", "listview"},
    39 /*HsAllAppsContext*/        {"listview",             "listview"},
    41 /*HsAllCollectionsContext*/ {"listview", "listview", "listview"},
    40 /*HsAllCollectionsContext*/ {"listview",             "listview"},
    42 /*HsInstalledAppsContext*/  {"labeledlistview", "labeledlistview",
    41 /*HsInstalledAppsContext*/  {"labeledlistview",     "emptylabeledview"},
    43         "emptylabeledview"},
    42 /*HsCollectionContext*/     {"labeledlistview",     "emptylabeledview"}
    44 /*HsCollectionContext*/     {"labeledlistview", "addcontentlabeledview",
       
    45         "emptylabeledview"}
       
    46 };
    43 };
    47 
    44 
    48 static const QString DOCUMENT_NAME_PREFIX(QLatin1String(":/xml/"));
    45 static const QString DOCUMENT_NAME_PREFIX(QLatin1String(":/xml/"));
    49 static const QString DOCUMENT_NAME_EXT(QLatin1String(".docml"));
    46 static const QString DOCUMENT_NAME_EXT(QLatin1String(".docml"));
    50 static const QString COMMON_OBJECTS_DOCUMENT_BASE_NAME(
    47 static const QString COMMON_OBJECTS_DOCUMENT_BASE_NAME(
    51         QLatin1String("common_objects"));
    48         QLatin1String("common_objects"));
    52 static const QString VIEW_NAME(QLatin1String("view"));
    49 static const QString VIEW_NAME(QLatin1String("view"));
    53 static const QString LIST_VIEW_NAME(QLatin1String("listView"));
    50 static const QString LIST_VIEW_NAME(QLatin1String("listView"));
    54 static const QString VIEW_LABEL_NAME(QLatin1String("label"));
    51 static const QString VIEW_LABEL_NAME(QLatin1String("label"));
    55 static const QString ADD_CONTENT_BUTTON_NAME(QLatin1String("addContentButton"));
       
    56 
    52 
    57 /*!
    53 /*!
    58     \class HsMenuViewBuilder
    54     \class HsMenuViewBuilder
    59     \ingroup group_hsmenustateplugin
    55     \ingroup group_hsmenustateplugin
    60 
    56 
   111     HbGroupBox *viewLabel =
   107     HbGroupBox *viewLabel =
   112             qobject_cast<HbGroupBox *>(
   108             qobject_cast<HbGroupBox *>(
   113                     currentLoader()->findWidget(VIEW_LABEL_NAME));
   109                     currentLoader()->findWidget(VIEW_LABEL_NAME));
   114 
   110 
   115     return viewLabel;
   111     return viewLabel;
   116 }
       
   117 
       
   118 /*!
       
   119  \return Pointer to the 'Add content' button resulting from last
       
   120  \a build call. It is
       
   121  guaranteed to be not NULL if the \a build was called for the context
       
   122  related to view including label.
       
   123  The pointer is valid until the HsMenuViewBuilder instance is destroyed.
       
   124  Memory ownership is not changed.
       
   125  */
       
   126 HbPushButton *HsMenuViewBuilder::currentAddContentButton()
       
   127 {
       
   128     HbPushButton *pushButton =
       
   129             qobject_cast<HbPushButton *>(currentLoader()->findWidget(
       
   130                         ADD_CONTENT_BUTTON_NAME));
       
   131     return pushButton;
       
   132 }
   112 }
   133 
   113 
   134 /*!
   114 /*!
   135  \return Pointer to All Applications Action. Guaranteed to be not NULL.
   115  \return Pointer to All Applications Action. Guaranteed to be not NULL.
   136  The pointer is valid until the HsMenuViewBuilder instance is destroyed.
   116  The pointer is valid until the HsMenuViewBuilder instance is destroyed.