homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsmenubasestate.h
changeset 35 f9ce957a272c
child 39 4e8ebe173323
equal deleted inserted replaced
5:c743ef5928ba 35:f9ce957a272c
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: Menu Base state
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef HSMENUBASESTATE_H
       
    19 #define HSMENUBASESTATE_H
       
    20 
       
    21 #include <qstate.h>
       
    22 #include <QVariant>
       
    23 
       
    24 #include "hsmenustates_global.h"
       
    25 HS_STATES_TEST_CLASS(MenuStatesTest)
       
    26 
       
    27 class HsShortcutService;
       
    28 class HsContentService;
       
    29 
       
    30 /**
       
    31  * @ingroup group_hsmenustateplugin
       
    32  * @brief Menu Base State
       
    33  *
       
    34  * Menu Base state is the base class for states used in Menu.
       
    35  * It provides basic functionality that makes implemenatation state easier.
       
    36  * Derived implementation can request specific service and access it using convience function.
       
    37  *
       
    38  * @lib ?library
       
    39  * @since S60 ?S60_version
       
    40  */
       
    41 class HsMenuBaseState: public QState
       
    42 {
       
    43     Q_OBJECT
       
    44 
       
    45     HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest)
       
    46 
       
    47 public:
       
    48 
       
    49     /**
       
    50      * Constructor.
       
    51      *
       
    52      * @since S60 ?S60_version.
       
    53      * @param objectName object name, used for debug purpose
       
    54      * @param parent Owner.
       
    55      */
       
    56     HsMenuBaseState(const QString &objectName, QState *parent = 0);
       
    57 
       
    58     /**
       
    59 
       
    60      * Destructor.
       
    61      *
       
    62      * @since S60 ?S60_version.
       
    63      */
       
    64     virtual ~HsMenuBaseState();
       
    65 
       
    66 protected:
       
    67 
       
    68     /**
       
    69      * Constructs contained objects.
       
    70      *
       
    71      * @since S60 ?S60_version.
       
    72      * @param objectName object name, used for debug purpose
       
    73      */
       
    74     void construct(const QString &objectName);
       
    75 
       
    76     /**
       
    77      * Request for services
       
    78      *
       
    79      * notice that services are appended to the list,
       
    80      * so this fuction can be called more than once.
       
    81      * @since S60 ?S60_version.
       
    82      * @param services list of requested services
       
    83      * this method must be called during construction phased of derived class
       
    84      */
       
    85     void requestServices(const QVariantList &services);
       
    86 
       
    87     /**
       
    88      * Convenience method that request single service.
       
    89      *
       
    90      * @param service service to be requested.
       
    91      * @see requestServices
       
    92      */
       
    93     void requestService(const QVariant &service);
       
    94 
       
    95     /**
       
    96      * Convenience method that returns the shortcut serviceif was requested
       
    97      *
       
    98      * @since S60 ?S60_version.
       
    99      * @return Shortcut service if exists.
       
   100      */
       
   101     HsShortcutService *shortcutService() const;
       
   102 
       
   103     /**
       
   104      * Convenient method that returns the content serviceif was requested
       
   105      *
       
   106      * @since S60 ?S60_version.
       
   107      * @return Content service if exists.
       
   108      */
       
   109     HsContentService *contentService() const;
       
   110 
       
   111 private:
       
   112     /**
       
   113      * Function return value for specified property and
       
   114      * if it is not valid add warning message on console.
       
   115      *
       
   116      * @since S60 ?S60_version.
       
   117      * @param propertyName Property name.
       
   118      * @return Property after validation.
       
   119      */
       
   120     QVariant propertyWithChecking(const char *propertyName) const;
       
   121 
       
   122 
       
   123 };
       
   124 
       
   125 #endif //HSMENUBASESTATE_H