-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 | |||
@@ -57,5 +57,63 @@ Incidence *Todo::clone() | |||
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 | { |