homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuviewbuilder.h
changeset 69 87476091b3f5
parent 55 03646e8da489
child 71 1db7cc813a4e
--- a/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuviewbuilder.h	Wed Jul 14 15:53:30 2010 +0300
+++ b/homescreenapp/stateplugins/hsapplibrarystateplugin/inc/hsmenuviewbuilder.h	Fri Jul 23 13:47:57 2010 +0300
@@ -20,7 +20,9 @@
 
 #include <QFlags>
 #include <QMap>
+#include <QPair>
 #include <QSet>
+#include <QSharedPointer>
 #include <QString>
 #include <qnamespace.h>
 #include <HbDocumentLoader>
@@ -38,18 +40,20 @@
 class HbToolBarExtension;
 class HbPushButton;
 
-enum HsViewContext {
-    HsAllAppsContext,
+enum HsStateContext {
+    HsAllAppsContext = 0,
     HsAllCollectionsContext,
     HsInstalledAppsContext,
     HsCollectionContext,
+    InvalidStateContext
 };
 
 enum HsOperationalContext {
-    HsItemViewContext,
+    HsItemViewContext = 0,
     HsSearchContext,
     HsButtonContext,
-    HsEmptyLabelContext
+    HsEmptyLabelContext,
+    InvalidOperationalContext
 };
 
 HS_STATES_TEST_CLASS(MenuStatesTest)
@@ -71,37 +75,33 @@
     HbToolBarExtension *toolBarExtension() const;
 
     // mandatory context dependent widgets accessors
-    HbView *currentView() const;
-    HbListView *currentListView() const;
+    HbView *currentView();
+    HbListView *currentListView();
 
 
     // optional widgets accessors
-    HbGroupBox *currentViewLabel() const;
-    HbSearchPanel *currentSearchPanel() const;
-    HbPushButton *collectionButton() const;
+    HbGroupBox *currentViewLabel();
+    HbSearchPanel *currentSearchPanel();
+    HbPushButton *currentAddContentButton();
 
 
-    void setViewContext(HsViewContext viewContext);
+    void setStateContext(HsStateContext stateContext);
     void setOperationalContext(HsOperationalContext operationalContext);
-    bool build();
 
 private:
-    void init();
+    typedef QPair<HsStateContext, HsOperationalContext> Context;
+    typedef QMap<Context, QSharedPointer<HbDocumentLoader> > LoaderMap;
+
+    QSharedPointer<HbDocumentLoader>
+            parseDocument(const QString &documentBaseName);
 
-    bool parseSection(const QString &sectionName = QString());
+    QSharedPointer<HbDocumentLoader> readContextConfiguration();
 
+    Context context() const;
 
-    bool readContextConfiguration(HsViewContext, HsOperationalContext);
+    QSharedPointer<HbDocumentLoader> currentLoader();
 
 
-    void searchPanelVisibilityChange(bool visible);
-
-    HbLineEdit *searchPanelLineEdit() const;
-
-    QMap<HsViewContext, QString > mViewContextToStringMap;
-    QMap<HsOperationalContext, QString > mOperationalContextToStringMap;
-
-    HbDocumentLoader mDocumentLoader;
     QSet<QObject *> mLoadedObjects;
 
     const QString DOCUMENT_FILE_NAME;
@@ -119,10 +119,13 @@
     HbToolBarExtension *mToolBarExtension;
     HbAction *mToolBarExtensionAction;
 
-    HsViewContext mViewContext;
+    HsStateContext mStateContext;
     HsOperationalContext mOperationalContext;
 
     HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest)
+
+    LoaderMap mLoaderMap;
+    QSharedPointer<HbDocumentLoader> mCommonObjectsLoader;
 };
 
 #endif // HSMENUVIEWBUILDER_H