summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
index 896d41d..781e3a4 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
@@ -42,12 +42,13 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name )
42 m_layoutDates->setAutoAdd( true ); 42 m_layoutDates->setAutoAdd( true );
43 43
44 m_eventsList.setAutoDelete( true ); 44 m_eventsList.setAutoDelete( true );
45 45
46 readConfig(); 46 readConfig();
47 getDates(); 47 getDates();
48 m_layoutDates->addStretch(5);
48} 49}
49 50
50DatebookPluginWidget::~DatebookPluginWidget() { 51DatebookPluginWidget::~DatebookPluginWidget() {
51 delete db; 52 delete db;
52 delete m_layoutDates; 53 delete m_layoutDates;
53} 54}
@@ -62,13 +63,21 @@ void DatebookPluginWidget::readConfig() {
62 m_onlyLater = cfg.readNumEntry( "onlylater", 1 ); 63 m_onlyLater = cfg.readNumEntry( "onlylater", 1 );
63 m_moreDays = cfg.readNumEntry( "moredays", 0 ); 64 m_moreDays = cfg.readNumEntry( "moredays", 0 );
64} 65}
65 66
66void DatebookPluginWidget::refresh() { 67void DatebookPluginWidget::refresh() {
67 m_eventsList.clear(); 68 m_eventsList.clear();
69
70 if ( m_layoutDates ) {
71 delete m_layoutDates;
72 }
73 m_layoutDates = new QVBoxLayout( this );
74 m_layoutDates->setAutoAdd( true );
75
68 getDates(); 76 getDates();
77 m_layoutDates->addStretch(5);
69} 78}
70 79
71/** 80/**
72 * Get all events that are in the datebook xml file for today 81 * Get all events that are in the datebook xml file for today
73 */ 82 */
74void DatebookPluginWidget::getDates() { 83void DatebookPluginWidget::getDates() {
@@ -86,13 +95,13 @@ void DatebookPluginWidget::getDates() {
86 if ( !m_onlyLater ) { 95 if ( !m_onlyLater ) {
87 count++; 96 count++;
88 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 );
89 m_eventsList.append( l ); 98 m_eventsList.append( l );
90 l->show(); 99 l->show();
91 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); 100 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
92 } else if ( QDateTime::currentDateTime() <= (*it).event().end() ) { 101 } else if ( QDateTime::currentDateTime() <= (*it).event().end() || (*it).event().start().date() != date ) {
93 count++; 102 count++;
94 // show only later appointments 103 // show only later appointments
95 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); 104 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
96 m_eventsList.append( l ); 105 m_eventsList.append( l );
97 l->show(); 106 l->show();
98 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); 107 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
@@ -110,6 +119,7 @@ void DatebookPluginWidget::getDates() {
110 m_eventsList.append( noEvents ); 119 m_eventsList.append( noEvents );
111 noEvents->show(); 120 noEvents->show();
112 noEvents->setText( QObject::tr( "No appointments today" ) ); 121 noEvents->setText( QObject::tr( "No appointments today" ) );
113 } 122 }
114} 123}
115 124
125