From 28b63b3270b8162fcea4449b53b75fa325d740ad Mon Sep 17 00:00:00 2001 From: zecke Date: Wed, 18 Feb 2004 23:19:17 +0000 Subject: Add Documentation on how we search and why we do stuff --- diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index 832b2f8..24affd0 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp @@ -997,6 +997,8 @@ void DateBook::slotDoFind( const QString& txt, const QDate &dt, inSearch = true; } static QDate searchDate = dt; + // if true at the end we will start at the begin again and afterwards + // we will emit string not found static bool wrapAround = true; bool candidtate; candidtate = false; @@ -1004,6 +1006,13 @@ void DateBook::slotDoFind( const QString& txt, const QDate &dt, QValueList repeats = db->getRawRepeats(); // find the candidate for the first repeat that matches... + // first check if there can ever be a match and then compute + // the next occurence from start. See if this event is closer + // to the beginning (start. next < dtEnd) and not smaller then the last + // result. If we find a canditate we set the dtEnd to the time + // of the ocurrence and rev to this occurence. + // set wrap around to true because there might be more events coming + // and we're not at the end. QValueListConstIterator it; QDate start = dt; for ( it = repeats.begin(); it != repeats.end(); ++it ) { @@ -1023,6 +1032,9 @@ void DateBook::slotDoFind( const QString& txt, const QDate &dt, } // now the for first non repeat... + // dtEnd is set by the previous iteration of repeatingEvents + // check if we find a closer item. Also set dtEnd to find even + // more close occurrence QValueList nonRepeats = db->getNonRepeatingEvents( dt, dtEnd.date() ); qHeapSort( nonRepeats.begin(), nonRepeats.end() ); for ( it = nonRepeats.begin(); it != nonRepeats.end(); ++it ) { -- cgit v0.9.0.2