bool CalendarPage::setupData(const QNdefMessage message) { QOrganizerItem o = Util::organizerItemFromNdef(message); if (o.isEmpty() == true) { setCalendarItem(QOrganizerItem()); return false; } setCalendarItem(o); if (isTemporary() == true) { setDefaultName(m_info.displayLabel()); } return true; }
QOrganizerItemLocation adr; adr.setLabel("this is a test address"); QVERIFY(keyTest.saveDetail(&adr)); allDetails = keyTest.details(); detailKeys.clear(); foreach (const QOrganizerItemDetail& det, allDetails) { int currKey = det.key(); QVERIFY(!detailKeys.contains(currKey)); detailKeys.append(currKey); } // now test for default construction sanity QOrganizerItem oi; // Test there are no details (apart from type) by default QVERIFY(oi.isEmpty() == true); QCOMPARE(oi.details().count(), 1); QCOMPARE(oi.details(QOrganizerItemLocation::DefinitionName).count(), 0); QCOMPARE(oi.details<QOrganizerItemLocation>().count(), 0); QVERIFY(oi.detail(QOrganizerItemLocation::DefinitionName).isEmpty()); QVERIFY(oi.detail<QOrganizerItemLocation>().isEmpty()); QCOMPARE(oi.details(QOrganizerItemLocation::DefinitionName.latin1()).count(), 0); QVERIFY(oi.detail(QOrganizerItemLocation::DefinitionName.latin1()).isEmpty()); QCOMPARE(oi.details(QLatin1String(QOrganizerItemLocation::DefinitionName)).count(), 0); QVERIFY(oi.detail(QLatin1String(QOrganizerItemLocation::DefinitionName)).isEmpty()); // Test retrieving the default details (type) QList<QOrganizerItemDetail> details = oi.details(QString()); QVERIFY(details.at(0).definitionName() == QOrganizerItemType::DefinitionName); QOrganizerItemDetail detail = oi.detail("nonexistent");