54 #include <hblistviewitem.h> |
54 #include <hblistviewitem.h> |
55 #include <hbactivitymanager.h> |
55 #include <hbactivitymanager.h> |
56 #define hbApp qobject_cast<HbApplication*>(qApp) |
56 #define hbApp qobject_cast<HbApplication*>(qApp) |
57 const int totalcategories_normalreason = 10; |
57 const int totalcategories_normalreason = 10; |
58 const int totalcategories_activityreasonreason = 13; |
58 const int totalcategories_activityreasonreason = 13; |
|
59 const int intial_iteration = 3; |
|
60 const int batch_iteration = 20; |
59 // --------------------------------------------------------------------------- |
61 // --------------------------------------------------------------------------- |
60 // SearchProgressiveState::SearchProgressiveState |
62 // SearchProgressiveState::SearchProgressiveState |
61 // --------------------------------------------------------------------------- |
63 // --------------------------------------------------------------------------- |
62 SearchProgressiveState::SearchProgressiveState(QState *parent) : |
64 SearchProgressiveState::SearchProgressiveState(QState *parent) : |
63 QState(parent), mMainWindow(NULL), mView(NULL), mListView(NULL), |
65 QState(parent), mMainWindow(NULL), mView(NULL), mListView(NULL), |
64 mSearchHandler(NULL), mNotesEditor(0), mAiwMgr(0), mRequest(0) |
66 mSearchHandler(NULL), mNotesEditor(0), mAiwMgr(0), mRequest(0) |
65 { |
67 { |
|
68 mUiLoader = SearchUiLoader::instance(); |
66 |
69 |
67 mMainWindow = hbInstance->allMainWindows().at(0); |
70 mMainWindow = hbInstance->allMainWindows().at(0); |
68 |
71 |
69 mAiwMgr = new XQApplicationManager; |
72 mAiwMgr = new XQApplicationManager; |
70 |
|
71 mUiLoader = SearchUiLoader::instance(); |
|
72 |
73 |
73 mView = mUiLoader->View(); |
74 mView = mUiLoader->View(); |
74 mListView = mUiLoader->ListWidget(); |
75 mListView = mUiLoader->ListWidget(); |
75 mSearchPanel = mUiLoader->SearchPanel(); |
76 mSearchPanel = mUiLoader->SearchPanel(); |
76 |
77 |
381 // SearchProgressiveState::onGetDocumentComplete |
323 // SearchProgressiveState::onGetDocumentComplete |
382 // --------------------------------------------------------------------------- |
324 // --------------------------------------------------------------------------- |
383 void SearchProgressiveState::onGetDocumentComplete(int aError, |
325 void SearchProgressiveState::onGetDocumentComplete(int aError, |
384 CpixDocument* aDoc) |
326 CpixDocument* aDoc) |
385 { |
327 { |
386 PERF_CAT_GETDOC_TIME_ACCUMULATE |
328 if (aError) |
387 if (aDoc == NULL || aError != 0) |
|
388 return; |
329 return; |
389 QString secondrow = aDoc->excerpt(); |
330 parseDocument(aDoc); |
390 QString firstrow; |
|
391 HbListWidgetItem* listitem = new HbListWidgetItem(); |
|
392 |
|
393 if (aDoc->baseAppClass().contains("contact")) |
|
394 { |
|
395 QStringList docsList = filterDoc(aDoc, "GivenName", "FamilyName"); |
|
396 if (docsList.value(0, "").length()) |
|
397 { |
|
398 firstrow.append(docsList.at(0)); |
|
399 } |
|
400 if (docsList.value(1, "").length()) |
|
401 { |
|
402 if (firstrow.length()) |
|
403 firstrow.append(" "); |
|
404 firstrow.append(docsList.at(1)); |
|
405 } |
|
406 if (firstrow.length() == 0) |
|
407 { |
|
408 firstrow = hbTrId("txt_phob_dblist_unnamed"); |
|
409 } |
|
410 listitem->setData(mIconArray.at(0), Qt::DecorationRole); |
|
411 } |
|
412 else if (aDoc->baseAppClass().contains("audio")) |
|
413 { |
|
414 QStringList audioList = filterDoc(aDoc, "Title", "MediaId"); |
|
415 if (audioList.value(0, "").length()) |
|
416 { |
|
417 firstrow.append(audioList.at(0)); |
|
418 } |
|
419 if (firstrow.length() == 0) |
|
420 { |
|
421 firstrow = hbTrId("txt_mus_dblist_val_unknown4"); |
|
422 } |
|
423 listitem->setData(mIconArray.at(1), Qt::DecorationRole); |
|
424 if (audioList.value(1, "").length()) |
|
425 { |
|
426 listitem->setData(audioList.at(1), Qt::UserRole + 2); |
|
427 } |
|
428 } |
|
429 else if (aDoc->baseAppClass().contains("video")) |
|
430 { |
|
431 QStringList videoList = filterDoc(aDoc, "Title", "MediaId", "Name"); |
|
432 if (videoList.value(0, "").length()) |
|
433 { |
|
434 firstrow.append(videoList.at(0)); |
|
435 } |
|
436 if (firstrow.length() == 0 && videoList.value(2, "").length()) |
|
437 { |
|
438 firstrow.append(videoList.at(2)); |
|
439 } |
|
440 listitem->setData(mIconArray.at(2), Qt::DecorationRole); |
|
441 if (videoList.value(1, "").length()) |
|
442 { |
|
443 listitem->setData(videoList.at(1), Qt::UserRole + 2); |
|
444 } |
|
445 } |
|
446 else if (aDoc->baseAppClass().contains("image")) |
|
447 { |
|
448 QStringList imageList = filterDoc(aDoc, "Name", "MediaId"); |
|
449 if (imageList.value(0, "").length()) |
|
450 { |
|
451 firstrow.append(imageList.at(0)); |
|
452 } |
|
453 listitem->setData(mIconArray.at(3), Qt::DecorationRole); |
|
454 if (imageList.value(1, "").length()) |
|
455 { |
|
456 listitem->setData(imageList.at(1), Qt::UserRole + 2); |
|
457 } |
|
458 } |
|
459 else if (aDoc->baseAppClass().contains("msg email")) |
|
460 { |
|
461 QStringList emailList = filterDoc(aDoc, "Sender", "MailBoxId", |
|
462 "FolderId"); |
|
463 firstrow.append(emailList.at(0)); |
|
464 listitem->setData(emailList.at(1), Qt::UserRole + 2); |
|
465 listitem->setData(emailList.at(2), Qt::UserRole + 3); |
|
466 listitem->setData(mIconArray.at(5), Qt::DecorationRole); |
|
467 } |
|
468 else if (aDoc->baseAppClass().contains("msg")) |
|
469 { |
|
470 QStringList msgList = filterDoc(aDoc, "Folder", "To", "From"); |
|
471 if (msgList.value(0).contains("Inbox")) |
|
472 { |
|
473 firstrow.append(msgList.at(2)); |
|
474 } |
|
475 else |
|
476 { |
|
477 if (msgList.value(1, "").length()) |
|
478 firstrow.append(msgList.at(1)); |
|
479 } |
|
480 listitem->setData(mIconArray.at(4), Qt::DecorationRole); |
|
481 } |
|
482 else if (aDoc->baseAppClass().contains("calendar")) |
|
483 { |
|
484 firstrow.append(filterDoc(aDoc, "Summary")); |
|
485 if (firstrow.length() == 0) |
|
486 { |
|
487 firstrow = hbTrId("txt_calendar_preview_unnamed"); |
|
488 } |
|
489 listitem->setData(mIconArray.at(6), Qt::DecorationRole); |
|
490 } |
|
491 else if (aDoc->baseAppClass().contains("notes")) |
|
492 { |
|
493 firstrow.append(filterDoc(aDoc, "Memo")); |
|
494 if (firstrow.length() == 0) |
|
495 { |
|
496 firstrow = hbTrId("txt_notes_dblist_unnamed"); |
|
497 } |
|
498 listitem->setData(mIconArray.at(7), Qt::DecorationRole); |
|
499 } |
|
500 else if (aDoc->baseAppClass().contains("applications")) |
|
501 { |
|
502 firstrow.append(filterDoc(aDoc, "Name")); |
|
503 bool ok; |
|
504 TRAP_IGNORE(listitem->setData(getAppIconFromAppIdL(TUid::Uid(aDoc->docId().toInt( |
|
505 &ok, 16))), Qt::DecorationRole)); |
|
506 } |
|
507 else if (aDoc->baseAppClass().contains("bookmark")) |
|
508 { |
|
509 firstrow.append(filterDoc(aDoc, "Name")); |
|
510 if (firstrow.length() == 0) |
|
511 { |
|
512 firstrow = "UnKnown"; |
|
513 } |
|
514 listitem->setData(secondrow, Qt::UserRole + 2); |
|
515 listitem->setData(mIconArray.at(8), Qt::DecorationRole); |
|
516 } |
|
517 else if (aDoc->baseAppClass().contains("file folder")) |
|
518 { |
|
519 bool ok; |
|
520 QStringList fileList = filterDoc(aDoc, "Name", "IsFolder", |
|
521 "Extension"); |
|
522 firstrow = fileList.at(0); |
|
523 if (fileList.at(1).toInt(&ok) == 1) // folder result icon map |
|
524 { |
|
525 listitem->setData(mIconArray.at(13), Qt::DecorationRole); |
|
526 } |
|
527 else |
|
528 { |
|
529 if (fileList.at(2).contains("sis", Qt::CaseInsensitive) |
|
530 || fileList.at(1).contains("sisx", Qt::CaseInsensitive)) |
|
531 { |
|
532 listitem->setData(mIconArray.at(10), Qt::DecorationRole); |
|
533 } |
|
534 else if (fileList.at(2).contains("java", Qt::CaseInsensitive) |
|
535 || fileList.at(2).contains("jar", Qt::CaseInsensitive) |
|
536 || fileList.at(2).contains("jad", Qt::CaseInsensitive)) |
|
537 { |
|
538 listitem->setData(mIconArray.at(11), Qt::DecorationRole); |
|
539 } |
|
540 else if (fileList.at(2).contains("swf", Qt::CaseInsensitive)) |
|
541 { |
|
542 listitem->setData(mIconArray.at(12), Qt::DecorationRole); |
|
543 } |
|
544 else |
|
545 { |
|
546 listitem->setData(mIconArray.at(14), Qt::DecorationRole); |
|
547 } |
|
548 } |
|
549 } |
|
550 else if (aDoc->baseAppClass().contains("file")) |
|
551 { |
|
552 QStringList fileList = filterDoc(aDoc, "Name", "Extension"); |
|
553 firstrow = fileList.at(0); |
|
554 if (firstrow.length() == 0) |
|
555 firstrow = aDoc->baseAppClass(); |
|
556 if (fileList.at(1).contains("txt", Qt::CaseInsensitive)) |
|
557 { |
|
558 listitem->setData(mIconArray.at(9), Qt::DecorationRole); |
|
559 } |
|
560 else |
|
561 { |
|
562 listitem->setData(mIconArray.at(14), Qt::DecorationRole); |
|
563 } |
|
564 } |
|
565 listitem->setText(firstrow); |
|
566 listitem->setSecondaryText(secondrow); |
|
567 listitem->setData(aDoc->docId(), Qt::UserRole); |
|
568 listitem->setData(aDoc->baseAppClass(), Qt::UserRole + 1); |
|
569 mListView->addItem(listitem); |
|
570 |
|
571 mResultparser++; |
331 mResultparser++; |
572 if (mResultparser < mResultcount) |
332 if (mResultparser < mResultcount) |
573 { |
333 { |
574 PERF_CAT_GETDOC_TIME_RESTART |
334 PERF_CAT_GETDOC_TIME_RESTART |
575 mSearchHandler->getDocumentAsyncAtIndex(mResultparser); |
335 if (mResultparser < intial_iteration) |
|
336 { |
|
337 mSearchHandler->getDocumentAsyncAtIndex(mResultparser); |
|
338 } |
|
339 else |
|
340 { |
|
341 mSearchHandler->getBatchDocumentAsyncAtIndex(mResultparser, |
|
342 batch_iteration); |
|
343 } |
576 } |
344 } |
577 else |
345 else |
578 { |
346 { |
579 PERF_CAT_GETDOC_ACCUMULATOR_ENDLOG |
347 PERF_CAT_GETDOC_ACCUMULATOR_ENDLOG |
580 searchOnCategory(mSearchString); |
348 searchOnCategory(mSearchString); |
581 } |
349 } |
|
350 } |
|
351 // --------------------------------------------------------------------------- |
|
352 // SearchProgressiveState::onGetDocumentComplete |
|
353 // --------------------------------------------------------------------------- |
|
354 void SearchProgressiveState::onGetBatchDocumentComplete(int aError, |
|
355 int aCount, CpixDocument** aDoc) |
|
356 { |
|
357 if (aError) |
|
358 return; |
|
359 for (int i = 0; i < aCount; i++) |
|
360 { |
|
361 parseDocument(aDoc[i]); |
|
362 } |
582 delete aDoc; |
363 delete aDoc; |
|
364 mResultparser += aCount; |
|
365 if (mResultparser < mResultcount) |
|
366 { |
|
367 PERF_CAT_GETDOC_TIME_RESTART |
|
368 mSearchHandler->getBatchDocumentAsyncAtIndex(mResultparser, |
|
369 batch_iteration); |
|
370 } |
|
371 else |
|
372 { |
|
373 PERF_CAT_GETDOC_ACCUMULATOR_ENDLOG |
|
374 searchOnCategory(mSearchString); |
|
375 } |
583 } |
376 } |
584 // --------------------------------------------------------------------------- |
377 // --------------------------------------------------------------------------- |
585 // SearchProgressiveState::getSettingCategory |
378 // SearchProgressiveState::getSettingCategory |
586 // --------------------------------------------------------------------------- |
379 // --------------------------------------------------------------------------- |
587 void SearchProgressiveState::getSettingCategory(int item, bool avalue) |
380 void SearchProgressiveState::getSettingCategory(int item, bool avalue) |
675 mRequest = mAiwMgr->create("nmail", |
469 mRequest = mAiwMgr->create("nmail", |
676 "com.nokia.symbian.IEmailMessageView", |
470 "com.nokia.symbian.IEmailMessageView", |
677 "viewMessage(QVariant,QVariant,QVariant)", true); |
471 "viewMessage(QVariant,QVariant,QVariant)", true); |
678 |
472 |
679 args << item->data(Qt::UserRole + 2).toULongLong(&t) << item->data( |
473 args << item->data(Qt::UserRole + 2).toULongLong(&t) << item->data( |
680 Qt::UserRole + 3).toULongLong(&t) << item->data(Qt::UserRole).toULongLong(&t); |
474 Qt::UserRole + 3).toULongLong(&t) |
|
475 << item->data(Qt::UserRole).toULongLong(&t); |
681 } |
476 } |
682 else if (item->data(Qt::UserRole + 1).toString().contains("msg")) |
477 else if (item->data(Qt::UserRole + 1).toString().contains("msg")) |
683 { |
478 { |
684 PERF_RESULT_ITEM_FOR_LAUNCHING("msg") |
479 PERF_RESULT_ITEM_FOR_LAUNCHING("msg") |
685 mRequest = mAiwMgr->create("messaging", |
480 mRequest = mAiwMgr->create("messaging", |
686 "com.nokia.symbian.IMessageView", "view(int)", true); |
481 "com.nokia.symbian.IMessageView", "view(int)", true); |
687 |
482 |
688 int uid = (item->data(Qt::UserRole)).toInt(&t); |
483 int uid = (item->data(Qt::UserRole)).toInt(&t); |
689 args << uid; |
484 args << uid; |
690 } |
485 } |
691 else if(item->data(Qt::UserRole + 1).toString().contains("links")) |
486 else if (item->data(Qt::UserRole + 1).toString().contains("links")) |
692 { |
487 { |
693 emit launchLink((item->data(Qt::UserRole)).toInt(&t),mOriginalString); |
488 emit launchLink((item->data(Qt::UserRole)).toInt(&t), mOriginalString); |
694 } |
489 } |
695 if (mRequest) |
490 if (mRequest) |
696 { |
491 { |
697 connect(mRequest, SIGNAL(requestOk(const QVariant&)), this, |
492 connect(mRequest, SIGNAL(requestOk(const QVariant&)), this, |
698 SLOT(handleOk(const QVariant&))); |
493 SLOT(handleOk(const QVariant&))); |
1319 User::LeaveIfError(appArcSession.StartApp(*cmdLine)); |
1131 User::LeaveIfError(appArcSession.StartApp(*cmdLine)); |
1320 CleanupStack::PopAndDestroy(cmdLine); |
1132 CleanupStack::PopAndDestroy(cmdLine); |
1321 CleanupStack::PopAndDestroy(&appArcSession); |
1133 CleanupStack::PopAndDestroy(&appArcSession); |
1322 } |
1134 } |
1323 CleanupStack::PopAndDestroy(&wsSession); |
1135 CleanupStack::PopAndDestroy(&wsSession); |
1324 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
1136 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
1325 } |
1137 } |
1326 // --------------------------------------------------------------------------- |
1138 // --------------------------------------------------------------------------- |
1327 // SearchProgressiveState::_viewingCompleted |
1139 // SearchProgressiveState::_viewingCompleted |
1328 // --------------------------------------------------------------------------- |
1140 // --------------------------------------------------------------------------- |
1329 void SearchProgressiveState::_viewingCompleted() |
1141 void SearchProgressiveState::_viewingCompleted() |
1330 { |
1142 { |
1331 if (calAgandaViewerPluginInstance) |
1143 if (calAgandaViewerPluginInstance) |
1332 calAgandaViewerPluginInstance->deleteLater(); |
1144 calAgandaViewerPluginInstance->deleteLater(); |
1333 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
1145 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
1334 } |
1146 } |
1335 // --------------------------------------------------------------------------- |
1147 // --------------------------------------------------------------------------- |
1336 // SearchProgressiveState::viewReady |
1148 // SearchProgressiveState::viewReady |
1337 // --------------------------------------------------------------------------- |
1149 // --------------------------------------------------------------------------- |
1338 void SearchProgressiveState::viewReady() |
1150 void SearchProgressiveState::viewReady() |
1339 { |
1151 { |
1340 |
|
1341 if (hbApp) |
1152 if (hbApp) |
1342 { |
1153 { |
1343 if (hbApp->activateReason() == Hb::ActivationReasonActivity) |
1154 if (hbApp->activateReason() == Hb::ActivationReasonActivity) |
1344 { |
1155 { |
1345 QVariantHash params = hbApp->activateParams(); |
1156 QVariantHash params = hbApp->activateParams(); |
1453 } |
1265 } |
1454 if (searchKey.length() > 0) |
1266 if (searchKey.length() > 0) |
1455 mSearchPanel->setCriteria(searchKey); |
1267 mSearchPanel->setCriteria(searchKey); |
1456 } |
1268 } |
1457 } |
1269 } |
|
1270 // --------------------------------------------------------------------------- |
|
1271 // SearchProgressiveState::parseDocument |
|
1272 // --------------------------------------------------------------------------- |
|
1273 void SearchProgressiveState::parseDocument(CpixDocument* aDoc) |
|
1274 { |
|
1275 PERF_CAT_GETDOC_TIME_ACCUMULATE |
|
1276 if (aDoc == NULL) |
|
1277 return; |
|
1278 QString secondrow = aDoc->excerpt(); |
|
1279 QString firstrow; |
|
1280 HbListWidgetItem* listitem = new HbListWidgetItem(); |
|
1281 |
|
1282 if (aDoc->baseAppClass().contains("contact")) |
|
1283 { |
|
1284 QStringList docsList = filterDoc(aDoc, "GivenName", "FamilyName"); |
|
1285 if (docsList.value(0, "").length()) |
|
1286 { |
|
1287 firstrow.append(docsList.at(0)); |
|
1288 } |
|
1289 if (docsList.value(1, "").length()) |
|
1290 { |
|
1291 if (firstrow.length()) |
|
1292 firstrow.append(" "); |
|
1293 firstrow.append(docsList.at(1)); |
|
1294 } |
|
1295 if (firstrow.length() == 0) |
|
1296 { |
|
1297 firstrow = hbTrId("txt_phob_dblist_unnamed"); |
|
1298 } |
|
1299 listitem->setData(mIconArray.at(0), Qt::DecorationRole); |
|
1300 } |
|
1301 else if (aDoc->baseAppClass().contains("audio")) |
|
1302 { |
|
1303 QStringList audioList = filterDoc(aDoc, "Title", "MediaId"); |
|
1304 if (audioList.value(0, "").length()) |
|
1305 { |
|
1306 firstrow.append(audioList.at(0)); |
|
1307 } |
|
1308 if (firstrow.length() == 0) |
|
1309 { |
|
1310 firstrow = hbTrId("txt_mus_dblist_val_unknown4"); |
|
1311 } |
|
1312 listitem->setData(mIconArray.at(1), Qt::DecorationRole); |
|
1313 if (audioList.value(1, "").length()) |
|
1314 { |
|
1315 listitem->setData(audioList.at(1), Qt::UserRole + 2); |
|
1316 } |
|
1317 } |
|
1318 else if (aDoc->baseAppClass().contains("video")) |
|
1319 { |
|
1320 QStringList videoList = filterDoc(aDoc, "Title", "MediaId", "Name"); |
|
1321 if (videoList.value(0, "").length()) |
|
1322 { |
|
1323 firstrow.append(videoList.at(0)); |
|
1324 } |
|
1325 if (firstrow.length() == 0 && videoList.value(2, "").length()) |
|
1326 { |
|
1327 firstrow.append(videoList.at(2)); |
|
1328 } |
|
1329 listitem->setData(mIconArray.at(2), Qt::DecorationRole); |
|
1330 if (videoList.value(1, "").length()) |
|
1331 { |
|
1332 listitem->setData(videoList.at(1), Qt::UserRole + 2); |
|
1333 } |
|
1334 } |
|
1335 else if (aDoc->baseAppClass().contains("image")) |
|
1336 { |
|
1337 QStringList imageList = filterDoc(aDoc, "Name", "MediaId"); |
|
1338 if (imageList.value(0, "").length()) |
|
1339 { |
|
1340 firstrow.append(imageList.at(0)); |
|
1341 } |
|
1342 listitem->setData(mIconArray.at(3), Qt::DecorationRole); |
|
1343 if (imageList.value(1, "").length()) |
|
1344 { |
|
1345 listitem->setData(imageList.at(1), Qt::UserRole + 2); |
|
1346 } |
|
1347 } |
|
1348 else if (aDoc->baseAppClass().contains("msg email")) |
|
1349 { |
|
1350 QStringList emailList = filterDoc(aDoc, "Sender", "MailBoxId", |
|
1351 "FolderId"); |
|
1352 firstrow.append(emailList.at(0)); |
|
1353 listitem->setData(emailList.at(1), Qt::UserRole + 2); |
|
1354 listitem->setData(emailList.at(2), Qt::UserRole + 3); |
|
1355 listitem->setData(mIconArray.at(5), Qt::DecorationRole); |
|
1356 } |
|
1357 else if (aDoc->baseAppClass().contains("msg")) |
|
1358 { |
|
1359 QStringList msgList = filterDoc(aDoc, "Folder", "To", "From"); |
|
1360 if (msgList.value(0).contains("Inbox")) |
|
1361 { |
|
1362 firstrow.append(msgList.at(2)); |
|
1363 } |
|
1364 else |
|
1365 { |
|
1366 if (msgList.value(1, "").length()) |
|
1367 firstrow.append(msgList.at(1)); |
|
1368 } |
|
1369 listitem->setData(mIconArray.at(4), Qt::DecorationRole); |
|
1370 } |
|
1371 else if (aDoc->baseAppClass().contains("calendar")) |
|
1372 { |
|
1373 firstrow.append(filterDoc(aDoc, "Summary")); |
|
1374 if (firstrow.length() == 0) |
|
1375 { |
|
1376 firstrow = hbTrId("txt_calendar_preview_unnamed"); |
|
1377 } |
|
1378 listitem->setData(mIconArray.at(6), Qt::DecorationRole); |
|
1379 } |
|
1380 else if (aDoc->baseAppClass().contains("notes")) |
|
1381 { |
|
1382 firstrow.append(filterDoc(aDoc, "Memo")); |
|
1383 if (firstrow.length() == 0) |
|
1384 { |
|
1385 firstrow = hbTrId("txt_notes_dblist_unnamed"); |
|
1386 } |
|
1387 listitem->setData(mIconArray.at(7), Qt::DecorationRole); |
|
1388 } |
|
1389 else if (aDoc->baseAppClass().contains("applications")) |
|
1390 { |
|
1391 firstrow.append(filterDoc(aDoc, "Name")); |
|
1392 bool ok; |
|
1393 TRAP_IGNORE(listitem->setData(getAppIconFromAppIdL(TUid::Uid(aDoc->docId().toUInt( |
|
1394 &ok, 16))), Qt::DecorationRole)); |
|
1395 } |
|
1396 else if (aDoc->baseAppClass().contains("bookmark")) |
|
1397 { |
|
1398 firstrow.append(filterDoc(aDoc, "Name")); |
|
1399 if (firstrow.length() == 0) |
|
1400 { |
|
1401 firstrow = "UnKnown"; |
|
1402 } |
|
1403 listitem->setData(secondrow, Qt::UserRole + 2); |
|
1404 listitem->setData(mIconArray.at(8), Qt::DecorationRole); |
|
1405 } |
|
1406 else if (aDoc->baseAppClass().contains("file folder")) |
|
1407 { |
|
1408 bool ok; |
|
1409 QStringList fileList = filterDoc(aDoc, "Name", "IsFolder", |
|
1410 "Extension"); |
|
1411 firstrow = fileList.at(0); |
|
1412 if (fileList.at(1).toInt(&ok) == 1) // folder result icon map |
|
1413 |
|
1414 { |
|
1415 listitem->setData(mIconArray.at(13), Qt::DecorationRole); |
|
1416 } |
|
1417 else |
|
1418 { |
|
1419 if (fileList.at(2).contains("sis", Qt::CaseInsensitive) |
|
1420 || fileList.at(1).contains("sisx", Qt::CaseInsensitive)) |
|
1421 { |
|
1422 listitem->setData(mIconArray.at(10), Qt::DecorationRole); |
|
1423 } |
|
1424 else if (fileList.at(2).contains("java", Qt::CaseInsensitive) |
|
1425 || fileList.at(2).contains("jar", Qt::CaseInsensitive) |
|
1426 || fileList.at(2).contains("jad", Qt::CaseInsensitive)) |
|
1427 { |
|
1428 listitem->setData(mIconArray.at(11), Qt::DecorationRole); |
|
1429 } |
|
1430 else if (fileList.at(2).contains("swf", Qt::CaseInsensitive)) |
|
1431 { |
|
1432 listitem->setData(mIconArray.at(12), Qt::DecorationRole); |
|
1433 } |
|
1434 else |
|
1435 { |
|
1436 listitem->setData(mIconArray.at(14), Qt::DecorationRole); |
|
1437 } |
|
1438 } |
|
1439 } |
|
1440 else if (aDoc->baseAppClass().contains("file")) |
|
1441 { |
|
1442 QStringList fileList = filterDoc(aDoc, "Name", "Extension"); |
|
1443 firstrow = fileList.at(0); |
|
1444 if (firstrow.length() == 0) |
|
1445 firstrow = aDoc->baseAppClass(); |
|
1446 if (fileList.at(1).contains("txt", Qt::CaseInsensitive)) |
|
1447 { |
|
1448 listitem->setData(mIconArray.at(9), Qt::DecorationRole); |
|
1449 } |
|
1450 else |
|
1451 { |
|
1452 listitem->setData(mIconArray.at(14), Qt::DecorationRole); |
|
1453 } |
|
1454 } |
|
1455 listitem->setText(firstrow); |
|
1456 listitem->setSecondaryText(secondrow); |
|
1457 listitem->setData(aDoc->docId(), Qt::UserRole); |
|
1458 listitem->setData(aDoc->baseAppClass(), Qt::UserRole + 1); |
|
1459 mListView->addItem(listitem); |
|
1460 |
|
1461 delete aDoc; |
|
1462 } |
|
1463 |
|
1464 InDeviceHandler* SearchProgressiveState::constructHandlers(int mDatabase) |
|
1465 { |
|
1466 InDeviceHandler* handler = NULL; |
|
1467 handler = new InDeviceHandler(); |
|
1468 switch (mDatabase) |
|
1469 { |
|
1470 case 0: |
|
1471 { |
|
1472 handler->setCategory(""); |
|
1473 break; |
|
1474 } |
|
1475 case 1: |
|
1476 { |
|
1477 handler->setCategory("contact"); |
|
1478 break; |
|
1479 } |
|
1480 case 2: |
|
1481 { |
|
1482 handler->setCategory("media"); |
|
1483 break; |
|
1484 } |
|
1485 case 3: |
|
1486 { |
|
1487 handler->setCategory("msg"); |
|
1488 break; |
|
1489 } |
|
1490 case 4: |
|
1491 { |
|
1492 handler->setCategory("msg email"); |
|
1493 break; |
|
1494 } |
|
1495 case 5: |
|
1496 { |
|
1497 handler->setCategory("calendar"); |
|
1498 break; |
|
1499 } |
|
1500 case 6: |
|
1501 { |
|
1502 handler->setCategory("notes"); |
|
1503 break; |
|
1504 } |
|
1505 case 7: |
|
1506 { |
|
1507 handler->setCategory("applications"); |
|
1508 break; |
|
1509 } |
|
1510 case 8: |
|
1511 { |
|
1512 handler->setCategory("file"); |
|
1513 break; |
|
1514 } |
|
1515 case 9: |
|
1516 { |
|
1517 // handler->setCategory("bookmark"); |
|
1518 break; |
|
1519 } |
|
1520 case 10: |
|
1521 { |
|
1522 handler->setCategory("media image"); |
|
1523 break; |
|
1524 } |
|
1525 case 11: |
|
1526 { |
|
1527 handler->setCategory("media audio"); |
|
1528 break; |
|
1529 } |
|
1530 case 12: |
|
1531 { |
|
1532 handler->setCategory("media video"); |
|
1533 break; |
|
1534 } |
|
1535 } |
|
1536 return handler; |
|
1537 } |