summaryrefslogtreecommitdiff
path: root/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
Unidiff
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 )
31 m_layoutDates = 0l; 31 m_layoutDates = 0l;
32 32
33 if ( db ) {
34 delete db;
35 }
36 db = new DateBookDB;
37
38 if ( m_layoutDates ) { 33 if ( m_layoutDates ) {
39 delete m_layoutDates; 34 delete m_layoutDates;
@@ -46,5 +41,4 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name )
46 readConfig(); 41 readConfig();
47 getDates(); 42 getDates();
48 m_layoutDates->addStretch(5);
49} 43}
50 44
@@ -63,4 +57,10 @@ void DatebookPluginWidget::readConfig() {
63 m_onlyLater = cfg.readNumEntry( "onlylater", 1 ); 57 m_onlyLater = cfg.readNumEntry( "onlylater", 1 );
64 m_moreDays = cfg.readNumEntry( "moredays", 0 ); 58 m_moreDays = cfg.readNumEntry( "moredays", 0 );
59 m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 );
60}
61
62void DatebookPluginWidget::reinitialize() {
63 readConfig();
64 refresh();
65} 65}
66 66
@@ -75,5 +75,4 @@ void DatebookPluginWidget::refresh() {
75 75
76 getDates(); 76 getDates();
77 m_layoutDates->addStretch(5);
78} 77}
79 78
@@ -83,4 +82,10 @@ void DatebookPluginWidget::refresh() {
83void DatebookPluginWidget::getDates() { 82void 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();
86 QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); 91 QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) );
@@ -95,16 +100,29 @@ void DatebookPluginWidget::getDates() {
95 if ( !m_onlyLater ) { 100 if ( !m_onlyLater ) {
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 );
106 l->show(); 104 l->show();
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 }
110 } 128 }