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> |
43 #include <AknInternalIconUtils.h> |
38 #include <AknInternalIconUtils.h> |
44 #include <AknIconUtils.h> |
39 #include <AknIconUtils.h> |
45 #include <apaidpartner.h> |
40 #include <apaidpartner.h> |
46 #include <qpluginloader.h> |
41 #include <qpluginloader.h> |
47 #include <eventviewerplugininterface.h> |
42 #include <eventviewerplugininterface.h> |
48 #include <noteseditor.h> |
43 #include <noteseditorinterface.h> |
49 #include <w32std.h> |
44 #include <w32std.h> |
50 #include <apgtask.h> |
45 #include <apgtask.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 const char *SEARCHSTATEPROVIDER_DOCML = ":/xml/searchstateprovider.docml"; |
57 const char *SEARCHSTATEPROVIDER_DOCML = ":/xml/searchstateprovider.docml"; |
57 const char *TOC_VIEW = "tocView"; |
58 const char *TOC_VIEW = "tocView"; |
58 const char *TUT_SEARCHPANEL_WIDGET = "searchPanel"; |
59 const char *TUT_SEARCHPANEL_WIDGET = "searchPanel"; |
59 const char *TUT_LIST_VIEW = "listView"; |
60 const char *TUT_LIST_VIEW = "listView"; |
60 const int totalcategories = 10; |
61 const int totalcategories = 10; |
61 // --------------------------------------------------------------------------- |
62 // --------------------------------------------------------------------------- |
62 // SearchProgressiveState::SearchProgressiveState |
63 // SearchProgressiveState::SearchProgressiveState |
63 // --------------------------------------------------------------------------- |
64 // --------------------------------------------------------------------------- |
64 SearchProgressiveState::SearchProgressiveState(QState *parent) : |
65 SearchProgressiveState::SearchProgressiveState(QState *parent) : |
65 QState(parent), mMainWindow(NULL), mView(NULL), mListView(NULL), |
66 QState(parent), mMainWindow(NULL), mView(NULL), mListView(NULL), |
66 mDocumentLoader(NULL), mModel(NULL), mSearchHandler(NULL), |
67 mDocumentLoader(NULL), mSearchHandler(NULL), mNotesEditor(0), |
67 notesEditor(0), mAiwMgr(0), mRequest(0) |
68 mAiwMgr(0), mRequest(0) |
68 { |
69 { |
69 |
70 |
70 mMainWindow = hbInstance->allMainWindows().at(0); |
71 mMainWindow = hbInstance->allMainWindows().at(0); |
71 mModel = new QStandardItemModel(this); |
|
72 |
72 |
73 mAiwMgr = new XQApplicationManager; |
73 mAiwMgr = new XQApplicationManager; |
74 |
74 |
75 mDocumentLoader = new HbDocumentLoader(); |
75 mDocumentLoader = new HbDocumentLoader(); |
76 bool ok = false; |
76 bool ok = false; |
97 frame.setFrameType(HbFrameDrawer::NinePieces); |
97 frame.setFrameType(HbFrameDrawer::NinePieces); |
98 prototype->setDefaultFrame(frame); |
98 prototype->setDefaultFrame(frame); |
99 |
99 |
100 HbListViewItem *prototypeListView = qobject_cast<HbListViewItem *> ( |
100 HbListViewItem *prototypeListView = qobject_cast<HbListViewItem *> ( |
101 prototype); |
101 prototype); |
|
102 prototypeListView->setGraphicsSize(HbListViewItem::LargeIcon); |
102 if (prototypeListView) |
103 if (prototypeListView) |
103 { |
104 { |
104 HbStyle style; |
105 HbStyle style; |
105 qreal x; |
106 qreal x; |
106 style.parameter("hb-param-graphic-size-primary-large", x); |
107 style.parameter("hb-param-graphic-size-primary-large", x); |
107 QSizeF size(x, x); |
108 QSizeF size(x, x); |
108 mListViewIconSize = size.toSize(); |
109 mListViewIconSize = size.toSize(); |
109 prototypeListView->setTextFormat(Qt::RichText); |
110 prototypeListView->setTextFormat(Qt::RichText); |
110 } |
111 } |
111 mListView->setModel(mModel, prototype); |
|
112 |
112 |
113 HbAbstractItemView::ItemAnimations noCreationAndRemovalAnimations = |
113 HbAbstractItemView::ItemAnimations noCreationAndRemovalAnimations = |
114 HbAbstractItemView::All; |
114 HbAbstractItemView::All; |
115 noCreationAndRemovalAnimations ^= HbAbstractItemView::Appear; |
115 noCreationAndRemovalAnimations ^= HbAbstractItemView::Appear; |
116 noCreationAndRemovalAnimations ^= HbAbstractItemView::Disappear; |
116 noCreationAndRemovalAnimations ^= HbAbstractItemView::Disappear; |
120 mSearchPanel = qobject_cast<HbSearchPanel *> ( |
120 mSearchPanel = qobject_cast<HbSearchPanel *> ( |
121 mDocumentLoader->findWidget(TUT_SEARCHPANEL_WIDGET)); |
121 mDocumentLoader->findWidget(TUT_SEARCHPANEL_WIDGET)); |
122 if (mSearchPanel) |
122 if (mSearchPanel) |
123 { |
123 { |
124 mSearchPanel->setSearchOptionsEnabled(true); |
124 mSearchPanel->setSearchOptionsEnabled(true); |
125 |
125 |
126 mSearchPanel->setPlaceholderText("Search device"); |
126 mSearchPanel->setPlaceholderText(hbTrId( |
|
127 "txt_search_dialog_search_device")); |
127 |
128 |
128 mSearchPanel->setCancelEnabled(false); |
129 mSearchPanel->setCancelEnabled(false); |
|
130 mSearchPanel->setFocus(); |
129 } |
131 } |
130 |
132 |
131 constructHandlers(); |
133 constructHandlers(); |
132 |
134 |
133 if (mView && mMainWindow) |
135 if (mView && mMainWindow) |
165 m_categorySearchUiTime.start(); |
167 m_categorySearchUiTime.start(); |
166 m_totalSearchUiTime.start(); |
168 m_totalSearchUiTime.start(); |
167 m_categoryGetDocumentApiTime.start(); |
169 m_categoryGetDocumentApiTime.start(); |
168 m_getDocumentCatergoryTimeAccumulator = 0; |
170 m_getDocumentCatergoryTimeAccumulator = 0; |
169 #endif |
171 #endif |
|
172 |
|
173 //Notes Editor Interface loading |
|
174 QDir dir(NOTES_EDITOR_PLUGIN_PATH); |
|
175 QString pluginName = dir.absoluteFilePath(NOTES_EDITOR_PLUGIN_NAME); |
|
176 |
|
177 // Create plugin loader. |
|
178 mNotespluginLoader = new QPluginLoader(pluginName); |
|
179 |
|
180 if (mNotespluginLoader) |
|
181 { |
|
182 // Load the plugin. |
|
183 mNotespluginLoader->load(); |
|
184 |
|
185 QObject *plugin = qobject_cast<QObject*> ( |
|
186 mNotespluginLoader->instance()); |
|
187 mNotesEditor = qobject_cast<NotesEditorInterface*> (plugin); |
|
188 } |
|
189 |
|
190 mOnlineQueryAvailable = false; |
170 } |
191 } |
171 // --------------------------------------------------------------------------- |
192 // --------------------------------------------------------------------------- |
172 // SearchProgressiveState::~SearchProgressiveState |
193 // SearchProgressiveState::~SearchProgressiveState |
173 // --------------------------------------------------------------------------- |
194 // --------------------------------------------------------------------------- |
174 SearchProgressiveState::~SearchProgressiveState() |
195 SearchProgressiveState::~SearchProgressiveState() |
175 { |
196 { |
176 if (mAiwMgr) |
197 if (mAiwMgr) |
177 { |
198 { |
178 delete mAiwMgr; |
199 delete mAiwMgr; |
179 } |
200 } |
180 if (mModel) |
|
181 { |
|
182 delete mModel; |
|
183 } |
|
184 if (mDocumentLoader) |
201 if (mDocumentLoader) |
185 { |
202 { |
186 delete mDocumentLoader; |
203 delete mDocumentLoader; |
187 } |
204 } |
188 for (int i = 0; i < mSearchHandlerList.count(); i++) |
205 for (int i = 0; i < mSearchHandlerList.count(); i++) |
189 { |
206 { |
190 delete mSearchHandlerList.at(i); |
207 delete mSearchHandlerList.at(i); |
191 } |
208 } |
192 if(notesEditor) |
209 if (mNotespluginLoader) |
193 { |
210 { |
194 delete notesEditor; |
211 mNotespluginLoader->unload(); |
|
212 delete mNotespluginLoader; |
195 } |
213 } |
196 } |
214 } |
197 // --------------------------------------------------------------------------- |
215 // --------------------------------------------------------------------------- |
198 // SearchProgressiveState::constructHandlers |
216 // SearchProgressiveState::constructHandlers |
199 // --------------------------------------------------------------------------- |
217 // --------------------------------------------------------------------------- |
277 } |
295 } |
278 mMainWindow->show(); |
296 mMainWindow->show(); |
279 } |
297 } |
280 if (loadSettings) |
298 if (loadSettings) |
281 { |
299 { |
282 emit settingsState(); |
300 emit switchProToSettingsState(); |
283 loadSettings = false; |
301 loadSettings = false; |
284 } |
302 } |
285 setSelectedCategories(); |
303 setSelectedCategories(); |
|
304 if (mOnlineQueryAvailable) |
|
305 { |
|
306 mSearchPanel->setCriteria(mOriginalString); |
|
307 mOnlineQueryAvailable = false; |
|
308 } |
286 } |
309 } |
287 // --------------------------------------------------------------------------- |
310 // --------------------------------------------------------------------------- |
288 // SearchProgressiveState::onExit |
311 // SearchProgressiveState::onExit |
289 // --------------------------------------------------------------------------- |
312 // --------------------------------------------------------------------------- |
290 void SearchProgressiveState::onExit(QEvent *event) |
313 void SearchProgressiveState::onExit(QEvent *event) |
306 SIGNAL(handleDocument(int,QCPixDocument*)), this, |
329 SIGNAL(handleDocument(int,QCPixDocument*)), this, |
307 SLOT(onGetDocumentComplete(int,QCPixDocument*))); |
330 SLOT(onGetDocumentComplete(int,QCPixDocument*))); |
308 } |
331 } |
309 if (mListView) |
332 if (mListView) |
310 { |
333 { |
311 connect(mListView, SIGNAL(activated(const QModelIndex)), this, |
334 connect(mListView, SIGNAL(activated(HbListWidgetItem *)), this, |
312 SLOT(openResultitem(const QModelIndex))); |
335 SLOT(openResultitem(HbListWidgetItem *))); |
313 } |
336 } |
314 if (mSearchPanel) |
337 if (mSearchPanel) |
315 { |
338 { |
316 connect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this, |
339 connect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this, |
317 SLOT(startNewSearch(QString))); |
340 SLOT(startNewSearch(QString))); |
318 connect(mSearchPanel, SIGNAL(searchOptionsClicked()), this, |
341 connect(mSearchPanel, SIGNAL(searchOptionsClicked()), this, |
319 SLOT(setSettings())); |
342 SLOT(setSettings())); |
320 } |
343 } |
|
344 |
|
345 connect(mMainWindow, SIGNAL(viewReady()), this, SLOT(viewReady())); |
321 |
346 |
322 } |
347 } |
323 // --------------------------------------------------------------------------- |
348 // --------------------------------------------------------------------------- |
324 // SearchProgressiveState::deActivateSignals |
349 // SearchProgressiveState::deActivateSignals |
325 // --------------------------------------------------------------------------- |
350 // --------------------------------------------------------------------------- |
334 SIGNAL(handleDocument(int,QCPixDocument*)), this, |
359 SIGNAL(handleDocument(int,QCPixDocument*)), this, |
335 SLOT(onGetDocumentComplete(int,QCPixDocument*))); |
360 SLOT(onGetDocumentComplete(int,QCPixDocument*))); |
336 } |
361 } |
337 if (mListView) |
362 if (mListView) |
338 { |
363 { |
339 disconnect(mListView, SIGNAL(activated(const QModelIndex)), this, |
364 disconnect(mListView, SIGNAL(activated(HbListWidgetItem *)), this, |
340 SLOT(openResultitem(const QModelIndex))); |
365 SLOT(openResultitem(HbListWidgetItem *))); |
341 } |
366 } |
342 if (mSearchPanel) |
367 if (mSearchPanel) |
343 { |
368 { |
344 disconnect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this, |
369 disconnect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this, |
345 SLOT(startNewSearch(QString))); |
370 SLOT(startNewSearch(QString))); |
346 disconnect(mSearchPanel, SIGNAL(searchOptionsClicked()), this, |
371 disconnect(mSearchPanel, SIGNAL(searchOptionsClicked()), this, |
347 SLOT(setSettings())); |
372 SLOT(setSettings())); |
348 } |
373 } |
|
374 disconnect(mMainWindow, SIGNAL(viewReady()), this, SLOT(viewReady())); |
349 } |
375 } |
350 // --------------------------------------------------------------------------- |
376 // --------------------------------------------------------------------------- |
351 // SearchProgressiveState::onAsyncSearchComplete |
377 // SearchProgressiveState::onAsyncSearchComplete |
352 // --------------------------------------------------------------------------- |
378 // --------------------------------------------------------------------------- |
353 void SearchProgressiveState::onAsyncSearchComplete(int aError, |
379 void SearchProgressiveState::onAsyncSearchComplete(int aError, |
384 if (aDoc == NULL || aError != 0) |
410 if (aDoc == NULL || aError != 0) |
385 return; |
411 return; |
386 QStringList liststr; |
412 QStringList liststr; |
387 QString secondrow = aDoc->excerpt(); |
413 QString secondrow = aDoc->excerpt(); |
388 QString firstrow; |
414 QString firstrow; |
389 QStandardItem* listitem = new QStandardItem(); |
415 HbListWidgetItem* listitem = new HbListWidgetItem(); |
390 |
416 |
391 if (aDoc->baseAppClass().contains("contact")) |
417 if (aDoc->baseAppClass().contains("contact")) |
392 { |
418 { |
393 QStringList docsList = filterDoc(aDoc, "GivenName", "FamilyName"); |
419 QStringList docsList = filterDoc(aDoc, "GivenName", "FamilyName"); |
394 if (docsList.value(0, "").length()) |
420 if (docsList.value(0, "").length()) |
426 listitem->setData(audioList.at(1), Qt::UserRole + 2); |
452 listitem->setData(audioList.at(1), Qt::UserRole + 2); |
427 } |
453 } |
428 } |
454 } |
429 else if (aDoc->baseAppClass().contains("video")) |
455 else if (aDoc->baseAppClass().contains("video")) |
430 { |
456 { |
431 QStringList videoList = filterDoc(aDoc, "Title", "MediaId","Name"); |
457 QStringList videoList = filterDoc(aDoc, "Title", "MediaId", "Name"); |
432 if (videoList.value(0, "").length()) |
458 if (videoList.value(0, "").length()) |
433 { |
459 { |
434 firstrow.append(videoList.at(0)); |
460 firstrow.append(videoList.at(0)); |
435 } |
461 } |
436 if (firstrow.length() == 0 && videoList.value(2, "").length()) |
462 if (firstrow.length() == 0 && videoList.value(2, "").length()) |
456 if (imageList.value(1, "").length()) |
482 if (imageList.value(1, "").length()) |
457 { |
483 { |
458 listitem->setData(imageList.at(1), Qt::UserRole + 2); |
484 listitem->setData(imageList.at(1), Qt::UserRole + 2); |
459 } |
485 } |
460 } |
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 } |
461 else if (aDoc->baseAppClass().contains("msg")) |
501 else if (aDoc->baseAppClass().contains("msg")) |
462 { |
502 { |
463 QStringList msgList = filterDoc(aDoc, "Subject", "Body"); |
503 QStringList msgList = filterDoc(aDoc, "Subject", "Body"); |
464 if (msgList.value(0, "").length()) |
504 if (msgList.value(0, "").length()) |
465 { |
505 { |
474 { |
514 { |
475 firstrow = " ";// space if subject and body are missing |
515 firstrow = " ";// space if subject and body are missing |
476 } |
516 } |
477 liststr << firstrow << secondrow; |
517 liststr << firstrow << secondrow; |
478 listitem->setData(mIconArray.at(4), Qt::DecorationRole); |
518 listitem->setData(mIconArray.at(4), Qt::DecorationRole); |
479 } |
519 } |
480 else if (aDoc->baseAppClass().contains("email")) |
|
481 { |
|
482 firstrow.append(filterDoc(aDoc, "Subject")); |
|
483 liststr << firstrow << secondrow; |
|
484 listitem->setData(mIconArray.at(5), Qt::DecorationRole); |
|
485 } |
|
486 else if (aDoc->baseAppClass().contains("calendar")) |
520 else if (aDoc->baseAppClass().contains("calendar")) |
487 { |
521 { |
488 firstrow.append(filterDoc(aDoc, "Summary")); |
522 firstrow.append(filterDoc(aDoc, "Summary")); |
489 if (firstrow.length() == 0) |
523 if (firstrow.length() == 0) |
490 { |
524 { |
518 if (firstrow.length() == 0) |
552 if (firstrow.length() == 0) |
519 { |
553 { |
520 firstrow = "UnKnown"; |
554 firstrow = "UnKnown"; |
521 } |
555 } |
522 liststr << firstrow << secondrow; |
556 liststr << firstrow << secondrow; |
|
557 listitem->setData(secondrow, Qt::UserRole + 2); |
523 listitem->setData(mIconArray.at(8), Qt::DecorationRole); |
558 listitem->setData(mIconArray.at(8), Qt::DecorationRole); |
524 } |
559 } |
525 else if (aDoc->baseAppClass().contains("file")) |
560 else if (aDoc->baseAppClass().contains("file")) |
526 { |
561 { |
527 firstrow.append(filterDoc(aDoc, "Name")); |
562 firstrow.append(filterDoc(aDoc, "Name")); |
528 if (firstrow.length() == 0) |
563 if (firstrow.length() == 0) |
529 firstrow = aDoc->baseAppClass(); |
564 firstrow = aDoc->baseAppClass(); |
530 liststr << firstrow << secondrow; |
565 liststr << firstrow << secondrow; |
531 listitem->setData(mIconArray.at(9), Qt::DecorationRole); |
566 listitem->setData(mIconArray.at(9), Qt::DecorationRole); |
532 } |
567 } |
533 listitem->setData(liststr, Qt::DisplayRole); |
568 listitem->setText(firstrow); |
|
569 listitem->setSecondaryText(secondrow); |
534 listitem->setData(aDoc->docId(), Qt::UserRole); |
570 listitem->setData(aDoc->docId(), Qt::UserRole); |
535 listitem->setData(aDoc->baseAppClass(), Qt::UserRole + 1); |
571 listitem->setData(aDoc->baseAppClass(), Qt::UserRole + 1); |
536 mModel->appendRow(listitem); |
572 mListView->addItem(listitem); |
537 |
573 |
538 mResultparser++; |
574 mResultparser++; |
539 if (mResultparser < mResultcount) |
575 if (mResultparser < mResultcount) |
540 { |
576 { |
541 PERF_CAT_GETDOC_TIME_RESTART |
577 PERF_CAT_GETDOC_TIME_RESTART |
556 mSelectedCategory.insert(item, avalue); |
592 mSelectedCategory.insert(item, avalue); |
557 } |
593 } |
558 // --------------------------------------------------------------------------- |
594 // --------------------------------------------------------------------------- |
559 // SearchProgressiveState::openResultitem |
595 // SearchProgressiveState::openResultitem |
560 // --------------------------------------------------------------------------- |
596 // --------------------------------------------------------------------------- |
561 void SearchProgressiveState::openResultitem(QModelIndex index) |
597 void SearchProgressiveState::openResultitem(HbListWidgetItem * item) |
562 { |
598 { |
563 QStandardItem* item = mModel->itemFromIndex(index); |
|
564 if (item == NULL) |
599 if (item == NULL) |
565 return; |
600 return;PERF_RESULT_ITEM_LAUNCH_TIME_RESTART |
566 QList<QVariant> args; |
601 QList<QVariant> args; |
567 bool t; |
602 bool t; |
568 mRequest = NULL; |
603 mRequest = NULL; |
569 if (item->data(Qt::UserRole + 1).toString().contains("contact")) |
604 if (item->data(Qt::UserRole + 1).toString().contains("contact")) |
570 { |
605 { |
|
606 PERF_RESULT_ITEM_FOR_LAUNCHING("contact") |
571 mRequest = mAiwMgr->create("com.nokia.services.phonebookservices", |
607 mRequest = mAiwMgr->create("com.nokia.services.phonebookservices", |
572 "Fetch", "open(int)", false); |
608 "Fetch", "open(int)", false); |
573 |
609 |
574 int uid = (item->data(Qt::UserRole)).toInt(&t); |
610 int uid = (item->data(Qt::UserRole)).toInt(&t); |
575 args << uid; |
611 args << uid; |
576 } |
612 } |
577 else if (item->data(Qt::UserRole + 1).toString().contains("bookmark")) |
613 else if (item->data(Qt::UserRole + 1).toString().contains("bookmark")) |
578 { |
614 { |
|
615 PERF_RESULT_ITEM_FOR_LAUNCHING("bookmark") |
|
616 QDesktopServices::openUrl(item->data(Qt::UserRole + 2).toString()); |
|
617 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
579 |
618 |
580 } |
619 } |
581 else if (item->data(Qt::UserRole + 1).toString().contains("calendar")) |
620 else if (item->data(Qt::UserRole + 1).toString().contains("calendar")) |
582 { |
621 { |
583 QDir pluginDir = QDir(QString("z:/resource/qt/plugins/calendar")); |
622 QDir pluginDir = QDir(QString("z:/resource/qt/plugins/calendar")); |
584 QPluginLoader *calAgandaViewerPluginLoader = new QPluginLoader( |
623 QPluginLoader *calAgandaViewerPluginLoader = new QPluginLoader( |
585 pluginDir.absoluteFilePath(QString( |
624 pluginDir.absoluteFilePath(QString( |
586 "agendaeventviewerplugin.qtplugin"))); |
625 "agendaeventviewerplugin.qtplugin"))); |
587 |
626 |
588 calAgandaViewerPluginInstance = qobject_cast< |
627 calAgandaViewerPluginInstance = qobject_cast< |
589 EventViewerPluginInterface *> ( |
628 EventViewerPluginInterface *> ( |
590 calAgandaViewerPluginLoader->instance()); |
629 calAgandaViewerPluginLoader->instance()); |
591 |
630 |
592 connect(calAgandaViewerPluginInstance, SIGNAL(viewingCompleted()), |
631 connect(calAgandaViewerPluginInstance, SIGNAL(viewingCompleted()), |
593 this, SLOT(_viewingCompleted())); |
632 this, SLOT(_viewingCompleted())); |
594 |
633 |
596 item->data(Qt::UserRole).toInt(), |
635 item->data(Qt::UserRole).toInt(), |
597 EventViewerPluginInterface::ActionEditDelete, NULL); |
636 EventViewerPluginInterface::ActionEditDelete, NULL); |
598 } |
637 } |
599 else if (item->data(Qt::UserRole + 1).toString().contains("applications")) |
638 else if (item->data(Qt::UserRole + 1).toString().contains("applications")) |
600 { |
639 { |
|
640 PERF_RESULT_ITEM_FOR_LAUNCHING("applications") |
601 TRAP_IGNORE(LaunchApplicationL(TUid::Uid((item->data(Qt::UserRole)).toString().toInt(&t, 16)))); |
641 TRAP_IGNORE(LaunchApplicationL(TUid::Uid((item->data(Qt::UserRole)).toString().toInt(&t, 16)))); |
|
642 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG("") |
602 } |
643 } |
603 else if (item->data(Qt::UserRole + 1).toString().contains("file")) |
644 else if (item->data(Qt::UserRole + 1).toString().contains("file")) |
604 { |
645 { |
|
646 PERF_RESULT_ITEM_FOR_LAUNCHING("file") |
605 QString uid = item->data(Qt::UserRole).toString(); |
647 QString uid = item->data(Qt::UserRole).toString(); |
606 QFile file(uid); |
648 QFile file(uid); |
607 mRequest = mAiwMgr->create(file, false); |
649 mRequest = mAiwMgr->create(file, false); |
608 args << file.fileName(); |
650 args << file.fileName(); |
609 } |
651 } |
610 else if ((item->data(Qt::UserRole + 1).toString().contains("video")) |
652 else if ((item->data(Qt::UserRole + 1).toString().contains("video")) |
611 || (item->data(Qt::UserRole + 1).toString().contains("audio")) |
653 || (item->data(Qt::UserRole + 1).toString().contains("audio")) |
612 || (item->data(Qt::UserRole + 1).toString().contains("image"))) |
654 || (item->data(Qt::UserRole + 1).toString().contains("image"))) |
613 { |
655 { |
|
656 PERF_RESULT_ITEM_FOR_LAUNCHING("media") |
614 QString uid = getDrivefromMediaId( |
657 QString uid = getDrivefromMediaId( |
615 item->data(Qt::UserRole + 2).toString()); |
658 item->data(Qt::UserRole + 2).toString()); |
616 uid.append(':'); |
659 uid.append(':'); |
617 uid.append(item->data(Qt::UserRole).toString()); |
660 uid.append(item->data(Qt::UserRole).toString()); |
618 QFile file(uid); |
661 QFile file(uid); |
620 args << file.fileName(); |
663 args << file.fileName(); |
621 } |
664 } |
622 |
665 |
623 else if (item->data(Qt::UserRole + 1).toString().contains("notes")) |
666 else if (item->data(Qt::UserRole + 1).toString().contains("notes")) |
624 { |
667 { |
625 if (!notesEditor) |
668 PERF_RESULT_ITEM_FOR_LAUNCHING("notes") |
626 { |
669 if(mNotesEditor) |
627 notesEditor = new NotesEditor(this); |
670 { |
628 } |
671 mNotesEditor->edit(item->data(Qt::UserRole).toInt()); |
629 notesEditor->edit(item->data(Qt::UserRole).toInt()); |
672 } |
|
673 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG("") |
|
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); |
630 } |
684 } |
631 else if (item->data(Qt::UserRole + 1).toString().contains("msg")) |
685 else if (item->data(Qt::UserRole + 1).toString().contains("msg")) |
632 { |
686 { |
|
687 PERF_RESULT_ITEM_FOR_LAUNCHING("msg") |
633 mRequest = mAiwMgr->create("com.nokia.services.hbserviceprovider", |
688 mRequest = mAiwMgr->create("com.nokia.services.hbserviceprovider", |
634 "conversationview", "view(int)", false); |
689 "conversationview", "view(int)", false); |
635 |
690 |
636 int uid = (item->data(Qt::UserRole)).toInt(&t); |
691 int uid = (item->data(Qt::UserRole)).toInt(&t); |
637 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); |
638 } |
697 } |
639 if (mRequest) |
698 if (mRequest) |
640 { |
699 { |
641 connect(mRequest, SIGNAL(requestOk(const QVariant&)), this, |
700 connect(mRequest, SIGNAL(requestOk(const QVariant&)), this, |
642 SLOT(handleOk(const QVariant&))); |
701 SLOT(handleOk(const QVariant&))); |
643 connect(mRequest, SIGNAL(requestError(int,const QString&)), this, |
702 connect(mRequest, SIGNAL(requestError(int,const QString&)), this, |
644 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. |
645 mRequest->setArguments(args); |
704 mRequest->setArguments(args); |
646 if (!mRequest->send())// Make the request |
705 if (!mRequest->send())// Make the request |
|
706 |
647 { |
707 { |
648 qDebug() << "AIW-ERROR: Send failed" << mRequest->lastError(); |
708 qDebug() << "AIW-ERROR: Send failed" << mRequest->lastError(); |
649 } |
709 } |
650 disconnect(mRequest, SIGNAL(requestOk(const QVariant&)), this, |
710 disconnect(mRequest, SIGNAL(requestOk(const QVariant&)), this, |
651 SLOT(handleOk(const QVariant&))); |
711 SLOT(handleOk(const QVariant&))); |
663 // SearchProgressiveState::handleOk |
723 // SearchProgressiveState::handleOk |
664 // --------------------------------------------------------------------------- |
724 // --------------------------------------------------------------------------- |
665 void SearchProgressiveState::handleOk(const QVariant& var) |
725 void SearchProgressiveState::handleOk(const QVariant& var) |
666 { |
726 { |
667 Q_UNUSED(var); |
727 Q_UNUSED(var); |
|
728 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
668 } |
729 } |
669 // --------------------------------------------------------------------------- |
730 // --------------------------------------------------------------------------- |
670 // SearchProgressiveState::handleError |
731 // SearchProgressiveState::handleError |
671 // --------------------------------------------------------------------------- |
732 // --------------------------------------------------------------------------- |
672 void SearchProgressiveState::handleError(int ret, const QString& var) |
733 void SearchProgressiveState::handleError(int ret, const QString& var) |
675 Q_UNUSED(var); |
736 Q_UNUSED(var); |
676 } |
737 } |
677 // --------------------------------------------------------------------------- |
738 // --------------------------------------------------------------------------- |
678 // SearchProgressiveState::createSuggestionLink |
739 // SearchProgressiveState::createSuggestionLink |
679 // --------------------------------------------------------------------------- |
740 // --------------------------------------------------------------------------- |
680 void SearchProgressiveState::createSuggestionLink(bool aFlag) |
741 void SearchProgressiveState::createSuggestionLink() |
681 { |
742 { |
682 QStandardItem* listitem = new QStandardItem(); |
743 QString linkString = QString(hbTrId("txt_search_list_search_for_1").arg( |
683 if (!aFlag) |
744 mOriginalString)); |
684 { |
745 QMapIterator<int, HbIcon> i(mISprovidersIcon); |
685 QString linkString = QString(hbTrId("txt_search_list_search_for_1").arg(mOriginalString)); |
746 while (i.hasNext()) |
686 mLinkindex = mModel->rowCount(); |
747 { |
687 listitem->setData(linkString, Qt::DisplayRole); |
748 i.next(); |
688 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); |
689 } |
755 } |
690 } |
756 } |
691 // --------------------------------------------------------------------------- |
757 // --------------------------------------------------------------------------- |
692 // SearchProgressiveState::noResultsFound |
758 // SearchProgressiveState::noResultsFound |
693 // --------------------------------------------------------------------------- |
759 // --------------------------------------------------------------------------- |
694 void SearchProgressiveState::noResultsFound(QString aKeyword) |
760 void SearchProgressiveState::noResultsFound(QString aKeyword) |
695 { |
761 { |
696 if (aKeyword.length()) |
762 if (aKeyword.length()) |
697 { |
763 { |
698 QStandardItem* listitem = new QStandardItem(); |
764 HbListWidgetItem* listitem = new HbListWidgetItem(); |
699 QString noResultMsg = QString("<align=\"center\">" + hbTrId( |
765 QString noResultMsg = QString("<align=\"center\">" + hbTrId( |
700 "txt_search_list_no_match_found")); |
766 "txt_search_list_no_match_found")); |
701 listitem->setData(noResultMsg, Qt::DisplayRole); |
767 listitem->setText(noResultMsg); |
702 mModel->appendRow(listitem); |
768 mListView->addItem(listitem); |
|
769 |
703 } |
770 } |
704 } |
771 } |
705 // --------------------------------------------------------------------------- |
772 // --------------------------------------------------------------------------- |
706 // SearchProgressiveState::clear |
773 // SearchProgressiveState::clear |
707 // --------------------------------------------------------------------------- |
774 // --------------------------------------------------------------------------- |
708 void SearchProgressiveState::clear() |
775 void SearchProgressiveState::clear() |
709 { |
776 { |
710 if (mModel) |
777 mListView->clear(); |
711 { |
|
712 mModel->clear(); |
|
713 } |
|
714 } |
778 } |
715 // --------------------------------------------------------------------------- |
779 // --------------------------------------------------------------------------- |
716 // SearchProgressiveState::searchOnCategory |
780 // SearchProgressiveState::searchOnCategory |
717 // --------------------------------------------------------------------------- |
781 // --------------------------------------------------------------------------- |
718 void SearchProgressiveState::searchOnCategory(const QString aKeyword) |
782 void SearchProgressiveState::searchOnCategory(const QString aKeyword) |
772 mDatabasecount++; |
836 mDatabasecount++; |
773 if (mSearchHandler->isPrepared()) |
837 if (mSearchHandler->isPrepared()) |
774 { |
838 { |
775 PERF_CAT_API_TIME_RESTART |
839 PERF_CAT_API_TIME_RESTART |
776 mSearchHandler->searchAsync(aKeyword, "_aggregate"); |
840 mSearchHandler->searchAsync(aKeyword, "_aggregate"); |
777 |
841 |
778 } |
842 } |
779 else |
843 else |
780 { |
844 { |
781 searchOnCategory(mSearchString); |
845 searchOnCategory(mSearchString); |
782 } |
846 } |
783 } |
847 } |
784 else if (mDatabasecount >= mTemplist.count()) |
848 else if (mDatabasecount >= mTemplist.count()) |
785 { |
849 { |
786 PERF_TOTAL_UI_ENDLOG |
850 PERF_TOTAL_UI_ENDLOG |
787 if (mModel->rowCount() == 0 && aKeyword.length() != 0) |
851 if (mListView->count() == 0 && aKeyword.length() != 0) |
788 { |
852 { |
789 noResultsFound(mOriginalString); |
853 noResultsFound(mOriginalString); |
790 createSuggestionLink(0); |
854 createSuggestionLink(); |
791 } |
855 } |
792 return; |
856 return; |
793 } |
857 } |
794 } |
858 } |
795 // --------------------------------------------------------------------------- |
859 // --------------------------------------------------------------------------- |
824 // SearchProgressiveState::setSettings |
888 // SearchProgressiveState::setSettings |
825 // --------------------------------------------------------------------------- |
889 // --------------------------------------------------------------------------- |
826 void SearchProgressiveState::setSettings() |
890 void SearchProgressiveState::setSettings() |
827 { |
891 { |
828 mTempSelectedCategory = mSelectedCategory; |
892 mTempSelectedCategory = mSelectedCategory; |
829 emit settingsState(); |
893 if (mOriginalString.length()) |
830 } |
894 emit inDeviceSearchQuery(mOriginalString); |
831 // --------------------------------------------------------------------------- |
895 emit switchProToSettingsState(); |
832 // SearchProgressiveState::_customizeGoButton |
|
833 // --------------------------------------------------------------------------- |
|
834 void SearchProgressiveState::_customizeGoButton(bool avalue) |
|
835 { |
|
836 if (mSearchPanel) |
|
837 { |
|
838 if (avalue) |
|
839 { |
|
840 mSearchPanel->setProgressive(false); |
|
841 } |
|
842 else |
|
843 { |
|
844 mSearchPanel->setProgressive(true); |
|
845 } |
|
846 } |
|
847 } |
896 } |
848 // --------------------------------------------------------------------------- |
897 // --------------------------------------------------------------------------- |
849 // SearchProgressiveState::settingsaction |
898 // SearchProgressiveState::settingsaction |
850 // --------------------------------------------------------------------------- |
899 // --------------------------------------------------------------------------- |
851 void SearchProgressiveState::settingsaction(bool avalue) |
900 void SearchProgressiveState::settingsaction(bool avalue) |
995 CleanupStack::Pop(fileNameFromApparc); |
1044 CleanupStack::Pop(fileNameFromApparc); |
996 } |
1045 } |
997 CleanupStack::PopAndDestroy(apaMaskedBitmap); |
1046 CleanupStack::PopAndDestroy(apaMaskedBitmap); |
998 } |
1047 } |
999 CleanupStack::PopAndDestroy(&apaLsSession); |
1048 CleanupStack::PopAndDestroy(&apaLsSession); |
1000 |
1049 |
1001 if (icon.isNull() || !(icon.size().isValid())) |
1050 if (icon.isNull() || !(icon.size().isValid())) |
1002 icon = HbIcon("qtg_large_application"); |
1051 icon = HbIcon("qtg_large_application"); |
1003 return icon; |
1052 return icon; |
1004 } |
1053 } |
1005 // --------------------------------------------------------------------------- |
1054 // --------------------------------------------------------------------------- |
1006 // SearchProgressiveState::GetPixmapByFilenameL |
1055 // SearchProgressiveState::GetPixmapByFilenameL |
1007 // --------------------------------------------------------------------------- |
1056 // --------------------------------------------------------------------------- |
1267 User::LeaveIfError(appArcSession.StartApp(*cmdLine)); |
1316 User::LeaveIfError(appArcSession.StartApp(*cmdLine)); |
1268 CleanupStack::PopAndDestroy(cmdLine); |
1317 CleanupStack::PopAndDestroy(cmdLine); |
1269 CleanupStack::PopAndDestroy(&appArcSession); |
1318 CleanupStack::PopAndDestroy(&appArcSession); |
1270 } |
1319 } |
1271 CleanupStack::PopAndDestroy(&wsSession); |
1320 CleanupStack::PopAndDestroy(&wsSession); |
|
1321 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
1272 } |
1322 } |
1273 // --------------------------------------------------------------------------- |
1323 // --------------------------------------------------------------------------- |
1274 // SearchProgressiveState::_viewingCompleted |
1324 // SearchProgressiveState::_viewingCompleted |
1275 // --------------------------------------------------------------------------- |
1325 // --------------------------------------------------------------------------- |
1276 void SearchProgressiveState::_viewingCompleted() |
1326 void SearchProgressiveState::_viewingCompleted() |
1277 { |
1327 { |
1278 if (calAgandaViewerPluginInstance) |
1328 if (calAgandaViewerPluginInstance) |
1279 calAgandaViewerPluginInstance->deleteLater(); |
1329 calAgandaViewerPluginInstance->deleteLater(); |
1280 } |
1330 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
|
1331 } |
|
1332 // --------------------------------------------------------------------------- |
|
1333 // SearchProgressiveState::viewReady |
|
1334 // --------------------------------------------------------------------------- |
|
1335 void SearchProgressiveState::viewReady() |
|
1336 { |
|
1337 if (hbApp) |
|
1338 { |
|
1339 if (hbApp->activateReason() == Hb::ActivationReasonActivity) |
|
1340 { |
|
1341 QVariantHash params = hbApp->activateParams(); |
|
1342 QString searchKey = params.value("query").toString(); |
|
1343 if (searchKey.length() > 0) |
|
1344 mSearchPanel->setCriteria(searchKey); |
|
1345 } |
|
1346 }PERF_APP_LAUNCH_END("SearchAppplication View is ready"); |
|
1347 } |
|
1348 void SearchProgressiveState::slotOnlineQuery(QString str) |
|
1349 { |
|
1350 mOriginalString = str; |
|
1351 mOnlineQueryAvailable = true; |
|
1352 } |
|
1353 void SearchProgressiveState::slotISProvidersIcon(int id, HbIcon icon) |
|
1354 { |
|
1355 mISprovidersIcon.insert(id, icon); |
|
1356 } |