51 #include <hblistwidget.h> |
51 #include <hblistwidget.h> |
52 #include <hblistwidgetitem.h> |
52 #include <hblistwidgetitem.h> |
53 #include <hbabstractviewitem.h> |
53 #include <hbabstractviewitem.h> |
54 #include <hblistviewitem.h> |
54 #include <hblistviewitem.h> |
55 #include <hbactivitymanager.h> |
55 #include <hbactivitymanager.h> |
|
56 #include <xqaiwdecl.h> |
|
57 #include <qservicemanager.h> |
|
58 #include <qurl.h> |
|
59 QTM_USE_NAMESPACE |
56 #define hbApp qobject_cast<HbApplication*>(qApp) |
60 #define hbApp qobject_cast<HbApplication*>(qApp) |
57 const int totalcategories_normalreason = 10; |
61 const int totalcategories_normalreason = 10; |
58 const int totalcategories_activityreasonreason = 13; |
62 const int totalcategories_activityreasonreason = 13; |
59 const int intial_iteration = 3; |
63 const int intial_iteration = 3; |
60 const int batch_iteration = 20; |
64 const int batch_iteration = 20; |
393 bool t; |
397 bool t; |
394 mRequest = NULL; |
398 mRequest = NULL; |
395 if (item->data(Qt::UserRole + 1).toString().contains("contact")) |
399 if (item->data(Qt::UserRole + 1).toString().contains("contact")) |
396 { |
400 { |
397 PERF_RESULT_ITEM_FOR_LAUNCHING("contact") |
401 PERF_RESULT_ITEM_FOR_LAUNCHING("contact") |
398 mRequest = mAiwMgr->create("com.nokia.services.phonebookservices", |
402 mRequest = mAiwMgr->create("com.nokia.symbian.IContactsView", |
399 "Fetch", "open(int)", true); |
403 "openContactCard(int)", true); |
400 |
404 |
401 int uid = (item->data(Qt::UserRole)).toInt(&t); |
405 int uid = (item->data(Qt::UserRole)).toInt(&t); |
402 args << uid; |
406 args << uid; |
403 } |
407 } |
404 else if (item->data(Qt::UserRole + 1).toString().contains("bookmark")) |
408 else if (item->data(Qt::UserRole + 1).toString().contains("bookmark")) |
408 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
412 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
409 |
413 |
410 } |
414 } |
411 else if (item->data(Qt::UserRole + 1).toString().contains("calendar")) |
415 else if (item->data(Qt::UserRole + 1).toString().contains("calendar")) |
412 { |
416 { |
413 QDir pluginDir = QDir(QString("z:/resource/qt/plugins/calendar")); |
417 QDir pluginDir = QDir(CALENDAR_EVENTVIEWER_PLUGIN_PATH); |
414 QPluginLoader *calAgandaViewerPluginLoader = new QPluginLoader( |
418 QPluginLoader *calAgandaViewerPluginLoader = new QPluginLoader( |
415 pluginDir.absoluteFilePath(QString( |
419 pluginDir.absoluteFilePath(CALENDAR_EVENTVIEWER_PLUGIN_NAME)); |
416 "agendaeventviewerplugin.qtplugin"))); |
|
417 |
420 |
418 calAgandaViewerPluginInstance = qobject_cast< |
421 calAgandaViewerPluginInstance = qobject_cast< |
419 EventViewerPluginInterface *> ( |
422 EventViewerPluginInterface *> ( |
420 calAgandaViewerPluginLoader->instance()); |
423 calAgandaViewerPluginLoader->instance()); |
421 |
424 |
427 EventViewerPluginInterface::ActionEditDelete, NULL); |
430 EventViewerPluginInterface::ActionEditDelete, NULL); |
428 } |
431 } |
429 else if (item->data(Qt::UserRole + 1).toString().contains("applications")) |
432 else if (item->data(Qt::UserRole + 1).toString().contains("applications")) |
430 { |
433 { |
431 PERF_RESULT_ITEM_FOR_LAUNCHING("applications") |
434 PERF_RESULT_ITEM_FOR_LAUNCHING("applications") |
432 TRAP_IGNORE(LaunchApplicationL(TUid::Uid((item->data(Qt::UserRole)).toString().toUInt(&t, 16)))); |
435 TRAP_IGNORE(LaunchApplicationL((item->data(Qt::UserRole)).toString())); |
433 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG("") |
436 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG("") |
434 } |
437 } |
435 else if (item->data(Qt::UserRole + 1).toString().contains("file")) |
438 else if (item->data(Qt::UserRole + 1).toString().contains("file")) |
436 { |
439 { |
437 PERF_RESULT_ITEM_FOR_LAUNCHING("file") |
440 PERF_RESULT_ITEM_FOR_LAUNCHING("file") |
1091 return QString::fromUtf16(mediaIdBuf.Ptr(), mediaIdBuf.Length()); |
1094 return QString::fromUtf16(mediaIdBuf.Ptr(), mediaIdBuf.Length()); |
1092 } |
1095 } |
1093 // --------------------------------------------------------------------------- |
1096 // --------------------------------------------------------------------------- |
1094 // SearchProgressiveState::LaunchApplicationL |
1097 // SearchProgressiveState::LaunchApplicationL |
1095 // --------------------------------------------------------------------------- |
1098 // --------------------------------------------------------------------------- |
1096 void SearchProgressiveState::LaunchApplicationL(const TUid aUid) |
1099 void SearchProgressiveState::LaunchApplicationL(const QString aUid) |
1097 { |
1100 { |
1098 RWsSession wsSession; |
1101 QServiceManager serviceManager; |
1099 User::LeaveIfError(wsSession.Connect()); |
1102 QObject* mActivityManager = serviceManager.loadInterface( |
1100 CleanupClosePushL<RWsSession> (wsSession); |
1103 "com.nokia.qt.activities.ActivityManager"); |
1101 CAknTaskList *taskList = CAknTaskList::NewL(wsSession); |
1104 if (!mActivityManager) |
1102 TApaTask task = taskList->FindRootApp(aUid); |
1105 { |
1103 delete taskList; |
1106 return; |
1104 if (task.Exists()) |
1107 } |
1105 { |
1108 QUrl url; |
1106 task.BringToForeground(); |
1109 url.setScheme(XQURI_SCHEME_ACTIVITY); |
1107 } |
1110 QString str("0x"); |
1108 else |
1111 str.append(aUid); |
1109 { |
1112 url.setHost(str); |
1110 TApaAppInfo appInfo; |
1113 QMetaObject::invokeMethod(mActivityManager, "launchActivity", |
1111 TApaAppCapabilityBuf capabilityBuf; |
1114 Q_ARG(QUrl, url)); |
1112 RApaLsSession appArcSession; |
1115 delete mActivityManager; |
1113 User::LeaveIfError(appArcSession.Connect()); |
1116 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG("") |
1114 CleanupClosePushL<RApaLsSession> (appArcSession); |
|
1115 User::LeaveIfError(appArcSession.GetAppInfo(appInfo, aUid)); |
|
1116 User::LeaveIfError( |
|
1117 appArcSession.GetAppCapability(capabilityBuf, aUid)); |
|
1118 TApaAppCapability &caps = capabilityBuf(); |
|
1119 TFileName appName = appInfo.iFullName; |
|
1120 CApaCommandLine *cmdLine = CApaCommandLine::NewLC(); |
|
1121 cmdLine->SetExecutableNameL(appName); |
|
1122 if (caps.iLaunchInBackground) |
|
1123 { |
|
1124 cmdLine->SetCommandL(EApaCommandBackground); |
|
1125 } |
|
1126 else |
|
1127 { |
|
1128 cmdLine->SetCommandL(EApaCommandRun); |
|
1129 } |
|
1130 //cmdLine->SetTailEndL(aParam); |
|
1131 User::LeaveIfError(appArcSession.StartApp(*cmdLine)); |
|
1132 CleanupStack::PopAndDestroy(cmdLine); |
|
1133 CleanupStack::PopAndDestroy(&appArcSession); |
|
1134 } |
|
1135 CleanupStack::PopAndDestroy(&wsSession); |
|
1136 PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") |
|
1137 } |
1117 } |
1138 // --------------------------------------------------------------------------- |
1118 // --------------------------------------------------------------------------- |
1139 // SearchProgressiveState::_viewingCompleted |
1119 // SearchProgressiveState::_viewingCompleted |
1140 // --------------------------------------------------------------------------- |
1120 // --------------------------------------------------------------------------- |
1141 void SearchProgressiveState::_viewingCompleted() |
1121 void SearchProgressiveState::_viewingCompleted() |
1199 QStringList icons; |
1179 QStringList icons; |
1200 icons << "qtg_large_phonebook" << "qtg_large_tone" << "qtg_large_video" |
1180 icons << "qtg_large_phonebook" << "qtg_large_tone" << "qtg_large_video" |
1201 << "qtg_large_photos" << "qtg_large_message" << "qtg_large_email" |
1181 << "qtg_large_photos" << "qtg_large_message" << "qtg_large_email" |
1202 << "qtg_large_calendar" << "qtg_large_notes" |
1182 << "qtg_large_calendar" << "qtg_large_notes" |
1203 << "qtg_large_web_link" << "qtg_large_text" << "qtg_large_sisx" |
1183 << "qtg_large_web_link" << "qtg_large_text" << "qtg_large_sisx" |
1204 << "qtg_large_java" << "qtg_large_flash" << "qtg_large_folder" |
1184 << "qtg_large_java" << "qtg_large_flash" << "qtg_large_query"; |
1205 << "qtg_large_query"; |
|
1206 mIconArray.clear(); |
1185 mIconArray.clear(); |
1207 for (int i = 0; i < icons.count(); i++) |
1186 for (int i = 0; i < icons.count(); i++) |
1208 { |
1187 { |
1209 HbIcon icon(icons.at(i)); |
1188 HbIcon icon(icons.at(i)); |
1210 if (icon.isNull() || !(icon.size().isValid())) |
1189 if (icon.isNull() || !(icon.size().isValid())) |
1276 if (aDoc == NULL) |
1255 if (aDoc == NULL) |
1277 return; |
1256 return; |
1278 QString secondrow = aDoc->excerpt(); |
1257 QString secondrow = aDoc->excerpt(); |
1279 QString firstrow; |
1258 QString firstrow; |
1280 HbListWidgetItem* listitem = new HbListWidgetItem(); |
1259 HbListWidgetItem* listitem = new HbListWidgetItem(); |
|
1260 bool addtoList = true; |
1281 |
1261 |
1282 if (aDoc->baseAppClass().contains("contact")) |
1262 if (aDoc->baseAppClass().contains("contact")) |
1283 { |
1263 { |
1284 QStringList docsList = filterDoc(aDoc, "GivenName", "FamilyName"); |
1264 QStringList docsList = filterDoc(aDoc, "GivenName", "FamilyName"); |
1285 if (docsList.value(0, "").length()) |
1265 if (docsList.value(0, "").length()) |
1303 QStringList audioList = filterDoc(aDoc, "Title", "MediaId"); |
1283 QStringList audioList = filterDoc(aDoc, "Title", "MediaId"); |
1304 if (audioList.value(0, "").length()) |
1284 if (audioList.value(0, "").length()) |
1305 { |
1285 { |
1306 firstrow.append(audioList.at(0)); |
1286 firstrow.append(audioList.at(0)); |
1307 } |
1287 } |
1308 if (firstrow.length() == 0) |
1288 else |
1309 { |
1289 { |
1310 firstrow = hbTrId("txt_mus_dblist_val_unknown4"); |
1290 firstrow = hbTrId("txt_mus_dblist_val_unknown4"); |
1311 } |
1291 } |
1312 listitem->setData(mIconArray.at(1), Qt::DecorationRole); |
1292 listitem->setData(mIconArray.at(1), Qt::DecorationRole); |
1313 if (audioList.value(1, "").length()) |
1293 if (audioList.value(1, "").length()) |
1320 QStringList videoList = filterDoc(aDoc, "Title", "MediaId", "Name"); |
1300 QStringList videoList = filterDoc(aDoc, "Title", "MediaId", "Name"); |
1321 if (videoList.value(0, "").length()) |
1301 if (videoList.value(0, "").length()) |
1322 { |
1302 { |
1323 firstrow.append(videoList.at(0)); |
1303 firstrow.append(videoList.at(0)); |
1324 } |
1304 } |
1325 if (firstrow.length() == 0 && videoList.value(2, "").length()) |
1305 else |
1326 { |
1306 { |
1327 firstrow.append(videoList.at(2)); |
1307 firstrow.append(videoList.at(2)); |
1328 } |
1308 } |
1329 listitem->setData(mIconArray.at(2), Qt::DecorationRole); |
1309 listitem->setData(mIconArray.at(2), Qt::DecorationRole); |
1330 if (videoList.value(1, "").length()) |
1310 if (videoList.value(1, "").length()) |
1333 } |
1313 } |
1334 } |
1314 } |
1335 else if (aDoc->baseAppClass().contains("image")) |
1315 else if (aDoc->baseAppClass().contains("image")) |
1336 { |
1316 { |
1337 QStringList imageList = filterDoc(aDoc, "Name", "MediaId"); |
1317 QStringList imageList = filterDoc(aDoc, "Name", "MediaId"); |
1338 if (imageList.value(0, "").length()) |
1318 |
1339 { |
1319 firstrow.append(imageList.at(0)); |
1340 firstrow.append(imageList.at(0)); |
1320 |
1341 } |
|
1342 listitem->setData(mIconArray.at(3), Qt::DecorationRole); |
1321 listitem->setData(mIconArray.at(3), Qt::DecorationRole); |
1343 if (imageList.value(1, "").length()) |
1322 if (imageList.value(1, "").length()) |
1344 { |
1323 { |
1345 listitem->setData(imageList.at(1), Qt::UserRole + 2); |
1324 listitem->setData(imageList.at(1), Qt::UserRole + 2); |
1346 } |
1325 } |
1362 firstrow.append(msgList.at(2)); |
1341 firstrow.append(msgList.at(2)); |
1363 } |
1342 } |
1364 else |
1343 else |
1365 { |
1344 { |
1366 if (msgList.value(1, "").length()) |
1345 if (msgList.value(1, "").length()) |
|
1346 { |
1367 firstrow.append(msgList.at(1)); |
1347 firstrow.append(msgList.at(1)); |
|
1348 } |
|
1349 else if (msgList.value(0).contains("Drafts")) |
|
1350 { |
|
1351 firstrow = QString("(no recipient)"); |
|
1352 } |
1368 } |
1353 } |
1369 listitem->setData(mIconArray.at(4), Qt::DecorationRole); |
1354 listitem->setData(mIconArray.at(4), Qt::DecorationRole); |
1370 } |
1355 } |
1371 else if (aDoc->baseAppClass().contains("calendar")) |
1356 else if (aDoc->baseAppClass().contains("calendar")) |
1372 { |
1357 { |
1407 { |
1392 { |
1408 bool ok; |
1393 bool ok; |
1409 QStringList fileList = filterDoc(aDoc, "Name", "IsFolder", |
1394 QStringList fileList = filterDoc(aDoc, "Name", "IsFolder", |
1410 "Extension"); |
1395 "Extension"); |
1411 firstrow = fileList.at(0); |
1396 firstrow = fileList.at(0); |
1412 if (fileList.at(1).toInt(&ok) == 1) // folder result icon map |
1397 if (fileList.at(1).toInt(&ok) == 1) // not to show folder results |
1413 |
1398 { |
1414 { |
1399 addtoList = false; |
1415 listitem->setData(mIconArray.at(13), Qt::DecorationRole); |
|
1416 } |
1400 } |
1417 else |
1401 else |
1418 { |
1402 { |
1419 if (fileList.at(2).contains("sis", Qt::CaseInsensitive) |
1403 if (fileList.at(2).contains("sis", Qt::CaseInsensitive) |
1420 || fileList.at(1).contains("sisx", Qt::CaseInsensitive)) |
1404 || fileList.at(1).contains("sisx", Qt::CaseInsensitive)) |
1447 { |
1431 { |
1448 listitem->setData(mIconArray.at(9), Qt::DecorationRole); |
1432 listitem->setData(mIconArray.at(9), Qt::DecorationRole); |
1449 } |
1433 } |
1450 else |
1434 else |
1451 { |
1435 { |
1452 listitem->setData(mIconArray.at(14), Qt::DecorationRole); |
1436 listitem->setData(mIconArray.at(13), Qt::DecorationRole); |
1453 } |
1437 } |
1454 } |
1438 } |
1455 listitem->setText(firstrow); |
1439 listitem->setText(firstrow); |
1456 listitem->setSecondaryText(secondrow); |
1440 listitem->setSecondaryText(secondrow); |
1457 listitem->setData(aDoc->docId(), Qt::UserRole); |
1441 listitem->setData(aDoc->docId(), Qt::UserRole); |
1458 listitem->setData(aDoc->baseAppClass(), Qt::UserRole + 1); |
1442 listitem->setData(aDoc->baseAppClass(), Qt::UserRole + 1); |
1459 mListView->addItem(listitem); |
1443 if (addtoList) |
|
1444 mListView->addItem(listitem); |
|
1445 else |
|
1446 delete listitem; |
1460 |
1447 |
1461 delete aDoc; |
1448 delete aDoc; |
1462 } |
1449 } |
1463 |
1450 // --------------------------------------------------------------------------- |
|
1451 // SearchProgressiveState::constructHandlers overloaded |
|
1452 // --------------------------------------------------------------------------- |
1464 InDeviceHandler* SearchProgressiveState::constructHandlers(int mDatabase) |
1453 InDeviceHandler* SearchProgressiveState::constructHandlers(int mDatabase) |
1465 { |
1454 { |
1466 InDeviceHandler* handler = NULL; |
1455 InDeviceHandler* handler = NULL; |
1467 handler = new InDeviceHandler(); |
1456 handler = new InDeviceHandler(); |
1468 switch (mDatabase) |
1457 switch (mDatabase) |