summaryrefslogtreecommitdiff
path: root/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/today/plugins/datebook/datebookpluginwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.cpp50
1 files changed, 34 insertions, 16 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
@@ -31,9 +31,4 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name )
m_layoutDates = 0l;
- if ( db ) {
- delete db;
- }
- db = new DateBookDB;
-
if ( m_layoutDates ) {
delete m_layoutDates;
@@ -46,5 +41,4 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name )
readConfig();
getDates();
- m_layoutDates->addStretch(5);
}
@@ -63,4 +57,10 @@ void DatebookPluginWidget::readConfig() {
m_onlyLater = cfg.readNumEntry( "onlylater", 1 );
m_moreDays = cfg.readNumEntry( "moredays", 0 );
+ m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 );
+}
+
+void DatebookPluginWidget::reinitialize() {
+ readConfig();
+ refresh();
}
@@ -75,5 +75,4 @@ void DatebookPluginWidget::refresh() {
getDates();
- m_layoutDates->addStretch(5);
}
@@ -83,4 +82,10 @@ void DatebookPluginWidget::refresh() {
void DatebookPluginWidget::getDates() {
+
+ if ( db ) {
+ delete db;
+ }
+ db = new DateBookDB;
+
QDate date = QDate::currentDate();
QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) );
@@ -95,16 +100,29 @@ void DatebookPluginWidget::getDates() {
if ( !m_onlyLater ) {
count++;
- DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
- m_eventsList.append( l );
- l->show();
- QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
- } else if ( QDateTime::currentDateTime() <= (*it).event().end() || (*it).event().start().date() != date ) {
- 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 );
l->show();
QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
- }
+ } 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, m_timeExtraLine );
+ m_eventsList.append( l );
+ l->show();
+ QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
+ }
+ }
}
}