22 #include <hbview.h> |
22 #include <hbview.h> |
23 #include <hblabel.h> |
23 #include <hblabel.h> |
24 #include <hbicon.h> |
24 #include <hbicon.h> |
25 #include <hbmenu.h> |
25 #include <hbmenu.h> |
26 #include <hbinstance.h> |
26 #include <hbinstance.h> |
27 #include <hblistview.h> |
|
28 #include <hbdocumentloader.h> |
27 #include <hbdocumentloader.h> |
29 #include <hbsearchpanel.h> |
28 #include <hbsearchpanel.h> |
30 #include <hbaction.h> |
29 #include <hbaction.h> |
31 #include <qstandarditemmodel.h> |
|
32 #include <hbframebackground.h> |
30 #include <hbframebackground.h> |
33 #include <hbabstractviewitem.h> |
|
34 #include <hbframebackground.h> |
|
35 #include <hblistviewitem.h> |
|
36 #include <hbapplication.h> |
31 #include <hbapplication.h> |
37 #include <qsortfilterproxymodel.h> |
32 #include <qsortfilterproxymodel.h> |
38 #include <AknsUtils.h> |
33 #include <AknsUtils.h> |
39 #include <bitdev.h> |
34 #include <bitdev.h> |
40 #include <bitstd.h> |
35 #include <bitstd.h> |
51 #include <apgcli.h> |
46 #include <apgcli.h> |
52 #include <AknTaskList.h> |
47 #include <AknTaskList.h> |
53 #include <apacmdln.h> |
48 #include <apacmdln.h> |
54 #include <xqconversions.h> |
49 #include <xqconversions.h> |
55 #include <apparc.h> |
50 #include <apparc.h> |
|
51 #include <qdesktopservices.h> |
|
52 #include <hblistwidget.h> |
|
53 #include <hblistwidgetitem.h> |
|
54 #include <hbabstractviewitem.h> |
|
55 #include <hblistviewitem.h> |
56 #define hbApp qobject_cast<HbApplication*>(qApp) |
56 #define hbApp qobject_cast<HbApplication*>(qApp) |
57 const char *SEARCHSTATEPROVIDER_DOCML = ":/xml/searchstateprovider.docml"; |
57 const char *SEARCHSTATEPROVIDER_DOCML = ":/xml/searchstateprovider.docml"; |
58 const char *TOC_VIEW = "tocView"; |
58 const char *TOC_VIEW = "tocView"; |
59 const char *TUT_SEARCHPANEL_WIDGET = "searchPanel"; |
59 const char *TUT_SEARCHPANEL_WIDGET = "searchPanel"; |
60 const char *TUT_LIST_VIEW = "listView"; |
60 const char *TUT_LIST_VIEW = "listView"; |
62 // --------------------------------------------------------------------------- |
62 // --------------------------------------------------------------------------- |
63 // SearchProgressiveState::SearchProgressiveState |
63 // SearchProgressiveState::SearchProgressiveState |
64 // --------------------------------------------------------------------------- |
64 // --------------------------------------------------------------------------- |
65 SearchProgressiveState::SearchProgressiveState(QState *parent) : |
65 SearchProgressiveState::SearchProgressiveState(QState *parent) : |
66 QState(parent), mMainWindow(NULL), mView(NULL), mListView(NULL), |
66 QState(parent), mMainWindow(NULL), mView(NULL), mListView(NULL), |
67 mDocumentLoader(NULL), mModel(NULL), mSearchHandler(NULL), |
67 mDocumentLoader(NULL), mSearchHandler(NULL), mNotesEditor(0), |
68 mNotesEditor(0), mAiwMgr(0), mRequest(0) |
68 mAiwMgr(0), mRequest(0) |
69 { |
69 { |
70 |
70 |
71 mMainWindow = hbInstance->allMainWindows().at(0); |
71 mMainWindow = hbInstance->allMainWindows().at(0); |
72 mModel = new QStandardItemModel(this); |
|
73 |
72 |
74 mAiwMgr = new XQApplicationManager; |
73 mAiwMgr = new XQApplicationManager; |
75 |
74 |
76 mDocumentLoader = new HbDocumentLoader(); |
75 mDocumentLoader = new HbDocumentLoader(); |
77 bool ok = false; |
76 bool ok = false; |
98 frame.setFrameType(HbFrameDrawer::NinePieces); |
97 frame.setFrameType(HbFrameDrawer::NinePieces); |
99 prototype->setDefaultFrame(frame); |
98 prototype->setDefaultFrame(frame); |
100 |
99 |
101 HbListViewItem *prototypeListView = qobject_cast<HbListViewItem *> ( |
100 HbListViewItem *prototypeListView = qobject_cast<HbListViewItem *> ( |
102 prototype); |
101 prototype); |
|
102 prototypeListView->setGraphicsSize(HbListViewItem::LargeIcon); |
103 if (prototypeListView) |
103 if (prototypeListView) |
104 { |
104 { |
105 HbStyle style; |
105 HbStyle style; |
106 qreal x; |
106 qreal x; |
107 style.parameter("hb-param-graphic-size-primary-large", x); |
107 style.parameter("hb-param-graphic-size-primary-large", x); |
108 QSizeF size(x, x); |
108 QSizeF size(x, x); |
109 mListViewIconSize = size.toSize(); |
109 mListViewIconSize = size.toSize(); |
110 prototypeListView->setTextFormat(Qt::RichText); |
110 prototypeListView->setTextFormat(Qt::RichText); |
111 } |
111 } |
112 mListView->setModel(mModel, prototype); |
|
113 |
112 |
114 HbAbstractItemView::ItemAnimations noCreationAndRemovalAnimations = |
113 HbAbstractItemView::ItemAnimations noCreationAndRemovalAnimations = |
115 HbAbstractItemView::All; |
114 HbAbstractItemView::All; |
116 noCreationAndRemovalAnimations ^= HbAbstractItemView::Appear; |
115 noCreationAndRemovalAnimations ^= HbAbstractItemView::Appear; |
117 noCreationAndRemovalAnimations ^= HbAbstractItemView::Disappear; |
116 noCreationAndRemovalAnimations ^= HbAbstractItemView::Disappear; |
121 mSearchPanel = qobject_cast<HbSearchPanel *> ( |
120 mSearchPanel = qobject_cast<HbSearchPanel *> ( |
122 mDocumentLoader->findWidget(TUT_SEARCHPANEL_WIDGET)); |
121 mDocumentLoader->findWidget(TUT_SEARCHPANEL_WIDGET)); |
123 if (mSearchPanel) |
122 if (mSearchPanel) |
124 { |
123 { |
125 mSearchPanel->setSearchOptionsEnabled(true); |
124 mSearchPanel->setSearchOptionsEnabled(true); |
126 |
125 |
127 mSearchPanel->setPlaceholderText(hbTrId("txt_search_dialog_search_device")); |
126 mSearchPanel->setPlaceholderText(hbTrId( |
|
127 "txt_search_dialog_search_device")); |
128 |
128 |
129 mSearchPanel->setCancelEnabled(false); |
129 mSearchPanel->setCancelEnabled(false); |
|
130 mSearchPanel->setFocus(); |
130 } |
131 } |
131 |
132 |
132 constructHandlers(); |
133 constructHandlers(); |
133 |
134 |
134 if (mView && mMainWindow) |
135 if (mView && mMainWindow) |
183 |
184 |
184 QObject *plugin = qobject_cast<QObject*> ( |
185 QObject *plugin = qobject_cast<QObject*> ( |
185 mNotespluginLoader->instance()); |
186 mNotespluginLoader->instance()); |
186 mNotesEditor = qobject_cast<NotesEditorInterface*> (plugin); |
187 mNotesEditor = qobject_cast<NotesEditorInterface*> (plugin); |
187 } |
188 } |
|
189 |
|
190 mOnlineQueryAvailable = false; |
188 } |
191 } |
189 // --------------------------------------------------------------------------- |
192 // --------------------------------------------------------------------------- |
190 // SearchProgressiveState::~SearchProgressiveState |
193 // SearchProgressiveState::~SearchProgressiveState |
191 // --------------------------------------------------------------------------- |
194 // --------------------------------------------------------------------------- |
192 SearchProgressiveState::~SearchProgressiveState() |
195 SearchProgressiveState::~SearchProgressiveState() |
193 { |
196 { |
194 if (mAiwMgr) |
197 if (mAiwMgr) |
195 { |
198 { |
196 delete mAiwMgr; |
199 delete mAiwMgr; |
197 } |
|
198 if (mModel) |
|
199 { |
|
200 delete mModel; |
|
201 } |
200 } |
202 if (mDocumentLoader) |
201 if (mDocumentLoader) |
203 { |
202 { |
204 delete mDocumentLoader; |
203 delete mDocumentLoader; |
205 } |
204 } |
296 } |
295 } |
297 mMainWindow->show(); |
296 mMainWindow->show(); |
298 } |
297 } |
299 if (loadSettings) |
298 if (loadSettings) |
300 { |
299 { |
301 emit settingsState(); |
300 emit switchProToSettingsState(); |
302 loadSettings = false; |
301 loadSettings = false; |
303 } |
302 } |
304 setSelectedCategories(); |
303 setSelectedCategories(); |
|
304 if (mOnlineQueryAvailable) |
|
305 { |
|
306 mSearchPanel->setCriteria(mOriginalString); |
|
307 mOnlineQueryAvailable = false; |
|
308 } |
305 } |
309 } |
306 // --------------------------------------------------------------------------- |
310 // --------------------------------------------------------------------------- |
307 // SearchProgressiveState::onExit |
311 // SearchProgressiveState::onExit |
308 // --------------------------------------------------------------------------- |
312 // --------------------------------------------------------------------------- |
309 void SearchProgressiveState::onExit(QEvent *event) |
313 void SearchProgressiveState::onExit(QEvent *event) |
325 SIGNAL(handleDocument(int,QCPixDocument*)), this, |
329 SIGNAL(handleDocument(int,QCPixDocument*)), this, |
326 SLOT(onGetDocumentComplete(int,QCPixDocument*))); |
330 SLOT(onGetDocumentComplete(int,QCPixDocument*))); |
327 } |
331 } |
328 if (mListView) |
332 if (mListView) |
329 { |
333 { |
330 connect(mListView, SIGNAL(activated(const QModelIndex)), this, |
334 connect(mListView, SIGNAL(activated(HbListWidgetItem *)), this, |
331 SLOT(openResultitem(const QModelIndex))); |
335 SLOT(openResultitem(HbListWidgetItem *))); |
332 } |
336 } |
333 if (mSearchPanel) |
337 if (mSearchPanel) |
334 { |
338 { |
335 connect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this, |
339 connect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this, |
336 SLOT(startNewSearch(QString))); |
340 SLOT(startNewSearch(QString))); |
355 SIGNAL(handleDocument(int,QCPixDocument*)), this, |
359 SIGNAL(handleDocument(int,QCPixDocument*)), this, |
356 SLOT(onGetDocumentComplete(int,QCPixDocument*))); |
360 SLOT(onGetDocumentComplete(int,QCPixDocument*))); |
357 } |
361 } |
358 if (mListView) |
362 if (mListView) |
359 { |
363 { |
360 disconnect(mListView, SIGNAL(activated(const QModelIndex)), this, |
364 disconnect(mListView, SIGNAL(activated(HbListWidgetItem *)), this, |
361 SLOT(openResultitem(const QModelIndex))); |
365 SLOT(openResultitem(HbListWidgetItem *))); |
362 } |
366 } |
363 if (mSearchPanel) |
367 if (mSearchPanel) |
364 { |
368 { |
365 disconnect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this, |
369 disconnect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this, |
366 SLOT(startNewSearch(QString))); |
370 SLOT(startNewSearch(QString))); |
406 if (aDoc == NULL || aError != 0) |
410 if (aDoc == NULL || aError != 0) |
407 return; |
411 return; |
408 QStringList liststr; |
412 QStringList liststr; |
409 QString secondrow = aDoc->excerpt(); |
413 QString secondrow = aDoc->excerpt(); |
410 QString firstrow; |
414 QString firstrow; |
411 QStandardItem* listitem = new QStandardItem(); |
415 HbListWidgetItem* listitem = new HbListWidgetItem(); |
412 |
416 |
413 if (aDoc->baseAppClass().contains("contact")) |
417 if (aDoc->baseAppClass().contains("contact")) |
414 { |
418 { |
415 QStringList docsList = filterDoc(aDoc, "GivenName", "FamilyName"); |
419 QStringList docsList = filterDoc(aDoc, "GivenName", "FamilyName"); |
416 if (docsList.value(0, "").length()) |
420 if (docsList.value(0, "").length()) |
448 listitem->setData(audioList.at(1), Qt::UserRole + 2); |
452 listitem->setData(audioList.at(1), Qt::UserRole + 2); |
449 } |
453 } |
450 } |
454 } |
451 else if (aDoc->baseAppClass().contains("video")) |
455 else if (aDoc->baseAppClass().contains("video")) |
452 { |
456 { |
453 QStringList videoList = filterDoc(aDoc, "Title", "MediaId","Name"); |
457 QStringList videoList = filterDoc(aDoc, "Title", "MediaId", "Name"); |
454 if (videoList.value(0, "").length()) |
458 if (videoList.value(0, "").length()) |
455 { |
459 { |
456 firstrow.append(videoList.at(0)); |
460 firstrow.append(videoList.at(0)); |
457 } |
461 } |
458 if (firstrow.length() == 0 && videoList.value(2, "").length()) |
462 if (firstrow.length() == 0 && videoList.value(2, "").length()) |
478 if (imageList.value(1, "").length()) |
482 if (imageList.value(1, "").length()) |
479 { |
483 { |
480 listitem->setData(imageList.at(1), Qt::UserRole + 2); |
484 listitem->setData(imageList.at(1), Qt::UserRole + 2); |
481 } |
485 } |
482 } |
486 } |
|
487 else if (aDoc->baseAppClass().contains("msg email")) |
|
488 { |
|
489 qDebug() << "searchui:on Get doc email"; |
|
490 QStringList emailList = filterDoc(aDoc, "Sender", "MailBoxId", |
|
491 "FolderId"); |
|
492 |
|
493 qDebug() << "searchui:recipients" << emailList.at(0) << emailList.at( |
|
494 1) << emailList.at(2); |
|
495 firstrow.append(emailList.at(0)); |
|
496 listitem->setData(emailList.at(1), Qt::UserRole + 2); |
|
497 listitem->setData(emailList.at(2), Qt::UserRole + 3); |
|
498 liststr << firstrow << secondrow; |
|
499 listitem->setData(mIconArray.at(5), Qt::DecorationRole); |
|
500 } |
483 else if (aDoc->baseAppClass().contains("msg")) |
501 else if (aDoc->baseAppClass().contains("msg")) |
484 { |
502 { |
485 QStringList msgList = filterDoc(aDoc, "Subject", "Body"); |
503 QStringList msgList = filterDoc(aDoc, "Subject", "Body"); |
486 if (msgList.value(0, "").length()) |
504 if (msgList.value(0, "").length()) |
487 { |
505 { |
496 { |
514 { |
497 firstrow = " ";// space if subject and body are missing |
515 firstrow = " ";// space if subject and body are missing |
498 } |
516 } |
499 liststr << firstrow << secondrow; |
517 liststr << firstrow << secondrow; |
500 listitem->setData(mIconArray.at(4), Qt::DecorationRole); |
518 listitem->setData(mIconArray.at(4), Qt::DecorationRole); |
501 } |
519 } |
502 else if (aDoc->baseAppClass().contains("email")) |
|
503 { |
|
504 firstrow.append(filterDoc(aDoc, "Subject")); |
|
505 liststr << firstrow << secondrow; |
|
506 listitem->setData(mIconArray.at(5), Qt::DecorationRole); |
|
507 } |
|
508 else if (aDoc->baseAppClass().contains("calendar")) |
520 else if (aDoc->baseAppClass().contains("calendar")) |
509 { |
521 { |
510 firstrow.append(filterDoc(aDoc, "Summary")); |
522 firstrow.append(filterDoc(aDoc, "Summary")); |
511 if (firstrow.length() == 0) |
523 if (firstrow.length() == 0) |
512 { |
524 { |
540 if (firstrow.length() == 0) |
552 if (firstrow.length() == 0) |
541 { |
553 { |
542 firstrow = "UnKnown"; |
554 firstrow = "UnKnown"; |
543 } |
555 } |
544 liststr << firstrow << secondrow; |
556 liststr << firstrow << secondrow; |
|
557 listitem->setData(secondrow, Qt::UserRole + 2); |
545 listitem->setData(mIconArray.at(8), Qt::DecorationRole); |
558 listitem->setData(mIconArray.at(8), Qt::DecorationRole); |
546 } |
559 } |
547 else if (aDoc->baseAppClass().contains("file")) |
560 else if (aDoc->baseAppClass().contains("file")) |
548 { |
561 { |
549 firstrow.append(filterDoc(aDoc, "Name")); |
562 firstrow.append(filterDoc(aDoc, "Name")); |
550 if (firstrow.length() == 0) |
563 if (firstrow.length() == 0) |
551 firstrow = aDoc->baseAppClass(); |
564 firstrow = aDoc->baseAppClass(); |
552 liststr << firstrow << secondrow; |
565 liststr << firstrow << secondrow; |
553 listitem->setData(mIconArray.at(9), Qt::DecorationRole); |
566 listitem->setData(mIconArray.at(9), Qt::DecorationRole); |
554 } |
567 } |
555 listitem->setData(liststr, Qt::DisplayRole); |
568 listitem->setText(firstrow); |
|
569 listitem->setSecondaryText(secondrow); |
556 listitem->setData(aDoc->docId(), Qt::UserRole); |
570 listitem->setData(aDoc->docId(), Qt::UserRole); |
557 listitem->setData(aDoc->baseAppClass(), Qt::UserRole + 1); |
571 listitem->setData(aDoc->baseAppClass(), Qt::UserRole + 1); |
558 mModel->appendRow(listitem); |
572 mListView->addItem(listitem); |
559 |
573 |
560 mResultparser++; |
574 mResultparser++; |
561 if (mResultparser < mResultcount) |
575 if (mResultparser < mResultcount) |
562 { |
576 { |
563 PERF_CAT_GETDOC_TIME_RESTART |
577 PERF_CAT_GETDOC_TIME_RESTART |
578 mSelectedCategory.insert(item, avalue); |
592 mSelectedCategory.insert(item, avalue); |
579 } |
593 } |
580 // --------------------------------------------------------------------------- |
594 // --------------------------------------------------------------------------- |
581 // SearchProgressiveState::openResultitem |
595 // SearchProgressiveState::openResultitem |
582 // --------------------------------------------------------------------------- |
596 // --------------------------------------------------------------------------- |
583 void SearchProgressiveState::openResultitem(QModelIndex index) |
597 void SearchProgressiveState::openResultitem(HbListWidgetItem * item) |
584 { |
598 { |
585 QStandardItem* item = mModel->itemFromIndex(index); |
|
586 if (item == NULL) |
599 if (item == NULL) |
587 return;PERF_RESULT_ITEM_LAUNCH_TIME_RESTART |
600 return;PERF_RESULT_ITEM_LAUNCH_TIME_RESTART |
588 QList<QVariant> args; |
601 QList<QVariant> args; |
589 bool t; |
602 bool t; |
590 mRequest = NULL; |
603 mRequest = NULL; |
598 args << uid; |
611 args << uid; |
599 } |
612 } |
600 else if (item->data(Qt::UserRole + 1).toString().contains("bookmark")) |
613 else if (item->data(Qt::UserRole + 1).toString().contains("bookmark")) |
601 { |
614 { |
602 PERF_RESULT_ITEM_FOR_LAUNCHING("bookmark") |
615 PERF_RESULT_ITEM_FOR_LAUNCHING("bookmark") |
603 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG("") |
616 QDesktopServices::openUrl(item->data(Qt::UserRole + 2).toString()); |
|
617 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
604 |
618 |
605 } |
619 } |
606 else if (item->data(Qt::UserRole + 1).toString().contains("calendar")) |
620 else if (item->data(Qt::UserRole + 1).toString().contains("calendar")) |
607 { |
621 { |
608 QDir pluginDir = QDir(QString("z:/resource/qt/plugins/calendar")); |
622 QDir pluginDir = QDir(QString("z:/resource/qt/plugins/calendar")); |
609 QPluginLoader *calAgandaViewerPluginLoader = new QPluginLoader( |
623 QPluginLoader *calAgandaViewerPluginLoader = new QPluginLoader( |
610 pluginDir.absoluteFilePath(QString( |
624 pluginDir.absoluteFilePath(QString( |
611 "agendaeventviewerplugin.qtplugin"))); |
625 "agendaeventviewerplugin.qtplugin"))); |
612 |
626 |
613 calAgandaViewerPluginInstance = qobject_cast< |
627 calAgandaViewerPluginInstance = qobject_cast< |
614 EventViewerPluginInterface *> ( |
628 EventViewerPluginInterface *> ( |
615 calAgandaViewerPluginLoader->instance()); |
629 calAgandaViewerPluginLoader->instance()); |
616 |
630 |
617 connect(calAgandaViewerPluginInstance, SIGNAL(viewingCompleted()), |
631 connect(calAgandaViewerPluginInstance, SIGNAL(viewingCompleted()), |
618 this, SLOT(_viewingCompleted())); |
632 this, SLOT(_viewingCompleted())); |
619 |
633 |
656 { |
670 { |
657 mNotesEditor->edit(item->data(Qt::UserRole).toInt()); |
671 mNotesEditor->edit(item->data(Qt::UserRole).toInt()); |
658 } |
672 } |
659 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG("") |
673 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG("") |
660 } |
674 } |
|
675 else if (item->data(Qt::UserRole + 1).toString().contains("msg email")) |
|
676 { |
|
677 |
|
678 mRequest = mAiwMgr->create("nmail", |
|
679 "com.nokia.symbian.IEmailMessageView", |
|
680 "viewMessage(QVariant,QVariant,QVariant)", false); |
|
681 |
|
682 args << item->data(Qt::UserRole + 2).toULongLong(&t) << item->data( |
|
683 Qt::UserRole + 3).toULongLong(&t) << item->data(Qt::UserRole).toULongLong(&t); |
|
684 } |
661 else if (item->data(Qt::UserRole + 1).toString().contains("msg")) |
685 else if (item->data(Qt::UserRole + 1).toString().contains("msg")) |
662 { |
686 { |
663 PERF_RESULT_ITEM_FOR_LAUNCHING("msg") |
687 PERF_RESULT_ITEM_FOR_LAUNCHING("msg") |
664 mRequest = mAiwMgr->create("com.nokia.services.hbserviceprovider", |
688 mRequest = mAiwMgr->create("com.nokia.services.hbserviceprovider", |
665 "conversationview", "view(int)", false); |
689 "conversationview", "view(int)", false); |
666 |
690 |
667 int uid = (item->data(Qt::UserRole)).toInt(&t); |
691 int uid = (item->data(Qt::UserRole)).toInt(&t); |
668 args << uid; |
692 args << uid; |
|
693 } |
|
694 else if(item->data(Qt::UserRole + 1).toString().contains("links")) |
|
695 { |
|
696 emit launchLink((item->data(Qt::UserRole)).toInt(&t),mOriginalString); |
669 } |
697 } |
670 if (mRequest) |
698 if (mRequest) |
671 { |
699 { |
672 connect(mRequest, SIGNAL(requestOk(const QVariant&)), this, |
700 connect(mRequest, SIGNAL(requestOk(const QVariant&)), this, |
673 SLOT(handleOk(const QVariant&))); |
701 SLOT(handleOk(const QVariant&))); |
674 connect(mRequest, SIGNAL(requestError(int,const QString&)), this, |
702 connect(mRequest, SIGNAL(requestError(int,const QString&)), this, |
675 SLOT(handleError(int,const QString&)));// Connect error handling signal or apply lastError function instead. |
703 SLOT(handleError(int,const QString&)));// Connect error handling signal or apply lastError function instead. |
676 mRequest->setArguments(args); |
704 mRequest->setArguments(args); |
677 if (!mRequest->send())// Make the request |
705 if (!mRequest->send())// Make the request |
|
706 |
678 { |
707 { |
679 qDebug() << "AIW-ERROR: Send failed" << mRequest->lastError(); |
708 qDebug() << "AIW-ERROR: Send failed" << mRequest->lastError(); |
680 } |
709 } |
681 disconnect(mRequest, SIGNAL(requestOk(const QVariant&)), this, |
710 disconnect(mRequest, SIGNAL(requestOk(const QVariant&)), this, |
682 SLOT(handleOk(const QVariant&))); |
711 SLOT(handleOk(const QVariant&))); |
707 Q_UNUSED(var); |
736 Q_UNUSED(var); |
708 } |
737 } |
709 // --------------------------------------------------------------------------- |
738 // --------------------------------------------------------------------------- |
710 // SearchProgressiveState::createSuggestionLink |
739 // SearchProgressiveState::createSuggestionLink |
711 // --------------------------------------------------------------------------- |
740 // --------------------------------------------------------------------------- |
712 void SearchProgressiveState::createSuggestionLink(bool aFlag) |
741 void SearchProgressiveState::createSuggestionLink() |
713 { |
742 { |
714 QStandardItem* listitem = new QStandardItem(); |
743 QString linkString = QString(hbTrId("txt_search_list_search_for_1").arg( |
715 if (!aFlag) |
744 mOriginalString)); |
716 { |
745 QMapIterator<int, HbIcon> i(mISprovidersIcon); |
717 QString linkString = QString(hbTrId("txt_search_list_search_for_1").arg(mOriginalString)); |
746 while (i.hasNext()) |
718 mLinkindex = mModel->rowCount(); |
747 { |
719 listitem->setData(linkString, Qt::DisplayRole); |
748 i.next(); |
720 mModel->appendRow(listitem); |
749 HbListWidgetItem* listitem = new HbListWidgetItem(); |
|
750 listitem->setText(linkString); |
|
751 listitem->setData(i.key(), Qt::UserRole); |
|
752 listitem->setData(i.value(), Qt::DecorationRole); |
|
753 listitem->setData("links", Qt::UserRole + 1); |
|
754 mListView->addItem(listitem); |
721 } |
755 } |
722 } |
756 } |
723 // --------------------------------------------------------------------------- |
757 // --------------------------------------------------------------------------- |
724 // SearchProgressiveState::noResultsFound |
758 // SearchProgressiveState::noResultsFound |
725 // --------------------------------------------------------------------------- |
759 // --------------------------------------------------------------------------- |
726 void SearchProgressiveState::noResultsFound(QString aKeyword) |
760 void SearchProgressiveState::noResultsFound(QString aKeyword) |
727 { |
761 { |
728 if (aKeyword.length()) |
762 if (aKeyword.length()) |
729 { |
763 { |
730 QStandardItem* listitem = new QStandardItem(); |
764 HbListWidgetItem* listitem = new HbListWidgetItem(); |
731 QString noResultMsg = QString("<align=\"center\">" + hbTrId( |
765 QString noResultMsg = QString("<align=\"center\">" + hbTrId( |
732 "txt_search_list_no_match_found")); |
766 "txt_search_list_no_match_found")); |
733 listitem->setData(noResultMsg, Qt::DisplayRole); |
767 listitem->setText(noResultMsg); |
734 mModel->appendRow(listitem); |
768 mListView->addItem(listitem); |
|
769 |
735 } |
770 } |
736 } |
771 } |
737 // --------------------------------------------------------------------------- |
772 // --------------------------------------------------------------------------- |
738 // SearchProgressiveState::clear |
773 // SearchProgressiveState::clear |
739 // --------------------------------------------------------------------------- |
774 // --------------------------------------------------------------------------- |
740 void SearchProgressiveState::clear() |
775 void SearchProgressiveState::clear() |
741 { |
776 { |
742 if (mModel) |
777 mListView->clear(); |
743 { |
|
744 mModel->clear(); |
|
745 } |
|
746 } |
778 } |
747 // --------------------------------------------------------------------------- |
779 // --------------------------------------------------------------------------- |
748 // SearchProgressiveState::searchOnCategory |
780 // SearchProgressiveState::searchOnCategory |
749 // --------------------------------------------------------------------------- |
781 // --------------------------------------------------------------------------- |
750 void SearchProgressiveState::searchOnCategory(const QString aKeyword) |
782 void SearchProgressiveState::searchOnCategory(const QString aKeyword) |
804 mDatabasecount++; |
836 mDatabasecount++; |
805 if (mSearchHandler->isPrepared()) |
837 if (mSearchHandler->isPrepared()) |
806 { |
838 { |
807 PERF_CAT_API_TIME_RESTART |
839 PERF_CAT_API_TIME_RESTART |
808 mSearchHandler->searchAsync(aKeyword, "_aggregate"); |
840 mSearchHandler->searchAsync(aKeyword, "_aggregate"); |
809 |
841 |
810 } |
842 } |
811 else |
843 else |
812 { |
844 { |
813 searchOnCategory(mSearchString); |
845 searchOnCategory(mSearchString); |
814 } |
846 } |
815 } |
847 } |
816 else if (mDatabasecount >= mTemplist.count()) |
848 else if (mDatabasecount >= mTemplist.count()) |
817 { |
849 { |
818 PERF_TOTAL_UI_ENDLOG |
850 PERF_TOTAL_UI_ENDLOG |
819 if (mModel->rowCount() == 0 && aKeyword.length() != 0) |
851 if (mListView->count() == 0 && aKeyword.length() != 0) |
820 { |
852 { |
821 noResultsFound(mOriginalString); |
853 noResultsFound(mOriginalString); |
822 createSuggestionLink(0); |
854 createSuggestionLink(); |
823 } |
855 } |
824 return; |
856 return; |
825 } |
857 } |
826 } |
858 } |
827 // --------------------------------------------------------------------------- |
859 // --------------------------------------------------------------------------- |
856 // SearchProgressiveState::setSettings |
888 // SearchProgressiveState::setSettings |
857 // --------------------------------------------------------------------------- |
889 // --------------------------------------------------------------------------- |
858 void SearchProgressiveState::setSettings() |
890 void SearchProgressiveState::setSettings() |
859 { |
891 { |
860 mTempSelectedCategory = mSelectedCategory; |
892 mTempSelectedCategory = mSelectedCategory; |
861 emit settingsState(); |
893 if (mOriginalString.length()) |
862 } |
894 emit inDeviceSearchQuery(mOriginalString); |
863 // --------------------------------------------------------------------------- |
895 emit switchProToSettingsState(); |
864 // SearchProgressiveState::_customizeGoButton |
|
865 // --------------------------------------------------------------------------- |
|
866 void SearchProgressiveState::_customizeGoButton(bool avalue) |
|
867 { |
|
868 if (mSearchPanel) |
|
869 { |
|
870 if (avalue) |
|
871 { |
|
872 mSearchPanel->setProgressive(false); |
|
873 } |
|
874 else |
|
875 { |
|
876 mSearchPanel->setProgressive(true); |
|
877 } |
|
878 } |
|
879 } |
896 } |
880 // --------------------------------------------------------------------------- |
897 // --------------------------------------------------------------------------- |
881 // SearchProgressiveState::settingsaction |
898 // SearchProgressiveState::settingsaction |
882 // --------------------------------------------------------------------------- |
899 // --------------------------------------------------------------------------- |
883 void SearchProgressiveState::settingsaction(bool avalue) |
900 void SearchProgressiveState::settingsaction(bool avalue) |
1027 CleanupStack::Pop(fileNameFromApparc); |
1044 CleanupStack::Pop(fileNameFromApparc); |
1028 } |
1045 } |
1029 CleanupStack::PopAndDestroy(apaMaskedBitmap); |
1046 CleanupStack::PopAndDestroy(apaMaskedBitmap); |
1030 } |
1047 } |
1031 CleanupStack::PopAndDestroy(&apaLsSession); |
1048 CleanupStack::PopAndDestroy(&apaLsSession); |
1032 |
1049 |
1033 if (icon.isNull() || !(icon.size().isValid())) |
1050 if (icon.isNull() || !(icon.size().isValid())) |
1034 icon = HbIcon("qtg_large_application"); |
1051 icon = HbIcon("qtg_large_application"); |
1035 return icon; |
1052 return icon; |
1036 } |
1053 } |
1037 // --------------------------------------------------------------------------- |
1054 // --------------------------------------------------------------------------- |
1038 // SearchProgressiveState::GetPixmapByFilenameL |
1055 // SearchProgressiveState::GetPixmapByFilenameL |
1039 // --------------------------------------------------------------------------- |
1056 // --------------------------------------------------------------------------- |