Diffstat (limited to 'core/pim/todo/taskeditoroverviewimpl.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/todo/taskeditoroverviewimpl.cpp | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/core/pim/todo/taskeditoroverviewimpl.cpp b/core/pim/todo/taskeditoroverviewimpl.cpp index 24b3386..aef3b1d 100644 --- a/core/pim/todo/taskeditoroverviewimpl.cpp +++ b/core/pim/todo/taskeditoroverviewimpl.cpp | |||
@@ -1,75 +1,112 @@ | |||
1 | #include <qapplication.h> | 1 | #include <qapplication.h> |
2 | #include <qcheckbox.h> | 2 | #include <qcheckbox.h> |
3 | #include <qcombobox.h> | 3 | #include <qcombobox.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | 5 | ||
6 | #include <qpe/datebookmonth.h> | 6 | #include <qpe/datebookmonth.h> |
7 | #include <qpe/categoryselect.h> | 7 | #include <qpe/categoryselect.h> |
8 | #include <qpe/timestring.h> | 8 | #include <qpe/timestring.h> |
9 | 9 | ||
10 | #include <opie/orecur.h> | ||
11 | |||
10 | #include "taskeditoroverviewimpl.h" | 12 | #include "taskeditoroverviewimpl.h" |
11 | 13 | ||
12 | /* | 14 | /* |
13 | * we need to hack | 15 | * we need to hack |
14 | */ | 16 | */ |
15 | 17 | ||
16 | TaskEditorOverViewImpl::TaskEditorOverViewImpl( QWidget* parent, const char* name ) | 18 | TaskEditorOverViewImpl::TaskEditorOverViewImpl( QWidget* parent, const char* name ) |
17 | : TaskEditorOverView( parent, name ) { | 19 | : TaskEditorOverView( parent, name ) { |
18 | init(); | 20 | init(); |
19 | } | 21 | } |
20 | TaskEditorOverViewImpl::~TaskEditorOverViewImpl() { | 22 | TaskEditorOverViewImpl::~TaskEditorOverViewImpl() { |
21 | } | 23 | } |
22 | void TaskEditorOverViewImpl::load( const OTodo& todo) { | 24 | void TaskEditorOverViewImpl::load( const OTodo& todo) { |
23 | /* | 25 | /* |
24 | * now that we're 'preloaded' we | 26 | * now that we're 'preloaded' we |
25 | * need to disable the buttons | 27 | * need to disable the buttons |
26 | * holding the dat | 28 | * holding the dat |
27 | */ | 29 | */ |
28 | btnDue-> setEnabled( FALSE ); | 30 | btnDue-> setEnabled( FALSE ); |
29 | btnComp-> setEnabled( FALSE ); | 31 | btnComp-> setEnabled( FALSE ); |
30 | btnStart->setEnabled( FALSE ); | 32 | btnStart->setEnabled( FALSE ); |
31 | 33 | ||
32 | 34 | /* | |
35 | * get some basic dateinfos for now | ||
36 | */ | ||
33 | QDate date = QDate::currentDate(); | 37 | QDate date = QDate::currentDate(); |
34 | QString str = TimeString::longDateString( date ); | 38 | QString str = TimeString::longDateString( date ); |
35 | 39 | ||
36 | emit recurranceEnabled( FALSE ); | 40 | CheckBox7->setChecked( todo.recurrence().doesRecur() ); |
37 | ckbStart->setChecked( FALSE ); | 41 | emit recurranceEnabled( todo.recurrence().doesRecur() ); |
42 | |||
43 | |||
44 | ckbStart->setChecked( todo.hasStartDate() ); | ||
45 | btnStart->setEnabled( todo.hasStartDate() ); | ||
46 | if ( todo.hasStartDate() ) { | ||
47 | m_start = todo.startDate(); | ||
48 | btnStart->setText( TimeString::longDateString( m_start ) ); | ||
49 | } else | ||
38 | btnStart->setText( str ); | 50 | btnStart->setText( str ); |
39 | 51 | ||
40 | ckbComp->setChecked( FALSE ); | 52 | ckbComp->setChecked( todo.hasCompletedDate() ); |
53 | btnComp->setEnabled( todo.hasCompletedDate() ); | ||
54 | if ( todo.hasCompletedDate() ) { | ||
55 | m_comp = todo.completedDate(); | ||
56 | btnComp->setText( TimeString::longDateString( m_comp ) ); | ||
57 | }else | ||
41 | btnComp->setText( str ); | 58 | btnComp->setText( str ); |
42 | 59 | ||
43 | cmbProgress->setCurrentItem( todo.progress()/20 ); | 60 | cmbProgress->setCurrentItem( todo.progress()/20 ); |
44 | cmbSum->insertItem( todo.summary(), 0 ); | 61 | cmbSum->insertItem( todo.summary(), 0 ); |
45 | cmbSum->setCurrentItem( 0 ); | 62 | cmbSum->setCurrentItem( 0 ); |
46 | 63 | ||
47 | ckbDue->setChecked( todo.hasDueDate() ); | 64 | ckbDue->setChecked( todo.hasDueDate() ); |
48 | btnDue->setText( TimeString::longDateString( todo.dueDate() ) ); | 65 | btnDue->setText( TimeString::longDateString( todo.dueDate() ) ); |
49 | btnDue->setEnabled( todo.hasDueDate() ); | 66 | btnDue->setEnabled( todo.hasDueDate() ); |
67 | m_due = todo.dueDate(); | ||
50 | 68 | ||
51 | cmbPrio->setCurrentItem( todo.priority() -1 ); | 69 | cmbPrio->setCurrentItem( todo.priority() -1 ); |
52 | ckbCompleted->setChecked( todo.isCompleted() ); | 70 | ckbCompleted->setChecked( todo.isCompleted() ); |
53 | 71 | ||
54 | comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") ); | 72 | comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") ); |
55 | 73 | ||
56 | } | 74 | } |
57 | void TaskEditorOverViewImpl::save( OTodo& to) { | 75 | void TaskEditorOverViewImpl::save( OTodo& to) { |
58 | qWarning("save it now"); | 76 | /* a invalid date */ |
77 | QDate inval; | ||
78 | /* save our info back */ | ||
79 | |||
80 | /* due date */ | ||
59 | if ( ckbDue->isChecked() ) { | 81 | if ( ckbDue->isChecked() ) { |
60 | to.setDueDate( m_due ); | 82 | to.setDueDate( m_due ); |
61 | to.setHasDueDate( true ); | 83 | to.setHasDueDate( true ); |
62 | }else | 84 | }else |
63 | to.setHasDueDate( false ); | 85 | to.setHasDueDate( false ); |
86 | |||
87 | /* start date */ | ||
88 | if ( ckbStart->isChecked() ) { | ||
89 | to.setStartDate( m_start ); | ||
90 | }else | ||
91 | to.setStartDate( inval ); | ||
92 | |||
93 | /* comp date */ | ||
94 | if ( ckbComp->isChecked() ) { | ||
95 | qWarning("completed checked"); | ||
96 | to.setCompletedDate( m_comp ); | ||
97 | }else | ||
98 | to.setCompletedDate( inval ); | ||
99 | |||
100 | |||
64 | if ( comboCategory->currentCategory() != -1 ) { | 101 | if ( comboCategory->currentCategory() != -1 ) { |
65 | QArray<int> arr = comboCategory->currentCategories(); | 102 | QArray<int> arr = comboCategory->currentCategories(); |
66 | to.setCategories( arr ); | 103 | to.setCategories( arr ); |
67 | } | 104 | } |
68 | to.setPriority( cmbPrio->currentItem() + 1 ); | 105 | to.setPriority( cmbPrio->currentItem() + 1 ); |
69 | to.setCompleted( ckbCompleted->isChecked() ); | 106 | to.setCompleted( ckbCompleted->isChecked() ); |
70 | to.setSummary( cmbSum->currentText() ); | 107 | to.setSummary( cmbSum->currentText() ); |
71 | to.setProgress( cmbProgress->currentItem() * 20 ); | 108 | to.setProgress( cmbProgress->currentItem() * 20 ); |
72 | } | 109 | } |
73 | /* | 110 | /* |
74 | * here we will init the basic view | 111 | * here we will init the basic view |
75 | * one Popup for each Date Button | 112 | * one Popup for each Date Button |
@@ -127,29 +164,31 @@ void TaskEditorOverViewImpl::init() { | |||
127 | } | 164 | } |
128 | 165 | ||
129 | void TaskEditorOverViewImpl::slotStartChecked() { | 166 | void TaskEditorOverViewImpl::slotStartChecked() { |
130 | qWarning("slotStartChecked"); | 167 | qWarning("slotStartChecked"); |
131 | btnStart->setEnabled( ckbStart->isChecked() ); | 168 | btnStart->setEnabled( ckbStart->isChecked() ); |
132 | } | 169 | } |
133 | void TaskEditorOverViewImpl::slotStartChanged(int y, int m, int d) { | 170 | void TaskEditorOverViewImpl::slotStartChanged(int y, int m, int d) { |
134 | m_start.setYMD( y, m, d ); | 171 | m_start.setYMD( y, m, d ); |
135 | btnStart->setText( TimeString::longDateString( m_start ) ); | 172 | btnStart->setText( TimeString::longDateString( m_start ) ); |
136 | } | 173 | } |
137 | void TaskEditorOverViewImpl::slotDueChecked() { | 174 | void TaskEditorOverViewImpl::slotDueChecked() { |
138 | btnDue->setEnabled( ckbDue->isChecked() ); | 175 | btnDue->setEnabled( ckbDue->isChecked() ); |
176 | emit dueDateChanged( m_due ); | ||
139 | qWarning("slotDueChecked"); | 177 | qWarning("slotDueChecked"); |
140 | } | 178 | } |
141 | void TaskEditorOverViewImpl::slotDueChanged(int y, int m, int d ) { | 179 | void TaskEditorOverViewImpl::slotDueChanged(int y, int m, int d ) { |
142 | m_due.setYMD(y, m, d ); | 180 | m_due.setYMD(y, m, d ); |
143 | btnDue->setText( TimeString::longDateString( m_due ) ); | 181 | btnDue->setText( TimeString::longDateString( m_due ) ); |
182 | emit dueDateChanged( m_due ); | ||
144 | } | 183 | } |
145 | void TaskEditorOverViewImpl::slotCompletedChecked() { | 184 | void TaskEditorOverViewImpl::slotCompletedChecked() { |
146 | btnComp->setEnabled( ckbComp->isChecked() ); | 185 | btnComp->setEnabled( ckbComp->isChecked() ); |
147 | qWarning("slotCompletedChecked"); | 186 | qWarning("slotCompletedChecked"); |
148 | } | 187 | } |
149 | void TaskEditorOverViewImpl::slotCompletedChanged(int y, int m, int d) { | 188 | void TaskEditorOverViewImpl::slotCompletedChanged(int y, int m, int d) { |
150 | m_comp.setYMD( y, m, d ); | 189 | m_comp.setYMD( y, m, d ); |
151 | btnComp->setText( TimeString::longDateString( m_comp ) ); | 190 | btnComp->setText( TimeString::longDateString( m_comp ) ); |
152 | } | 191 | } |
153 | /* | 192 | /* |
154 | * called by a button pressed event... | 193 | * called by a button pressed event... |
155 | * three slots to avoid ugly name() tests | 194 | * three slots to avoid ugly name() tests |