homescreenapp/stateplugins/hsmenuworkerstateplugin/inc/hsaddappstocollectionstate.h
changeset 46 23b5d6a29cce
parent 39 4e8ebe173323
child 55 03646e8da489
equal deleted inserted replaced
39:4e8ebe173323 46:23b5d6a29cce
    23 #include <hsmenuservice.h>
    23 #include <hsmenuservice.h>
    24 #include "hsmenustates_global.h"
    24 #include "hsmenustates_global.h"
    25 HS_STATES_TEST_CLASS(MenuStatesTest)
    25 HS_STATES_TEST_CLASS(MenuStatesTest)
    26 
    26 
    27 class QStandardItemModel;
    27 class QStandardItemModel;
       
    28 class HbAction;
    28 class HsAppsCheckList;
    29 class HsAppsCheckList;
       
    30 class HsCollectionNameDialog;
       
    31 class HsCollectionsListDialog;
    29 
    32 
    30 /**
       
    31  * @ingroup group_hsworkerstateplugin
       
    32  * @brief Application Library State.
       
    33  *
       
    34  * State responsible for adding new applications to collections.
       
    35  *
       
    36  * @see StateMachine
       
    37  *
       
    38  * @lib ?library
       
    39  * @since S60 ?S60_version
       
    40  */
       
    41 class HsAddAppsToCollectionState: public QState
    33 class HsAddAppsToCollectionState: public QState
    42 {
    34 {
    43     Q_OBJECT
    35     Q_OBJECT
    44 
    36 
    45     // Friend classes
       
    46     HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest)
    37     HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest)
    47 
    38 
    48 public:
    39 public:
    49 
    40 
    50     /**
       
    51      * Types of collection's related actions.
       
    52      */
       
    53     enum CollectionActionType {
    41     enum CollectionActionType {
    54         // No action
       
    55         NoActionType,
    42         NoActionType,
    56         // Adding a specific application to an existing collection via item specific menu
       
    57         ViaItemSpecificMenuType = 1000,
    43         ViaItemSpecificMenuType = 1000,
    58         // Add one/many applications to a new/an existing collection via the All view
       
    59         ViaAllViewOptionMenuType,
    44         ViaAllViewOptionMenuType,
    60         // Adding a new collection via the Collections view
       
    61         ViaAllCollectionsViewType,
    45         ViaAllCollectionsViewType,
    62         // Add items to a collection via the collection's view options meu
       
    63         ViaCollectionsViewOptionsMenuType,
    46         ViaCollectionsViewOptionsMenuType,
    64         // Add a specific item to a collection via collection specific menu
       
    65         ViaCollectionSpecificMenuType
    47         ViaCollectionSpecificMenuType
    66     };
    48     };
    67 
    49 
    68     HsAddAppsToCollectionState(QState *parent = 0);
    50     HsAddAppsToCollectionState(QState *parent = 0);
    69     virtual ~HsAddAppsToCollectionState();
    51     virtual ~HsAddAppsToCollectionState();
    70 
    52 
    71 signals:
    53 signals:
    72 
    54 
    73     /**
       
    74      * Signal emitted when collection name is selected.
       
    75      *
       
    76      * @since S60 ?S60_version.
       
    77      * @param collectionName name of collection.
       
    78      */
       
    79     void transitToSaveState(const QString &collectionName);
    55     void transitToSaveState(const QString &collectionName);
    80 
    56 
    81     /**
       
    82      * Signal emitted when collection name is selected - version to trigger
       
    83      * transition to mAppCheckListState.
       
    84      *
       
    85      * @since S60 ?S60_version.
       
    86      * @param collectionName name of collection.
       
    87      */
       
    88     void transitToAppsCheckListState(const QString &collectionName);
    57     void transitToAppsCheckListState(const QString &collectionName);
    89 
    58 
    90     /**
       
    91      * Signal emitted when collection id is selected.
       
    92      *
       
    93      * @since S60 ?S60_version.
       
    94      * @param collectionId id of collection.
       
    95      */
       
    96     void transitToSaveState(int collectionId);
    59     void transitToSaveState(int collectionId);
    97 
    60 
    98     /**
       
    99      * Signal emitted when collection id is selected - version to trigger
       
   100      * transition to mAppCheckListState.
       
   101      *
       
   102      * @since S60 ?S60_version.
       
   103      * @param collectionId id of collection.
       
   104      */
       
   105     void transitToAppsCheckListState(int collectionId);
    61     void transitToAppsCheckListState(int collectionId);
   106 
    62 
   107     /**
       
   108      * Signal emitted when user selects creating new collection.
       
   109      *
       
   110      * @since S60 ?S60_version.
       
   111      */
       
   112     void transitToNewCollectionState();
    63     void transitToNewCollectionState();
   113 
    64 
   114     /**
       
   115      * Signal emitted when applications are selected.
       
   116      *
       
   117      * @param appList application list.
       
   118      * @since S60 ?S60_version.
       
   119      */
       
   120     void transitToSaveState(const QList<int> &appList);
    65     void transitToSaveState(const QList<int> &appList);
   121 
    66 
   122     /**
       
   123      * Signal emitted when user selects cancel.
       
   124      *
       
   125      * @since S60 ?S60_version.
       
   126      */
       
   127     void transitToFinalState();
    67     void transitToFinalState();
   128 
    68 
   129 protected:
    69 protected:
   130 
    70 
   131     void onEntry(QEvent *event);
    71     void onEntry(QEvent *event);
   154 
    94 
   155     void selectCollection();
    95     void selectCollection();
   156 
    96 
   157     void appsCheckListState();
    97     void appsCheckListState();
   158 
    98 
       
    99     void editorDialogFinished(HbAction* finishedAction);
       
   100 
       
   101     void listDialogFinished(HbAction* finishedAction);
       
   102 
   159 private:
   103 private:
   160 
   104 
   161     void construct();
   105     void construct();
   162 
   106 
   163     void createStates();
   107     void createStates();
   164 
   108 
   165 private:
   109 private:
   166 
   110 
   167     /**
       
   168      * Collection name.
       
   169      */
       
   170     QString mCollectionName;
   111     QString mCollectionName;
   171 
   112 
   172     /**
       
   173      * Collection id.
       
   174      */
       
   175     int mCollectionId;
   113     int mCollectionId;
   176 
   114 
   177     /**
       
   178      * Applications list.
       
   179      */
       
   180     QList<int> mAppList;
   115     QList<int> mAppList;
   181 
   116 
   182     /**
       
   183      * Boll indicating need of confirmation note after saving in content arsenal.
       
   184      */
       
   185     bool mShowConfirmation;
   117     bool mShowConfirmation;
   186 
   118 
   187     /**
       
   188      * Initial state.
       
   189      */
       
   190     QState *mInitialState;
   119     QState *mInitialState;
   191 
   120 
   192     /**
       
   193      * Select collection state.
       
   194      */
       
   195     QState *mSelectCollectionState;
   121     QState *mSelectCollectionState;
   196 
   122 
   197     /**
       
   198      * Collection name state.
       
   199      */
       
   200     QState *mNewCollectionState;
   123     QState *mNewCollectionState;
   201 
   124 
   202     /**
       
   203      * Collection name state.
       
   204      */
       
   205     QState *mAppsCheckListState;
   125     QState *mAppsCheckListState;
   206 
   126 
   207     /**
       
   208      * Collection action type.
       
   209      */
       
   210     CollectionActionType mActionType;
   127     CollectionActionType mActionType;
   211 
   128 
   212     /**
       
   213      * Applications sort order.
       
   214      */
       
   215     HsSortAttribute mApplicationsSortAttribute;
   129     HsSortAttribute mApplicationsSortAttribute;
   216 
   130 
   217     /**
       
   218      * Collections sort order.
       
   219      */
       
   220     HsSortAttribute mCollectionsSortAttribute;
   131     HsSortAttribute mCollectionsSortAttribute;
   221 
   132 
   222     /**
       
   223      * Applications check list.
       
   224      */
       
   225     HsAppsCheckList *mAppsCheckList;
   133     HsAppsCheckList *mAppsCheckList;
       
   134 
       
   135     HsCollectionNameDialog *mEditorDialog;
       
   136 
       
   137     bool mEditorFinishedEntered;
       
   138 
       
   139     HsCollectionsListDialog *mListDialog;
       
   140 
       
   141     bool mListFinishedEntered;
   226 
   142 
   227 };
   143 };
   228 
   144 
   229 #endif /* ADDAPPSTOCOLLECTIONSTATE_H */
   145 #endif /* ADDAPPSTOCOLLECTIONSTATE_H */