1264 HbDeviceNotificationDialog::notification("", LOC_SAVED_TO_DRAFTS); |
1264 HbDeviceNotificationDialog::notification("", LOC_SAVED_TO_DRAFTS); |
1265 } |
1265 } |
1266 return msgId; |
1266 return msgId; |
1267 } |
1267 } |
1268 |
1268 |
|
1269 bool MsgUnifiedEditorView::handleKeyEvent(int key) |
|
1270 { |
|
1271 bool eventHandled = false; |
|
1272 if (Qt::Key_Yes == key && mSendAction->isEnabled()) { |
|
1273 eventHandled = true; |
|
1274 send(); |
|
1275 } |
|
1276 |
|
1277 return eventHandled; |
|
1278 } |
|
1279 |
1269 void MsgUnifiedEditorView::resizeEvent( QGraphicsSceneResizeEvent * event ) |
1280 void MsgUnifiedEditorView::resizeEvent( QGraphicsSceneResizeEvent * event ) |
1270 { |
1281 { |
1271 Q_UNUSED(event) |
1282 Q_UNUSED(event) |
1272 #ifdef _DEBUG_TRACES_ |
1283 #ifdef _DEBUG_TRACES_ |
1273 qDebug()<<"resize event"; |
1284 qDebug()<<"resize event"; |
1291 |
1302 |
1292 // extract contact-list |
1303 // extract contact-list |
1293 QContactManager* contactManager = new QContactManager("symbian"); |
1304 QContactManager* contactManager = new QContactManager("symbian"); |
1294 CntServicesContactList cntServicesContacts = qVariantValue<CntServicesContactList>(value); |
1305 CntServicesContactList cntServicesContacts = qVariantValue<CntServicesContactList>(value); |
1295 int cntCount = cntServicesContacts.count(); |
1306 int cntCount = cntServicesContacts.count(); |
|
1307 |
|
1308 QCRITICAL_WRITE_FORMAT("servicecontactlist count:",cntCount); |
|
1309 |
1296 QList<QtMobility::QContact> contactList; |
1310 QList<QtMobility::QContact> contactList; |
1297 for(int i = 0; i < cntCount; i++ ) |
1311 for(int i = 0; i < cntCount; i++ ) |
1298 { |
1312 { |
1299 contactList << contactManager->contact( cntServicesContacts.at(i).mContactId ); |
1313 contactList << contactManager->contact( cntServicesContacts.at(i).mContactId ); |
1300 } |
1314 } |
1301 delete contactManager; |
1315 delete contactManager; |
1302 |
1316 |
1303 // get list of all versit-documents |
1317 // get list of all versit-documents |
1304 QVersitDocument::VersitType versitType(QVersitDocument::VCard21Type); |
1318 QVersitDocument::VersitType versitType(QVersitDocument::VCard21Type); |
1305 QVersitContactExporter* exporter = new QVersitContactExporter(); |
1319 |
1306 |
1320 QVersitContactExporter exporter; |
1307 bool ret_val = exporter->exportContacts(contactList, versitType); |
1321 bool ret_val = exporter.exportContacts(contactList, versitType); |
1308 QList<QtMobility::QVersitDocument> documentList = exporter->documents(); |
1322 |
1309 |
1323 if(ret_val == false) |
1310 delete exporter; |
1324 { |
1311 |
1325 QCRITICAL_WRITE("QVersitContactExporter::exportContacts returned false"); |
|
1326 return KErrGeneral; |
|
1327 } |
|
1328 |
|
1329 // process the documents |
|
1330 QList<QtMobility::QVersitDocument> documentList = exporter.documents(); |
|
1331 |
1312 // loop though and create a vcard for each contact |
1332 // loop though and create a vcard for each contact |
1313 QVersitWriter* writer = new QVersitWriter(); |
1333 QVersitWriter* writer = new QVersitWriter(); |
1314 for(int i = 0; i < cntCount; i++ ) |
1334 for(int i = 0; i < cntCount; i++ ) |
1315 { |
1335 { |
1316 // buffer to hold vcard data fetched from contacts |
1336 // buffer to hold vcard data fetched from contacts |
1331 if(file.open(QIODevice::WriteOnly)) |
1351 if(file.open(QIODevice::WriteOnly)) |
1332 { |
1352 { |
1333 // trap ignore so that, incase of multiselection, other vcards are still created |
1353 // trap ignore so that, incase of multiselection, other vcards are still created |
1334 QByteArray bufArr; |
1354 QByteArray bufArr; |
1335 TRAP_IGNORE( |
1355 TRAP_IGNORE( |
1336 CBufBase* contactbufbase = CBufFlat::NewL(contactsbuf.size()); |
1356 HBufC8* contactBuf8 = XQConversions::qStringToS60Desc8(contactsbuf.data()); |
1337 CleanupStack::PushL(contactbufbase); |
1357 if(contactBuf8) |
1338 contactbufbase->InsertL( contactbufbase->Size(), |
1358 { |
1339 *XQConversions::qStringToS60Desc8( contactsbuf.data() ) ); |
1359 CleanupStack::PushL(contactBuf8); |
1340 TPtr8 ptrbuf(contactbufbase->Ptr(0)); |
1360 CBufBase* contactbufbase = CBufFlat::NewL(contactsbuf.size()); |
1341 bufArr = XQConversions::s60Desc8ToQByteArray(ptrbuf); |
1361 CleanupStack::PushL(contactbufbase); |
1342 CleanupStack::PopAndDestroy(contactbufbase); |
1362 |
1343 ); |
1363 contactbufbase->InsertL( contactbufbase->Size(), *contactBuf8); |
1344 file.write(bufArr); |
1364 |
1345 file.close(); |
1365 TPtr8 ptrbuf(contactbufbase->Ptr(0)); |
1346 filelist << filepath; |
1366 bufArr = XQConversions::s60Desc8ToQByteArray(ptrbuf); |
|
1367 |
|
1368 CleanupStack::PopAndDestroy(contactbufbase); |
|
1369 CleanupStack::PopAndDestroy(contactBuf8); |
|
1370 |
|
1371 // write to file |
|
1372 file.write(bufArr); |
|
1373 filelist << filepath; |
|
1374 } |
|
1375 ); // TRAP END |
|
1376 |
|
1377 //close file |
|
1378 file.close(); |
1347 } |
1379 } |
1348 } |
1380 } |
1349 } |
1381 } |
1350 |
1382 |
1351 // cleanup & return |
1383 // cleanup & return |
1434 // MsgUnifiedEditorView::fetchContacts |
1466 // MsgUnifiedEditorView::fetchContacts |
1435 // @see header file |
1467 // @see header file |
1436 //--------------------------------------------------------------- |
1468 //--------------------------------------------------------------- |
1437 void MsgUnifiedEditorView::fetchContacts() |
1469 void MsgUnifiedEditorView::fetchContacts() |
1438 { |
1470 { |
1439 QList<QVariant> args; |
1471 QString service("phonebookservices"); |
1440 QString serviceName("com.nokia.services.phonebookservices"); |
1472 QString interface("com.nokia.symbian.IContactsFetch"); |
1441 QString operation("fetch(QString,QString,QString)"); |
1473 QString operation("multiFetch(QString,QString)"); |
1442 XQAiwRequest* request; |
1474 XQAiwRequest* request; |
1443 XQApplicationManager appManager; |
1475 XQApplicationManager appManager; |
1444 request = appManager.create(serviceName, "Fetch", operation, true); //embedded |
1476 request = appManager.create(service, interface, operation, true); //embedded |
1445 if ( request == NULL ) |
1477 if ( request == NULL ) |
1446 { |
1478 { |
1447 QCRITICAL_WRITE("AIW-ERROR: NULL request"); |
1479 QCRITICAL_WRITE("AIW-ERROR: NULL request"); |
1448 return; |
1480 return; |
1449 } |
1481 } |
1450 |
1482 |
1451 // Result handlers |
1483 // Result handlers |
1452 connect (request, SIGNAL(requestOk(const QVariant&)), |
1484 connect (request, SIGNAL(requestOk(const QVariant&)), |
1453 this, SLOT(contactsFetched(const QVariant&))); |
1485 this, SLOT(contactsFetched(const QVariant&))); |
1454 connect (request, SIGNAL(requestError(int,const QString&)), |
1486 connect (request, SIGNAL(requestError(int,const QString&)), |
1455 this, SLOT(serviceRequestError(int,const QString&))); |
1487 this, SLOT(serviceRequestError(int,const QString&))); |
1456 |
1488 |
1457 args << QString(tr("Phonebook")); |
1489 QList<QVariant> args; |
|
1490 args << QString(tr("Phonebook")); |
1458 args << KCntActionAll; |
1491 args << KCntActionAll; |
1459 args << KCntFilterDisplayAll; |
1492 args << KCntFilterDisplayAll; |
1460 |
1493 |
1461 request->setArguments(args); |
1494 request->setArguments(args); |
1462 if(!request->send()) |
1495 if(!request->send()) |
1476 QString interface("com.nokia.symbian.IImageFetch"); |
1509 QString interface("com.nokia.symbian.IImageFetch"); |
1477 QString operation("fetch()"); |
1510 QString operation("fetch()"); |
1478 XQAiwRequest* request = NULL; |
1511 XQAiwRequest* request = NULL; |
1479 XQApplicationManager appManager; |
1512 XQApplicationManager appManager; |
1480 request = appManager.create(service,interface, operation, true);//embedded |
1513 request = appManager.create(service,interface, operation, true);//embedded |
1481 request->setSynchronous(true); // synchronous |
1514 |
1482 if(!request) |
1515 if(!request) |
1483 { |
1516 { |
1484 QCRITICAL_WRITE("AIW-ERROR: NULL request"); |
1517 QCRITICAL_WRITE("AIW-ERROR: NULL request"); |
1485 return; |
1518 return; |
1486 } |
1519 } |
|
1520 |
|
1521 request->setSynchronous(true); // synchronous |
1487 |
1522 |
1488 connect(request, SIGNAL(requestOk(const QVariant&)), |
1523 connect(request, SIGNAL(requestOk(const QVariant&)), |
1489 this, SLOT(imagesFetched(const QVariant&))); |
1524 this, SLOT(imagesFetched(const QVariant&))); |
1490 connect(request, SIGNAL(requestError(int,const QString&)), |
1525 connect(request, SIGNAL(requestError(int,const QString&)), |
1491 this, SLOT(serviceRequestError(int,const QString&))); |
1526 this, SLOT(serviceRequestError(int,const QString&))); |