author | zecke <zecke> | 2004-02-18 22:11:25 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-02-18 22:11:25 (UTC) |
commit | 71b6aa6d19ed2e4690cd98ecdb7dbfe40f857653 (patch) (side-by-side diff) | |
tree | 2d300c075b052fa1ad7e4814f52256e51fd7d8ba | |
parent | 859ad22772e90dfbd4a8c0760ddc52d451f50011 (diff) | |
download | opie-71b6aa6d19ed2e4690cd98ecdb7dbfe40f857653.zip opie-71b6aa6d19ed2e4690cd98ecdb7dbfe40f857653.tar.gz opie-71b6aa6d19ed2e4690cd98ecdb7dbfe40f857653.tar.bz2 |
be more clever when it comes to searching events
Fix bug 1193
-rw-r--r-- | core/pim/datebook/datebook.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index 706cc08..832b2f8 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp @@ -183,13 +183,12 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) #if defined(Q_WS_QWS) #if !defined(QT_NO_COP) QCopChannel *channel = new QCopChannel( "QPE/System", this ); connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); channel = new QCopChannel( "QPE/Datebook", this ); connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); - qDebug("olle\n"); #endif #endif qDebug("done t=%d", t.elapsed() ); connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); @@ -406,13 +405,12 @@ void DateBook::insertEvent( const Event &e ) db->addEvent(dupEvent); emit newEvent(); } void DateBook::duplicateEvent( const Event &e ) { - qWarning("Hmmm..."); // Alot of code duplication, as this is almost like editEvent(); if (syncing) { QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") ); return; } @@ -505,12 +503,13 @@ void DateBook::removeEvent( const Event &e ) if ( !QPEMessageBox::confirmDelete( this, tr( "Calendar" ),strName ) ) return; db->removeEvent( e ); if ( views->visibleWidget() == dayView && dayView ) dayView->redraw(); + } void DateBook::addEvent( const Event &e ) { QDate d = e.start().date(); initDay(); @@ -988,14 +987,13 @@ void DateBook::slotDoFind( const QString& txt, const QDate &dt, next; QRegExp r( txt ); r.setCaseSensitive( caseSensitive ); - static Event rev, - nonrev; + static Event rev, nonrev; if ( !inSearch ) { rev.setStart( QDateTime(QDate(1960, 1, 1), QTime(0, 0, 0)) ); nonrev.setStart( rev.start() ); inSearch = true; } static QDate searchDate = dt; @@ -1007,24 +1005,21 @@ void DateBook::slotDoFind( const QString& txt, const QDate &dt, // find the candidate for the first repeat that matches... QValueListConstIterator<Event> it; QDate start = dt; for ( it = repeats.begin(); it != repeats.end(); ++it ) { if ( catComp( (*it).categories(), category ) ) { - while ( nextOccurance( *it, start, next ) ) { - if ( next < dtEnd ) { - if ( (*it).match( r ) && !(next <= rev.start()) ) { + if ( (*it).match( r ) ) { + if ( nextOccurance( *it, start, next ) ) { + if ( next < dtEnd && !(next <= rev.start() ) ) { rev = *it; dtEnd = next; rev.setStart( next ); candidtate = true; wrapAround = true; - start = dt; - break; - } else - start = next.date().addDays( 1 ); + } } } } } // now the for first non repeat... @@ -1072,11 +1067,9 @@ Event DateBookDBHack::eventByUID(int uid) { if ((*it).uid() == uid) return *it; } for (it = myRepeatEvents.begin(); it != myRepeatEvents.end(); it++) { if ((*it).uid() == uid) return *it; } - qDebug("Event not found: uid=%d\n", uid); Event ev; return ev; // return at least } - |