Diffstat (limited to 'libopie/pim/test/oevent_test.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/pim/test/oevent_test.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libopie/pim/test/oevent_test.cpp b/libopie/pim/test/oevent_test.cpp index 50cc032..6f04995 100644 --- a/libopie/pim/test/oevent_test.cpp +++ b/libopie/pim/test/oevent_test.cpp | |||
@@ -1,23 +1,50 @@ | |||
1 | #include <qdatetime.h> | 1 | #include <qdatetime.h> |
2 | 2 | ||
3 | #include "../oevent.h" | 3 | #include "../oevent.h" |
4 | #include "../odatebookaccess.h" | ||
4 | 5 | ||
5 | int main(int argc, char* argv ) { | 6 | int main(int argc, char* argv ) { |
6 | OEvent ev; | 7 | OEvent ev; |
7 | ev.setUid( 20 ); | 8 | ev.setUid( 20 ); |
8 | 9 | ||
9 | ev.setDescription( "Foo" ); | 10 | ev.setDescription( "Foo" ); |
10 | 11 | ||
11 | OEvent ev2 = ev; | 12 | OEvent ev2 = ev; |
12 | ev2.setDescription("Foo2"); | 13 | ev2.setDescription("Foo2"); |
13 | qWarning("%s", ev2.description().latin1() ); | 14 | qWarning("%s", ev2.description().latin1() ); |
14 | qWarning("%s", ev.description().latin1() ); | 15 | qWarning("%s", ev.description().latin1() ); |
15 | 16 | ||
16 | QDateTime time = QDateTime::currentDateTime(); | 17 | QDateTime time = QDateTime::currentDateTime(); |
17 | ev2.setStartDateTime( time ); | 18 | ev2.setStartDateTime( time ); |
18 | ev2.setTimeZone( "Europe/London" ); | 19 | ev2.setTimeZone( "Europe/London" ); |
19 | 20 | ||
20 | qWarning("%s", ev2.startDateTime().toString().latin1() ); | 21 | qWarning("%s", ev2.startDateTime().toString().latin1() ); |
21 | qWarning("%s", ev2.startDateTimeInZone().toString().latin1() ); | 22 | qWarning("%s", ev2.startDateTimeInZone().toString().latin1() ); |
23 | |||
24 | ODateBookAccess acc; | ||
25 | if(!acc.load() ) qWarning("could not load"); | ||
26 | |||
27 | ODateBookAccess::List::Iterator it; | ||
28 | ODateBookAccess::List list = acc.allRecords(); | ||
29 | |||
30 | for( it = list.begin(); it != list.end(); ++it ){ | ||
31 | OEvent ev = (*it); | ||
32 | qWarning("Summary: %s",ev.description().latin1() ); | ||
33 | qWarning("Start: %s End: %s",ev.startDateTime().toString().latin1(), ev.endDateTime().toString().latin1() ); | ||
34 | qWarning("All Day: %d",ev.isAllDay() ); | ||
35 | |||
36 | } | ||
37 | QDate date1(2003,02,01 ); | ||
38 | QDate date2(2003,03,01 ); | ||
39 | |||
40 | OEffectiveEvent::ValueList effList = acc.effectiveEvents( date1,date2 ); | ||
41 | OEffectiveEvent::ValueList::Iterator effIt; | ||
42 | |||
43 | for( effIt = effList.begin(); effIt != effList.end(); ++effIt ){ | ||
44 | OEffectiveEvent ef = (*effIt); | ||
45 | qWarning("Summary: %s", ef.description().latin1() ); | ||
46 | qWarning("Date: %s", ef.date().toString().latin1() ); | ||
47 | } | ||
48 | |||
22 | return 0; | 49 | return 0; |
23 | } | 50 | } |