|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef ADDAPPSTOCOLLECTIONSTATE_H |
|
19 #define ADDAPPSTOCOLLECTIONSTATE_H |
|
20 |
|
21 #include <QState> |
|
22 #include <QVariant> |
|
23 #include <hsmenuservice.h> |
|
24 #include "hsmenustates_global.h" |
|
25 HS_STATES_TEST_CLASS(MenuStatesTest) |
|
26 |
|
27 class QStandardItemModel; |
|
28 class HsAppsCheckList; |
|
29 |
|
30 /** |
|
31 * @ingroup group_hsmenustateplugin |
|
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 |
|
42 { |
|
43 Q_OBJECT |
|
44 |
|
45 // Friend classes |
|
46 HS_STATES_TEST_FRIEND_CLASS(MenuStatesTest) |
|
47 |
|
48 public: |
|
49 |
|
50 /** |
|
51 * Types of collection's related actions. |
|
52 */ |
|
53 enum CollectionActionType { |
|
54 // No action |
|
55 NoActionType, |
|
56 // Adding a specific application to an existing collection via item specific menu |
|
57 ViaItemSpecificMenuType = 1000, |
|
58 // Add one/many applications to a new/an existing collection via the All view |
|
59 ViaAllViewOptionMenuType, |
|
60 // Adding a new collection via the Collections view |
|
61 ViaAllCollectionsViewType, |
|
62 // Add items to a collection via the collection's view options meu |
|
63 ViaCollectionsViewOptionsMenuType, |
|
64 // Add a specific item to a collection via collection specific menu |
|
65 ViaCollectionSpecificMenuType |
|
66 }; |
|
67 |
|
68 HsAddAppsToCollectionState(QState *parent = 0); |
|
69 virtual ~HsAddAppsToCollectionState(); |
|
70 |
|
71 signals: |
|
72 |
|
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); |
|
80 |
|
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); |
|
89 |
|
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); |
|
97 |
|
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); |
|
106 |
|
107 /** |
|
108 * Signal emitted when user selects creating new collection. |
|
109 * |
|
110 * @since S60 ?S60_version. |
|
111 */ |
|
112 void transitToNewCollectionState(); |
|
113 |
|
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); |
|
121 |
|
122 /** |
|
123 * Signal emitted when user selects cancel. |
|
124 * |
|
125 * @since S60 ?S60_version. |
|
126 */ |
|
127 void transitToFinalState(); |
|
128 |
|
129 protected: |
|
130 |
|
131 void onEntry(QEvent *event); |
|
132 |
|
133 void showMessageAppsAdded(int id); |
|
134 |
|
135 protected slots: |
|
136 |
|
137 void setCollectionName(const QString &collectionName); |
|
138 |
|
139 void setCollectionId(int collectionId); |
|
140 |
|
141 void setAppList(const QList<int> &appList); |
|
142 |
|
143 void save(); |
|
144 |
|
145 void cleanData(); |
|
146 |
|
147 void selectApplicationsDone(const QList<int> &appList); |
|
148 |
|
149 private slots: |
|
150 |
|
151 void stateExited(); |
|
152 |
|
153 void newCollection(); |
|
154 |
|
155 void selectCollection(); |
|
156 |
|
157 void appsCheckListState(); |
|
158 |
|
159 private: |
|
160 |
|
161 void construct(); |
|
162 |
|
163 void createStates(); |
|
164 |
|
165 private: |
|
166 |
|
167 /** |
|
168 * Collection name. |
|
169 */ |
|
170 QString mCollectionName; |
|
171 |
|
172 /** |
|
173 * Collection id. |
|
174 */ |
|
175 int mCollectionId; |
|
176 |
|
177 /** |
|
178 * Applications list. |
|
179 */ |
|
180 QList<int> mAppList; |
|
181 |
|
182 /** |
|
183 * Boll indicating need of confirmation note after saving in content arsenal. |
|
184 */ |
|
185 bool mShowConfirmation; |
|
186 |
|
187 /** |
|
188 * Initial state. |
|
189 */ |
|
190 QState *mInitialState; |
|
191 |
|
192 /** |
|
193 * Select collection state. |
|
194 */ |
|
195 QState *mSelectCollectionState; |
|
196 |
|
197 /** |
|
198 * Collection name state. |
|
199 */ |
|
200 QState *mNewCollectionState; |
|
201 |
|
202 /** |
|
203 * Collection name state. |
|
204 */ |
|
205 QState *mAppsCheckListState; |
|
206 |
|
207 /** |
|
208 * Collection action type. |
|
209 */ |
|
210 CollectionActionType mActionType; |
|
211 |
|
212 /** |
|
213 * Applications sort order. |
|
214 */ |
|
215 HsSortAttribute mApplicationsSortAttribute; |
|
216 |
|
217 /** |
|
218 * Collections sort order. |
|
219 */ |
|
220 HsSortAttribute mCollectionsSortAttribute; |
|
221 |
|
222 /** |
|
223 * Applications check list. |
|
224 */ |
|
225 HsAppsCheckList *mAppsCheckList; |
|
226 |
|
227 }; |
|
228 |
|
229 #endif /* ADDAPPSTOCOLLECTIONSTATE_H */ |