From 871eadc731c0c05c553b8edc8c0e3198127057b6 Mon Sep 17 00:00:00 2001 From: harlekin Date: Mon, 10 Feb 2003 23:05:51 +0000 Subject: fixed segfault --- (limited to 'core/pim/today/plugins') diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp index e2f492e..9a18408 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp @@ -38,12 +38,15 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name) } db = new DateBookDB; + if ( m_layoutDates ) { delete m_layoutDates; } m_layoutDates = new QVBoxLayout( this ); m_layoutDates->setAutoAdd( true ); + m_eventsList.setAutoDelete( true ); + readConfig(); getDates(); } @@ -69,6 +72,7 @@ void DatebookPluginWidget::refresh() { for ( ev = m_eventsList.first(); ev != 0; ev = m_eventsList.next() ) { delete ev; } + m_eventsList.clear(); getDates(); } @@ -78,25 +82,22 @@ void DatebookPluginWidget::refresh() { void DatebookPluginWidget::getDates() { QDate date = QDate::currentDate(); - QValueList list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); qBubbleSort( list ); - //Config config( "qpe" ); - int count=0; + int count = 0; + qDebug( QString("List count %1" ).arg(list.count() ) ); if ( list.count() > 0 ) { - for ( QValueList::ConstIterator it = list.begin(); it != list.end(); ++it ) { + for ( QValueList::ConstIterator it = list.begin(); it != list.end(); ++it ) { if ( count <= m_max_lines_meet ) { - QTime time = QTime::currentTime(); - if ( !m_onlyLater ) { count++; DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); m_eventsList.append( l ); QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); - } else if ( ( time.toString() <= TimeString::dateString( (*it).event().end() ) ) ) { + } else if ( QDateTime::currentDateTime() <= (*it).event().end() ) { count++; // show only later appointments DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); -- cgit v0.9.0.2