Diffstat (limited to 'core/pim/today/plugins/todolist/todopluginwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/today/plugins/todolist/todopluginwidget.cpp | 32 |
1 files changed, 21 insertions, 11 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 @@ | |||
30 | TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name ) | 30 | TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name ) |
31 | : QWidget( parent, name ) { | 31 | : QWidget( parent, name ) { |
32 | 32 | ||
33 | todoLabel = 0l; | ||
34 | todo = 0l; | 33 | todo = 0l; |
34 | layoutTodo = 0l; | ||
35 | todoLabel = 0l; | ||
35 | 36 | ||
36 | if ( todo ) { | 37 | if ( todo ) { |
37 | delete todo; | 38 | delete todo; |
38 | } | 39 | } |
39 | |||
40 | todo = new OTodoAccess(); | 40 | todo = new OTodoAccess(); |
41 | todo->load(); | 41 | todo->load(); |
42 | 42 | ||
43 | if ( layoutTodo ) { | ||
44 | delete layoutTodo; | ||
45 | } | ||
46 | layoutTodo = new QVBoxLayout( this ); | ||
47 | layoutTodo->setAutoAdd( true ); | ||
48 | |||
49 | |||
50 | if ( todoLabel ) { | ||
51 | delete todoLabel; | ||
52 | } | ||
53 | todoLabel = new OClickableLabel( this ); | ||
54 | |||
55 | connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) ); | ||
56 | |||
43 | readConfig(); | 57 | readConfig(); |
44 | getTodo(); | 58 | getTodo(); |
45 | } | 59 | } |
46 | 60 | ||
47 | TodolistPluginWidget::~TodolistPluginWidget() { | 61 | TodolistPluginWidget::~TodolistPluginWidget() { |
48 | delete todo; | 62 | delete todo; |
63 | delete todoLabel; | ||
64 | delete layoutTodo; | ||
49 | } | 65 | } |
50 | 66 | ||
51 | 67 | ||
@@ -56,20 +72,15 @@ void TodolistPluginWidget::readConfig() { | |||
56 | m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); | 72 | m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); |
57 | } | 73 | } |
58 | 74 | ||
75 | void TodolistPluginWidget:: refresh() { | ||
76 | getTodo(); | ||
77 | } | ||
59 | 78 | ||
60 | /** | 79 | /** |
61 | * Get the todos | 80 | * Get the todos |
62 | */ | 81 | */ |
63 | void TodolistPluginWidget::getTodo() { | 82 | void TodolistPluginWidget::getTodo() { |
64 | 83 | ||
65 | QVBoxLayout* layoutTodo = new QVBoxLayout( this ); | ||
66 | |||
67 | if ( todoLabel ) { | ||
68 | delete todoLabel; | ||
69 | } | ||
70 | |||
71 | todoLabel = new OClickableLabel( this ); | ||
72 | connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) ); | ||
73 | 84 | ||
74 | QString output; | 85 | QString output; |
75 | QString tmpout; | 86 | QString tmpout; |
@@ -118,7 +129,6 @@ void TodolistPluginWidget::getTodo() { | |||
118 | output = QObject::tr( "No active tasks" ); | 129 | output = QObject::tr( "No active tasks" ); |
119 | } | 130 | } |
120 | todoLabel->setText( output ); | 131 | todoLabel->setText( output ); |
121 | layoutTodo->addWidget( todoLabel ); | ||
122 | } | 132 | } |
123 | 133 | ||
124 | /** | 134 | /** |