15
|
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 Ui Loader .
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
#ifndef SEARCH_CONTROLLER_H
|
|
18 |
#define SEARCH_CONTROLLER_H
|
|
19 |
|
|
20 |
#include "search_global.h"
|
|
21 |
#include <qobject.h>
|
|
22 |
#include <qmutex.h>
|
16
|
23 |
#include <hbmainwindow.h>
|
15
|
24 |
class HbDocumentLoader;
|
|
25 |
class HbView;
|
|
26 |
class HbListWidget;
|
|
27 |
class HbSearchPanel;
|
|
28 |
class TsTaskSettings;
|
16
|
29 |
class SearchMainWindow;
|
15
|
30 |
class HbShrinkingVkbHost;
|
26
|
31 |
class SearchContentInfoDbData;
|
|
32 |
class ContentInfoDbRead;
|
15
|
33 |
SEARCH_CLASS( SearchStateProviderTest)
|
|
34 |
|
|
35 |
class SearchUiLoader : public QObject
|
|
36 |
{
|
|
37 |
Q_OBJECT
|
|
38 |
public:
|
|
39 |
/**
|
|
40 |
* Singleton construtor
|
|
41 |
* @since S60 ?S60_version.
|
|
42 |
*/
|
|
43 |
static SearchUiLoader* instance()
|
|
44 |
{
|
|
45 |
static QMutex mutex;
|
|
46 |
if (!m_instance)
|
|
47 |
{
|
|
48 |
mutex.lock();
|
|
49 |
m_instanceCounter++;
|
|
50 |
if (!m_instance)
|
|
51 |
{
|
|
52 |
m_instance = new SearchUiLoader;
|
|
53 |
}
|
|
54 |
mutex.unlock();
|
|
55 |
}
|
|
56 |
|
|
57 |
return m_instance;
|
|
58 |
}
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Singleton destructor
|
|
62 |
* @since S60 ?S60_version.
|
|
63 |
*/
|
|
64 |
static void deleteinstance()
|
|
65 |
{
|
|
66 |
m_instanceCounter--;
|
|
67 |
if ((m_instanceCounter <= 0) && (m_instance))
|
|
68 |
{
|
|
69 |
delete m_instance;
|
|
70 |
m_instance = 0;
|
|
71 |
}
|
|
72 |
}
|
26
|
73 |
|
|
74 |
private:
|
|
75 |
void readDB();
|
|
76 |
|
15
|
77 |
public slots:
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Slot to send the application to background fake exit
|
|
81 |
* @since S60 ?S60_version.
|
|
82 |
*/
|
16
|
83 |
void slotsendtobackground();
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Slot to open vkb
|
|
87 |
* @since S60 ?S60_version.
|
|
88 |
*/
|
|
89 |
void slotbringvkb();
|
15
|
90 |
|
26
|
91 |
void slotdataChanged();
|
|
92 |
|
|
93 |
signals:
|
|
94 |
void dbChanged();
|
|
95 |
|
15
|
96 |
public:
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Function returns the HbListWidget object
|
|
100 |
* @param aUid Unique app Id.
|
|
101 |
*/
|
|
102 |
HbView* View()
|
|
103 |
{
|
|
104 |
return mView;
|
|
105 |
}
|
|
106 |
|
|
107 |
/**
|
|
108 |
* Function returns the HbListWidget object
|
|
109 |
* @param aUid Unique app Id.
|
|
110 |
*/
|
|
111 |
HbListWidget* ListWidget()
|
|
112 |
{
|
|
113 |
return mListWidget;
|
|
114 |
}
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Function returns the HbSearchPanel object
|
|
118 |
* @param aUid Unique app Id.
|
|
119 |
*/
|
|
120 |
HbSearchPanel* SearchPanel()
|
|
121 |
{
|
|
122 |
return mSearchPanel;
|
21
|
123 |
}
|
26
|
124 |
QList<SearchContentInfoDbData*> ContentInfoList()
|
|
125 |
{
|
|
126 |
return mContentInfoList;
|
|
127 |
}
|
15
|
128 |
private:
|
|
129 |
/**
|
|
130 |
* Constructor.
|
|
131 |
* @since S60 ?S60_version.
|
|
132 |
* @param aParent Owner.
|
|
133 |
*/
|
|
134 |
SearchUiLoader();
|
|
135 |
/**
|
|
136 |
* Destructor.
|
|
137 |
* @since S60 ?S60_version.
|
|
138 |
*/
|
|
139 |
~SearchUiLoader();
|
|
140 |
private:
|
|
141 |
|
|
142 |
/**
|
|
143 |
* static instance to make single instance
|
|
144 |
* Own.
|
|
145 |
*/
|
|
146 |
static SearchUiLoader *m_instance;
|
|
147 |
|
|
148 |
/**
|
|
149 |
* counter for number for instance
|
|
150 |
* Own.
|
|
151 |
*/
|
|
152 |
static int m_instanceCounter;
|
|
153 |
|
|
154 |
/**
|
|
155 |
* Doucument loader API
|
|
156 |
* Own.
|
|
157 |
*/
|
|
158 |
HbDocumentLoader* mDocumentLoader;
|
|
159 |
|
|
160 |
/**
|
|
161 |
* Application view
|
|
162 |
* Own.
|
|
163 |
*/
|
|
164 |
HbView* mView;
|
|
165 |
|
|
166 |
/**
|
|
167 |
* Listwidget to show the search results
|
|
168 |
* Own.
|
|
169 |
*/
|
|
170 |
HbListWidget* mListWidget;
|
|
171 |
|
|
172 |
/**
|
|
173 |
* searchpanel for query
|
|
174 |
* Own.
|
|
175 |
*/
|
|
176 |
HbSearchPanel* mSearchPanel;
|
|
177 |
|
|
178 |
/**
|
|
179 |
* to hide for task switcher
|
|
180 |
* Own.
|
|
181 |
*/
|
|
182 |
TsTaskSettings* mClient;
|
|
183 |
|
|
184 |
/**
|
|
185 |
* application main window
|
|
186 |
*/
|
16
|
187 |
SearchMainWindow* mMainWindow;
|
15
|
188 |
|
|
189 |
/**
|
|
190 |
* vkbhost to resize the result screen
|
|
191 |
* Own.
|
|
192 |
*/
|
|
193 |
HbShrinkingVkbHost* mVirtualKeyboard;
|
16
|
194 |
|
|
195 |
/**
|
|
196 |
* flag to validate fake exit
|
|
197 |
* Own.
|
|
198 |
*/
|
|
199 |
bool mBringtoForground;
|
26
|
200 |
|
|
201 |
QList<SearchContentInfoDbData*> mContentInfoList;
|
|
202 |
|
|
203 |
ContentInfoDbRead* mDb;
|
15
|
204 |
private:
|
16
|
205 |
SEARCH_FRIEND_CLASS ( SearchStateProviderTest)
|
15
|
206 |
};
|
|
207 |
|
16
|
208 |
class SearchMainWindow : public HbMainWindow
|
|
209 |
{
|
|
210 |
Q_OBJECT
|
|
211 |
public:
|
|
212 |
/**
|
|
213 |
* Constructor.
|
|
214 |
* @since S60 ?S60_version.
|
|
215 |
*/
|
|
216 |
SearchMainWindow()
|
|
217 |
{
|
|
218 |
connect(this, SIGNAL(viewReady()), this, SLOT(slotViewReady()));
|
|
219 |
}
|
|
220 |
/**
|
|
221 |
* Function capture the focusin event
|
|
222 |
* @param event .
|
|
223 |
*/
|
|
224 |
void focusInEvent(QFocusEvent * event)
|
|
225 |
{
|
|
226 |
Q_UNUSED(event);
|
|
227 |
slotViewReady();
|
|
228 |
}
|
|
229 |
public slots:
|
|
230 |
/**
|
|
231 |
* Slot to send the application to background fake exit
|
|
232 |
* @since S60 ?S60_version.
|
|
233 |
*/
|
|
234 |
void slotViewReady();
|
|
235 |
signals:
|
|
236 |
/**
|
|
237 |
* signal to send the notification for vkb
|
|
238 |
* @since S60 ?S60_version.
|
|
239 |
*/
|
|
240 |
void bringvkb();
|
|
241 |
};
|
26
|
242 |
class SearchContentInfoDbData : public QObject
|
|
243 |
{
|
|
244 |
Q_OBJECT
|
|
245 |
public:
|
|
246 |
|
|
247 |
/**
|
|
248 |
* Constructor.
|
|
249 |
* @since S60 ?S60_version.
|
|
250 |
* @param aParent Owner.
|
|
251 |
*/
|
|
252 |
SearchContentInfoDbData()
|
|
253 |
{
|
|
254 |
mSearchProgress = false;
|
|
255 |
mSelected = false;
|
|
256 |
}
|
|
257 |
|
|
258 |
/**
|
|
259 |
* Destructor.
|
|
260 |
* @since S60 ?S60_version.
|
|
261 |
*/
|
|
262 |
~SearchContentInfoDbData()
|
|
263 |
{
|
|
264 |
}
|
|
265 |
public:
|
|
266 |
QString getCategoryName()
|
|
267 |
{
|
|
268 |
return mCategoryName;
|
|
269 |
}
|
|
270 |
QString getDisplayName()
|
|
271 |
{
|
|
272 |
return mDisplayName;
|
|
273 |
}
|
|
274 |
QString getDisplayIcon()
|
|
275 |
{
|
|
276 |
return mDisplayIcon;
|
|
277 |
}
|
|
278 |
QString getExceptionString()
|
|
279 |
{
|
|
280 |
return mExceptionString;
|
|
281 |
}
|
|
282 |
QString getBaseApp()
|
|
283 |
{
|
|
284 |
return mBaseApp;
|
|
285 |
}
|
|
286 |
QString getTranslationPath()
|
|
287 |
{
|
|
288 |
return mTranslationPath;
|
|
289 |
}
|
|
290 |
bool getActivityUri()
|
|
291 |
{
|
|
292 |
return mActivityUri;
|
|
293 |
}
|
|
294 |
int getDisplayOrder()
|
|
295 |
{
|
|
296 |
return mDisplayOrder;
|
|
297 |
}
|
|
298 |
bool getSearchProgress()
|
|
299 |
{
|
|
300 |
return mSearchProgress;
|
|
301 |
}
|
|
302 |
bool getSelected()
|
|
303 |
{
|
|
304 |
return mSelected;
|
|
305 |
}
|
|
306 |
|
|
307 |
void setCategoryName(QString aCategoryName)
|
|
308 |
{
|
|
309 |
mCategoryName = aCategoryName;
|
|
310 |
}
|
|
311 |
void setDisplayName(QString aDisplayName)
|
|
312 |
{
|
|
313 |
mDisplayName = aDisplayName;
|
|
314 |
}
|
|
315 |
void setDisplayIcon(QString aDisplayIcon)
|
|
316 |
{
|
|
317 |
mDisplayIcon = aDisplayIcon;
|
|
318 |
}
|
|
319 |
void setExceptionString(QString aExceptionString)
|
|
320 |
{
|
|
321 |
mExceptionString = aExceptionString;
|
|
322 |
}
|
|
323 |
void setBaseApp(QString aBaseApp)
|
|
324 |
{
|
|
325 |
mBaseApp = aBaseApp;
|
|
326 |
}
|
|
327 |
void setTranslationPath(QString aTranslationPath)
|
|
328 |
{
|
|
329 |
mTranslationPath = aTranslationPath;
|
|
330 |
}
|
|
331 |
void setActivityUri(QString aActivityUri)
|
|
332 |
{
|
|
333 |
mActivityUri = false;
|
|
334 |
if (aActivityUri.length())
|
|
335 |
{
|
|
336 |
mActivityUri = true;
|
|
337 |
}
|
|
338 |
}
|
|
339 |
void setDisplayOrder(int aDisplayOrder)
|
|
340 |
{
|
|
341 |
mDisplayOrder = aDisplayOrder;
|
|
342 |
}
|
|
343 |
void setSearchProgress(bool aSearchProgress)
|
|
344 |
{
|
|
345 |
mSearchProgress = aSearchProgress;
|
|
346 |
}
|
|
347 |
void setSelected(bool aSelected)
|
|
348 |
{
|
|
349 |
mSelected = aSelected;
|
|
350 |
}
|
|
351 |
private:
|
|
352 |
QString mCategoryName;
|
|
353 |
QString mDisplayName;
|
|
354 |
QString mDisplayIcon;
|
|
355 |
QString mExceptionString;
|
|
356 |
bool mActivityUri;
|
|
357 |
QString mBaseApp;
|
|
358 |
int mDisplayOrder;
|
|
359 |
QString mTranslationPath;
|
|
360 |
|
|
361 |
bool mSearchProgress;
|
|
362 |
bool mSelected;
|
|
363 |
};
|
21
|
364 |
|
15
|
365 |
#endif //SEARCH_CONTROLLER_H
|