save QOrganizerEventOccurrence
how to save QOrganizerEventOccurrence?
I try
QOrganizerManager defaultManager;
QOrganizerEventOccurrence eventOccurrence;
eventOccurrence.setDisplayLabel("test");
eventOccurrence.setStartDateTime(QDateTime(QDate(2012, 3, 3)));
eventOccurrence.setEndDateTime (QDateTime(QDate(2012, 3, 4)));
eventOccurrence.setOriginalDate(QDate(2012, 3, 3));
defaultManager.saveItem(&eventOccurrence);
if (defaultManager.error())
qDebug() << defaultManager.error();
Result:
QOrganizerManager::InvalidOccurrenceError 15 The most recent operation failed because it was an attempt to save an occurrence without a correct InstanceOrigin detail
Re: save QOrganizerEventOccurrence
Might be if its asking for DATE & TIME then providing only date might be an issue, try like this if its helps:
QDateTime start = QDateTime::fromString(aStartDateTime, "yyyy-MM-ddTHH:mm"); // fill here the start date & time
QDateTime end = QDateTime::fromString(aEndDateTime, "yyyy-MM-ddTHH:mm"); // fill here the end date & time
eventOccurrence.setStartDateTime(start);
eventOccurrence.setEndDateTime (end);
Re: save QOrganizerEventOccurrence
Re: save QOrganizerEventOccurrence
I think using QOrganizerEventOccurrence , you can modify an already existing event in the manager, at least that is what i understand from its description here:
[url]http://doc.qt.nokia.com/qtmobility/qorganizereventoccurrence.html[/url]
Also see its example usage here :
[url]http://harmattan-dev.nokia.com/docs/library/html/qtmobility/organizer.html[/url] (search for '[B]Recurring Items[/B]')
Re: save QOrganizerEventOccurrence
I read this earlier and try
QList<QOrganizerItem> entries1 = defaultManager.items();
foreach (QOrganizerItem item, entries1) {
if (item.type() == QOrganizerItemType::TypeEvent) {
QOrganizerEventOccurrence nextMarshmallowMeeting = defaultManager.itemOccurrences(item).value(0);
nextMarshmallowMeeting.setStartDateTime(event1.startDateTime());
nextMarshmallowMeeting.setEndDateTime(event1.endDateTime());
nextMarshmallowMeeting.setDisplayLabel("hello");
nextMarshmallowMeeting.setDescription("hello world");
defaultManager.saveItem(&nextMarshmallowMeeting);
if (defaultManager.error())
QMessageBox::warning(this, QString(tr("Failed2")), QString("(error code %1 %2)").arg(defaultManager.error()).arg(item.displayLabel()));
}
}
Result
QOrganizerManager::InvalidDetail Error 3 The most recent operation failed because the specified organizer detail definition already exists
Re: save QOrganizerEventOccurrence
Not sure but you might have to add some recurrence rule to an event & also apply the case as given in 2nd link as :
else if (item.type() == QOrganizerItemType::[B]TypeEventOccurrence[/B]) {
QOrganizerEventOccurrence event(item);
...
...