本文整理汇总了C++中QOrganizerItem::saveDetail方法的典型用法代码示例。如果您正苦于以下问题:C++ QOrganizerItem::saveDetail方法的具体用法?C++ QOrganizerItem::saveDetail怎么用?C++ QOrganizerItem::saveDetail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QOrganizerItem
的用法示例。
在下文中一共展示了QOrganizerItem::saveDetail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: guid
void tst_QOrganizerItemDetails::guid()
{
QOrganizerItem oi;
QOrganizerItemGuid g1, g2;
// test property set
g1.setGuid("1234");
QCOMPARE(g1.guid(), QString("1234"));
QCOMPARE(g1.value(QOrganizerItemGuid::FieldGuid).toString(), QString("1234"));
// test property add
QVERIFY(oi.saveDetail(&g1));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeGuid).count(), 1);
QCOMPARE(QOrganizerItemGuid(oi.details(QOrganizerItemDetail::TypeGuid).value(0)).guid(), g1.guid());
// test property update
g1.setValue(101,"label1");
g1.setGuid("12345");
QVERIFY(oi.saveDetail(&g1));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeGuid).value(0).value(101).toString(), QString("label1"));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeGuid).value(0).value(QOrganizerItemGuid::FieldGuid).toString(), QString("12345"));
// test property remove
QVERIFY(oi.removeDetail(&g1));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeGuid).count(), 0);
QVERIFY(oi.saveDetail(&g2));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeGuid).count(), 1);
QVERIFY(oi.removeDetail(&g2));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeGuid).count(), 0);
QVERIFY(oi.removeDetail(&g2) == false);
QCOMPARE(oi.details(QOrganizerItemDetail::TypeGuid).count(), 0);
}
示例2: description
void tst_QOrganizerItemDetails::description()
{
QOrganizerItemDescription d1;
QOrganizerItem oi;
QVERIFY(d1.description().isEmpty());
QVERIFY(d1.value(QOrganizerItemDescription::FieldDescription).isNull());
d1.setValue(QOrganizerItemDescription::FieldDescription, "Test");
QVERIFY(d1.value(QOrganizerItemDescription::FieldDescription) == QString("Test"));
QVERIFY(d1.description() == QString("Test"));
QOrganizerItemDescription d2;
d2.setValue(QOrganizerItemDescription::FieldDescription, "Test 2");
// test property add -- description is unique.
QVERIFY(oi.saveDetail(&d2));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeDescription).count(), 1); // count should be 1
QVERIFY(oi.saveDetail(&d1));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeDescription).count(), 1); // count should be 1
// test property update
d1.setDescription("Test 3");
QVERIFY(oi.saveDetail(&d1));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeDescription).count(), 1); // count should be 1
QVERIFY(oi.detail(QOrganizerItemDetail::TypeDescription).value(QOrganizerItemDescription::FieldDescription) == QString("Test 3"));
// test property remove
QVERIFY(oi.removeDetail(&d1));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeDescription).count(), 0);
}
示例3: displayLabel
void tst_QOrganizerItemDetails::displayLabel()
{
QOrganizerItemDisplayLabel d1;
QOrganizerItem oi;
QVERIFY(d1.label().isEmpty());
QVERIFY(d1.value(QOrganizerItemDisplayLabel::FieldLabel).isNull());
d1.setValue(QOrganizerItemDisplayLabel::FieldLabel, "Test");
QVERIFY(d1.value(QOrganizerItemDisplayLabel::FieldLabel) == QString("Test"));
QVERIFY(d1.label() == QString("Test"));
QOrganizerItemDisplayLabel d2;
d2.setValue(QOrganizerItemDisplayLabel::FieldLabel, "Test 2");
// test property add - should update.
QVERIFY(oi.saveDetail(&d2));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeDisplayLabel).count(), 1);
QVERIFY(oi.saveDetail(&d1));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeDisplayLabel).count(), 1);
// test property update - should update
d1.setLabel("Test 3");
QVERIFY(oi.saveDetail(&d1));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeDisplayLabel).count(), 1);
QVERIFY(oi.detail(QOrganizerItemDetail::TypeDisplayLabel).value(QOrganizerItemDisplayLabel::FieldLabel) == QString("Test 3"));
// test property remove
QVERIFY(oi.removeDetail(&d1)); // can remove display label. it's unique but not required.
QCOMPARE(oi.details(QOrganizerItemDetail::TypeDisplayLabel).count(), 0);
}
示例4: tag
void tst_QOrganizerItemDetails::tag()
{
QOrganizerItem oi;
QOrganizerItemTag t1, t2;
// test property set
t1.setTag("red");
QCOMPARE(t1.tag(), QString("red"));
QCOMPARE(t1.value(QOrganizerItemTag::FieldTag).toString(), QString("red"));
// test property add
QVERIFY(oi.saveDetail(&t1));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeTag).count(), 1);
QCOMPARE(QOrganizerItemTag(oi.details(QOrganizerItemDetail::TypeTag).value(0)).tag(), t1.tag());
QVERIFY(oi.saveDetail(&t2));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeTag).count(), 2);
// test property update
t1.setValue(101,"label1");
t1.setTag("green");
QVERIFY(oi.saveDetail(&t1));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeTag).value(0).value(101).toString(), QString("label1"));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeTag).value(0).value(QOrganizerItemTag::FieldTag).toString(), QString("green"));
// test property remove
QVERIFY(oi.removeDetail(&t1));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeTag).count(), 1);
QVERIFY(oi.removeDetail(&t2));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeTag).count(), 0);
QVERIFY(oi.removeDetail(&t2) == false);
QCOMPARE(oi.details(QOrganizerItemDetail::TypeTag).count(), 0);
}
示例5: location
void tst_QOrganizerItemDetails::location()
{
QOrganizerItemLocation l1;
QOrganizerItem oi;
QVERIFY(l1.isEmpty());
l1.setLatitude(0.12345);
QVERIFY(!l1.isEmpty());
QVERIFY(l1.latitude() == 0.12345);
l1.setValue(QOrganizerItemLocation::FieldLongitude, 0.54321);
QVERIFY(l1.longitude() == 0.54321);
l1.setLabel("test");
QVERIFY(l1.label() == QString("test"));
QVERIFY(oi.details<QOrganizerItemLocation>().size() == 0);
QVERIFY(oi.saveDetail(&l1));
QVERIFY(oi.details<QOrganizerItemLocation>().size() == 1);
QVERIFY(oi.detail<QOrganizerItemLocation>() == l1);
l1.setLabel("test 2");
QVERIFY(oi.detail<QOrganizerItemLocation>() != l1);
QVERIFY(oi.saveDetail(&l1)); // update.
QVERIFY(oi.details<QOrganizerItemLocation>().size() == 1); // should update, not add another.
QVERIFY(oi.detail<QOrganizerItemLocation>() == l1);
oi.removeDetail(&l1);
QVERIFY(oi.details<QOrganizerItemLocation>().size() == 0);
}
示例6: audibleReminder
void tst_QOrganizerItemDetails::audibleReminder()
{
QOrganizerItemAudibleReminder r;
QOrganizerItem oi;
QVERIFY(r.isEmpty());
QVERIFY(r.reminderType() == QOrganizerItemReminder::AudibleReminder);
QVERIFY(r.secondsBeforeStart() == 0);
QVERIFY(r.repetitionCount() == 0);
QVERIFY(r.repetitionDelay() == 0);
r.setSecondsBeforeStart(45);
QVERIFY(!r.isEmpty());
r.removeValue(QOrganizerItemReminder::FieldSecondsBeforeStart);
QVERIFY(r.isEmpty());
QOrganizerItemReminder baseR;
baseR = r;
QVERIFY(baseR.isEmpty());
baseR.setSecondsBeforeStart(50);
QVERIFY(baseR.secondsBeforeStart() == 50);
QVERIFY(r.secondsBeforeStart() == 0);
QVERIFY(!baseR.isEmpty());
QVERIFY(r.isEmpty());
r.setRepetition(3, 100);
QVERIFY(r.repetitionCount() == 3);
QVERIFY(r.repetitionDelay() == 100);
QVERIFY(!r.isEmpty());
r.setSecondsBeforeStart(30); // reminder, 30 seconds before the item is due to start.
QVERIFY(r.secondsBeforeStart() == 30);
// add
QVERIFY(oi.details(QOrganizerItemDetail::TypeAudibleReminder).size() == 0);
QVERIFY(oi.saveDetail(&r));
QVERIFY(oi.details(QOrganizerItemDetail::TypeAudibleReminder).size() == 1);
QVERIFY(oi.detail(QOrganizerItemDetail::TypeAudibleReminder) == r);
// update
r.setSecondsBeforeStart(300);
r.setDataUrl(QUrl("http://www.test.com"));
QVERIFY(r.dataUrl() == QUrl("http://www.test.com"));
QVERIFY(oi.detail(QOrganizerItemDetail::TypeAudibleReminder) != r);
QVERIFY(oi.saveDetail(&r));
QVERIFY(oi.details(QOrganizerItemDetail::TypeAudibleReminder).size() == 1); // should update, not add another
QVERIFY(oi.detail(QOrganizerItemDetail::TypeAudibleReminder) == r);
// remove
QVERIFY(oi.removeDetail(&r));
QVERIFY(oi.details(QOrganizerItemDetail::TypeAudibleReminder).size() == 0);
}
示例7: attendee
void tst_QOrganizerItemDetails::attendee()
{
QOrganizerEventAttendee a;
QOrganizerItem oi;
QVERIFY(a.isEmpty());
QVERIFY(a.name().isEmpty());
QVERIFY(a.emailAddress().isEmpty());
QVERIFY(a.attendeeId().isEmpty());
QVERIFY(a.participationRole() == 0);
QVERIFY(a.participationStatus() == 0);
a.setAttendeeId("123456");
QVERIFY(a.attendeeId() == QString("123456"));
a.setEmailAddress("[email protected]");
QVERIFY(a.emailAddress() == QString("[email protected]"));
a.setName("people");
QVERIFY(a.name() == QString("people"));
a.setParticipationRole(QOrganizerEventAttendee::RoleRequiredParticipant);
QVERIFY(a.participationRole() == QOrganizerEventAttendee::RoleRequiredParticipant);
a.setParticipationStatus(QOrganizerEventAttendee::StatusAccepted);
QVERIFY(a.participationStatus() == QOrganizerEventAttendee::StatusAccepted);
// add
QVERIFY(oi.details(QOrganizerItemDetail::TypeEventAttendee).size() == 0);
QVERIFY(oi.saveDetail(&a));
QVERIFY(oi.details(QOrganizerItemDetail::TypeEventAttendee).size() == 1);
QVERIFY(oi.detail(QOrganizerItemDetail::TypeEventAttendee) == a);
// update
a.setAttendeeId("54321");
a.setName("newpeople");
a.setEmailAddress("[email protected]");
QVERIFY(oi.detail(QOrganizerItemDetail::TypeEventAttendee) != a);
QVERIFY(oi.saveDetail(&a));
QVERIFY(oi.details(QOrganizerItemDetail::TypeEventAttendee).size() == 1);
QVERIFY(oi.detail(QOrganizerItemDetail::TypeEventAttendee) == a);
// add one more attendee
QOrganizerEventAttendee a1;
a1.setAttendeeId("777777");
a1.setName("people1");
a1.setEmailAddress("[email protected]");
QVERIFY(oi.saveDetail(&a1));
QVERIFY(oi.details(QOrganizerItemDetail::TypeEventAttendee).size() == 2);
// remove
QVERIFY(oi.removeDetail(&a));
QVERIFY(oi.details(QOrganizerItemDetail::TypeEventAttendee).size() == 1);
QVERIFY(oi.removeDetail(&a1));
QVERIFY(oi.details(QOrganizerItemDetail::TypeEventAttendee).size() == 0);
}
示例8: type
void tst_QOrganizerItemDetails::type()
{
QOrganizerItem oi;
QOrganizerItemType t1, t2;
QOrganizerEvent e;
QOrganizerNote n;
QOrganizerTodo t;
QOrganizerJournal j;
QOrganizerEventOccurrence eo;
QOrganizerTodoOccurrence to;
QVERIFY(e.type() == QOrganizerItemType::TypeEvent);
QVERIFY(n.type() == QOrganizerItemType::TypeNote);
QVERIFY(t.type() == QOrganizerItemType::TypeTodo);
QVERIFY(j.type() == QOrganizerItemType::TypeJournal);
QVERIFY(eo.type() == QOrganizerItemType::TypeEventOccurrence);
QVERIFY(to.type() == QOrganizerItemType::TypeTodoOccurrence);
// test property set
t1.setType(QOrganizerItemType::TypeEvent);
QCOMPARE(t1.type(), QOrganizerItemType::TypeEvent);
QCOMPARE(static_cast<QOrganizerItemType::ItemType>(t1.value(QOrganizerItemType::FieldType).toInt()), QOrganizerItemType::TypeEvent);
// test property add
QVERIFY(oi.saveDetail(&t1));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeItemType).count(), 1);
QCOMPARE(QOrganizerItemType(oi.details(QOrganizerItemDetail::TypeItemType).value(0)).type(), t1.type());
// test property update
t1.setType(QOrganizerItemType::TypeTodo);
QVERIFY(oi.saveDetail(&t1));
QCOMPARE(static_cast<QOrganizerItemType::ItemType>(oi.details(QOrganizerItemDetail::TypeItemType).value(0).value(QOrganizerItemType::FieldType).toInt()), QOrganizerItemType::TypeTodo);
// test property remove
QVERIFY(!oi.removeDetail(&t1)); // cannot remove type
QCOMPARE(oi.details(QOrganizerItemDetail::TypeItemType).count(), 1);
t2.setType(QOrganizerItemType::TypeNote);
QVERIFY(oi.saveDetail(&t2)); // overwrites t1
QCOMPARE(oi.details(QOrganizerItemDetail::TypeItemType).count(), 1);
QVERIFY(!oi.removeDetail(&t2)); // cannot remove type - "succeeds" but count remains unchanged
QCOMPARE(oi.details(QOrganizerItemDetail::TypeItemType).count(), 1);
QVERIFY(!oi.removeDetail(&t2));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeItemType).count(), 1);
}
示例9: emailReminder
void tst_QOrganizerItemDetails::emailReminder()
{
QOrganizerItemEmailReminder r;
QOrganizerItem oi;
QVERIFY(r.isEmpty());
QVERIFY(r.reminderType() == QOrganizerItemReminder::EmailReminder);
QVERIFY(r.secondsBeforeStart() == 0);
QVERIFY(r.repetitionCount() == 0);
QVERIFY(r.repetitionDelay() == 0);
r.setRepetition(3, 100);
QVERIFY(r.repetitionCount() == 3);
QVERIFY(r.repetitionDelay() == 100);
QVERIFY(!r.isEmpty());
r.setSecondsBeforeStart(30); // reminder, 30 seconds before the item is due to start.
QVERIFY(r.secondsBeforeStart() == 30);
// add
QVERIFY(oi.details(QOrganizerItemDetail::TypeEmailReminder).size() == 0);
QVERIFY(oi.saveDetail(&r));
QVERIFY(oi.details(QOrganizerItemDetail::TypeEmailReminder).size() == 1);
QVERIFY(oi.detail(QOrganizerItemDetail::TypeEmailReminder) == r);
// update
r.setSecondsBeforeStart(300);
r.setContents("subject", "body", QVariantList());
r.setRecipients(QStringList() << "recipient" << "other recipient");
QVERIFY(r.subject() == QString("subject"));
QVERIFY(r.body() == QString("body"));
QVERIFY(r.attachments() == QVariantList());
QVERIFY(r.recipients() == (QStringList() << "recipient" << "other recipient"));
QVERIFY(oi.detail(QOrganizerItemDetail::TypeEmailReminder) != r);
QVERIFY(oi.saveDetail(&r));
QVERIFY(oi.details(QOrganizerItemDetail::TypeEmailReminder).size() == 1); // should update, not add another
QVERIFY(oi.detail(QOrganizerItemDetail::TypeEmailReminder) == r);
// remove
QVERIFY(oi.removeDetail(&r));
QVERIFY(oi.details(QOrganizerItemDetail::TypeEmailReminder).size() == 0);
}
示例10: reminder
void tst_QOrganizerItemDetails::reminder()
{
QOrganizerItemReminder r;
QOrganizerItem oi;
QVERIFY(r.isEmpty());
QVERIFY(r.reminderType() == QOrganizerItemReminder::NoReminder);
QVERIFY(r.secondsBeforeStart() == 0);
QVERIFY(r.repetitionCount() == 0);
QVERIFY(r.repetitionDelay() == 0);
r.setSecondsBeforeStart(45);
QVERIFY(!r.isEmpty());
r.removeValue(QOrganizerItemReminder::FieldSecondsBeforeStart);
QVERIFY(r.isEmpty());
r.setRepetition(3, 100);
QVERIFY(r.repetitionCount() == 3);
QVERIFY(r.repetitionDelay() == 100);
QVERIFY(!r.isEmpty());
r.setSecondsBeforeStart(30); // reminder, 30 seconds before the item is due to start.
QVERIFY(r.secondsBeforeStart() == 30);
// add
QVERIFY(oi.details(QOrganizerItemDetail::TypeReminder).size() == 0);
QVERIFY(oi.saveDetail(&r));
QVERIFY(oi.details(QOrganizerItemDetail::TypeReminder).size() == 1);
QVERIFY(oi.detail(QOrganizerItemDetail::TypeReminder) == r);
// update
r.setSecondsBeforeStart(300);
QVERIFY(oi.detail(QOrganizerItemDetail::TypeReminder) != r);
QVERIFY(oi.saveDetail(&r));
QVERIFY(oi.details(QOrganizerItemDetail::TypeReminder).size() == 1); // should update, not add another
QVERIFY(oi.detail(QOrganizerItemDetail::TypeReminder) == r);
// remove
QVERIFY(oi.removeDetail(&r));
QVERIFY(oi.details(QOrganizerItemDetail::TypeReminder).size() == 0);
}
示例11: visualReminder
void tst_QOrganizerItemDetails::visualReminder()
{
QOrganizerItemVisualReminder r;
QOrganizerItem oi;
QVERIFY(r.isEmpty());
QVERIFY(r.reminderType() == QOrganizerItemReminder::VisualReminder);
QVERIFY(r.secondsBeforeStart() == 0);
QVERIFY(r.repetitionCount() == 0);
QVERIFY(r.repetitionDelay() == 0);
r.setRepetition(3, 100);
QVERIFY(r.repetitionCount() == 3);
QVERIFY(r.repetitionDelay() == 100);
QVERIFY(!r.isEmpty());
r.setSecondsBeforeStart(30); // reminder, 30 seconds before the item is due to start.
QVERIFY(r.secondsBeforeStart() == 30);
// add
QVERIFY(oi.details(QOrganizerItemDetail::TypeVisualReminder).size() == 0);
QVERIFY(oi.saveDetail(&r));
QVERIFY(oi.details(QOrganizerItemDetail::TypeVisualReminder).size() == 1);
QVERIFY(oi.detail(QOrganizerItemDetail::TypeVisualReminder) == r);
// update
r.setSecondsBeforeStart(300);
r.setMessage("test");
r.setDataUrl(QUrl("http://www.test.com"));
QVERIFY(r.message() == QString("test"));
QVERIFY(r.dataUrl() == QUrl("http://www.test.com"));
QVERIFY(oi.detail(QOrganizerItemDetail::TypeVisualReminder) != r);
QVERIFY(oi.saveDetail(&r));
QVERIFY(oi.details(QOrganizerItemDetail::TypeVisualReminder).size() == 1); // should update, not add another
QVERIFY(oi.detail(QOrganizerItemDetail::TypeVisualReminder) == r);
// remove
QVERIFY(oi.removeDetail(&r));
QVERIFY(oi.details(QOrganizerItemDetail::TypeVisualReminder).size() == 0);
}
示例12: priority
void tst_QOrganizerItemDetails::priority()
{
QOrganizerItemPriority p;
QOrganizerItem oi;
QVERIFY(p.isEmpty());
p.setValue(QOrganizerItemPriority::FieldPriority, QOrganizerItemPriority::VeryHighPriority);
QVERIFY(p.priority() == QOrganizerItemPriority::VeryHighPriority);
QVERIFY(oi.saveDetail(&p));
QVERIFY(oi.details(QOrganizerItemDetail::TypePriority).size() == 1);
QVERIFY(oi.detail(QOrganizerItemDetail::TypePriority) == p);
p.setPriority(QOrganizerItemPriority::VeryLowPriority);
QVERIFY(oi.detail(QOrganizerItemDetail::TypePriority) != p);
QVERIFY(oi.saveDetail(&p));
QVERIFY(oi.details(QOrganizerItemDetail::TypePriority).size() == 1); // update shouldn't add another detail.
QVERIFY(oi.detail(QOrganizerItemDetail::TypePriority) == p);
QVERIFY(oi.removeDetail(&p));
QVERIFY(oi.details(QOrganizerItemDetail::TypePriority).size() == 0);
}
示例13: location
void tst_QOrganizerItemDetails::location()
{
QOrganizerItemLocation l1;
QOrganizerItem oi;
QVERIFY(l1.isEmpty());
l1.setLatitude(89.999);
QVERIFY(!l1.isEmpty());
QVERIFY(l1.latitude() == 89.999);
l1.setValue(QOrganizerItemLocation::FieldLatitude, -89.12345);
QVERIFY(l1.value(QOrganizerItemLocation::FieldLatitude) == -89.12345);
l1.setLatitude(-90.12345);
l1.setLatitude(91);
QVERIFY(l1.latitude() == -89.12345);
l1.setLongitude(179);
QVERIFY(l1.longitude() == 179);
l1.setValue(QOrganizerItemLocation::FieldLongitude, -179.54321);
QVERIFY(l1.value(QOrganizerItemLocation::FieldLongitude) == -179.54321);
l1.setLongitude(180.1);
l1.setLongitude(-180.1);
QVERIFY(l1.longitude() == -179.54321);
l1.setLabel("test");
QVERIFY(l1.label() == QString("test"));
QVERIFY(oi.details(QOrganizerItemDetail::TypeLocation).size() == 0);
QVERIFY(oi.saveDetail(&l1));
QVERIFY(oi.details(QOrganizerItemDetail::TypeLocation).size() == 1);
QVERIFY(oi.detail(QOrganizerItemDetail::TypeLocation) == l1);
l1.setLabel("test 2");
QVERIFY(oi.detail(QOrganizerItemDetail::TypeLocation) != l1);
QVERIFY(oi.saveDetail(&l1)); // update.
QVERIFY(oi.details(QOrganizerItemDetail::TypeLocation).size() == 1); // should update, not add another.
QVERIFY(oi.detail(QOrganizerItemDetail::TypeLocation) == l1);
oi.removeDetail(&l1);
QVERIFY(oi.details(QOrganizerItemDetail::TypeLocation).size() == 0);
}
示例14: classification
void tst_QOrganizerItemDetails::classification()
{
QOrganizerItemClassification classification;
QOrganizerItem oi;
QVERIFY(classification.isEmpty());
// setters/getters
classification.setClassification(QOrganizerItemClassification::AccessPublic);
QVERIFY(classification.classification() == QOrganizerItemClassification::AccessPublic);
classification.setClassification(QOrganizerItemClassification::AccessPrivate);
QVERIFY(classification.classification() == QOrganizerItemClassification::AccessPrivate);
classification.setClassification(QOrganizerItemClassification::AccessConfidential);
QVERIFY(classification.classification() == QOrganizerItemClassification::AccessConfidential);
// add
QCOMPARE(0, oi.details(QOrganizerItemDetail::TypeClassification).size());
QVERIFY(oi.saveDetail(&classification));
QCOMPARE(1, oi.details(QOrganizerItemDetail::TypeClassification).size());
QCOMPARE(classification, static_cast<QOrganizerItemClassification>(oi.detail(QOrganizerItemDetail::TypeClassification)));
// update
classification.setValue(QOrganizerItemClassification::FieldClassification, QOrganizerItemClassification::AccessPrivate);
QVERIFY(oi.detail(QOrganizerItemDetail::TypeClassification) != classification);
QVERIFY(oi.saveDetail(&classification));
QCOMPARE(1, oi.details(QOrganizerItemDetail::TypeClassification).size());
QVERIFY(oi.detail(QOrganizerItemDetail::TypeClassification) == classification);
// try adding another, amount of details should stay the same
QOrganizerItemClassification classification2;
classification2.setClassification(QOrganizerItemClassification::AccessConfidential);
QVERIFY(oi.saveDetail(&classification2));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeClassification).size(), 1);
// remove
QVERIFY(oi.removeDetail(&classification2));
QCOMPARE(oi.details(QOrganizerItemDetail::TypeClassification).size(), 0);
}
示例15: details
void tst_QOrganizerItem::details()
{
// Check that detail keys are unique, regardless of order of initialisation
// First, construct the detail first, then the contact
QOrganizerItemComment note;
note.setComment("Example Note");
QOrganizerItem keyTest;
QVERIFY(keyTest.saveDetail(¬e));
QList<QOrganizerItemDetail> allDetails = keyTest.details();
QList<int> detailKeys;
foreach (const QOrganizerItemDetail& det, allDetails) {
int currKey = det.key();
QVERIFY(!detailKeys.contains(currKey));
detailKeys.append(currKey);
}