55 #include <hbactivitymanager.h> |
55 #include <hbactivitymanager.h> |
56 #include <xqaiwdecl.h> |
56 #include <xqaiwdecl.h> |
57 #include <xqaiwdeclplat.h> |
57 #include <xqaiwdeclplat.h> |
58 #include <qservicemanager.h> |
58 #include <qservicemanager.h> |
59 #include <qurl.h> |
59 #include <qurl.h> |
|
60 #include <email_services_api.h> |
|
61 #include <xqrequestinfo.h> |
60 QTM_USE_NAMESPACE |
62 QTM_USE_NAMESPACE |
61 #define hbApp qobject_cast<HbApplication*>(qApp) |
63 #define hbApp qobject_cast<HbApplication*>(qApp) |
62 const int totalcategories_normalreason = 10; |
64 |
63 const int totalcategories_activityreasonreason = 13; |
|
64 const int intial_iteration = 3; |
65 const int intial_iteration = 3; |
65 const int batch_iteration = 20; |
66 const int batch_iteration = 20; |
66 #define SEARCHAPPUID "2002C377" |
67 |
67 |
68 |
68 // --------------------------------------------------------------------------- |
69 // --------------------------------------------------------------------------- |
69 // SearchProgressiveState::SearchProgressiveState |
70 // SearchProgressiveState::SearchProgressiveState |
70 // --------------------------------------------------------------------------- |
71 // --------------------------------------------------------------------------- |
71 SearchProgressiveState::SearchProgressiveState(QState *parent) : |
72 SearchProgressiveState::SearchProgressiveState(QState *parent) : |
72 QState(parent), mMainWindow(NULL), mView(NULL), mListView(NULL), |
73 QState(parent), mMainWindow(NULL), mView(NULL), mListView(NULL), |
73 mSearchHandler(NULL), mNotesEditor(0), mAiwMgr(0), mRequest(0) |
74 mSearchHandler(NULL), mNotesEditor(0), mAiwMgr(0), mRequest(0) |
74 { |
75 { |
75 mUiLoader = SearchUiLoader::instance(); |
76 mUiLoader = SearchUiLoader::instance(); |
|
77 connect(mUiLoader, SIGNAL(dbChanged), this, SLOT(slotdbChanged())); |
76 |
78 |
77 mMainWindow = hbInstance->allMainWindows().at(0); |
79 mMainWindow = hbInstance->allMainWindows().at(0); |
78 |
80 |
79 mAiwMgr = new XQApplicationManager; |
81 mAiwMgr = new XQApplicationManager; |
80 |
82 |
172 // --------------------------------------------------------------------------- |
175 // --------------------------------------------------------------------------- |
173 // SearchProgressiveState::constructHandlers |
176 // SearchProgressiveState::constructHandlers |
174 // --------------------------------------------------------------------------- |
177 // --------------------------------------------------------------------------- |
175 void SearchProgressiveState::constructHandlers() |
178 void SearchProgressiveState::constructHandlers() |
176 { |
179 { |
177 int categories = totalcategories_normalreason; |
180 for (int i = 0; i < mSearchHandlerList.count(); i++) |
178 |
181 { |
179 if (hbApp && hbApp->activateReason() == Hb::ActivationReasonActivity) |
182 disconnect(mSearchHandlerList.at(i), |
180 { |
183 SIGNAL(handleAsyncSearchResult(int,int)), this, |
181 categories = totalcategories_activityreasonreason; |
184 SLOT(slotonAsyncSearchComplete(int,int))); |
182 } |
185 disconnect(mSearchHandlerList.at(i), |
183 for (int i = 0; i < categories; i++) |
186 SIGNAL(handleDocument(int,CpixDocument*)), this, |
184 { |
187 SLOT(slotonGetDocumentComplete(int,CpixDocument*))); |
185 mSearchHandlerList.append(constructHandlers(i)); |
188 disconnect(mSearchHandlerList.at(i), |
|
189 SIGNAL(handleBatchDocument(int,int,CpixDocument**)), this, |
|
190 SLOT(slotonGetBatchDocumentComplete(int,int,CpixDocument**))); |
|
191 delete mSearchHandlerList.at(i); |
|
192 } |
|
193 mSearchHandlerList.clear(); |
|
194 |
|
195 for (int i = 0; i < mUiLoader->ContentInfoList().count(); i++) |
|
196 { |
|
197 InDeviceHandler* handler = NULL; |
|
198 handler = new InDeviceHandler(); |
|
199 handler->setCategory(mUiLoader->ContentInfoList().at(i)->getBaseApp()); |
|
200 mSearchHandlerList.append(handler); |
|
201 if(mUiLoader->ContentInfoList().at(i)->getTranslationPath().length()) |
|
202 { |
|
203 loadTranslator(mUiLoader->ContentInfoList().at(i)->getTranslationPath()); |
|
204 } |
|
205 } |
|
206 for (int i = 0; i < mSearchHandlerList.count(); i++) |
|
207 { |
|
208 connect(mSearchHandlerList.at(i), |
|
209 SIGNAL(handleAsyncSearchResult(int,int)), this, |
|
210 SLOT(slotonAsyncSearchComplete(int,int))); |
|
211 connect(mSearchHandlerList.at(i), |
|
212 SIGNAL(handleDocument(int,CpixDocument*)), this, |
|
213 SLOT(slotonGetDocumentComplete(int,CpixDocument*))); |
|
214 connect(mSearchHandlerList.at(i), |
|
215 SIGNAL(handleBatchDocument(int,int,CpixDocument**)), this, |
|
216 SLOT(slotonGetBatchDocumentComplete(int,int,CpixDocument**))); |
186 } |
217 } |
187 } |
218 } |
188 // --------------------------------------------------------------------------- |
219 // --------------------------------------------------------------------------- |
189 // SearchProgressiveState::onEntry |
220 // SearchProgressiveState::onEntry |
190 // --------------------------------------------------------------------------- |
221 // --------------------------------------------------------------------------- |
191 void SearchProgressiveState::onEntry(QEvent *event) |
222 void SearchProgressiveState::onEntry(QEvent *event) |
192 { |
223 { |
193 QState::onEntry(event); |
224 QState::onEntry(event); |
194 mStateStatus = true;// used for conditional execution for the slots that are connected as transitions |
225 mStateStatus = true;// used for conditional execution for the slots that are connected as transitions |
195 if (mSearchPanel) |
226 if (mSearchPanel) |
196 { |
227 { |
197 mSearchPanel->setPlaceholderText(hbTrId( |
228 mSearchPanel->setPlaceholderText(hbTrId( |
237 // --------------------------------------------------------------------------- |
267 // --------------------------------------------------------------------------- |
238 // SearchProgressiveState::activateSignals |
268 // SearchProgressiveState::activateSignals |
239 // --------------------------------------------------------------------------- |
269 // --------------------------------------------------------------------------- |
240 void SearchProgressiveState::activateSignals() |
270 void SearchProgressiveState::activateSignals() |
241 { |
271 { |
242 for (int i = 0; i < mSearchHandlerList.count(); i++) |
|
243 { |
|
244 connect(mSearchHandlerList.at(i), |
|
245 SIGNAL(handleAsyncSearchResult(int,int)), this, |
|
246 SLOT(onAsyncSearchComplete(int,int))); |
|
247 connect(mSearchHandlerList.at(i), |
|
248 SIGNAL(handleDocument(int,CpixDocument*)), this, |
|
249 SLOT(onGetDocumentComplete(int,CpixDocument*))); |
|
250 connect(mSearchHandlerList.at(i), |
|
251 SIGNAL(handleBatchDocument(int,int,CpixDocument**)), this, |
|
252 SLOT(onGetBatchDocumentComplete(int,int,CpixDocument**))); |
|
253 |
|
254 } |
|
255 if (mListView) |
272 if (mListView) |
256 { |
273 { |
257 connect(mListView, SIGNAL(activated(HbListWidgetItem *)), this, |
274 connect(mListView, SIGNAL(activated(HbListWidgetItem *)), this, |
258 SLOT(openResultitem(HbListWidgetItem *))); |
275 SLOT(slotopenResultitem(HbListWidgetItem *))); |
259 } |
276 } |
260 if (mSearchPanel) |
277 if (mSearchPanel) |
261 { |
278 { |
262 connect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this, |
279 connect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this, |
263 SLOT(startNewSearch(QString))); |
280 SLOT(slotstartNewSearch(QString))); |
264 connect(mSearchPanel, SIGNAL(searchOptionsClicked()), this, |
281 connect(mSearchPanel, SIGNAL(searchOptionsClicked()), this, |
265 SLOT(setSettings())); |
282 SLOT(slotsetSettings())); |
266 } |
283 } |
267 connect(mMainWindow, SIGNAL(viewReady()), this, SLOT(viewReady())); |
284 connect(mMainWindow, SIGNAL(viewReady()), this, SLOT(slotviewReady())); |
268 } |
285 } |
269 // --------------------------------------------------------------------------- |
286 // --------------------------------------------------------------------------- |
270 // SearchProgressiveState::deActivateSignals |
287 // SearchProgressiveState::deActivateSignals |
271 // --------------------------------------------------------------------------- |
288 // --------------------------------------------------------------------------- |
272 void SearchProgressiveState::deActivateSignals() |
289 void SearchProgressiveState::deActivateSignals() |
273 { |
290 { |
274 for (int i = 0; i < mSearchHandlerList.count(); i++) |
|
275 { |
|
276 disconnect(mSearchHandlerList.at(i), |
|
277 SIGNAL(handleAsyncSearchResult(int,int)), this, |
|
278 SLOT(onAsyncSearchComplete(int,int))); |
|
279 disconnect(mSearchHandlerList.at(i), |
|
280 SIGNAL(handleDocument(int,CpixDocument*)), this, |
|
281 SLOT(onGetDocumentComplete(int,CpixDocument*))); |
|
282 disconnect(mSearchHandlerList.at(i), |
|
283 SIGNAL(handleBatchDocument(int,int,CpixDocument**)), this, |
|
284 SLOT(onGetBatchDocumentComplete(int,int,CpixDocument**))); |
|
285 } |
|
286 if (mListView) |
291 if (mListView) |
287 { |
292 { |
288 disconnect(mListView, SIGNAL(activated(HbListWidgetItem *)), this, |
293 disconnect(mListView, SIGNAL(activated(HbListWidgetItem *)), this, |
289 SLOT(openResultitem(HbListWidgetItem *))); |
294 SLOT(slotopenResultitem(HbListWidgetItem *))); |
290 } |
295 } |
291 if (mSearchPanel) |
296 if (mSearchPanel) |
292 { |
297 { |
293 disconnect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this, |
298 disconnect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this, |
294 SLOT(startNewSearch(QString))); |
299 SLOT(slotstartNewSearch(QString))); |
295 disconnect(mSearchPanel, SIGNAL(searchOptionsClicked()), this, |
300 disconnect(mSearchPanel, SIGNAL(searchOptionsClicked()), this, |
296 SLOT(setSettings())); |
301 SLOT(slotsetSettings())); |
297 } |
302 } |
298 disconnect(mMainWindow, SIGNAL(viewReady()), this, SLOT(viewReady())); |
303 disconnect(mMainWindow, SIGNAL(viewReady()), this, SLOT(slotviewReady())); |
299 } |
304 } |
300 // --------------------------------------------------------------------------- |
305 // --------------------------------------------------------------------------- |
301 // SearchProgressiveState::onAsyncSearchComplete |
306 // SearchProgressiveState::slotonAsyncSearchComplete |
302 // --------------------------------------------------------------------------- |
307 // --------------------------------------------------------------------------- |
303 void SearchProgressiveState::onAsyncSearchComplete(int aError, |
308 void SearchProgressiveState::slotonAsyncSearchComplete(int aError, |
304 int aResultCount) |
309 int aResultCount) |
305 { |
310 { |
306 PERF_CAT_API_ENDLOG |
311 PERF_CAT_API_ENDLOG |
307 PERF_CAT_HITS_ENDLOG |
312 PERF_CAT_HITS_ENDLOG |
308 if (aError != 0) |
313 if (aError != 0) |
309 { |
314 { |
310 //some error print logs |
315 if (aError == KErrServerTerminated) // server terminated refresh the handlers |
|
316 { |
|
317 constructHandlers(); |
|
318 mDatabasecount = 0; |
|
319 mLinkindex = 0; |
|
320 } |
311 searchOnCategory(mSearchString); |
321 searchOnCategory(mSearchString); |
312 return; |
322 return; |
313 } |
323 } |
314 if (aResultCount == 0) |
324 if (aResultCount == 0) |
315 { |
325 { |
316 searchOnCategory(mSearchString); |
326 searchOnCategory(mSearchString); |
317 } |
327 } |
318 else if (aResultCount > 0) |
328 else if (aResultCount > 0) |
319 { |
329 { |
320 mResultcount = aResultCount; |
330 mResultcount = aResultCount; |
321 mResultparser = 0; |
331 if (mContinuationSearch) |
|
332 { |
|
333 mContinuationSearch = false; |
|
334 } |
|
335 else |
|
336 { |
|
337 mResultparser = 0; |
|
338 } |
322 PERF_CAT_GETDOC_TIME_RESTART |
339 PERF_CAT_GETDOC_TIME_RESTART |
323 PERF_CAT_GETDOC_ACCUMULATOR_RESET |
340 PERF_CAT_GETDOC_ACCUMULATOR_RESET |
324 mSearchHandler->getDocumentAsyncAtIndex(mResultparser); |
341 if (mListView->count() >= intial_iteration) |
325 } |
342 { |
326 } |
343 mSearchHandler->getBatchDocumentAsyncAtIndex(mResultparser, |
327 // --------------------------------------------------------------------------- |
344 batch_iteration); |
328 // SearchProgressiveState::onGetDocumentComplete |
345 } |
329 // --------------------------------------------------------------------------- |
346 else |
330 void SearchProgressiveState::onGetDocumentComplete(int aError, |
347 { |
|
348 mSearchHandler->getDocumentAsyncAtIndex(mResultparser); |
|
349 } |
|
350 } |
|
351 } |
|
352 // --------------------------------------------------------------------------- |
|
353 // SearchProgressiveState::slotonGetDocumentComplete |
|
354 // --------------------------------------------------------------------------- |
|
355 void SearchProgressiveState::slotonGetDocumentComplete(int aError, |
331 CpixDocument* aDoc) |
356 CpixDocument* aDoc) |
332 { |
357 { |
|
358 if (aError == KErrServerTerminated) // server terminated refresh the handlers |
|
359 { |
|
360 constructHandlers(); |
|
361 mDatabasecount = 0; |
|
362 mLinkindex = 0; |
|
363 searchOnCategory(mSearchString); |
|
364 mContinuationSearch = true; |
|
365 return; |
|
366 } |
333 if (aError) |
367 if (aError) |
334 return; |
368 return; |
335 parseDocument(aDoc); |
369 parseDocument(aDoc); |
336 mResultparser++; |
370 mResultparser++; |
337 if (mResultparser < mResultcount) |
371 if (mResultparser < mResultcount) |
338 { |
372 { |
339 PERF_CAT_GETDOC_TIME_RESTART |
373 PERF_CAT_GETDOC_TIME_RESTART |
340 if (mResultparser < intial_iteration) |
374 if (mListView->count() < intial_iteration) |
341 { |
375 { |
342 mSearchHandler->getDocumentAsyncAtIndex(mResultparser); |
376 mSearchHandler->getDocumentAsyncAtIndex(mResultparser); |
343 } |
377 } |
344 else |
378 else |
345 { |
379 { |
378 PERF_CAT_GETDOC_ACCUMULATOR_ENDLOG |
421 PERF_CAT_GETDOC_ACCUMULATOR_ENDLOG |
379 searchOnCategory(mSearchString); |
422 searchOnCategory(mSearchString); |
380 } |
423 } |
381 } |
424 } |
382 // --------------------------------------------------------------------------- |
425 // --------------------------------------------------------------------------- |
383 // SearchProgressiveState::getSettingCategory |
426 // SearchProgressiveState::slotopenResultitem |
384 // --------------------------------------------------------------------------- |
427 // --------------------------------------------------------------------------- |
385 void SearchProgressiveState::getSettingCategory(int item, bool avalue) |
428 void SearchProgressiveState::slotopenResultitem(HbListWidgetItem * item) |
386 { |
|
387 mSelectedCategory.insert(item, avalue); |
|
388 } |
|
389 // --------------------------------------------------------------------------- |
|
390 // SearchProgressiveState::openResultitem |
|
391 // --------------------------------------------------------------------------- |
|
392 void SearchProgressiveState::openResultitem(HbListWidgetItem * item) |
|
393 { |
429 { |
394 if (item == NULL) |
430 if (item == NULL) |
395 return; |
431 return; |
396 PERF_RESULT_ITEM_LAUNCH_TIME_RESTART |
432 PERF_RESULT_ITEM_LAUNCH_TIME_RESTART |
397 QList<QVariant> args; |
433 QList<QVariant> args; |
398 bool t; |
434 bool t; |
|
435 if(mRequest) |
|
436 delete mRequest; |
399 mRequest = NULL; |
437 mRequest = NULL; |
400 if (item->data(Qt::UserRole + 1).toString().contains("contact")) |
438 if (item->data(Qt::UserRole + 1).toString().contains(CONTACTCATEGORY)) |
401 { |
439 { |
402 PERF_RESULT_ITEM_FOR_LAUNCHING("contact") |
440 PERF_RESULT_ITEM_FOR_LAUNCHING(CONTACTCATEGORY) |
403 mRequest = mAiwMgr->create(XQI_CONTACTS_VIEW,XQOP_CONTACTS_VIEW_CONTACT_CARD, true); |
441 mRequest = mAiwMgr->create(XQI_CONTACTS_VIEW,XQOP_CONTACTS_VIEW_CONTACT_CARD, true); |
404 |
442 |
405 int uid = (item->data(Qt::UserRole)).toInt(&t); |
443 int uid = (item->data(Qt::UserRole)).toInt(&t); |
406 args << uid; |
444 args << uid; |
407 } |
445 } |
408 else if (item->data(Qt::UserRole + 1).toString().contains("bookmark")) |
446 else if (item->data(Qt::UserRole + 1).toString().contains(BOOKMARKCATEGORY)) |
409 { |
447 { |
410 PERF_RESULT_ITEM_FOR_LAUNCHING("bookmark") |
448 PERF_RESULT_ITEM_FOR_LAUNCHING(BOOKMARKCATEGORY) |
411 QDesktopServices::openUrl(item->data(Qt::UserRole + 2).toString()); |
449 QDesktopServices::openUrl(item->data(Qt::UserRole + 2).toString()); |
412 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
450 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
413 |
451 |
414 } |
452 } |
415 else if (item->data(Qt::UserRole + 1).toString().contains("calendar")) |
453 else if (item->data(Qt::UserRole + 1).toString().contains(CALENDARCATEGORY)) |
416 { |
454 { |
417 QDir pluginDir = QDir(CALENDAR_EVENTVIEWER_PLUGIN_PATH); |
455 QDir pluginDir = QDir(CALENDAR_EVENTVIEWER_PLUGIN_PATH); |
418 QPluginLoader *calAgandaViewerPluginLoader = new QPluginLoader( |
456 QPluginLoader *calAgandaViewerPluginLoader = new QPluginLoader( |
419 pluginDir.absoluteFilePath(CALENDAR_EVENTVIEWER_PLUGIN_NAME)); |
457 pluginDir.absoluteFilePath(CALENDAR_EVENTVIEWER_PLUGIN_NAME)); |
420 |
458 |
421 calAgandaViewerPluginInstance = qobject_cast< |
459 calAgandaViewerPluginInstance = qobject_cast< |
422 EventViewerPluginInterface *> ( |
460 EventViewerPluginInterface *> ( |
423 calAgandaViewerPluginLoader->instance()); |
461 calAgandaViewerPluginLoader->instance()); |
424 |
462 |
425 connect(calAgandaViewerPluginInstance, SIGNAL(viewingCompleted()), |
463 connect(calAgandaViewerPluginInstance, SIGNAL(viewingCompleted()), |
426 this, SLOT(_viewingCompleted())); |
464 this, SLOT(slotviewingCompleted())); |
427 |
465 |
428 calAgandaViewerPluginInstance->viewEvent( |
466 calAgandaViewerPluginInstance->viewEvent( |
429 item->data(Qt::UserRole).toInt(), |
467 item->data(Qt::UserRole).toInt(), |
430 EventViewerPluginInterface::ActionEditDelete, NULL); |
468 EventViewerPluginInterface::ActionEditDelete, NULL); |
431 } |
469 } |
432 else if (item->data(Qt::UserRole + 1).toString().contains("applications")) |
470 else if (item->data(Qt::UserRole + 1).toString().contains(APPLICATIONCATEGORY)) |
433 { |
471 { |
434 PERF_RESULT_ITEM_FOR_LAUNCHING("applications") |
472 PERF_RESULT_ITEM_FOR_LAUNCHING(APPLICATIONCATEGORY) |
435 TRAP_IGNORE(LaunchApplicationL((item->data(Qt::UserRole)).toString())); |
473 TRAP_IGNORE(LaunchApplicationL((item->data(Qt::UserRole)).toString())); |
436 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG("") |
474 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG("") |
437 } |
475 } |
438 else if (item->data(Qt::UserRole + 1).toString().contains("file")) |
476 else if (item->data(Qt::UserRole + 1).toString().contains(FILECATEGORY)) |
439 { |
477 { |
440 PERF_RESULT_ITEM_FOR_LAUNCHING("file") |
478 PERF_RESULT_ITEM_FOR_LAUNCHING(FILECATEGORY) |
441 QString uid = item->data(Qt::UserRole).toString(); |
479 QString uid = item->data(Qt::UserRole).toString(); |
442 QFile file(uid); |
480 QFile file(uid); |
443 mRequest = mAiwMgr->create(file, true); |
481 mRequest = mAiwMgr->create(file, true); |
444 args << file.fileName(); |
482 args << file.fileName(); |
445 } |
483 } |
446 else if ((item->data(Qt::UserRole + 1).toString().contains("video")) |
484 else if ((item->data(Qt::UserRole + 1).toString().contains(VIDEOCATEGORY)) |
447 || (item->data(Qt::UserRole + 1).toString().contains("audio")) |
485 || (item->data(Qt::UserRole + 1).toString().contains(AUDIOCATEGORY))) |
448 || (item->data(Qt::UserRole + 1).toString().contains("image"))) |
486 { |
449 { |
487 PERF_RESULT_ITEM_FOR_LAUNCHING(AUDIOCATEGORY) |
450 PERF_RESULT_ITEM_FOR_LAUNCHING("media") |
|
451 QString uid = getDrivefromMediaId( |
488 QString uid = getDrivefromMediaId( |
452 item->data(Qt::UserRole + 2).toString()); |
489 item->data(Qt::UserRole + 2).toString()); |
453 uid.append(':'); |
490 uid.append(':'); |
454 uid.append(item->data(Qt::UserRole).toString()); |
491 uid.append(item->data(Qt::UserRole).toString()); |
455 QFile file(uid); |
492 QFile file(uid); |
456 mRequest = mAiwMgr->create(file, true); |
493 mRequest = mAiwMgr->create(file, false); |
457 args << file.fileName(); |
494 args << file.fileName(); |
458 } |
495 if(mRequest) |
459 |
496 { |
460 else if (item->data(Qt::UserRole + 1).toString().contains("notes")) |
497 QVariant title(hbTrId("txt_search_title_search")); |
461 { |
498 XQRequestInfo info; |
462 PERF_RESULT_ITEM_FOR_LAUNCHING("notes") |
499 info.setInfo(XQINFO_KEY_WINDOW_TITLE, title); |
|
500 mRequest->setInfo(info); |
|
501 mRequest->setBackground(false); |
|
502 mRequest->setSynchronous(false); |
|
503 } |
|
504 } |
|
505 else if ((item->data(Qt::UserRole + 1).toString().contains(IMAGECATEGORY))) |
|
506 { |
|
507 PERF_RESULT_ITEM_FOR_LAUNCHING(IMAGECATEGORY) |
|
508 QString uid = getDrivefromMediaId( |
|
509 item->data(Qt::UserRole + 2).toString()); |
|
510 uid.append(':'); |
|
511 uid.append(item->data(Qt::UserRole).toString()); |
|
512 QFile file(uid); |
|
513 mRequest = mAiwMgr->create(file, true); |
|
514 args << file.fileName(); |
|
515 } |
|
516 else if (item->data(Qt::UserRole + 1).toString().contains(NOTESCATEGORY)) |
|
517 { |
|
518 PERF_RESULT_ITEM_FOR_LAUNCHING(NOTESCATEGORY) |
463 if (mNotesEditor) |
519 if (mNotesEditor) |
464 { |
520 { |
465 mNotesEditor->edit(item->data(Qt::UserRole).toInt()); |
521 mNotesEditor->edit(item->data(Qt::UserRole).toInt()); |
466 } |
522 } |
467 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG("") |
523 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG("") |
468 } |
524 } |
469 else if (item->data(Qt::UserRole + 1).toString().contains("msg email")) |
525 else if (item->data(Qt::UserRole + 1).toString().contains(EMAILCATEGORY)) |
470 { |
526 { |
471 |
527 QVariantList listarg; |
472 mRequest = mAiwMgr->create(XQI_EMAIL_MESSAGE_VIEW,XQOP_EMAIL_MESSAGE_VIEW, true); |
528 listarg.append(item->data(Qt::UserRole + 2).toULongLong(&t)); |
473 |
529 listarg.append(item->data(Qt::UserRole + 3).toULongLong(&t)); |
474 args << item->data(Qt::UserRole + 2).toULongLong(&t) << item->data( |
530 listarg.append(item->data(Qt::UserRole).toULongLong(&t)); |
475 Qt::UserRole + 3).toULongLong(&t) |
531 |
476 << item->data(Qt::UserRole).toULongLong(&t); |
532 QVariant idListAsVariant = QVariant::fromValue(listarg); |
477 } |
533 |
478 else if (item->data(Qt::UserRole + 1).toString().contains("msg")) |
534 mRequest = mAiwMgr->create(XQI_EMAIL_MESSAGE_VIEW,XQOP_EMAIL_MESSAGE_VIEW, true); |
479 { |
535 args.append(idListAsVariant); |
480 PERF_RESULT_ITEM_FOR_LAUNCHING("msg") |
536 args.append(EmailNoFlags); |
|
537 } |
|
538 else if (item->data(Qt::UserRole + 1).toString().contains(MESSAGECATEGORY)) |
|
539 { |
|
540 PERF_RESULT_ITEM_FOR_LAUNCHING(MESSAGECATEGORY) |
481 mRequest = mAiwMgr->create(XQI_MESSAGE_VIEW, XQOP_MESSAGE_VIEW, true); |
541 mRequest = mAiwMgr->create(XQI_MESSAGE_VIEW, XQOP_MESSAGE_VIEW, true); |
482 |
542 |
483 int uid = (item->data(Qt::UserRole)).toInt(&t); |
543 int uid = (item->data(Qt::UserRole)).toInt(&t); |
484 args << uid; |
544 args << uid; |
485 } |
545 } |
486 else if (item->data(Qt::UserRole + 1).toString().contains("links")) |
546 else if (item->data(Qt::UserRole + 1).toString().contains(SUGGESTIONLINKS)) |
487 { |
547 { |
488 emit launchLink((item->data(Qt::UserRole)).toInt(&t), mOriginalString); |
548 emit launchLink((item->data(Qt::UserRole)).toInt(&t), mOriginalString); |
489 } |
549 } |
490 if (mRequest) |
550 if (mRequest) |
491 { |
551 { |
492 connect(mRequest, SIGNAL(requestOk(const QVariant&)), this, |
552 connect(mRequest, SIGNAL(requestOk(const QVariant&)), this, |
493 SLOT(handleOk(const QVariant&))); |
553 SLOT(slothandleOk(const QVariant&))); |
494 connect(mRequest, SIGNAL(requestError(int,const QString&)), this, |
554 connect(mRequest, SIGNAL(requestError(int,const QString&)), this, |
495 SLOT(handleError(int,const QString&)));// Connect error handling signal or apply lastError function instead. |
555 SLOT(slothandleError(int,const QString&)));// Connect error handling signal or apply lastError function instead. |
496 mRequest->setArguments(args); |
556 mRequest->setArguments(args); |
497 if (!mRequest->send())// Make the request |
557 if (!mRequest->send())// Make the request |
498 |
558 |
499 { |
559 { |
500 qDebug() << "AIW-ERROR: Send failed" << mRequest->lastError(); |
560 qDebug() << "AIW-ERROR: Send failed" << mRequest->lastError(); |
501 } |
561 } |
502 disconnect(mRequest, SIGNAL(requestOk(const QVariant&)), this, |
562 disconnect(mRequest, SIGNAL(requestOk(const QVariant&)), this, |
503 SLOT(handleOk(const QVariant&))); |
563 SLOT(slothandleOk(const QVariant&))); |
504 disconnect(mRequest, SIGNAL(requestError(int,const QString&)), this, |
564 disconnect(mRequest, SIGNAL(requestError(int,const QString&)), this, |
505 SLOT(handleError(int,const QString&)));// Connect error handling signal or apply lastError function instead. |
565 SLOT(slothandleError(int,const QString&)));// Connect error handling signal or apply lastError function instead. |
506 mRequest->deleteLater(); |
|
507 } |
566 } |
508 else |
567 else |
509 { |
568 { |
510 qDebug() << "AIW-ERROR: NULL request"; |
569 qDebug() << "AIW-ERROR: NULL request"; |
511 return; |
570 return; |
512 } |
571 } |
513 } |
572 } |
514 // --------------------------------------------------------------------------- |
573 // --------------------------------------------------------------------------- |
515 // SearchProgressiveState::handleOk |
574 // SearchProgressiveState::slothandleOk |
516 // --------------------------------------------------------------------------- |
575 // --------------------------------------------------------------------------- |
517 void SearchProgressiveState::handleOk(const QVariant& var) |
576 void SearchProgressiveState::slothandleOk(const QVariant& var) |
518 { |
577 { |
519 Q_UNUSED(var); |
578 Q_UNUSED(var); |
520 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
579 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
521 } |
580 } |
522 // --------------------------------------------------------------------------- |
581 // --------------------------------------------------------------------------- |
523 // SearchProgressiveState::handleError |
582 // SearchProgressiveState::slothandleError |
524 // --------------------------------------------------------------------------- |
583 // --------------------------------------------------------------------------- |
525 void SearchProgressiveState::handleError(int ret, const QString& var) |
584 void SearchProgressiveState::slothandleError(int ret, const QString& var) |
526 { |
585 { |
527 Q_UNUSED(ret); |
586 Q_UNUSED(ret); |
528 Q_UNUSED(var); |
587 Q_UNUSED(var); |
529 } |
588 } |
530 // --------------------------------------------------------------------------- |
589 // --------------------------------------------------------------------------- |
580 } |
639 } |
581 PERF_CAT_UI_TIME_RESTART |
640 PERF_CAT_UI_TIME_RESTART |
582 #endif |
641 #endif |
583 mResultparser = 0; |
642 mResultparser = 0; |
584 mResultcount = 0; |
643 mResultcount = 0; |
585 if (mDatabasecount < mTemplist.count()) |
644 mSearchHandler = NULL; |
586 { |
645 if (mDatabasecount < mUiLoader->ContentInfoList().count()) |
587 if (mTemplist.at(mDatabasecount).contains("selectall")) |
646 { |
588 { |
647 for (int i = 0; i < mUiLoader->ContentInfoList().count(); i++) |
589 mSearchHandler = mSearchHandlerList.at(0); |
648 { |
590 } |
649 //skip all categories if "selectall" option get selected, skip other iterations |
591 else if (mTemplist.at(mDatabasecount).contains("contact")) |
650 if (i == 0 && mUiLoader->ContentInfoList().at(i)->getSelected()) |
592 { |
651 { |
593 mSearchHandler = mSearchHandlerList.at(1); |
652 mSearchHandler = mSearchHandlerList.at(i); |
594 } |
653 mDatabasecount = mUiLoader->ContentInfoList().count(); |
595 else if (mTemplist.at(mDatabasecount).contains("image")) |
654 break; |
596 { |
655 } |
597 mSearchHandler = mSearchHandlerList.at(10); |
656 if (mUiLoader->ContentInfoList().at(i)->getSelected() |
598 } |
657 && (!mUiLoader->ContentInfoList().at(i)->getSearchProgress())) |
599 else if (mTemplist.at(mDatabasecount).contains("audio")) |
658 { |
600 { |
659 mSearchHandler = mSearchHandlerList.at(i); |
601 mSearchHandler = mSearchHandlerList.at(11); |
660 mUiLoader->ContentInfoList().at(i)->setSearchProgress(true); |
602 } |
661 break; |
603 else if (mTemplist.at(mDatabasecount).contains("video")) |
662 } |
604 { |
663 } |
605 mSearchHandler = mSearchHandlerList.at(12); |
|
606 } |
|
607 else if (mTemplist.at(mDatabasecount).contains("media")) |
|
608 { |
|
609 mSearchHandler = mSearchHandlerList.at(2); |
|
610 } |
|
611 else if (mTemplist.at(mDatabasecount).contains("msg")) |
|
612 { |
|
613 mSearchHandler = mSearchHandlerList.at(3); |
|
614 } |
|
615 else if (mTemplist.at(mDatabasecount).contains("email")) |
|
616 { |
|
617 mSearchHandler = mSearchHandlerList.at(4); |
|
618 } |
|
619 else if (mTemplist.at(mDatabasecount).contains("calendar")) |
|
620 { |
|
621 mSearchHandler = mSearchHandlerList.at(5); |
|
622 } |
|
623 else if (mTemplist.at(mDatabasecount).contains("notes")) |
|
624 { |
|
625 mSearchHandler = mSearchHandlerList.at(6); |
|
626 } |
|
627 else if (mTemplist.at(mDatabasecount).contains("applications")) |
|
628 { |
|
629 mSearchHandler = mSearchHandlerList.at(7); |
|
630 } |
|
631 else if (mTemplist.at(mDatabasecount).contains("file")) |
|
632 { |
|
633 mSearchHandler = mSearchHandlerList.at(8); |
|
634 } |
|
635 else if (mTemplist.at(mDatabasecount).contains("bookmark")) |
|
636 { |
|
637 mSearchHandler = mSearchHandlerList.at(9); |
|
638 } |
|
639 // mSearchHandler->setCategory(mTemplist.at(mDatabasecount)); |
|
640 mDatabasecount++; |
664 mDatabasecount++; |
641 if (mSearchHandler != NULL && mSearchHandler->isPrepared()) |
665 if (mSearchHandler != NULL && mSearchHandler->isPrepared()) |
642 { |
666 { |
643 PERF_CAT_API_TIME_RESTART |
667 PERF_CAT_API_TIME_RESTART |
644 mSearchHandler->searchAsync(aKeyword, "_aggregate"); |
668 mSearchHandler->searchAsync(aKeyword, DEFAULT_SEARCH_FIELD); |
645 |
669 |
646 } |
670 } |
647 else |
671 else |
648 { |
672 { |
649 searchOnCategory(mSearchString); |
673 searchOnCategory(mSearchString); |
650 } |
674 } |
651 } |
675 } |
652 else if (mDatabasecount >= mTemplist.count()) |
676 else |
653 { |
677 { |
654 PERF_TOTAL_UI_ENDLOG |
678 PERF_TOTAL_UI_ENDLOG |
655 if (mListView->count() == 0 && aKeyword.length() != 0) |
679 if (mListView->count() == 0 && aKeyword.length() != 0) |
656 { |
680 { |
657 noResultsFound(mOriginalString); |
681 noResultsFound(mOriginalString); |
704 mSearchString += "\")"; |
713 mSearchString += "\")"; |
705 searchOnCategory(mSearchString); |
714 searchOnCategory(mSearchString); |
706 } |
715 } |
707 } |
716 } |
708 // --------------------------------------------------------------------------- |
717 // --------------------------------------------------------------------------- |
709 // SearchProgressiveState::setSettings |
718 // SearchProgressiveState::slotsetSettings |
710 // --------------------------------------------------------------------------- |
719 // --------------------------------------------------------------------------- |
711 void SearchProgressiveState::setSettings() |
720 void SearchProgressiveState::slotsetSettings() |
712 { |
721 { |
713 mTempSelectedCategory = mSelectedCategory; |
722 for (int j = 0; j < mUiLoader->ContentInfoList().count(); j++) |
|
723 { |
|
724 mSelectedCategory.insert(j, |
|
725 mUiLoader->ContentInfoList().at(j)->getSelected()); |
|
726 } |
714 if (mOriginalString.length()) |
727 if (mOriginalString.length()) |
715 emit inDeviceSearchQuery(mOriginalString); |
728 emit inDeviceSearchQuery(mOriginalString); |
716 emit switchProToSettingsState(); |
729 emit switchProToSettingsState(); |
717 } |
730 } |
718 // --------------------------------------------------------------------------- |
731 // --------------------------------------------------------------------------- |
719 // SearchProgressiveState::settingsaction |
732 // SearchProgressiveState::slotsettingsaction |
720 // --------------------------------------------------------------------------- |
733 // --------------------------------------------------------------------------- |
721 void SearchProgressiveState::settingsaction(bool avalue) |
734 void SearchProgressiveState::slotsettingsaction(bool avalue) |
722 { |
735 { |
723 if (avalue && mStateStatus) |
736 if (avalue && mStateStatus) |
724 { |
737 { |
725 QMapIterator<int, bool> i(mTempSelectedCategory); |
738 QMap<int, bool> mTempSelectedCategory; |
726 QMapIterator<int, bool> j(mSelectedCategory); |
739 for (int i = 0; i < mUiLoader->ContentInfoList().count(); i++) |
727 while (i.hasNext()) |
740 { |
728 { |
741 mTempSelectedCategory.insert(i, |
729 i.next(); |
742 mUiLoader->ContentInfoList().at(i)->getSelected()); |
|
743 } |
|
744 QMapIterator<int, bool> j(mTempSelectedCategory); |
|
745 QMapIterator<int, bool> k(mSelectedCategory); |
|
746 while (j.hasNext()) |
|
747 { |
730 j.next(); |
748 j.next(); |
731 if (i.value() != j.value()) |
749 k.next(); |
|
750 if (j.value() != k.value()) |
732 { |
751 { |
733 startNewSearch(mOriginalString); |
752 slotstartNewSearch(mOriginalString); |
734 break; |
753 break; |
735 } |
754 } |
736 } |
755 } |
737 } |
|
738 } |
|
739 // --------------------------------------------------------------------------- |
|
740 // SearchProgressiveState::setSelectedCategories |
|
741 // --------------------------------------------------------------------------- |
|
742 void SearchProgressiveState::setSelectedCategories() |
|
743 { |
|
744 mTemplist.clear(); |
|
745 QMapIterator<int, bool> i(mSelectedCategory); |
|
746 bool isrootsearch = false; |
|
747 while (i.hasNext()) |
|
748 { |
|
749 i.next(); |
|
750 if (i.value()) |
|
751 { |
|
752 switch (i.key()) |
|
753 { |
|
754 case 0: |
|
755 { |
|
756 isrootsearch = true; |
|
757 // mTemplist.append("selectall"); |
|
758 break; |
|
759 } |
|
760 case 1: //Contacts |
|
761 { |
|
762 mTemplist.append("contact"); |
|
763 break; |
|
764 } |
|
765 case 2://Media |
|
766 { |
|
767 mTemplist.append("media"); |
|
768 break; |
|
769 } |
|
770 case 3://Messages& emails |
|
771 { |
|
772 mTemplist.append("msg"); |
|
773 mTemplist.append("email"); |
|
774 break; |
|
775 } |
|
776 case 4://Calender& notes |
|
777 { |
|
778 mTemplist.append("calendar"); |
|
779 mTemplist.append("notes"); |
|
780 break; |
|
781 } |
|
782 case 5://Applications |
|
783 { |
|
784 mTemplist.append("applications"); |
|
785 break; |
|
786 } |
|
787 case 6://Bookmarks |
|
788 { |
|
789 mTemplist.append("bookmark"); |
|
790 break; |
|
791 } |
|
792 case 7://All other files |
|
793 { |
|
794 mTemplist.append("file"); |
|
795 break; |
|
796 } |
|
797 } |
|
798 } |
|
799 } |
|
800 if (mTemplist.count() == 9) |
|
801 isrootsearch = true; |
|
802 if (isrootsearch) |
|
803 { |
|
804 mTemplist.clear(); |
|
805 mTemplist.append("selectall"); |
|
806 } |
756 } |
807 } |
757 } |
808 // --------------------------------------------------------------------------- |
758 // --------------------------------------------------------------------------- |
809 // SearchProgressiveState::getAppIconFromAppId |
759 // SearchProgressiveState::getAppIconFromAppId |
810 // --------------------------------------------------------------------------- |
760 // --------------------------------------------------------------------------- |
1115 Q_ARG(QUrl, url)); |
1064 Q_ARG(QUrl, url)); |
1116 delete mActivityManager; |
1065 delete mActivityManager; |
1117 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG("") |
1066 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG("") |
1118 } |
1067 } |
1119 // --------------------------------------------------------------------------- |
1068 // --------------------------------------------------------------------------- |
1120 // SearchProgressiveState::_viewingCompleted |
1069 // SearchProgressiveState::slotviewingCompleted |
1121 // --------------------------------------------------------------------------- |
1070 // --------------------------------------------------------------------------- |
1122 void SearchProgressiveState::_viewingCompleted() |
1071 void SearchProgressiveState::slotviewingCompleted() |
1123 { |
1072 { |
1124 if (calAgandaViewerPluginInstance) |
1073 if (calAgandaViewerPluginInstance) |
1125 calAgandaViewerPluginInstance->deleteLater(); |
1074 calAgandaViewerPluginInstance->deleteLater(); |
1126 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
1075 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
1127 } |
1076 } |
1128 // --------------------------------------------------------------------------- |
1077 // --------------------------------------------------------------------------- |
1129 // SearchProgressiveState::viewReady |
1078 // SearchProgressiveState::slotviewReady |
1130 // --------------------------------------------------------------------------- |
1079 // --------------------------------------------------------------------------- |
1131 void SearchProgressiveState::viewReady() |
1080 void SearchProgressiveState::slotviewReady() |
1132 { |
1081 { |
1133 if (hbApp) |
1082 if (hbApp) |
1134 { |
1083 { |
1135 if (hbApp->activateReason() == Hb::ActivationReasonActivity) |
1084 if (hbApp->activateReason() == Hb::ActivationReasonActivity) |
1136 { |
1085 { |
1137 QVariantHash params = hbApp->activateParams(); |
1086 QVariantHash params = hbApp->activateParams(); |
1138 QString searchKey = params.value("query").toString(); |
1087 QString searchKey = params.value(SEARCHAIWQUERY).toString(); |
1139 params.remove("query"); |
1088 params.remove(SEARCHAIWQUERY); |
1140 params.remove("activityname"); |
1089 params.remove(XQURI_KEY_ACTIVITY_NAME); |
1141 QList<QVariant> list = params.values(); |
1090 QList<QVariant> list = params.values(); |
1142 mTemplist.clear(); |
1091 for (int i = 0; i < mUiLoader->ContentInfoList().count(); i++) |
|
1092 { |
|
1093 mUiLoader->ContentInfoList().at(i)->setSelected(false); |
|
1094 } |
1143 for (int i = 0; i < list.count(); i++) |
1095 for (int i = 0; i < list.count(); i++) |
1144 { |
1096 { |
1145 QString str = list.at(i).toString(); |
1097 QString str = list.at(i).toString(); |
1146 if (!str.isNull()) |
1098 if (!str.isNull()) |
1147 mTemplist.append(str); |
1099 { |
|
1100 for (int j = 0; j < mUiLoader->ContentInfoList().count(); j++) |
|
1101 { |
|
1102 if (mUiLoader->ContentInfoList().at(i)->getBaseApp().contains( |
|
1103 str)) |
|
1104 mUiLoader->ContentInfoList().at(i)->setSelected( |
|
1105 true); |
|
1106 } |
|
1107 } |
1148 } |
1108 } |
1149 if (searchKey.length() > 0) |
1109 if (searchKey.length() > 0) |
1150 mSearchPanel->setCriteria(searchKey); |
1110 mSearchPanel->setCriteria(searchKey); |
1151 } |
1111 } |
1152 } |
1112 } |
1170 void SearchProgressiveState::slotISProvidersIcon(int id, HbIcon icon) |
1130 void SearchProgressiveState::slotISProvidersIcon(int id, HbIcon icon) |
1171 { |
1131 { |
1172 mISprovidersIcon.insert(id, icon); |
1132 mISprovidersIcon.insert(id, icon); |
1173 } |
1133 } |
1174 // --------------------------------------------------------------------------- |
1134 // --------------------------------------------------------------------------- |
1175 // SearchProgressiveState::slotPrepareResultIcons |
1135 // SearchProgressiveState::slotactivityRequested |
1176 // --------------------------------------------------------------------------- |
1136 // --------------------------------------------------------------------------- |
1177 void SearchProgressiveState::slotPrepareResultIcons() |
1137 void SearchProgressiveState::slotactivityRequested(const QString &name) |
1178 { |
1138 { |
1179 //Icon creation in array |
1139 if (name == SEARCHAIWDECLINDEVICE) |
1180 QStringList icons; |
|
1181 icons << "qtg_large_phonebook" << "qtg_large_tone" << "qtg_large_video" |
|
1182 << "qtg_large_photos" << "qtg_large_message" << "qtg_large_email" |
|
1183 << "qtg_large_calendar" << "qtg_large_notes" |
|
1184 << "qtg_large_web_link" << "qtg_large_text" << "qtg_large_sisx" |
|
1185 << "qtg_large_java" << "qtg_large_flash" << "qtg_large_query"; |
|
1186 mIconArray.clear(); |
|
1187 for (int i = 0; i < icons.count(); i++) |
|
1188 { |
|
1189 HbIcon icon(icons.at(i)); |
|
1190 if (icon.isNull() || !(icon.size().isValid())) |
|
1191 icon = HbIcon("qtg_large_application"); |
|
1192 mIconArray.append(icon); |
|
1193 } |
|
1194 } |
|
1195 // --------------------------------------------------------------------------- |
|
1196 // SearchProgressiveState::activityRequested |
|
1197 // --------------------------------------------------------------------------- |
|
1198 void SearchProgressiveState::activityRequested(const QString &name) |
|
1199 { |
|
1200 /* when search application is launched in normal and then supporting for activity uri |
|
1201 * for normal search launching "media" is used instead of "media image","media audio","media video" |
|
1202 */ |
|
1203 if (mSearchHandlerList.count() != totalcategories_activityreasonreason) |
|
1204 { |
|
1205 InDeviceHandler* handler = NULL; |
|
1206 handler->setCategory("media image"); |
|
1207 mSearchHandlerList.append(handler); |
|
1208 handler->setCategory("media audio"); |
|
1209 mSearchHandlerList.append(handler); |
|
1210 handler->setCategory("media video"); |
|
1211 mSearchHandlerList.append(handler); |
|
1212 } |
|
1213 if (name == "SearchDeviceQueryView") |
|
1214 { |
1140 { |
1215 QVariantHash params = hbApp->activateParams(); |
1141 QVariantHash params = hbApp->activateParams(); |
1216 QString searchKey = params.value("query").toString(); |
1142 QString searchKey = params.value(SEARCHAIWQUERY).toString(); |
1217 int i = params.count(); |
1143 int i = params.count(); |
1218 params.remove("query"); |
1144 params.remove(SEARCHAIWQUERY); |
1219 params.remove("activityname"); |
1145 params.remove(XQURI_KEY_ACTIVITY_NAME); |
1220 QList<QVariant> list = params.values(); |
1146 QList<QVariant> list = params.values(); |
1221 int j = list.count(); |
1147 for (int i = 0; i < mUiLoader->ContentInfoList().count(); i++) |
1222 mTemplist.clear(); |
1148 { |
|
1149 mUiLoader->ContentInfoList().at(i)->setSelected(false); |
|
1150 } |
1223 for (int i = 0; i < list.count(); i++) |
1151 for (int i = 0; i < list.count(); i++) |
1224 { |
1152 { |
1225 QString str = list.at(i).toString(); |
1153 QString str = list.at(i).toString(); |
1226 if (!str.isNull()) |
1154 if (!str.isNull()) |
1227 mTemplist.append(str); |
1155 { |
|
1156 for (int j = 0; j < mUiLoader->ContentInfoList().count(); j++) |
|
1157 { |
|
1158 if (mUiLoader->ContentInfoList().at(i)->getBaseApp().contains( |
|
1159 str)) |
|
1160 mUiLoader->ContentInfoList().at(i)->setSelected(true); |
|
1161 } |
|
1162 } |
1228 } |
1163 } |
1229 if (searchKey.length() > 0) |
1164 if (searchKey.length() > 0) |
1230 mSearchPanel->setCriteria(searchKey); |
1165 mSearchPanel->setCriteria(searchKey); |
1231 } |
1166 } |
1232 } |
1167 } |
1241 QString secondrow = aDoc->excerpt(); |
1176 QString secondrow = aDoc->excerpt(); |
1242 QString firstrow; |
1177 QString firstrow; |
1243 HbListWidgetItem* listitem = new HbListWidgetItem(); |
1178 HbListWidgetItem* listitem = new HbListWidgetItem(); |
1244 bool addtoList = true; |
1179 bool addtoList = true; |
1245 |
1180 |
1246 if (aDoc->baseAppClass().contains("contact")) |
1181 if (aDoc->baseAppClass().contains(FILEFOLDERCATEGORY)) |
1247 { |
1182 { |
1248 QStringList docsList = filterDoc(aDoc, "GivenName", "FamilyName"); |
|
1249 if (docsList.value(0, "").length()) |
|
1250 { |
|
1251 firstrow.append(docsList.at(0)); |
|
1252 } |
|
1253 if (docsList.value(1, "").length()) |
|
1254 { |
|
1255 if (firstrow.length()) |
|
1256 firstrow.append(" "); |
|
1257 firstrow.append(docsList.at(1)); |
|
1258 } |
|
1259 if (firstrow.length() == 0) |
|
1260 { |
|
1261 firstrow = hbTrId("txt_phob_dblist_unnamed"); |
|
1262 } |
|
1263 listitem->setData(mIconArray.at(0), Qt::DecorationRole); |
|
1264 } |
|
1265 else if (aDoc->baseAppClass().contains("audio")) |
|
1266 { |
|
1267 QStringList audioList = filterDoc(aDoc, "Title", "MediaId"); |
|
1268 if (audioList.value(0, "").length()) |
|
1269 { |
|
1270 firstrow.append(audioList.at(0)); |
|
1271 } |
|
1272 else |
|
1273 { |
|
1274 firstrow = hbTrId("txt_mus_dblist_val_unknown4"); |
|
1275 } |
|
1276 listitem->setData(mIconArray.at(1), Qt::DecorationRole); |
|
1277 if (audioList.value(1, "").length()) |
|
1278 { |
|
1279 listitem->setData(audioList.at(1), Qt::UserRole + 2); |
|
1280 } |
|
1281 } |
|
1282 else if (aDoc->baseAppClass().contains("video")) |
|
1283 { |
|
1284 QStringList videoList = filterDoc(aDoc, "Title", "MediaId", "Name"); |
|
1285 if (videoList.value(0, "").length()) |
|
1286 { |
|
1287 firstrow.append(videoList.at(0)); |
|
1288 } |
|
1289 else |
|
1290 { |
|
1291 firstrow.append(videoList.at(2)); |
|
1292 } |
|
1293 listitem->setData(mIconArray.at(2), Qt::DecorationRole); |
|
1294 if (videoList.value(1, "").length()) |
|
1295 { |
|
1296 listitem->setData(videoList.at(1), Qt::UserRole + 2); |
|
1297 } |
|
1298 } |
|
1299 else if (aDoc->baseAppClass().contains("image")) |
|
1300 { |
|
1301 QStringList imageList = filterDoc(aDoc, "Name", "MediaId"); |
|
1302 |
|
1303 firstrow.append(imageList.at(0)); |
|
1304 |
|
1305 listitem->setData(mIconArray.at(3), Qt::DecorationRole); |
|
1306 if (imageList.value(1, "").length()) |
|
1307 { |
|
1308 listitem->setData(imageList.at(1), Qt::UserRole + 2); |
|
1309 } |
|
1310 } |
|
1311 else if (aDoc->baseAppClass().contains("msg email")) |
|
1312 { |
|
1313 QStringList emailList = filterDoc(aDoc, "Sender", "MailBoxId", |
|
1314 "FolderId"); |
|
1315 firstrow.append(emailList.at(0)); |
|
1316 listitem->setData(emailList.at(1), Qt::UserRole + 2); |
|
1317 listitem->setData(emailList.at(2), Qt::UserRole + 3); |
|
1318 listitem->setData(mIconArray.at(5), Qt::DecorationRole); |
|
1319 } |
|
1320 else if (aDoc->baseAppClass().contains("msg")) |
|
1321 { |
|
1322 QStringList msgList = filterDoc(aDoc, "Folder", "To", "From"); |
|
1323 if (msgList.value(0).contains("Inbox")) |
|
1324 { |
|
1325 firstrow.append(msgList.at(2)); |
|
1326 } |
|
1327 else |
|
1328 { |
|
1329 if (msgList.value(1, "").length()) |
|
1330 { |
|
1331 firstrow.append(msgList.at(1)); |
|
1332 } |
|
1333 else if (msgList.value(0).contains("Drafts")) |
|
1334 { |
|
1335 firstrow = QString("(no recipient)"); |
|
1336 } |
|
1337 } |
|
1338 listitem->setData(mIconArray.at(4), Qt::DecorationRole); |
|
1339 } |
|
1340 else if (aDoc->baseAppClass().contains("calendar")) |
|
1341 { |
|
1342 firstrow.append(filterDoc(aDoc, "Summary")); |
|
1343 if (firstrow.length() == 0) |
|
1344 { |
|
1345 firstrow = hbTrId("txt_calendar_preview_unnamed"); |
|
1346 } |
|
1347 listitem->setData(mIconArray.at(6), Qt::DecorationRole); |
|
1348 } |
|
1349 else if (aDoc->baseAppClass().contains("notes")) |
|
1350 { |
|
1351 firstrow.append(filterDoc(aDoc, "Memo")); |
|
1352 if (firstrow.length() == 0) |
|
1353 { |
|
1354 firstrow = hbTrId("txt_notes_dblist_unnamed"); |
|
1355 } |
|
1356 listitem->setData(mIconArray.at(7), Qt::DecorationRole); |
|
1357 } |
|
1358 else if (aDoc->baseAppClass().contains("applications")) |
|
1359 { |
|
1360 firstrow.append(filterDoc(aDoc, "Name")); |
|
1361 bool ok; |
1183 bool ok; |
1362 TRAP_IGNORE(listitem->setData(getAppIconFromAppIdL(TUid::Uid(aDoc->docId().toUInt( |
1184 QStringList fileList = filterDoc(aDoc, NAMEFIELD, ISFOLDERFIELD, |
1363 &ok, 16))), Qt::DecorationRole)); |
1185 EXTENSIONFIELD); |
1364 } |
|
1365 else if (aDoc->baseAppClass().contains("bookmark")) |
|
1366 { |
|
1367 firstrow.append(filterDoc(aDoc, "Name")); |
|
1368 if (firstrow.length() == 0) |
|
1369 { |
|
1370 firstrow = "UnKnown"; |
|
1371 } |
|
1372 listitem->setData(secondrow, Qt::UserRole + 2); |
|
1373 listitem->setData(mIconArray.at(8), Qt::DecorationRole); |
|
1374 } |
|
1375 else if (aDoc->baseAppClass().contains("file folder")) |
|
1376 { |
|
1377 bool ok; |
|
1378 QStringList fileList = filterDoc(aDoc, "Name", "IsFolder", |
|
1379 "Extension"); |
|
1380 firstrow = fileList.at(0); |
1186 firstrow = fileList.at(0); |
1381 if (fileList.at(1).toInt(&ok) == 1) // not to show folder results |
1187 if (fileList.at(1).toInt(&ok) == 1) // not to show folder results |
1382 { |
1188 { |
1383 addtoList = false; |
1189 addtoList = false; |
1384 } |
1190 } |
1385 else |
1191 else |
1386 { |
1192 { |
1387 if (fileList.at(2).contains("sis", Qt::CaseInsensitive) |
1193 if (fileList.at(2).contains("sis", Qt::CaseInsensitive) |
1388 || fileList.at(1).contains("sisx", Qt::CaseInsensitive)) |
1194 || fileList.at(1).contains("sisx", Qt::CaseInsensitive)) |
1389 { |
1195 { |
1390 listitem->setData(mIconArray.at(10), Qt::DecorationRole); |
1196 listitem->setData(HbIcon("qtg_large_sisx"), Qt::DecorationRole); |
1391 } |
1197 } |
1392 else if (fileList.at(2).contains("java", Qt::CaseInsensitive) |
1198 else if (fileList.at(2).contains("java", Qt::CaseInsensitive) |
1393 || fileList.at(2).contains("jar", Qt::CaseInsensitive) |
1199 || fileList.at(2).contains("jar", Qt::CaseInsensitive) |
1394 || fileList.at(2).contains("jad", Qt::CaseInsensitive)) |
1200 || fileList.at(2).contains("jad", Qt::CaseInsensitive)) |
1395 { |
1201 { |
1396 listitem->setData(mIconArray.at(11), Qt::DecorationRole); |
1202 listitem->setData(HbIcon("qtg_large_java"), Qt::DecorationRole); |
1397 } |
1203 } |
1398 else if (fileList.at(2).contains("swf", Qt::CaseInsensitive)) |
1204 else if (fileList.at(2).contains("swf", Qt::CaseInsensitive)) |
1399 { |
1205 { |
1400 listitem->setData(mIconArray.at(12), Qt::DecorationRole); |
1206 listitem->setData(HbIcon("qtg_large_flash"), Qt::DecorationRole); |
1401 } |
1207 } |
1402 else |
1208 else |
1403 { |
1209 { |
1404 listitem->setData(mIconArray.at(13), Qt::DecorationRole); |
1210 listitem->setData(HbIcon("qtg_large_query"), Qt::DecorationRole); |
1405 } |
1211 } |
1406 } |
1212 } |
1407 } |
1213 } |
1408 else if (aDoc->baseAppClass().contains("file")) |
1214 else if (aDoc->baseAppClass().contains(FILECATEGORY)) |
1409 { |
1215 { |
1410 QStringList fileList = filterDoc(aDoc, "Name", "Extension"); |
1216 QStringList fileList = filterDoc(aDoc, NAMEFIELD, EXTENSIONFIELD); |
1411 firstrow = fileList.at(0); |
1217 firstrow = fileList.at(0); |
1412 if (firstrow.length() == 0) |
1218 if (firstrow.length() == 0) |
1413 firstrow = aDoc->baseAppClass(); |
1219 firstrow = aDoc->baseAppClass(); |
1414 if (fileList.at(1).contains("txt", Qt::CaseInsensitive)) |
1220 if (fileList.at(1).contains("txt", Qt::CaseInsensitive)) |
1415 { |
1221 { |
1416 listitem->setData(mIconArray.at(9), Qt::DecorationRole); |
1222 listitem->setData(HbIcon("qtg_large_text"), Qt::DecorationRole); |
1417 } |
1223 } |
1418 else |
1224 else |
1419 { |
1225 { |
1420 listitem->setData(mIconArray.at(13), Qt::DecorationRole); |
1226 listitem->setData(HbIcon("qtg_large_query"), Qt::DecorationRole); |
|
1227 } |
|
1228 } |
|
1229 else |
|
1230 { |
|
1231 if (aDoc->baseAppClass().contains(MEDIACATEGORY)) |
|
1232 { |
|
1233 QStringList medialist = filterDoc(aDoc, FIRSTLINEFIELD, MEDIAIDFIELD); |
|
1234 firstrow = medialist.at(0); |
|
1235 listitem->setData(medialist.at(1), Qt::UserRole + 2); |
|
1236 } |
|
1237 else if (aDoc->baseAppClass().contains(EMAILCATEGORY)) |
|
1238 { |
|
1239 QStringList emaillist = filterDoc(aDoc, FIRSTLINEFIELD, |
|
1240 MAILBOXFIELD, FOLDERFIELD); |
|
1241 firstrow = emaillist.at(0); |
|
1242 listitem->setData(emaillist.at(1), Qt::UserRole + 2); |
|
1243 listitem->setData(emaillist.at(2), Qt::UserRole + 3); |
|
1244 } |
|
1245 else |
|
1246 { |
|
1247 firstrow = filterDoc(aDoc, FIRSTLINEFIELD); |
|
1248 } |
|
1249 for (int i = 0; i < mUiLoader->ContentInfoList().count(); i++) |
|
1250 { |
|
1251 if (aDoc->baseAppClass() |
|
1252 == mUiLoader->ContentInfoList().at(i)->getBaseApp()) |
|
1253 { |
|
1254 if (!firstrow.length()) |
|
1255 { |
|
1256 firstrow = QString(hbTrId(mUiLoader->ContentInfoList().at(i)->getExceptionString().toAscii())); |
|
1257 } |
|
1258 if(mUiLoader->ContentInfoList().at(i)->getDisplayIcon().length()) |
|
1259 { |
|
1260 listitem->setData(HbIcon(mUiLoader->ContentInfoList().at(i)->getDisplayIcon()), Qt::DecorationRole); |
|
1261 } |
|
1262 else |
|
1263 { |
|
1264 bool ok; |
|
1265 TRAP_IGNORE(listitem->setData(getAppIconFromAppIdL(TUid::Uid(aDoc->docId().toUInt(&ok, 16))), Qt::DecorationRole)); |
|
1266 } |
|
1267 } |
1421 } |
1268 } |
1422 } |
1269 } |
1423 listitem->setText(firstrow); |
1270 listitem->setText(firstrow); |
1424 listitem->setSecondaryText(secondrow); |
1271 listitem->setSecondaryText(secondrow); |
1425 listitem->setData(aDoc->docId(), Qt::UserRole); |
1272 listitem->setData(aDoc->docId(), Qt::UserRole); |