author | harlekin <harlekin> | 2003-02-10 23:05:51 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-02-10 23:05:51 (UTC) |
commit | 871eadc731c0c05c553b8edc8c0e3198127057b6 (patch) (unidiff) | |
tree | 88af2b393914bc6c8c479462b4e502ad6ee85062 /core/pim/today | |
parent | 51452f8478edb77ed1eef61adff314c2d239712f (diff) | |
download | opie-871eadc731c0c05c553b8edc8c0e3198127057b6.zip opie-871eadc731c0c05c553b8edc8c0e3198127057b6.tar.gz opie-871eadc731c0c05c553b8edc8c0e3198127057b6.tar.bz2 |
fixed segfault
-rw-r--r-- | core/pim/today/plugins/datebook/datebookpluginwidget.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
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) | |||
38 | } | 38 | } |
39 | db = new DateBookDB; | 39 | db = new DateBookDB; |
40 | 40 | ||
41 | |||
41 | if ( m_layoutDates ) { | 42 | if ( m_layoutDates ) { |
42 | delete m_layoutDates; | 43 | delete m_layoutDates; |
43 | } | 44 | } |
44 | m_layoutDates = new QVBoxLayout( this ); | 45 | m_layoutDates = new QVBoxLayout( this ); |
45 | m_layoutDates->setAutoAdd( true ); | 46 | m_layoutDates->setAutoAdd( true ); |
46 | 47 | ||
48 | m_eventsList.setAutoDelete( true ); | ||
49 | |||
47 | readConfig(); | 50 | readConfig(); |
48 | getDates(); | 51 | getDates(); |
49 | } | 52 | } |
@@ -69,6 +72,7 @@ void DatebookPluginWidget::refresh() { | |||
69 | for ( ev = m_eventsList.first(); ev != 0; ev = m_eventsList.next() ) { | 72 | for ( ev = m_eventsList.first(); ev != 0; ev = m_eventsList.next() ) { |
70 | delete ev; | 73 | delete ev; |
71 | } | 74 | } |
75 | m_eventsList.clear(); | ||
72 | getDates(); | 76 | getDates(); |
73 | } | 77 | } |
74 | 78 | ||
@@ -78,25 +82,22 @@ void DatebookPluginWidget::refresh() { | |||
78 | void DatebookPluginWidget::getDates() { | 82 | void DatebookPluginWidget::getDates() { |
79 | 83 | ||
80 | QDate date = QDate::currentDate(); | 84 | QDate date = QDate::currentDate(); |
81 | |||
82 | QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); | 85 | QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); |
83 | qBubbleSort( list ); | 86 | qBubbleSort( list ); |
84 | //Config config( "qpe" ); | 87 | int count = 0; |
85 | int count=0; | ||
86 | 88 | ||
89 | qDebug( QString("List count %1" ).arg(list.count() ) ); | ||
87 | if ( list.count() > 0 ) { | 90 | if ( list.count() > 0 ) { |
88 | 91 | ||
89 | for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) { | 92 | for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) { |
90 | 93 | ||
91 | if ( count <= m_max_lines_meet ) { | 94 | if ( count <= m_max_lines_meet ) { |
92 | QTime time = QTime::currentTime(); | ||
93 | |||
94 | if ( !m_onlyLater ) { | 95 | if ( !m_onlyLater ) { |
95 | count++; | 96 | count++; |
96 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); | 97 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); |
97 | m_eventsList.append( l ); | 98 | m_eventsList.append( l ); |
98 | QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); | 99 | QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); |
99 | } else if ( ( time.toString() <= TimeString::dateString( (*it).event().end() ) ) ) { | 100 | } else if ( QDateTime::currentDateTime() <= (*it).event().end() ) { |
100 | count++; | 101 | count++; |
101 | // show only later appointments | 102 | // show only later appointments |
102 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); | 103 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); |