author | zecke <zecke> | 2002-03-20 21:45:51 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-03-20 21:45:51 (UTC) |
commit | e9189f8d0cc46b0532fdcbcb2377ae3d108666d5 (patch) (unidiff) | |
tree | 20af6104c262510595b82e619ee69b0958596ddd /libopie/todoevent.cpp | |
parent | 0b39bb8d62f67a86128a6bd16afbd2aae004637c (diff) | |
download | opie-e9189f8d0cc46b0532fdcbcb2377ae3d108666d5.zip opie-e9189f8d0cc46b0532fdcbcb2377ae3d108666d5.tar.gz opie-e9189f8d0cc46b0532fdcbcb2377ae3d108666d5.tar.bz2 |
vCal Resource for the tododb
-rw-r--r-- | libopie/todoevent.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libopie/todoevent.cpp b/libopie/todoevent.cpp index 4cfe1c0..5fa4472 100644 --- a/libopie/todoevent.cpp +++ b/libopie/todoevent.cpp | |||
@@ -1,80 +1,82 @@ | |||
1 | 1 | ||
2 | #include <opie/todoevent.h> | 2 | #include <opie/todoevent.h> |
3 | #include <qpe/palmtopuidgen.h> | 3 | #include <qpe/palmtopuidgen.h> |
4 | #include <qpe/stringutil.h> | ||
5 | //#include <qpe/palmtoprecord.h> | ||
4 | 6 | ||
5 | ToDoEvent::ToDoEvent(bool completed, int priority, const QString &category, | 7 | ToDoEvent::ToDoEvent(bool completed, int priority, const QString &category, |
6 | const QString &description, bool hasDate, QDate date, int uid ) | 8 | const QString &description, bool hasDate, QDate date, int uid ) |
7 | { | 9 | { |
8 | qWarning("todoEvent c'tor" ); | 10 | qWarning("todoEvent c'tor" ); |
9 | m_date = date; | 11 | m_date = date; |
10 | m_isCompleted = completed; | 12 | m_isCompleted = completed; |
11 | m_hasDate = hasDate; | 13 | m_hasDate = hasDate; |
12 | m_priority = priority; | 14 | m_priority = priority; |
13 | m_category = category; | 15 | m_category = category; |
14 | m_desc = description; | 16 | m_desc = Qtopia::simplifyMultiLineSpace(description ); |
15 | if (uid == -1 ) { | 17 | if (uid == -1 ) { |
16 | Qtopia::UidGen *uidgen = new Qtopia::UidGen(); | 18 | Qtopia::UidGen *uidgen = new Qtopia::UidGen(); |
17 | uid = uidgen->generate(); | 19 | uid = uidgen->generate(); |
18 | delete uidgen; | 20 | delete uidgen; |
19 | }// generate the ids | 21 | }// generate the ids |
20 | m_uid = uid; | 22 | m_uid = uid; |
21 | } | 23 | } |
22 | bool ToDoEvent::isCompleted() const | 24 | bool ToDoEvent::isCompleted() const |
23 | { | 25 | { |
24 | return m_isCompleted; | 26 | return m_isCompleted; |
25 | } | 27 | } |
26 | bool ToDoEvent::hasDate() const | 28 | bool ToDoEvent::hasDate() const |
27 | { | 29 | { |
28 | return m_hasDate; | 30 | return m_hasDate; |
29 | } | 31 | } |
30 | int ToDoEvent::priority()const | 32 | int ToDoEvent::priority()const |
31 | { | 33 | { |
32 | return m_priority; | 34 | return m_priority; |
33 | } | 35 | } |
34 | QString ToDoEvent::category()const | 36 | QString ToDoEvent::category()const |
35 | { | 37 | { |
36 | return m_category; | 38 | return m_category; |
37 | } | 39 | } |
38 | QDate ToDoEvent::date()const | 40 | QDate ToDoEvent::date()const |
39 | { | 41 | { |
40 | return m_date; | 42 | return m_date; |
41 | } | 43 | } |
42 | QString ToDoEvent::description()const | 44 | QString ToDoEvent::description()const |
43 | { | 45 | { |
44 | return m_desc; | 46 | return m_desc; |
45 | } | 47 | } |
46 | void ToDoEvent::setCompleted( bool completed ) | 48 | void ToDoEvent::setCompleted( bool completed ) |
47 | { | 49 | { |
48 | m_isCompleted = completed; | 50 | m_isCompleted = completed; |
49 | } | 51 | } |
50 | void ToDoEvent::setHasDate( bool hasDate ) | 52 | void ToDoEvent::setHasDate( bool hasDate ) |
51 | { | 53 | { |
52 | m_hasDate = hasDate; | 54 | m_hasDate = hasDate; |
53 | } | 55 | } |
54 | void ToDoEvent::setDescription(const QString &desc ) | 56 | void ToDoEvent::setDescription(const QString &desc ) |
55 | { | 57 | { |
56 | m_desc = desc; | 58 | m_desc = Qtopia::simplifyMultiLineSpace(desc ); |
57 | } | 59 | } |
58 | void ToDoEvent::setCategory( const QString &cat ) | 60 | void ToDoEvent::setCategory( const QString &cat ) |
59 | { | 61 | { |
60 | m_category = cat; | 62 | m_category = cat; |
61 | } | 63 | } |
62 | void ToDoEvent::setPriority(int prio ) | 64 | void ToDoEvent::setPriority(int prio ) |
63 | { | 65 | { |
64 | m_priority = prio; | 66 | m_priority = prio; |
65 | } | 67 | } |
66 | void ToDoEvent::setDate( QDate date ) | 68 | void ToDoEvent::setDate( QDate date ) |
67 | { | 69 | { |
68 | m_date = date; | 70 | m_date = date; |
69 | } | 71 | } |
70 | bool ToDoEvent::isOverdue( ) | 72 | bool ToDoEvent::isOverdue( ) |
71 | { | 73 | { |
72 | if( m_hasDate ) | 74 | if( m_hasDate ) |
73 | return QDate::currentDate() > m_date; | 75 | return QDate::currentDate() > m_date; |
74 | return false; | 76 | return false; |
75 | } | 77 | } |
76 | bool ToDoEvent::operator<( const ToDoEvent &toDoEvent )const{ | 78 | bool ToDoEvent::operator<( const ToDoEvent &toDoEvent )const{ |
77 | if( !hasDate() && !toDoEvent.hasDate() ) return true; | 79 | if( !hasDate() && !toDoEvent.hasDate() ) return true; |
78 | if( !hasDate() && toDoEvent.hasDate() ) return true; | 80 | if( !hasDate() && toDoEvent.hasDate() ) return true; |
79 | if( hasDate() && toDoEvent.hasDate() ){ | 81 | if( hasDate() && toDoEvent.hasDate() ){ |
80 | if( date() == toDoEvent.date() ){ // let's the priority decide | 82 | if( date() == toDoEvent.date() ){ // let's the priority decide |