Diffstat (limited to 'core/pim/today/plugins/todolist') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/today/plugins/todolist/todoplugin.cpp | 16 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todoplugin.h | 8 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todopluginwidget.cpp | 34 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todopluginwidget.h | 4 |
4 files changed, 46 insertions, 16 deletions
diff --git a/core/pim/today/plugins/todolist/todoplugin.cpp b/core/pim/today/plugins/todolist/todoplugin.cpp index b5abbd3..1238f92 100644 --- a/core/pim/today/plugins/todolist/todoplugin.cpp +++ b/core/pim/today/plugins/todolist/todoplugin.cpp @@ -19,11 +19,12 @@ #include "todoplugin.h" #include "todopluginconfig.h" -#include "todopluginwidget.h" TodolistPlugin::TodolistPlugin() { + m_widget = 0l; } TodolistPlugin::~TodolistPlugin() { + delete m_widget; } @@ -33,5 +34,5 @@ QString TodolistPlugin::pluginName() const { double TodolistPlugin::versionNumber() const { - return 0.8; + return 0.9; } @@ -41,5 +42,8 @@ QString TodolistPlugin::pixmapNameWidget() const { QWidget* TodolistPlugin::widget( QWidget *wid ) { - return new TodolistPluginWidget( wid, "Todolist" ); + if(!m_widget) { + m_widget = new TodolistPluginWidget( wid, "Todolist" ); + } + return m_widget; } @@ -60,2 +64,8 @@ bool TodolistPlugin::excludeFromRefresh() const { return false; } + +void TodolistPlugin::refresh() { + if ( m_widget ) { + m_widget->refresh(); + } +} diff --git a/core/pim/today/plugins/todolist/todoplugin.h b/core/pim/today/plugins/todolist/todoplugin.h index f98afdb..6106d0c 100644 --- a/core/pim/today/plugins/todolist/todoplugin.h +++ b/core/pim/today/plugins/todolist/todoplugin.h @@ -25,4 +25,6 @@ #include <opie/todayplugininterface.h> +#include "todopluginwidget.h" + class TodolistPlugin : public TodayPluginObject { @@ -30,5 +32,5 @@ public: TodolistPlugin(); ~TodolistPlugin(); - + QString pluginName() const; double versionNumber() const; @@ -39,4 +41,8 @@ public: QString appName() const; bool excludeFromRefresh() const; + void refresh(); + + private: + TodolistPluginWidget *m_widget; }; 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 @@ -31,14 +31,28 @@ 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(); @@ -47,4 +61,6 @@ TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name ) TodolistPluginWidget::~TodolistPluginWidget() { delete todo; + delete todoLabel; + delete layoutTodo; } @@ -57,4 +73,7 @@ void TodolistPluginWidget::readConfig() { } +void TodolistPluginWidget:: refresh() { + getTodo(); +} /** @@ -63,12 +82,4 @@ void TodolistPluginWidget::readConfig() { 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; @@ -87,5 +98,5 @@ void TodolistPluginWidget::getTodo() { } tmpout += "<font color=#e00000><b>-" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>"; - ammount++; + ammount++ ; } } @@ -119,5 +130,4 @@ void TodolistPluginWidget::getTodo() { } todoLabel->setText( output ); - layoutTodo->addWidget( todoLabel ); } diff --git a/core/pim/today/plugins/todolist/todopluginwidget.h b/core/pim/today/plugins/todolist/todopluginwidget.h index 37b0ee1..0d0deb5 100644 --- a/core/pim/today/plugins/todolist/todopluginwidget.h +++ b/core/pim/today/plugins/todolist/todopluginwidget.h @@ -20,4 +20,5 @@ #include <qstring.h> #include <qwidget.h> +#include <qlayout.h> #include <opie/otodo.h> @@ -34,4 +35,6 @@ public: ~TodolistPluginWidget(); + void refresh(); + protected slots: void startTodolist(); @@ -39,4 +42,5 @@ protected slots: private: OClickableLabel *todoLabel; + QVBoxLayout* layoutTodo; OTodoAccess *todo; |