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.cpp | 50 |
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 | |||
@@ -32,7 +32,2 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name ) | |||
32 | 32 | ||
33 | if ( db ) { | ||
34 | delete db; | ||
35 | } | ||
36 | db = new DateBookDB; | ||
37 | |||
38 | if ( m_layoutDates ) { | 33 | if ( m_layoutDates ) { |
@@ -47,3 +42,2 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name ) | |||
47 | getDates(); | 42 | getDates(); |
48 | m_layoutDates->addStretch(5); | ||
49 | } | 43 | } |
@@ -64,2 +58,8 @@ void DatebookPluginWidget::readConfig() { | |||
64 | m_moreDays = cfg.readNumEntry( "moredays", 0 ); | 58 | m_moreDays = cfg.readNumEntry( "moredays", 0 ); |
59 | m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 ); | ||
60 | } | ||
61 | |||
62 | void DatebookPluginWidget::reinitialize() { | ||
63 | readConfig(); | ||
64 | refresh(); | ||
65 | } | 65 | } |
@@ -76,3 +76,2 @@ void DatebookPluginWidget::refresh() { | |||
76 | getDates(); | 76 | getDates(); |
77 | m_layoutDates->addStretch(5); | ||
78 | } | 77 | } |
@@ -84,2 +83,8 @@ void DatebookPluginWidget::getDates() { | |||
84 | 83 | ||
84 | |||
85 | if ( db ) { | ||
86 | delete db; | ||
87 | } | ||
88 | db = new DateBookDB; | ||
89 | |||
85 | QDate date = QDate::currentDate(); | 90 | QDate date = QDate::currentDate(); |
@@ -96,10 +101,3 @@ void DatebookPluginWidget::getDates() { | |||
96 | count++; | 101 | count++; |
97 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); | 102 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine ); |
98 | m_eventsList.append( l ); | ||
99 | l->show(); | ||
100 | QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); | ||
101 | } else if ( QDateTime::currentDateTime() <= (*it).event().end() || (*it).event().start().date() != date ) { | ||
102 | count++; | ||
103 | // show only later appointments | ||
104 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); | ||
105 | m_eventsList.append( l ); | 103 | m_eventsList.append( l ); |
@@ -107,3 +105,23 @@ void DatebookPluginWidget::getDates() { | |||
107 | QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); | 105 | QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); |
108 | } | 106 | } else { |
107 | if ( ( QDateTime::currentDateTime() <= (*it).event().end() ) | ||
108 | // Show events which span over many days and are not elapsed. | ||
109 | || ( ( (*it).event().start().date() != date ) && ( QDateTime::currentDateTime() <= (*it).event().end() ) ) | ||
110 | // Show repeated event for today that is not elapsed. | ||
111 | || ( ( (*it).event().repeatType() != Event::NoRepeat ) | ||
112 | && ( ( date.dayOfWeek() == (*it).date().dayOfWeek() ) | ||
113 | && ( QTime::currentTime() < (*it).event().start().time() ) ) ) | ||
114 | // Show repeated event for next days. | ||
115 | || ( ( (*it).event().repeatType() != Event::NoRepeat ) | ||
116 | && ( date.dayOfWeek() != (*it).date().dayOfWeek() ) ) | ||
117 | ) | ||
118 | { | ||
119 | count++; | ||
120 | // show only later appointments | ||
121 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine ); | ||
122 | m_eventsList.append( l ); | ||
123 | l->show(); | ||
124 | QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); | ||
125 | } | ||
126 | } | ||
109 | } | 127 | } |