|
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: Declaration of the progressive search state. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef PROGRESSIVE_SEARCH_STATE_H |
|
19 #define PROGRESSIVE_SEARCH_STATE_H |
|
20 |
|
21 #include <qabstractitemmodel.h> |
|
22 #include <qstate.h> |
|
23 #include <qstringlist.h> |
|
24 #include <qdatetime.h> |
|
25 #include <qpixmap.h> |
|
26 #include <hbicon.h> |
|
27 #include <displaymode.h> |
|
28 #include "Search_global.h" |
|
29 |
|
30 class HbMainWindow; |
|
31 class HbView; |
|
32 class HbListView; |
|
33 class HbDocumentLoader; |
|
34 class QStandardItemModel; |
|
35 class HbSearchPanel; |
|
36 class QSortFilterProxyModel; |
|
37 |
|
38 class CFbsBitmap; |
|
39 |
|
40 class InDeviceHandler; |
|
41 class QCPixDocument; |
|
42 |
|
43 SEARCH_CLASS( SearchStateProviderTest) |
|
44 /** @ingroup group_searchstateprovider |
|
45 * @brief The state where progressive search state is shown |
|
46 * |
|
47 * @see StateMachine |
|
48 * |
|
49 * @lib ?library |
|
50 * @since S60 ?S60_version |
|
51 */ |
|
52 class SearchProgressiveState : public QState |
|
53 { |
|
54 Q_OBJECT |
|
55 |
|
56 public: |
|
57 |
|
58 /** |
|
59 * Constructor. |
|
60 * @since S60 ?S60_version. |
|
61 * @param aParent Owner. |
|
62 */ |
|
63 SearchProgressiveState(QState *aParent = 0); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 * @since S60 ?S60_version. |
|
68 */ |
|
69 virtual ~SearchProgressiveState(); |
|
70 |
|
71 protected: |
|
72 |
|
73 /** |
|
74 * @copydoc QState::onEntry() |
|
75 */ |
|
76 void onEntry(QEvent *event); |
|
77 |
|
78 /** |
|
79 * @copydoc QState::onExit() |
|
80 */ |
|
81 void onExit(QEvent *event); |
|
82 |
|
83 private: |
|
84 /** |
|
85 * deactivates the signals . |
|
86 * @since S60 ?S60_version. |
|
87 */ |
|
88 void deActivateSignals(); |
|
89 |
|
90 /** |
|
91 * activates the signals . |
|
92 * @since S60 ?S60_version. |
|
93 */ |
|
94 void activateSignals(); |
|
95 |
|
96 /** |
|
97 * get the application icon . |
|
98 * @since S60 ?S60_version. |
|
99 */ |
|
100 HbIcon getAppIconFromAppId(TUid auid); |
|
101 |
|
102 /** |
|
103 * resizing the symbain icon . |
|
104 * @since S60 ?S60_version. |
|
105 */ |
|
106 CFbsBitmap *copyBitmapLC(CFbsBitmap *input); |
|
107 public slots: |
|
108 |
|
109 /** |
|
110 * slot connects to CSearchHandler to get the status of search result synchronously |
|
111 * @since S60 ?S60_version. |
|
112 * @param aError error code. |
|
113 * @param aResultCount number of results |
|
114 */ |
|
115 void onSearchComplete(int aError, int aResultCount); |
|
116 |
|
117 /** |
|
118 * slot connects to CSearchHandler to get the status of search result asynchronously |
|
119 * @since S60 ?S60_version. |
|
120 * @param aError error code. |
|
121 * @param aResultCount number of results |
|
122 */ |
|
123 void onAsyncSearchComplete(int aError, int aResultCount); |
|
124 |
|
125 /** |
|
126 * slot connects to CSearchHandler to get the result item asynchronously |
|
127 * @since S60 ?S60_version. |
|
128 * @param aError error code. |
|
129 * @param aDoc result item |
|
130 */ |
|
131 void onGetDocumentComplete(int aError, QCPixDocument* aDoc); |
|
132 |
|
133 /** |
|
134 * slot connects to list view to launch the respective application |
|
135 * @since S60 ?S60_version. |
|
136 * @param aIndex index of the activated item. |
|
137 */ |
|
138 void openResultitem(QModelIndex aIndex); |
|
139 |
|
140 /** |
|
141 * slot connects to settings state to get the selected category information |
|
142 * @since S60 ?S60_version. |
|
143 * @param aCategory category(database) name. |
|
144 * @param aStatus whether the category selected or not |
|
145 */ |
|
146 void getSettingCategory(int, bool); |
|
147 |
|
148 /** |
|
149 * slot connects to action to change the current state to settings state |
|
150 * @since S60 ?S60_version. |
|
151 */ |
|
152 void setSettings(); |
|
153 |
|
154 /** |
|
155 * slot connects to search panel to initiate the fresh search |
|
156 * @since S60 ?S60_version. |
|
157 * @param aKeyword search keyword. |
|
158 */ |
|
159 void startNewSearch(const QString &aKeyword); |
|
160 |
|
161 /** |
|
162 * slot connects to search state for internet search |
|
163 * @since S60 ?S60_version. |
|
164 */ |
|
165 void _customizeGoButton(bool avalue); |
|
166 |
|
167 /** |
|
168 * slot connects to search state for internet search |
|
169 * @since S60 ?S60_version. |
|
170 */ |
|
171 void settingsaction(bool avalue); |
|
172 |
|
173 /** |
|
174 * slot connects to search state for internet search |
|
175 * @since S60 ?S60_version. |
|
176 */ |
|
177 void cancelSearch(); |
|
178 |
|
179 private: |
|
180 |
|
181 /** |
|
182 * initiate the fresh search for selected category separately |
|
183 * |
|
184 * @param aKeyword search keyword. |
|
185 */ |
|
186 void searchOnCategory(const QString aKeyword); |
|
187 |
|
188 /** |
|
189 * clears the model |
|
190 * |
|
191 */ |
|
192 void clear(); |
|
193 |
|
194 /** |
|
195 * prepares the item on result list view for no result case |
|
196 * |
|
197 * @param aKeyword search keyword. |
|
198 */ |
|
199 void noResultsFound(QString aKeyword); |
|
200 |
|
201 /** |
|
202 * prepares the suggestion link item on result list view to provide suggestion links |
|
203 * |
|
204 * @param aKeyword search keyword. |
|
205 */ |
|
206 void createSuggestionLink(bool aFlag); |
|
207 |
|
208 /** |
|
209 * Function to include corrrect Qimage format to be taken from bitmap |
|
210 * @param mode Bitmap display mode. |
|
211 */ |
|
212 QImage::Format TDisplayMode2Format(TDisplayMode mode); |
|
213 |
|
214 /** |
|
215 * Function to convert the s60 based CFbsBitmap into Qt specific QPixmap |
|
216 * @param aBitmap Bitmap to be converted. |
|
217 */ |
|
218 QPixmap fromSymbianCFbsBitmap(CFbsBitmap *aBitmap); |
|
219 |
|
220 signals: |
|
221 |
|
222 /** |
|
223 * Signalled when user selects an to switch the settings state |
|
224 * setting state will be activated. |
|
225 */ |
|
226 void settingsState(); |
|
227 |
|
228 private: |
|
229 |
|
230 HbMainWindow* mMainWindow; |
|
231 |
|
232 /** |
|
233 * main view. |
|
234 * Own. |
|
235 */ |
|
236 HbView* mView; |
|
237 |
|
238 /** |
|
239 * The List View widget. |
|
240 * Own. |
|
241 */ |
|
242 HbListView* mListView; |
|
243 |
|
244 /** |
|
245 * Document handler to load .docml. |
|
246 * Own. |
|
247 */ |
|
248 HbDocumentLoader* mDocumentLoader; |
|
249 |
|
250 /** |
|
251 * The searchpanel widget. |
|
252 * Own. |
|
253 */ |
|
254 HbSearchPanel* mSearchPanel; |
|
255 /** |
|
256 * proxymodel for list view |
|
257 * Own. |
|
258 */ |
|
259 QSortFilterProxyModel *proxyModel; |
|
260 |
|
261 /** |
|
262 * model for list view |
|
263 * Own. |
|
264 */ |
|
265 QStandardItemModel* mModel; |
|
266 |
|
267 /** |
|
268 * qt interface for CPix engine |
|
269 * Own. |
|
270 */ |
|
271 InDeviceHandler* mSearchHandler; |
|
272 |
|
273 /** |
|
274 * Search Keyword |
|
275 */ |
|
276 |
|
277 QString mSearchString; |
|
278 |
|
279 /** |
|
280 * Search Keyword |
|
281 */ |
|
282 |
|
283 QString mOriginalString; |
|
284 |
|
285 /** |
|
286 * selected categories on a map |
|
287 */ |
|
288 QMap<int, bool> mSelectedCategory; |
|
289 |
|
290 /** |
|
291 * save the previous selected categories,decision to search again |
|
292 */ |
|
293 QMap<int, bool> mTempSelectedCategory; |
|
294 |
|
295 /** |
|
296 * temporary list of selected categories |
|
297 */ |
|
298 QStringList mTemplist; |
|
299 |
|
300 /** |
|
301 * number of categories selected |
|
302 * |
|
303 */ |
|
304 int mDatabasecount; |
|
305 |
|
306 /** |
|
307 * index of link item |
|
308 */ |
|
309 int mLinkindex; |
|
310 |
|
311 /** |
|
312 * number of hits |
|
313 */ |
|
314 int mResultcount; |
|
315 |
|
316 /** |
|
317 * result parser |
|
318 * |
|
319 */ |
|
320 int mResultparser; |
|
321 |
|
322 /** |
|
323 * setting loaded or not variable |
|
324 * |
|
325 */ |
|
326 bool loadSettings; |
|
327 QList<HbIcon> mIconArray; |
|
328 HbIcon mIcon; |
|
329 |
|
330 SEARCH_FRIEND_CLASS (SearchStateProviderTest) |
|
331 |
|
332 }; |
|
333 |
|
334 #endif //PROGRESSIVE_SEARCH_STATE_H |