summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp2
-rw-r--r--core/pim/todo/otaskeditor.cpp19
-rw-r--r--core/pim/todo/otaskeditor.h7
-rw-r--r--core/pim/todo/taskeditoroverviewimpl.cpp12
-rw-r--r--core/pim/todo/todoeditor.cpp32
-rw-r--r--core/pim/todo/todoeditor.h4
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
@@ -174,9 +174,9 @@ void MainWindow::initActions() {
174 m_bar->insertItem( tr("Category"), m_catMenu ); 174 m_bar->insertItem( tr("Category"), m_catMenu );
175 m_bar->insertItem( tr("Options"), m_options ); 175 m_bar->insertItem( tr("Options"), m_options );
176 176
177 /* initialize the view menu */ 177 /* initialize the view menu */
178 a = new QAction( QString::null, tr("Show over due"), 178 a = new QAction( QString::null, tr("Show only over due"),
179 0, this, 0, TRUE ); 179 0, this, 0, TRUE );
180 a->addTo( m_view ); 180 a->addTo( m_view );
181 a->setOn( showOverDue() ); 181 a->setOn( showOverDue() );
182 connect(a, SIGNAL(toggled(bool)), 182 connect(a, SIGNAL(toggled(bool)),
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
@@ -13,22 +13,29 @@
13 13
14OTaskEditor::OTaskEditor(int cur) 14OTaskEditor::OTaskEditor(int cur)
15 : QDialog(0, 0, TRUE ) { 15 : QDialog(0, 0, TRUE ) {
16 init(); 16 init();
17 OTodo to; 17 init( cur );
18 to.setCategories( cur );
19 load(to);
20 m_uid = 1; // generate a new one
21} 18}
22OTaskEditor::OTaskEditor( const OTodo& to) 19OTaskEditor::OTaskEditor( const OTodo& to)
23 : QDialog(0, 0, TRUE ) { 20 : QDialog(0, 0, TRUE ) {
24 init(); 21 init();
25 load( to ); 22 init( to );
26 m_uid = to.uid();
27} 23}
28OTaskEditor::~OTaskEditor() { 24OTaskEditor::~OTaskEditor() {
29 25
30} 26}
27void OTaskEditor::init( int cur ) {
28 OTodo to;
29 if ( cur != 0 )
30 to.setCategories( cur );
31 load(to);
32 m_uid = 1; // generate a new one
33}
34void OTaskEditor::init( const OTodo& to ) {
35 load( to );
36 m_uid = to.uid();
37}
31OTodo OTaskEditor::todo()const{ 38OTodo OTaskEditor::todo()const{
32 qWarning("saving!"); 39 qWarning("saving!");
33 OTodo to; 40 OTodo to;
34 to.setUid(m_uid ); 41 to.setUid(m_uid );
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
@@ -17,8 +17,15 @@ public:
17 OTaskEditor(int cur); 17 OTaskEditor(int cur);
18 OTaskEditor( const OTodo& todo ); 18 OTaskEditor( const OTodo& todo );
19 ~OTaskEditor(); 19 ~OTaskEditor();
20 20
21 /*
22 * same as the c'tor but this gives us the
23 * power to 'preload' the dialog
24 */
25 void init( int cur );
26 void init( const OTodo& todo );
27
21 OTodo todo()const; 28 OTodo todo()const;
22private: 29private:
23 void load( const OTodo& ); 30 void load( const OTodo& );
24 void init(); 31 void init();
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
@@ -19,8 +19,18 @@ TaskEditorOverViewImpl::TaskEditorOverViewImpl( QWidget* parent, const char* nam
19} 19}
20TaskEditorOverViewImpl::~TaskEditorOverViewImpl() { 20TaskEditorOverViewImpl::~TaskEditorOverViewImpl() {
21} 21}
22void TaskEditorOverViewImpl::load( const OTodo& todo) { 22void TaskEditorOverViewImpl::load( const OTodo& todo) {
23 /*
24 * now that we're 'preloaded' we
25 * need to disable the buttons
26 * holding the dat
27 */
28 btnDue-> setEnabled( FALSE );
29 btnComp-> setEnabled( FALSE );
30 btnStart->setEnabled( FALSE );
31
32
23 QDate date = QDate::currentDate(); 33 QDate date = QDate::currentDate();
24 QString str = TimeString::longDateString( date ); 34 QString str = TimeString::longDateString( date );
25 35
26 emit recurranceEnabled( FALSE ); 36 emit recurranceEnabled( FALSE );
@@ -68,8 +78,10 @@ void TaskEditorOverViewImpl::init() {
68 QDate curDate = QDate::currentDate(); 78 QDate curDate = QDate::currentDate();
69 m_start = m_comp = m_due = curDate; 79 m_start = m_comp = m_due = curDate;
70 QString str = TimeString::longDateString( curDate ); 80 QString str = TimeString::longDateString( curDate );
71 81
82
83
72 /* Start Date Picker */ 84 /* Start Date Picker */
73 m_startPop = new QPopupMenu(this); 85 m_startPop = new QPopupMenu(this);
74 m_startBook = new DateBookMonth(m_startPop, 0, TRUE ); 86 m_startBook = new DateBookMonth(m_startPop, 0, TRUE );
75 m_startPop->insertItem( m_startBook ); 87 m_startPop->insertItem( m_startBook );
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
@@ -5,45 +5,51 @@
5using namespace Todo; 5using namespace Todo;
6 6
7Editor::Editor() { 7Editor::Editor() {
8 m_accepted = false; 8 m_accepted = false;
9 m_self = 0l;
9} 10}
10Editor::~Editor() { 11Editor::~Editor() {
12 delete m_self;
13 m_self = 0;
11} 14}
12OTodo Editor::newTodo( int cur, 15OTodo Editor::newTodo( int cur,
13 QWidget* par) { 16 QWidget*) {
14 17
15 OTaskEditor e( cur); 18 OTaskEditor *e = self();
19 e->setCaption( QObject::tr("Enter Task") );
20 e->init( cur );
16 21
17 22
18#if defined(Q_WS_QWS) || defined(_WS_QWS_) 23#if defined(Q_WS_QWS) || defined(_WS_QWS_)
19 e.showMaximized(); 24 e->showMaximized();
20#endif 25#endif
21 26
22 int ret = e.exec(); 27 int ret = e->exec();
23 if ( QDialog::Accepted == ret ) { 28 if ( QDialog::Accepted == ret ) {
24 m_accepted = true; 29 m_accepted = true;
25 }else 30 }else
26 m_accepted = false; 31 m_accepted = false;
27 32
28 OTodo ev = e.todo(); 33 OTodo ev = e->todo();
29 qWarning("Todo uid"); 34 qWarning("Todo uid");
30 qWarning("Todo %s %d %d", ev.summary().latin1(), ev.progress(), ev.isCompleted() ); 35 qWarning("Todo %s %d %d", ev.summary().latin1(), ev.progress(), ev.isCompleted() );
31 ev.setUid(1); 36 ev.setUid(1);
32 37
33 return ev; 38 return ev;
34} 39}
35OTodo Editor::edit( QWidget *wid, 40OTodo Editor::edit( QWidget *wid,
36 const OTodo& todo ) { 41 const OTodo& todo ) {
37 OTaskEditor e( todo ); 42 OTaskEditor *e = self();
38 e.setCaption( QObject::tr( "Edit Task" ) ); 43 e->init( todo );
44 e->setCaption( QObject::tr( "Edit Task" ) );
39 45
40#if defined(Q_WS_QWS) || defined(_WS_QWS_) 46#if defined(Q_WS_QWS) || defined(_WS_QWS_)
41 e.showMaximized(); 47 e->showMaximized();
42#endif 48#endif
43 int ret = e.exec(); 49 int ret = e->exec();
44 50
45 OTodo ev = e.todo(); 51 OTodo ev = e->todo();
46 if ( ret == QDialog::Accepted ) 52 if ( ret == QDialog::Accepted )
47 m_accepted = true; 53 m_accepted = true;
48 else 54 else
49 m_accepted = false; 55 m_accepted = false;
@@ -52,4 +58,10 @@ OTodo Editor::edit( QWidget *wid,
52} 58}
53bool Editor::accepted()const { 59bool Editor::accepted()const {
54 return m_accepted; 60 return m_accepted;
55} 61}
62OTaskEditor* Editor::self() {
63 if (!m_self )
64 m_self = new OTaskEditor(0);
65
66 return m_self;
67}
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
@@ -3,8 +3,9 @@
3 3
4#include <opie/otodo.h> 4#include <opie/otodo.h>
5 5
6 6
7class OTaskEditor;
7namespace Todo { 8namespace Todo {
8 class Editor { 9 class Editor {
9 public: 10 public:
10 Editor(); 11 Editor();
@@ -16,10 +17,13 @@ namespace Todo {
16 const OTodo& ev = OTodo() ); 17 const OTodo& ev = OTodo() );
17 18
18 19
19 bool accepted()const; 20 bool accepted()const;
21 protected:
22 OTaskEditor* self();
20 private: 23 private:
21 bool m_accepted: 1; 24 bool m_accepted: 1;
25 OTaskEditor* m_self;
22 }; 26 };
23}; 27};
24 28
25#endif 29#endif