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 | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp index c6aa2a6..e2f492e 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp @@ -18,3 +18,2 @@ #include "datebookpluginwidget.h" -#include "datebookevent.h" @@ -32,3 +31,17 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name) : QWidget(parent, name ) { + db = 0l; + m_layoutDates = 0l; + + if ( db ) { + delete db; + } + db = new DateBookDB; + + if ( m_layoutDates ) { + delete m_layoutDates; + } + m_layoutDates = new QVBoxLayout( this ); + m_layoutDates->setAutoAdd( true ); + readConfig(); @@ -39,2 +52,3 @@ DatebookPluginWidget::~DatebookPluginWidget() { delete db; + delete m_layoutDates; } @@ -52,2 +66,9 @@ void DatebookPluginWidget::readConfig() { +void DatebookPluginWidget::refresh() { + DateBookEvent* ev; + for ( ev = m_eventsList.first(); ev != 0; ev = m_eventsList.next() ) { + delete ev; + } + getDates(); +} @@ -58,21 +79,7 @@ void DatebookPluginWidget::getDates() { - QDate date = QDate::currentDate(); - QVBoxLayout* layoutDates = new QVBoxLayout( this ); - layoutDates->setSpacing( 1 ); - layoutDates->setMargin( 1 ); - - if ( db ) { - delete db; - } - - db = new DateBookDB; - QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); - qBubbleSort( list ); - - Config config( "qpe" ); - + //Config config( "qpe" ); int count=0; @@ -89,3 +96,3 @@ void DatebookPluginWidget::getDates() { DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); - layoutDates->addWidget( l ); + m_eventsList.append( l ); QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) ); @@ -95,3 +102,3 @@ void DatebookPluginWidget::getDates() { DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); - layoutDates->addWidget( l ); + m_eventsList.append( l ); QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) ); @@ -103,3 +110,2 @@ void DatebookPluginWidget::getDates() { noMoreEvents->setText( QObject::tr( "No more appointments today" ) ); - layoutDates->addWidget( noMoreEvents ); } @@ -108,3 +114,2 @@ void DatebookPluginWidget::getDates() { noEvents->setText( QObject::tr( "No appointments today" ) ); - layoutDates->addWidget( noEvents ); } |