void tst_QOrganizerItemDetails::parent()
{
    QOrganizerItemParent p;
    QOrganizerItem oi;

    // hrm, how to test parent local id?

    QVERIFY(p.isEmpty());
    p.setOriginalDate(QDate(2010, 10, 13));
    QVERIFY(p.originalDate() == QDate(2010, 10, 13));
    QVERIFY(!p.isEmpty());

    QVERIFY(oi.saveDetail(&p));
    QVERIFY(oi.details(QOrganizerItemDetail::TypeParent).size() == 1);
    QVERIFY(oi.detail(QOrganizerItemDetail::TypeParent) == p);

    p.setOriginalDate(QDate(2010, 10, 14));
    QVERIFY(oi.detail(QOrganizerItemDetail::TypeParent) != p);
    QVERIFY(oi.saveDetail(&p)); // update
    QVERIFY(oi.detail(QOrganizerItemDetail::TypeParent) == p);

    QVERIFY(oi.removeDetail(&p));
    QVERIFY(oi.details(QOrganizerItemDetail::TypeParent).size() == 0);
}
/*!
    Sets the date at which this occurrence was originally going to occur,
    to the given \a date.
 */
void QOrganizerTodoOccurrence::setOriginalDate(const QDate &date)
{
    QOrganizerItemParent origin = detail(QOrganizerItemDetail::TypeParent);
    origin.setOriginalDate(date);
    saveDetail(&origin);
}
Esempio n. 3
0
/*!
  Sets the date at which this occurrence was originally going to occur,
  to the given \a date.
  \since 1.1
 */
void QOrganizerEventOccurrence::setOriginalDate(const QDate& date)
{
    QOrganizerItemParent origin = detail<QOrganizerItemParent>();
    origin.setOriginalDate(date);
    saveDetail(&origin);
}