From 4f276d80bd977401d656851515474cc00c661e5b Mon Sep 17 00:00:00 2001 From: zautrix Date: Fri, 15 Oct 2004 14:26:07 +0000 Subject: many phone and sync fixes --- (limited to 'libkcal/todo.cpp') diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 0c1e3e4..3d2de61 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp @@ -56,7 +56,65 @@ Incidence *Todo::clone() return new Todo(*this); } +bool Todo::contains ( Todo* from ) +{ + if ( !from->summary().isEmpty() ) + if ( !summary().startsWith( from->summary() )) + return false; + if ( from->hasStartDate() ) { + if ( !hasStartDate() ) + return false; + if ( from->dtStart() != dtStart()) + return false; + } + if ( from->hasDueDate() ){ + if ( !hasDueDate() ) + return false; + if ( from->dtDue() != dtDue()) + return false; + } + if ( !from->location().isEmpty() ) + if ( !location().startsWith( from->location() ) ) + return false; + if ( !from->description().isEmpty() ) + if ( !description().startsWith( from->description() )) + return false; + if ( from->alarms().count() ) { + Alarm *a = from->alarms().first(); + if ( a->enabled() ){ + if ( !alarms().count() ) + return false; + Alarm *b = alarms().first(); + if( ! b->enabled() ) + return false; + if ( ! (a->offset() == b->offset() )) + return false; + } + } + + QStringList cat = categories(); + QStringList catFrom = from->categories(); + QString nCat; + int iii; + for ( iii = 0; iii < catFrom.count();++iii ) { + nCat = catFrom[iii]; + if ( !nCat.isEmpty() ) + if ( !cat.contains( nCat )) { + return false; + } + } + if ( from->isCompleted() ) { + if ( !isCompleted() ) + return false; + } + if( priority() != from->priority() ) + return false; + + + return true; + +} bool KCal::operator==( const Todo& t1, const Todo& t2 ) { -- cgit v0.9.0.2