summaryrefslogtreecommitdiff
path: root/core/pim/todo/todoeditor.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/todo/todoeditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/todoeditor.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/core/pim/todo/todoeditor.cpp b/core/pim/todo/todoeditor.cpp
index e19ab8d..9b8c5cb 100644
--- a/core/pim/todo/todoeditor.cpp
+++ b/core/pim/todo/todoeditor.cpp
@@ -6,26 +6,31 @@ using namespace Todo;
Editor::Editor() {
m_accepted = false;
+ m_self = 0l;
}
Editor::~Editor() {
+ delete m_self;
+ m_self = 0;
}
OTodo Editor::newTodo( int cur,
- QWidget* par) {
+ QWidget*) {
- OTaskEditor e( cur);
+ OTaskEditor *e = self();
+ e->setCaption( QObject::tr("Enter Task") );
+ e->init( cur );
#if defined(Q_WS_QWS) || defined(_WS_QWS_)
- e.showMaximized();
+ e->showMaximized();
#endif
- int ret = e.exec();
+ int ret = e->exec();
if ( QDialog::Accepted == ret ) {
m_accepted = true;
}else
m_accepted = false;
- OTodo ev = e.todo();
+ OTodo ev = e->todo();
qWarning("Todo uid");
qWarning("Todo %s %d %d", ev.summary().latin1(), ev.progress(), ev.isCompleted() );
ev.setUid(1);
@@ -34,15 +39,16 @@ OTodo Editor::newTodo( int cur,
}
OTodo Editor::edit( QWidget *wid,
const OTodo& todo ) {
- OTaskEditor e( todo );
- e.setCaption( QObject::tr( "Edit Task" ) );
+ OTaskEditor *e = self();
+ e->init( todo );
+ e->setCaption( QObject::tr( "Edit Task" ) );
#if defined(Q_WS_QWS) || defined(_WS_QWS_)
- e.showMaximized();
+ e->showMaximized();
#endif
- int ret = e.exec();
+ int ret = e->exec();
- OTodo ev = e.todo();
+ OTodo ev = e->todo();
if ( ret == QDialog::Accepted )
m_accepted = true;
else
@@ -53,3 +59,9 @@ OTodo Editor::edit( QWidget *wid,
bool Editor::accepted()const {
return m_accepted;
}
+OTaskEditor* Editor::self() {
+ if (!m_self )
+ m_self = new OTaskEditor(0);
+
+ return m_self;
+}