summaryrefslogtreecommitdiff
path: root/core/pim/todo/todoentryimpl.cpp
Unidiff
Diffstat (limited to 'core/pim/todo/todoentryimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/todoentryimpl.cpp53
1 files changed, 35 insertions, 18 deletions
diff --git a/core/pim/todo/todoentryimpl.cpp b/core/pim/todo/todoentryimpl.cpp
index c957715..1dc1d44 100644
--- a/core/pim/todo/todoentryimpl.cpp
+++ b/core/pim/todo/todoentryimpl.cpp
@@ -20,12 +20,15 @@
20 20
21#include "todoentryimpl.h" 21#include "todoentryimpl.h"
22 22
23#include <opie/todoevent.h>
24#include <opie/tododb.h>
25
23#include <qpe/categoryselect.h> 26#include <qpe/categoryselect.h>
24#include <qpe/datebookmonth.h> 27#include <qpe/datebookmonth.h>
25#include <qpe/global.h> 28#include <qpe/global.h>
26#include <qpe/imageedit.h> 29#include <qpe/imageedit.h>
27#include <qpe/task.h>
28#include <qpe/timestring.h> 30#include <qpe/timestring.h>
31#include <qpe/palmtoprecord.h>
29 32
30#include <qmessagebox.h> 33#include <qmessagebox.h>
31#include <qpopupmenu.h> 34#include <qpopupmenu.h>
@@ -39,14 +42,15 @@
39#include <qapplication.h> 42#include <qapplication.h>
40 43
41 44
42NewTaskDialog::NewTaskDialog( const Task& task, QWidget *parent, 45NewTaskDialog::NewTaskDialog( const ToDoEvent& task, QWidget *parent,
43 const char *name, bool modal, WFlags fl ) 46 const char *name, bool modal, WFlags fl )
44 : NewTaskDialogBase( parent, name, modal, fl ), 47 : NewTaskDialogBase( parent, name, modal, fl ),
45 todo( task ) 48 todo( task )
46{ 49{
47 todo.setCategories( task.categories() ); 50 qWarning("setting category" );
48 if ( todo.hasDueDate() ) 51 todo.setCategory( task.category() );
49 date = todo.dueDate(); 52 if ( todo.hasDate() )
53 date = todo.date();
50 else 54 else
51 date = QDate::currentDate(); 55 date = QDate::currentDate();
52 56
@@ -54,7 +58,7 @@ NewTaskDialog::NewTaskDialog( const Task& task, QWidget *parent,
54 comboPriority->setCurrentItem( task.priority() - 1 ); 58 comboPriority->setCurrentItem( task.priority() - 1 );
55 59
56 checkCompleted->setChecked( task.isCompleted() ); 60 checkCompleted->setChecked( task.isCompleted() );
57 checkDate->setChecked( task.hasDueDate() ); 61 checkDate->setChecked( task.hasDate() );
58 buttonDate->setText( TimeString::longDateString( date ) ); 62 buttonDate->setText( TimeString::longDateString( date ) );
59 63
60 txtTodo->setText( task.description() ); 64 txtTodo->setText( task.description() );
@@ -75,7 +79,7 @@ NewTaskDialog::NewTaskDialog( int id, QWidget* parent, const char* name, bool m
75 if ( id != -1 ) { 79 if ( id != -1 ) {
76 QArray<int> ids( 1 ); 80 QArray<int> ids( 1 );
77 ids[0] = id; 81 ids[0] = id;
78 todo.setCategories( ids ); 82 todo.setCategory( Qtopia::Record::idsToString( ids ) );
79 } 83 }
80 init(); 84 init();
81} 85}
@@ -100,6 +104,7 @@ void NewTaskDialog::init()
100 */ 104 */
101NewTaskDialog::~NewTaskDialog() 105NewTaskDialog::~NewTaskDialog()
102{ 106{
107 qWarning("d'tor" );
103 // no need to delete child widgets, Qt does it all for us 108 // no need to delete child widgets, Qt does it all for us
104} 109}
105void NewTaskDialog::dateChanged( int y, int m, int d ) 110void NewTaskDialog::dateChanged( int y, int m, int d )
@@ -111,18 +116,29 @@ void NewTaskDialog::dateChanged( int y, int m, int d )
111/*! 116/*!
112*/ 117*/
113 118
114Task NewTaskDialog::todoEntry() 119ToDoEvent NewTaskDialog::todoEntry()
115{ 120{
116 todo.setDueDate( date, checkDate->isChecked() ); 121 qWarning("todoEntry()" );
117 if ( comboCategory->currentCategory() != -1 ) { 122 if( checkDate->isChecked() ){
118 todo.setCategories( comboCategory->currentCategories() ); 123 todo.setDate( date );
119 } 124 todo.setHasDate( true );
120 todo.setPriority( comboPriority->currentItem() + 1 ); 125 }else{
121 todo.setCompleted( checkCompleted->isChecked() ); 126 todo.setHasDate( false );
122 127 }
123 todo.setDescription( txtTodo->text() ); 128 qWarning("todoEntry::category()" );
124 129 if ( comboCategory->currentCategory() != -1 ) {
125 return todo; 130 QArray<int> arr = comboCategory->currentCategories();
131 int id = arr[0];
132 qWarning("id 0: %d",id );
133 todo.setCategory( Qtopia::Record::idsToString( arr ) );
134 qWarning("saving category");
135 }
136 todo.setPriority( comboPriority->currentItem() + 1 );
137 todo.setCompleted( checkCompleted->isChecked() );
138
139 todo.setDescription( txtTodo->text() );
140
141 return todo;
126} 142}
127 143
128 144
@@ -132,6 +148,7 @@ Task NewTaskDialog::todoEntry()
132 148
133void NewTaskDialog::accept() 149void NewTaskDialog::accept()
134{ 150{
151 qWarning("accept" );
135 QString strText = txtTodo->text(); 152 QString strText = txtTodo->text();
136 if ( strText.isEmpty() ) { 153 if ( strText.isEmpty() ) {
137 // hmm... just decline it then, the user obviously didn't care about it 154 // hmm... just decline it then, the user obviously didn't care about it