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.cpp53
1 files changed, 29 insertions, 24 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
@@ -1,2 +1,2 @@
-/*
+ /*
* 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;
@@ -81,3 +88,3 @@ void DatebookPluginWidget::getDates() {
- for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); it!=list.end(); ++it ) {
+ for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) {
@@ -89,4 +96,4 @@ void DatebookPluginWidget::getDates() {
DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
- layoutDates->addWidget( l );
- QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) );
+ m_eventsList.append( l );
+ QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
} else if ( ( time.toString() <= TimeString::dateString( (*it).event().end() ) ) ) {
@@ -95,4 +102,4 @@ void DatebookPluginWidget::getDates() {
DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
- layoutDates->addWidget( l );
- QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) );
+ 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 );
}