summaryrefslogtreecommitdiff
path: root/core/pim/today/plugins/todolist/todopluginwidget.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/today/plugins/todolist/todopluginwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.cpp34
1 files changed, 22 insertions, 12 deletions
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.cpp b/core/pim/today/plugins/todolist/todopluginwidget.cpp
index 773e5cf..3242dac 100644
--- a/core/pim/today/plugins/todolist/todopluginwidget.cpp
+++ b/core/pim/today/plugins/todolist/todopluginwidget.cpp
@@ -30,22 +30,38 @@
TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name )
: QWidget( parent, name ) {
- todoLabel = 0l;
todo = 0l;
+ layoutTodo = 0l;
+ todoLabel = 0l;
if ( todo ) {
delete todo;
}
-
todo = new OTodoAccess();
todo->load();
+ if ( layoutTodo ) {
+ delete layoutTodo;
+ }
+ layoutTodo = new QVBoxLayout( this );
+ layoutTodo->setAutoAdd( true );
+
+
+ if ( todoLabel ) {
+ delete todoLabel;
+ }
+ todoLabel = new OClickableLabel( this );
+
+ connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) );
+
readConfig();
getTodo();
}
TodolistPluginWidget::~TodolistPluginWidget() {
delete todo;
+ delete todoLabel;
+ delete layoutTodo;
}
@@ -56,20 +72,15 @@ void TodolistPluginWidget::readConfig() {
m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
}
+void TodolistPluginWidget:: refresh() {
+ getTodo();
+}
/**
* Get the todos
*/
void TodolistPluginWidget::getTodo() {
- QVBoxLayout* layoutTodo = new QVBoxLayout( this );
-
- if ( todoLabel ) {
- delete todoLabel;
- }
-
- todoLabel = new OClickableLabel( this );
- connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) );
QString output;
QString tmpout;
@@ -86,7 +97,7 @@ void TodolistPluginWidget::getTodo() {
desc = (*m_it).description();
}
tmpout += "<font color=#e00000><b>-" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>";
- ammount++;
+ ammount++ ;
}
}
@@ -118,7 +129,6 @@ void TodolistPluginWidget::getTodo() {
output = QObject::tr( "No active tasks" );
}
todoLabel->setText( output );
- layoutTodo->addWidget( todoLabel );
}
/**