102 |
103 |
103 void tst_details::dumpContact(const QContact& contact) |
104 void tst_details::dumpContact(const QContact& contact) |
104 { |
105 { |
105 qDebug() << "Contact: " << contact.localId(); |
106 qDebug() << "Contact: " << contact.localId(); |
106 QList<QContactDetail> details = contact.details(); |
107 QList<QContactDetail> details = contact.details(); |
107 foreach(QContactDetail d, details) { |
108 foreach(const QContactDetail& d, details) { |
108 qDebug() << " " << d.definitionName() << ":"; |
109 qDebug() << " " << d.definitionName() << ":"; |
109 foreach( QString key, d.variantValues().keys() ) |
110 foreach( const QString& key, d.variantValues().keys() ) |
110 qDebug() << " " << key << d.variantValue(key); |
111 qDebug() << " " << key << d.variantValue(key); |
111 } |
112 } |
112 } |
113 } |
113 |
114 |
114 void tst_details::initTestCase() |
115 void tst_details::initTestCase() |
115 { |
116 { |
116 qDebug() << "Available managers:"; |
117 qDebug() << "Available managers:"; |
117 foreach( QString manager, QContactManager::availableManagers() ) |
118 foreach( const QString& manager, QContactManager::availableManagers() ) |
118 qDebug() << manager; |
119 qDebug() << manager; |
119 QVERIFY(QContactManager::availableManagers().contains("symbian")); |
120 QVERIFY(QContactManager::availableManagers().contains("symbian")); |
120 |
121 |
121 QContactManager cm("symbian"); |
122 QContactManager cm("symbian"); |
122 QList<QContactLocalId> ids = cm.contactIds(); |
123 QList<QContactLocalId> ids = cm.contactIds(); |
398 c.saveDetail( &u ); |
399 c.saveDetail( &u ); |
399 |
400 |
400 saveAndVerifyContact( c ); |
401 saveAndVerifyContact( c ); |
401 } |
402 } |
402 |
403 |
|
404 void tst_details::testPresence() |
|
405 { |
|
406 QContact c; |
|
407 |
|
408 QContactPresence presence; |
|
409 presence.setNickname("Tom"); |
|
410 presence.setTimestamp(QDateTime::currentTime()); |
|
411 presence.setPresenceState(QContactPresence::PresenceAvailable); |
|
412 presence.setPresenceStateText("Available"); |
|
413 presence.setPresenceStateImageUrl("http://example.com/example.jpg"); |
|
414 presence.setCustomMessage("MSN"); |
|
415 c.saveDetail(&presence); |
|
416 |
|
417 saveAndVerifyContact( c ); |
|
418 } |
403 QTEST_MAIN(tst_details) |
419 QTEST_MAIN(tst_details) |
404 #include "tst_details.moc" |
420 #include "tst_details.moc" |