Diffstat (limited to 'core/pim/today/plugins/datebook/datebookpluginwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/today/plugins/datebook/datebookpluginwidget.cpp | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp index 1970654..9e95bcd 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp @@ -32,7 +32,2 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name ) - if ( db ) { - delete db; - } - db = new DateBookDB; - if ( m_layoutDates ) { @@ -47,3 +42,2 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name ) getDates(); - m_layoutDates->addStretch(5); } @@ -64,2 +58,8 @@ void DatebookPluginWidget::readConfig() { m_moreDays = cfg.readNumEntry( "moredays", 0 ); + m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 ); +} + +void DatebookPluginWidget::reinitialize() { + readConfig(); + refresh(); } @@ -76,3 +76,2 @@ void DatebookPluginWidget::refresh() { getDates(); - m_layoutDates->addStretch(5); } @@ -84,2 +83,8 @@ void DatebookPluginWidget::getDates() { + + if ( db ) { + delete db; + } + db = new DateBookDB; + QDate date = QDate::currentDate(); @@ -96,3 +101,3 @@ void DatebookPluginWidget::getDates() { count++; - DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); + DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine ); m_eventsList.append( l ); @@ -100,6 +105,18 @@ void DatebookPluginWidget::getDates() { QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); - } else if ( QDateTime::currentDateTime() <= (*it).event().end() || (*it).event().start().date() != date ) { + } else { + if ( ( QDateTime::currentDateTime() <= (*it).event().end() ) + // Show events which span over many days and are not elapsed. + || ( ( (*it).event().start().date() != date ) && ( QDateTime::currentDateTime() <= (*it).event().end() ) ) + // Show repeated event for today that is not elapsed. + || ( ( (*it).event().repeatType() != Event::NoRepeat ) + && ( ( date.dayOfWeek() == (*it).date().dayOfWeek() ) + && ( QTime::currentTime() < (*it).event().start().time() ) ) ) + // Show repeated event for next days. + || ( ( (*it).event().repeatType() != Event::NoRepeat ) + && ( date.dayOfWeek() != (*it).date().dayOfWeek() ) ) + ) + { count++; // show only later appointments - DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); + DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine ); m_eventsList.append( l ); @@ -110,2 +127,3 @@ void DatebookPluginWidget::getDates() { } + } if ( m_onlyLater && count == 0 ) { |