summaryrefslogtreecommitdiff
path: root/libopie/pim/test/oevent_test.cpp
blob: 9f169113513a1fa0f0bea71af3aa2a7bd23a6260 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <qdatetime.h>

#include "../oevent.h"
#include "../odatebookaccess.h"

int main(int argc, char* argv ) {
    ODateBookAccess acc;
    if(!acc.load() ) qWarning("could not load");

    ODateBookAccess::List::Iterator it;
    ODateBookAccess::List list = acc.allRecords();

    for( it = list.begin(); it != list.end(); ++it ){
	OEvent ev = (*it);
	qWarning("Summary: %s",ev.description().latin1() );
	qWarning("Start: %s End: %s",ev.startDateTime().toString().latin1(), ev.endDateTime().toString().latin1() );
	qWarning("All Day: %d Recurrence: %d",ev.isAllDay(), ev.hasRecurrence() );
        qWarning("UID %d", ev.uid() );

    }
    QDate date1(2003,02,01 );
    QDate date2(2003,03,01 );

    OEffectiveEvent::ValueList effList = acc.effectiveEvents( date1,date2 );
    OEffectiveEvent::ValueList::Iterator effIt;

    for( effIt = effList.begin(); effIt != effList.end(); ++effIt ){
	OEffectiveEvent ef = (*effIt);
	qWarning("Summary: %s", ef.description().latin1() );
	qWarning("Date: %s", ef.date().toString().latin1() );
    }
    acc.save();

    return 0;
}