summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/qtorganizerdocsample/qtorganizerdocsample.cpp
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2010-10-19 13:23:37 +1000
committerChris Adams <christopher.adams@nokia.com>2010-10-19 13:23:37 +1000
commitd67dffaa9873d22574a17edde6e0e47b2240dac3 (patch)
tree658430ab40f0ef2524bf23ca8567afc0622b2ce6 /doc/src/snippets/qtorganizerdocsample/qtorganizerdocsample.cpp
parent9add9cf632e8bd47b1049f5d4b0eb163e9d20ae8 (diff)
Fix various problems in the organizer module documentation
Relates to task MOBILITY-1763. Reviewed By: Michael Goddard
Diffstat (limited to 'doc/src/snippets/qtorganizerdocsample/qtorganizerdocsample.cpp')
-rw-r--r--doc/src/snippets/qtorganizerdocsample/qtorganizerdocsample.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/doc/src/snippets/qtorganizerdocsample/qtorganizerdocsample.cpp b/doc/src/snippets/qtorganizerdocsample/qtorganizerdocsample.cpp
index 212e22bfa5..f2c7608a38 100644
--- a/doc/src/snippets/qtorganizerdocsample/qtorganizerdocsample.cpp
+++ b/doc/src/snippets/qtorganizerdocsample/qtorganizerdocsample.cpp
@@ -79,18 +79,18 @@ void snippets()
rDates << firstOccDate << secondOccDate << thirdOccDate;
//! [Creating a recurrent event]
- QOrganizerEvent recEvent;
- recEvent.setRecurrenceDates(rDates);
- recEvent.setPriority(QOrganizerItemPriority::HighPriority);
- recEvent.setLocation("Meeting Room 8");
- recEvent.setDescription("A meeting every wednesday to discuss the vitally important topic of marshmallows");
- recEvent.setDisplayLabel("Marshmallow Conference");
- if (!defaultManager.saveItem(&recEvent))
+ QOrganizerEvent marshmallowMeeting;
+ marshmallowMeeting.setRecurrenceDates(rDates);
+ marshmallowMeeting.setPriority(QOrganizerItemPriority::HighPriority);
+ marshmallowMeeting.setLocation("Meeting Room 8");
+ marshmallowMeeting.setDescription("A meeting every wednesday to discuss the vitally important topic of marshmallows");
+ marshmallowMeeting.setDisplayLabel("Marshmallow Conference");
+ if (!defaultManager.saveItem(&marshmallowMeeting))
qDebug() << "Failed to save the recurrent event; error:" << defaultManager.error();
//! [Creating a recurrent event]
//! [Retrieving occurrences of a particular recurrent event within a time period]
- QList<QOrganizerItem> instances = defaultManager.itemOccurrences(recEvent, startDateTime, endDateTime);
+ QList<QOrganizerItem> instances = defaultManager.itemOccurrences(marshmallowMeeting, startDateTime, endDateTime);
//! [Retrieving occurrences of a particular recurrent event within a time period]
qDebug() << "dumping retrieved instances:";
foreach(const QOrganizerItem& currInst, instances)
@@ -101,12 +101,12 @@ void snippets()
//! [Retrieving the next 5 occurrences of a particular recurrent event]
- instances = defaultManager.itemOccurrences(recEvent, QDateTime::currentDateTime(), QDateTime(), 5);
+ instances = defaultManager.itemOccurrences(marshmallowMeeting, QDateTime::currentDateTime(), QDateTime(), 5);
//! [Retrieving the next 5 occurrences of a particular recurrent event]
//! [Retrieving the next 10 occurrences of any item (Agenda View)]
- // XXX TODO: make this more convenient.
- // QOIM::itemOccurrences(count) ?
+ instances = defaultManager.items(QDateTime::currentDateTime(), QDateTime());
+ instances = instances.mid(0, 10);
//! [Retrieving the next 10 occurrences of any item (Agenda View)]
//! [Creating a non-recurrent entry]
@@ -121,8 +121,13 @@ void snippets()
//! [Creating a non-recurrent entry]
//! [Editing a non-recurrent entry]
- journal.addComment("Serves: 8. Ingredients: 500g Milk Chocolate, 500g Marshmallows. Step 1: Put the marshmallows into 8 separate bowls. Step 2: Melt the chocolate. Step 3: Pour the chocolate over the marshmallows in the bowls. Step 4: Put the bowls into the refrigerator for 20 minutes; serve chilled.");
- if (!defaultManager.saveItem(&journal)) qDebug() << "Unable to save updated journal! Error:" << defaultManager.error();
+ journal.addComment("Serves: 8. Ingredients: 500g Milk Chocolate, 500g Marshmallows."\
+ " Step 1: Put the marshmallows into 8 separate bowls."\
+ " Step 2: Melt the chocolate."\
+ " Step 3: Pour the chocolate over the marshmallows in the bowls."\
+ " Step 4: Put the bowls into the refrigerator for 20 minutes; serve chilled.");
+ if (!defaultManager.saveItem(&journal))
+ qDebug() << "Unable to save updated journal! Error:" << defaultManager.error();
//! [Editing a non-recurrent entry]
//! [Retrieving any entry (not occurrence) which matches a search criteria]
@@ -130,9 +135,7 @@ void snippets()
//! [Retrieving any entry (not occurrence) which matches a search criteria]
//! [Creating an exception to a particular recurrent event]
- // the following line should be made simpler via QOIM::itemOccurrences(item, startDateTime, endDateTime, count)...
- /* FIXME: correct the example
- QOrganizerEventOccurrence nextMarshmallowMeeting = QOrganizerEventOccurrence(defaultManager.itemOccurrences().value(0)); // should use dfil.
+ QOrganizerEventOccurrence nextMarshmallowMeeting = QOrganizerEventOccurrence(defaultManager.itemOccurrences(marshmallowMeeting).value(0));
nextMarshmallowMeeting.setStartDateTime(QDateTime::fromString("13.05.2010 18:00:00", "dd.MM.yy hh:mm:ss"));
nextMarshmallowMeeting.setEndDateTime(QDateTime::fromString("13.05.2010 20:00:00", "dd.MM.yy hh:mm:ss"));
nextMarshmallowMeeting.addComment("The next meeting will go for an hour longer (starting one "\
@@ -140,7 +143,6 @@ void snippets()
"to taste the results of the recipe that I will be presenting "\
"at the meeting.");
defaultManager.saveItem(&nextMarshmallowMeeting);
- */
//! [Creating an exception to a particular recurrent event]
dumpItems(&defaultManager);