-rw-r--r-- | core/pim/todo/mainwindow.cpp | 2 | ||||
-rw-r--r-- | core/pim/todo/otaskeditor.cpp | 19 | ||||
-rw-r--r-- | core/pim/todo/otaskeditor.h | 7 | ||||
-rw-r--r-- | core/pim/todo/taskeditoroverviewimpl.cpp | 12 | ||||
-rw-r--r-- | core/pim/todo/todoeditor.cpp | 32 | ||||
-rw-r--r-- | core/pim/todo/todoeditor.h | 4 |
6 files changed, 59 insertions, 17 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 71e6750..9b2423b 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp @@ -177,3 +177,3 @@ void MainWindow::initActions() { /* initialize the view menu */ - a = new QAction( QString::null, tr("Show over due"), + a = new QAction( QString::null, tr("Show only over due"), 0, this, 0, TRUE ); diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp index e8e922f..1a68eb5 100644 --- a/core/pim/todo/otaskeditor.cpp +++ b/core/pim/todo/otaskeditor.cpp @@ -16,6 +16,3 @@ OTaskEditor::OTaskEditor(int cur) init(); - OTodo to; - to.setCategories( cur ); - load(to); - m_uid = 1; // generate a new one + init( cur ); } @@ -24,4 +21,3 @@ OTaskEditor::OTaskEditor( const OTodo& to) init(); - load( to ); - m_uid = to.uid(); + init( to ); } @@ -30,2 +26,13 @@ OTaskEditor::~OTaskEditor() { } +void OTaskEditor::init( int cur ) { + OTodo to; + if ( cur != 0 ) + to.setCategories( cur ); + load(to); + m_uid = 1; // generate a new one +} +void OTaskEditor::init( const OTodo& to ) { + load( to ); + m_uid = to.uid(); +} OTodo OTaskEditor::todo()const{ diff --git a/core/pim/todo/otaskeditor.h b/core/pim/todo/otaskeditor.h index 5842fdc..bcbd543 100644 --- a/core/pim/todo/otaskeditor.h +++ b/core/pim/todo/otaskeditor.h @@ -20,2 +20,9 @@ public: + /* + * same as the c'tor but this gives us the + * power to 'preload' the dialog + */ + void init( int cur ); + void init( const OTodo& todo ); + OTodo todo()const; diff --git a/core/pim/todo/taskeditoroverviewimpl.cpp b/core/pim/todo/taskeditoroverviewimpl.cpp index b9b2ae6..c10ad40 100644 --- a/core/pim/todo/taskeditoroverviewimpl.cpp +++ b/core/pim/todo/taskeditoroverviewimpl.cpp @@ -22,2 +22,12 @@ TaskEditorOverViewImpl::~TaskEditorOverViewImpl() { void TaskEditorOverViewImpl::load( const OTodo& todo) { + /* + * now that we're 'preloaded' we + * need to disable the buttons + * holding the dat + */ + btnDue-> setEnabled( FALSE ); + btnComp-> setEnabled( FALSE ); + btnStart->setEnabled( FALSE ); + + QDate date = QDate::currentDate(); @@ -71,2 +81,4 @@ void TaskEditorOverViewImpl::init() { + + /* Start Date Picker */ 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 @@ -8,9 +8,14 @@ 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 ); @@ -18,6 +23,6 @@ OTodo Editor::newTodo( int 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 ) { @@ -27,3 +32,3 @@ OTodo Editor::newTodo( int cur, - OTodo ev = e.todo(); + OTodo ev = e->todo(); qWarning("Todo uid"); @@ -36,11 +41,12 @@ 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 ) @@ -55 +61,7 @@ bool Editor::accepted()const { } +OTaskEditor* Editor::self() { + if (!m_self ) + m_self = new OTaskEditor(0); + + return m_self; +} diff --git a/core/pim/todo/todoeditor.h b/core/pim/todo/todoeditor.h index bbfdcb5..fe30634 100644 --- a/core/pim/todo/todoeditor.h +++ b/core/pim/todo/todoeditor.h @@ -6,2 +6,3 @@ +class OTaskEditor; namespace Todo { @@ -19,4 +20,7 @@ namespace Todo { bool accepted()const; + protected: + OTaskEditor* self(); private: bool m_accepted: 1; + OTaskEditor* m_self; }; |