author | zautrix <zautrix> | 2004-10-15 14:26:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-15 14:26:07 (UTC) |
commit | 4f276d80bd977401d656851515474cc00c661e5b (patch) (unidiff) | |
tree | 0d3a747bef0431ef791b69876f5bda554f9ca83f /libkcal/todo.cpp | |
parent | c2fb960297c4b08980921c818a4d347057732390 (diff) | |
download | kdepimpi-4f276d80bd977401d656851515474cc00c661e5b.zip kdepimpi-4f276d80bd977401d656851515474cc00c661e5b.tar.gz kdepimpi-4f276d80bd977401d656851515474cc00c661e5b.tar.bz2 |
many phone and sync fixes
-rw-r--r-- | libkcal/todo.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 0c1e3e4..3d2de61 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -27,65 +27,123 @@ | |||
27 | using namespace KCal; | 27 | using namespace KCal; |
28 | 28 | ||
29 | Todo::Todo(): Incidence() | 29 | Todo::Todo(): Incidence() |
30 | { | 30 | { |
31 | // mStatus = TENTATIVE; | 31 | // mStatus = TENTATIVE; |
32 | 32 | ||
33 | mHasDueDate = false; | 33 | mHasDueDate = false; |
34 | setHasStartDate( false ); | 34 | setHasStartDate( false ); |
35 | mCompleted = getEvenTime(QDateTime::currentDateTime()); | 35 | mCompleted = getEvenTime(QDateTime::currentDateTime()); |
36 | mHasCompletedDate = false; | 36 | mHasCompletedDate = false; |
37 | mPercentComplete = 0; | 37 | mPercentComplete = 0; |
38 | } | 38 | } |
39 | 39 | ||
40 | Todo::Todo(const Todo &t) : Incidence(t) | 40 | Todo::Todo(const Todo &t) : Incidence(t) |
41 | { | 41 | { |
42 | mDtDue = t.mDtDue; | 42 | mDtDue = t.mDtDue; |
43 | mHasDueDate = t.mHasDueDate; | 43 | mHasDueDate = t.mHasDueDate; |
44 | mCompleted = t.mCompleted; | 44 | mCompleted = t.mCompleted; |
45 | mHasCompletedDate = t.mHasCompletedDate; | 45 | mHasCompletedDate = t.mHasCompletedDate; |
46 | mPercentComplete = t.mPercentComplete; | 46 | mPercentComplete = t.mPercentComplete; |
47 | } | 47 | } |
48 | 48 | ||
49 | Todo::~Todo() | 49 | Todo::~Todo() |
50 | { | 50 | { |
51 | 51 | ||
52 | } | 52 | } |
53 | 53 | ||
54 | Incidence *Todo::clone() | 54 | Incidence *Todo::clone() |
55 | { | 55 | { |
56 | return new Todo(*this); | 56 | return new Todo(*this); |
57 | } | 57 | } |
58 | 58 | ||
59 | bool Todo::contains ( Todo* from ) | ||
60 | { | ||
59 | 61 | ||
62 | if ( !from->summary().isEmpty() ) | ||
63 | if ( !summary().startsWith( from->summary() )) | ||
64 | return false; | ||
65 | if ( from->hasStartDate() ) { | ||
66 | if ( !hasStartDate() ) | ||
67 | return false; | ||
68 | if ( from->dtStart() != dtStart()) | ||
69 | return false; | ||
70 | } | ||
71 | if ( from->hasDueDate() ){ | ||
72 | if ( !hasDueDate() ) | ||
73 | return false; | ||
74 | if ( from->dtDue() != dtDue()) | ||
75 | return false; | ||
76 | } | ||
77 | if ( !from->location().isEmpty() ) | ||
78 | if ( !location().startsWith( from->location() ) ) | ||
79 | return false; | ||
80 | if ( !from->description().isEmpty() ) | ||
81 | if ( !description().startsWith( from->description() )) | ||
82 | return false; | ||
83 | if ( from->alarms().count() ) { | ||
84 | Alarm *a = from->alarms().first(); | ||
85 | if ( a->enabled() ){ | ||
86 | if ( !alarms().count() ) | ||
87 | return false; | ||
88 | Alarm *b = alarms().first(); | ||
89 | if( ! b->enabled() ) | ||
90 | return false; | ||
91 | if ( ! (a->offset() == b->offset() )) | ||
92 | return false; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | QStringList cat = categories(); | ||
97 | QStringList catFrom = from->categories(); | ||
98 | QString nCat; | ||
99 | int iii; | ||
100 | for ( iii = 0; iii < catFrom.count();++iii ) { | ||
101 | nCat = catFrom[iii]; | ||
102 | if ( !nCat.isEmpty() ) | ||
103 | if ( !cat.contains( nCat )) { | ||
104 | return false; | ||
105 | } | ||
106 | } | ||
107 | if ( from->isCompleted() ) { | ||
108 | if ( !isCompleted() ) | ||
109 | return false; | ||
110 | } | ||
111 | if( priority() != from->priority() ) | ||
112 | return false; | ||
113 | |||
114 | |||
115 | return true; | ||
116 | |||
117 | } | ||
60 | bool KCal::operator==( const Todo& t1, const Todo& t2 ) | 118 | bool KCal::operator==( const Todo& t1, const Todo& t2 ) |
61 | { | 119 | { |
62 | 120 | ||
63 | bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); | 121 | bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); |
64 | if ( ! ret ) | 122 | if ( ! ret ) |
65 | return false; | 123 | return false; |
66 | if ( t1.hasDueDate() == t2.hasDueDate() ) { | 124 | if ( t1.hasDueDate() == t2.hasDueDate() ) { |
67 | if ( t1.hasDueDate() ) { | 125 | if ( t1.hasDueDate() ) { |
68 | if ( t1.doesFloat() == t2.doesFloat() ) { | 126 | if ( t1.doesFloat() == t2.doesFloat() ) { |
69 | if ( t1.doesFloat() ) { | 127 | if ( t1.doesFloat() ) { |
70 | if ( t1.dtDue().date() != t2.dtDue().date() ) | 128 | if ( t1.dtDue().date() != t2.dtDue().date() ) |
71 | return false; | 129 | return false; |
72 | } else | 130 | } else |
73 | if ( t1.dtDue() != t2.dtDue() ) | 131 | if ( t1.dtDue() != t2.dtDue() ) |
74 | return false; | 132 | return false; |
75 | } else | 133 | } else |
76 | return false;// float != | 134 | return false;// float != |
77 | } | 135 | } |
78 | 136 | ||
79 | } else | 137 | } else |
80 | return false; | 138 | return false; |
81 | if ( t1.percentComplete() != t2.percentComplete() ) | 139 | if ( t1.percentComplete() != t2.percentComplete() ) |
82 | return false; | 140 | return false; |
83 | if ( t1.isCompleted() ) { | 141 | if ( t1.isCompleted() ) { |
84 | if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { | 142 | if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { |
85 | if ( t1.hasCompletedDate() ) { | 143 | if ( t1.hasCompletedDate() ) { |
86 | if ( t1.completed() != t2.completed() ) | 144 | if ( t1.completed() != t2.completed() ) |
87 | return false; | 145 | return false; |
88 | } | 146 | } |
89 | 147 | ||
90 | } else | 148 | } else |
91 | return false; | 149 | return false; |