summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/todoentry.ui226
-rw-r--r--core/pim/todo/todoentryimpl.cpp4
2 files changed, 154 insertions, 76 deletions
diff --git a/core/pim/todo/todoentry.ui b/core/pim/todo/todoentry.ui
index 87ee68c..5da4bb7 100644
--- a/core/pim/todo/todoentry.ui
+++ b/core/pim/todo/todoentry.ui
@@ -1,326 +1,402 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>NewTaskDialogBase</class> 2<class>NewTaskDialogBase</class>
3<comment>********************************************************************* 3<comment>*********************************************************************
4** Copyright (C) 2000 Trolltech AS. All rights reserved. 4** Copyright (C) 2000 Trolltech AS. All rights reserved.
5** 5**
6** This file is part of Qtopia Environment. 6** This file is part of Qtopia Environment.
7** 7**
8** This file may be distributed and/or modified under the terms of the 8** This file may be distributed and/or modified under the terms of the
9** GNU General Public License version 2 as published by the Free Software 9** GNU General Public License version 2 as published by the Free Software
10** Foundation and appearing in the file LICENSE.GPL included in the 10** Foundation and appearing in the file LICENSE.GPL included in the
11** packaging of this file. 11** packaging of this file.
12** 12**
13** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 13** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
14** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 14** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15** 15**
16** See http://www.trolltech.com/gpl/ for GPL licensing information. 16** See http://www.trolltech.com/gpl/ for GPL licensing information.
17** 17**
18** Contact info@trolltech.com if any conditions of this licensing are 18** Contact info@trolltech.com if any conditions of this licensing are
19** not clear to you. 19** not clear to you.
20** 20**
21*********************************************************************</comment> 21*********************************************************************</comment>
22<widget> 22<widget>
23 <class>QDialog</class> 23 <class>QDialog</class>
24 <property stdset="1"> 24 <property stdset="1">
25 <name>name</name> 25 <name>name</name>
26 <cstring>NewTaskDialogBase</cstring> 26 <cstring>NewTaskDialogBase</cstring>
27 </property> 27 </property>
28 <property stdset="1"> 28 <property stdset="1">
29 <name>geometry</name> 29 <name>geometry</name>
30 <rect> 30 <rect>
31 <x>0</x> 31 <x>0</x>
32 <y>0</y> 32 <y>0</y>
33 <width>245</width> 33 <width>429</width>
34 <height>321</height> 34 <height>321</height>
35 </rect> 35 </rect>
36 </property> 36 </property>
37 <property stdset="1"> 37 <property stdset="1">
38 <name>caption</name> 38 <name>caption</name>
39 <string>New Task</string> 39 <string>New Task</string>
40 </property> 40 </property>
41 <property> 41 <property>
42 <name>layoutMargin</name> 42 <name>layoutMargin</name>
43 </property> 43 </property>
44 <property> 44 <property>
45 <name>layoutSpacing</name> 45 <name>layoutSpacing</name>
46 </property> 46 </property>
47 <widget> 47 <widget>
48 <class>QLayoutWidget</class> 48 <class>QLayoutWidget</class>
49 <property stdset="1"> 49 <property stdset="1">
50 <name>name</name> 50 <name>name</name>
51 <cstring>Layout3</cstring> 51 <cstring>Layout22</cstring>
52 </property> 52 </property>
53 <property stdset="1"> 53 <property stdset="1">
54 <name>geometry</name> 54 <name>geometry</name>
55 <rect> 55 <rect>
56 <x>1</x> 56 <x>0</x>
57 <y>25</y> 57 <y>5</y>
58 <width>243</width> 58 <width>240</width>
59 <height>17</height> 59 <height>310</height>
60 </rect> 60 </rect>
61 </property> 61 </property>
62 <hbox> 62 <grid>
63 <property stdset="1"> 63 <property stdset="1">
64 <name>margin</name> 64 <name>margin</name>
65 <number>0</number> 65 <number>0</number>
66 </property> 66 </property>
67 <property stdset="1"> 67 <property stdset="1">
68 <name>spacing</name> 68 <name>spacing</name>
69 <number>6</number> 69 <number>6</number>
70 </property> 70 </property>
71 <widget> 71 <widget row="3" column="0" >
72 <class>QLabel</class> 72 <class>QLayoutWidget</class>
73 <property stdset="1">
74 <name>name</name>
75 <cstring>TextLabel3</cstring>
76 </property>
77 <property stdset="1">
78 <name>frameShape</name>
79 <enum>NoFrame</enum>
80 </property>
81 <property stdset="1">
82 <name>text</name>
83 <string>Category:</string>
84 </property>
85 </widget>
86 <widget>
87 <class>CategorySelect</class>
88 <property stdset="1"> 73 <property stdset="1">
89 <name>name</name> 74 <name>name</name>
90 <cstring>comboCategory</cstring> 75 <cstring>Layout18</cstring>
91 </property> 76 </property>
77 <hbox>
78 <property stdset="1">
79 <name>margin</name>
80 <number>0</number>
81 </property>
82 <property stdset="1">
83 <name>spacing</name>
84 <number>6</number>
85 </property>
86 <widget>
87 <class>QLabel</class>
88 <property stdset="1">
89 <name>name</name>
90 <cstring>TextLabel3</cstring>
91 </property>
92 <property stdset="1">
93 <name>frameShape</name>
94 <enum>NoFrame</enum>
95 </property>
96 <property stdset="1">
97 <name>text</name>
98 <string>Category:</string>
99 </property>
100 </widget>
101 <widget>
102 <class>CategorySelect</class>
103 <property stdset="1">
104 <name>name</name>
105 <cstring>comboCategory</cstring>
106 </property>
107 <property stdset="1">
108 <name>minimumSize</name>
109 <size>
110 <width>60</width>
111 <height>0</height>
112 </size>
113 </property>
114 </widget>
115 </hbox>
92 </widget> 116 </widget>
93 </hbox> 117 <widget row="4" column="0" >
94 </widget>
95 <widget>
96 <class>QLayoutWidget</class>
97 <property stdset="1">
98 <name>name</name>
99 <cstring>Layout6</cstring>
100 </property>
101 <property stdset="1">
102 <name>geometry</name>
103 <rect>
104 <x>0</x>
105 <y>0</y>
106 <width>240</width>
107 <height>320</height>
108 </rect>
109 </property>
110 <grid>
111 <property stdset="1">
112 <name>margin</name>
113 <number>0</number>
114 </property>
115 <property stdset="1">
116 <name>spacing</name>
117 <number>6</number>
118 </property>
119 <widget row="2" column="0" >
120 <class>QLayoutWidget</class> 118 <class>QLayoutWidget</class>
121 <property stdset="1"> 119 <property stdset="1">
122 <name>name</name> 120 <name>name</name>
123 <cstring>Layout4</cstring> 121 <cstring>Layout4</cstring>
124 </property> 122 </property>
125 <hbox> 123 <hbox>
126 <property stdset="1"> 124 <property stdset="1">
127 <name>margin</name> 125 <name>margin</name>
128 <number>0</number> 126 <number>0</number>
129 </property> 127 </property>
130 <property stdset="1"> 128 <property stdset="1">
131 <name>spacing</name> 129 <name>spacing</name>
132 <number>6</number> 130 <number>6</number>
133 </property> 131 </property>
134 <widget> 132 <widget>
135 <class>QLabel</class> 133 <class>QLabel</class>
136 <property stdset="1"> 134 <property stdset="1">
137 <name>name</name> 135 <name>name</name>
138 <cstring>TextLabel1</cstring> 136 <cstring>TextLabel1</cstring>
139 </property> 137 </property>
140 <property stdset="1"> 138 <property stdset="1">
141 <name>text</name> 139 <name>text</name>
142 <string>Summary:</string> 140 <string>Summary:</string>
143 </property> 141 </property>
144 </widget> 142 </widget>
145 <widget> 143 <widget>
146 <class>QLineEdit</class> 144 <class>QLineEdit</class>
147 <property stdset="1"> 145 <property stdset="1">
148 <name>name</name> 146 <name>name</name>
149 <cstring>lneSum</cstring> 147 <cstring>lneSum</cstring>
150 </property> 148 </property>
151 </widget> 149 </widget>
152 </hbox> 150 </hbox>
153 </widget> 151 </widget>
154 <widget row="3" column="0" > 152 <widget row="0" column="0" >
155 <class>QMultiLineEdit</class> 153 <class>QLayoutWidget</class>
156 <property stdset="1"> 154 <property stdset="1">
157 <name>name</name> 155 <name>name</name>
158 <cstring>txtTodo</cstring> 156 <cstring>Layout20</cstring>
159 </property> 157 </property>
158 <hbox>
159 <property stdset="1">
160 <name>margin</name>
161 <number>0</number>
162 </property>
163 <property stdset="1">
164 <name>spacing</name>
165 <number>6</number>
166 </property>
167 <widget>
168 <class>QLabel</class>
169 <property stdset="1">
170 <name>name</name>
171 <cstring>TextLabel2</cstring>
172 </property>
173 <property stdset="1">
174 <name>text</name>
175 <string>Priority:</string>
176 </property>
177 </widget>
178 <widget>
179 <class>QComboBox</class>
180 <item>
181 <property>
182 <name>text</name>
183 <string>1 - Very High</string>
184 </property>
185 </item>
186 <item>
187 <property>
188 <name>text</name>
189 <string>2 - High</string>
190 </property>
191 </item>
192 <item>
193 <property>
194 <name>text</name>
195 <string>3 - Normal</string>
196 </property>
197 </item>
198 <item>
199 <property>
200 <name>text</name>
201 <string>4 - Low</string>
202 </property>
203 </item>
204 <item>
205 <property>
206 <name>text</name>
207 <string>5 - Very Low</string>
208 </property>
209 </item>
210 <property stdset="1">
211 <name>name</name>
212 <cstring>comboPriority</cstring>
213 </property>
214 <property stdset="1">
215 <name>sizePolicy</name>
216 <sizepolicy>
217 <hsizetype>7</hsizetype>
218 <vsizetype>0</vsizetype>
219 </sizepolicy>
220 </property>
221 <property stdset="1">
222 <name>currentItem</name>
223 <number>2</number>
224 </property>
225 </widget>
226 </hbox>
160 </widget> 227 </widget>
161 <widget row="1" column="0" > 228 <widget row="1" column="0" >
162 <class>QLayoutWidget</class> 229 <class>QLayoutWidget</class>
163 <property stdset="1"> 230 <property stdset="1">
164 <name>name</name> 231 <name>name</name>
165 <cstring>Layout4</cstring> 232 <cstring>Layout21</cstring>
166 </property> 233 </property>
167 <hbox> 234 <hbox>
168 <property stdset="1"> 235 <property stdset="1">
169 <name>margin</name> 236 <name>margin</name>
170 <number>0</number> 237 <number>0</number>
171 </property> 238 </property>
172 <property stdset="1"> 239 <property stdset="1">
173 <name>spacing</name> 240 <name>spacing</name>
174 <number>6</number> 241 <number>6</number>
175 </property> 242 </property>
176 <widget> 243 <widget>
177 <class>QCheckBox</class> 244 <class>QCheckBox</class>
178 <property stdset="1"> 245 <property stdset="1">
179 <name>name</name> 246 <name>name</name>
180 <cstring>checkCompleted</cstring> 247 <cstring>checkCompleted</cstring>
181 </property> 248 </property>
182 <property stdset="1"> 249 <property stdset="1">
183 <name>text</name> 250 <name>text</name>
184 <string>&amp;Completed</string> 251 <string>&amp;Completed</string>
185 </property> 252 </property>
186 </widget> 253 </widget>
187 <widget> 254 <widget>
188 <class>QCheckBox</class> 255 <class>QCheckBox</class>
189 <property stdset="1"> 256 <property stdset="1">
190 <name>name</name> 257 <name>name</name>
191 <cstring>checkDate</cstring> 258 <cstring>checkDate</cstring>
192 </property> 259 </property>
193 <property stdset="1"> 260 <property stdset="1">
194 <name>text</name> 261 <name>text</name>
195 <string>D&amp;ue</string> 262 <string>D&amp;ue</string>
196 </property> 263 </property>
197 </widget> 264 </widget>
198 <widget> 265 <widget>
199 <class>QPushButton</class> 266 <class>QPushButton</class>
200 <property stdset="1"> 267 <property stdset="1">
201 <name>name</name> 268 <name>name</name>
202 <cstring>buttonDate</cstring> 269 <cstring>buttonDate</cstring>
203 </property> 270 </property>
204 <property stdset="1"> 271 <property stdset="1">
205 <name>enabled</name> 272 <name>enabled</name>
206 <bool>false</bool> 273 <bool>false</bool>
207 </property> 274 </property>
208 <property stdset="1"> 275 <property stdset="1">
209 <name>text</name> 276 <name>text</name>
210 <string>1 Jan 2001</string> 277 <string>1 Jan 2001</string>
211 </property> 278 </property>
212 </widget> 279 </widget>
213 </hbox> 280 </hbox>
214 </widget> 281 </widget>
215 <widget row="0" column="0" > 282 <widget row="2" column="0" >
216 <class>QLayoutWidget</class> 283 <class>QLayoutWidget</class>
217 <property stdset="1"> 284 <property stdset="1">
218 <name>name</name> 285 <name>name</name>
219 <cstring>Layout4</cstring> 286 <cstring>Layout19</cstring>
220 </property> 287 </property>
221 <hbox> 288 <hbox>
222 <property stdset="1"> 289 <property stdset="1">
223 <name>margin</name> 290 <name>margin</name>
224 <number>0</number> 291 <number>0</number>
225 </property> 292 </property>
226 <property stdset="1"> 293 <property stdset="1">
227 <name>spacing</name> 294 <name>spacing</name>
228 <number>6</number> 295 <number>6</number>
229 </property> 296 </property>
230 <widget> 297 <widget>
231 <class>QLabel</class> 298 <class>QLabel</class>
232 <property stdset="1"> 299 <property stdset="1">
233 <name>name</name> 300 <name>name</name>
234 <cstring>TextLabel2</cstring> 301 <cstring>txtProg</cstring>
235 </property> 302 </property>
236 <property stdset="1"> 303 <property stdset="1">
237 <name>text</name> 304 <name>text</name>
238 <string>Priority:</string> 305 <string>Progress:</string>
239 </property> 306 </property>
240 </widget> 307 </widget>
241 <widget> 308 <widget>
242 <class>QComboBox</class> 309 <class>QComboBox</class>
243 <item> 310 <item>
244 <property> 311 <property>
245 <name>text</name> 312 <name>text</name>
246 <string>1 - Very High</string> 313 <string>0%</string>
247 </property> 314 </property>
248 </item> 315 </item>
249 <item> 316 <item>
250 <property> 317 <property>
251 <name>text</name> 318 <name>text</name>
252 <string>2 - High</string> 319 <string>20%</string>
253 </property> 320 </property>
254 </item> 321 </item>
255 <item> 322 <item>
256 <property> 323 <property>
257 <name>text</name> 324 <name>text</name>
258 <string>3 - Normal</string> 325 <string>40%</string>
259 </property> 326 </property>
260 </item> 327 </item>
261 <item> 328 <item>
262 <property> 329 <property>
263 <name>text</name> 330 <name>text</name>
264 <string>4 - Low</string> 331 <string>60%</string>
265 </property> 332 </property>
266 </item> 333 </item>
267 <item> 334 <item>
268 <property> 335 <property>
269 <name>text</name> 336 <name>text</name>
270 <string>5 - Very Low</string> 337 <string>80%</string>
338 </property>
339 </item>
340 <item>
341 <property>
342 <name>text</name>
343 <string>100%</string>
271 </property> 344 </property>
272 </item> 345 </item>
273 <property stdset="1"> 346 <property stdset="1">
274 <name>name</name> 347 <name>name</name>
275 <cstring>comboPriority</cstring> 348 <cstring>cmbProg</cstring>
276 </property> 349 </property>
277 <property stdset="1"> 350 <property stdset="1">
278 <name>sizePolicy</name> 351 <name>maximumSize</name>
279 <sizepolicy> 352 <size>
280 <hsizetype>7</hsizetype> 353 <width>45</width>
281 <vsizetype>0</vsizetype> 354 <height>32767</height>
282 </sizepolicy> 355 </size>
283 </property>
284 <property stdset="1">
285 <name>currentItem</name>
286 <number>2</number>
287 </property> 356 </property>
288 </widget> 357 </widget>
289 </hbox> 358 </hbox>
290 </widget> 359 </widget>
360 <widget row="5" column="0" >
361 <class>QMultiLineEdit</class>
362 <property stdset="1">
363 <name>name</name>
364 <cstring>txtTodo</cstring>
365 </property>
366 </widget>
291 </grid> 367 </grid>
292 </widget> 368 </widget>
293</widget> 369</widget>
294<customwidgets> 370<customwidgets>
295 <customwidget> 371 <customwidget>
296 <class>CategorySelect</class> 372 <class>CategorySelect</class>
297 <header location="global">qpe/categoryselect.h</header> 373 <header location="global">qpe/categoryselect.h</header>
298 <sizehint> 374 <sizehint>
299 <width>-1</width> 375 <width>-1</width>
300 <height>-1</height> 376 <height>-1</height>
301 </sizehint> 377 </sizehint>
302 <container>0</container> 378 <container>0</container>
303 <sizepolicy> 379 <sizepolicy>
304 <hordata>7</hordata> 380 <hordata>7</hordata>
305 <verdata>1</verdata> 381 <verdata>1</verdata>
306 </sizepolicy> 382 </sizepolicy>
307 <pixmap>image0</pixmap> 383 <pixmap>image0</pixmap>
308 </customwidget> 384 </customwidget>
309</customwidgets> 385</customwidgets>
310<images> 386<images>
311 <image> 387 <image>
312 <name>image0</name> 388 <name>image0</name>
313 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> 389 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
314 </image> 390 </image>
315</images> 391</images>
316<connections> 392<connections>
317 <connection> 393 <connection>
318 <sender>checkDate</sender> 394 <sender>checkDate</sender>
319 <signal>toggled(bool)</signal> 395 <signal>toggled(bool)</signal>
320 <receiver>buttonDate</receiver> 396 <receiver>buttonDate</receiver>
321 <slot>setEnabled(bool)</slot> 397 <slot>setEnabled(bool)</slot>
322 </connection> 398 </connection>
323 <slot access="protected">dateChanged( const QString &amp; )</slot> 399 <slot access="protected">dateChanged( const QString &amp; )</slot>
324 <slot access="protected">dateChanged( int, int, int )</slot> 400 <slot access="protected">dateChanged( int, int, int )</slot>
325</connections> 401</connections>
326</UI> 402</UI>
diff --git a/core/pim/todo/todoentryimpl.cpp b/core/pim/todo/todoentryimpl.cpp
index dfaf9b4..f8e2f4d 100644
--- a/core/pim/todo/todoentryimpl.cpp
+++ b/core/pim/todo/todoentryimpl.cpp
@@ -1,156 +1,158 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** Copyright (C) 2002 zecke 3** Copyright (C) 2002 zecke
4** 4**
5** This file is part of Qtopia Environment. 5** This file is part of Qtopia Environment.
6** 6**
7** This file may be distributed and/or modified under the terms of the 7** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 8** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 10** packaging of this file.
11** 11**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14** 14**
15** See http://www.trolltech.com/gpl/ for GPL licensing information. 15** See http://www.trolltech.com/gpl/ for GPL licensing information.
16** 16**
17** Contact info@trolltech.com if any conditions of this licensing are 17** Contact info@trolltech.com if any conditions of this licensing are
18** not clear to you. 18** not clear to you.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22#include "todoentryimpl.h" 22#include "todoentryimpl.h"
23 23
24#include <opie/todoevent.h> 24#include <opie/todoevent.h>
25#include <opie/tododb.h> 25#include <opie/tododb.h>
26 26
27#include <qpe/categoryselect.h> 27#include <qpe/categoryselect.h>
28#include <qpe/datebookmonth.h> 28#include <qpe/datebookmonth.h>
29#include <qpe/global.h> 29#include <qpe/global.h>
30#include <qpe/imageedit.h> 30#include <qpe/imageedit.h>
31#include <qpe/timestring.h> 31#include <qpe/timestring.h>
32#include <qpe/palmtoprecord.h> 32#include <qpe/palmtoprecord.h>
33 33
34#include <qmessagebox.h> 34#include <qmessagebox.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36#include <qtoolbutton.h> 36#include <qtoolbutton.h>
37#include <qcombobox.h> 37#include <qcombobox.h>
38#include <qcheckbox.h> 38#include <qcheckbox.h>
39#include <qlineedit.h> 39#include <qlineedit.h>
40#include <qmultilineedit.h> 40#include <qmultilineedit.h>
41#include <qlabel.h> 41#include <qlabel.h>
42#include <qtimer.h> 42#include <qtimer.h>
43#include <qapplication.h> 43#include <qapplication.h>
44 44
45 45
46NewTaskDialog::NewTaskDialog( const ToDoEvent& task, QWidget *parent, 46NewTaskDialog::NewTaskDialog( const ToDoEvent& task, QWidget *parent,
47 const char *name, bool modal, WFlags fl ) 47 const char *name, bool modal, WFlags fl )
48 : NewTaskDialogBase( parent, name, modal, fl ), 48 : NewTaskDialogBase( parent, name, modal, fl ),
49 todo( task ) 49 todo( task )
50{ 50{
51 todo.setCategories( task.allCategories() ); 51 todo.setCategories( task.allCategories() );
52 if ( todo.hasDate() ) 52 if ( todo.hasDate() )
53 date = todo.date(); 53 date = todo.date();
54 else 54 else
55 date = QDate::currentDate(); 55 date = QDate::currentDate();
56 56
57 init(); 57 init();
58 comboPriority->setCurrentItem( task.priority() - 1 ); 58 comboPriority->setCurrentItem( task.priority() - 1 );
59 59
60 checkCompleted->setChecked( task.isCompleted() ); 60 checkCompleted->setChecked( task.isCompleted() );
61 checkDate->setChecked( task.hasDate() ); 61 checkDate->setChecked( task.hasDate() );
62 buttonDate->setText( TimeString::longDateString( date ) ); 62 buttonDate->setText( TimeString::longDateString( date ) );
63 63
64 txtTodo->setText( task.description() ); 64 txtTodo->setText( task.description() );
65 lneSum->setText( task.summary() ); 65 lneSum->setText( task.summary() );
66 cmbProg->setCurrentItem( task.progress()/20 );
66} 67}
67 68
68/* 69/*
69 * Constructs a NewTaskDialog which is a child of 'parent', with the 70 * Constructs a NewTaskDialog which is a child of 'parent', with the
70 * name 'name' and widget flags set to 'f' 71 * name 'name' and widget flags set to 'f'
71 * 72 *
72 * The dialog will by default be modeless, unless you set 'modal' to 73 * The dialog will by default be modeless, unless you set 'modal' to
73 * TRUE to construct a modal dialog. 74 * TRUE to construct a modal dialog.
74 */ 75 */
75NewTaskDialog::NewTaskDialog( int id, QWidget* parent, const char* name, bool modal, 76NewTaskDialog::NewTaskDialog( int id, QWidget* parent, const char* name, bool modal,
76 WFlags fl ) 77 WFlags fl )
77 : NewTaskDialogBase( parent, name, modal, fl ), 78 : NewTaskDialogBase( parent, name, modal, fl ),
78 date( QDate::currentDate() ) 79 date( QDate::currentDate() )
79{ 80{
80 if ( id != -1 ) { 81 if ( id != -1 ) {
81 QArray<int> ids( 1 ); 82 QArray<int> ids( 1 );
82 ids[0] = id; 83 ids[0] = id;
83 todo.setCategory( Qtopia::Record::idsToString( ids ) ); 84 todo.setCategory( Qtopia::Record::idsToString( ids ) );
84 } 85 }
85 init(); 86 init();
86} 87}
87 88
88void NewTaskDialog::init() 89void NewTaskDialog::init()
89{ 90{
90 QPopupMenu *m1 = new QPopupMenu( this ); 91 QPopupMenu *m1 = new QPopupMenu( this );
91 picker = new DateBookMonth( m1, 0, TRUE ); 92 picker = new DateBookMonth( m1, 0, TRUE );
92 m1->insertItem( picker ); 93 m1->insertItem( picker );
93 buttonDate->setPopup( m1 ); 94 buttonDate->setPopup( m1 );
94 comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") ); 95 comboCategory->setCategories( todo.categories(), "Todo List", tr("Todo List") );
95 96
96 connect( picker, SIGNAL( dateClicked( int, int, int ) ), 97 connect( picker, SIGNAL( dateClicked( int, int, int ) ),
97 this, SLOT( dateChanged( int, int, int ) ) ); 98 this, SLOT( dateChanged( int, int, int ) ) );
98 99
99 buttonDate->setText( TimeString::longDateString( date ) ); 100 buttonDate->setText( TimeString::longDateString( date ) );
100 picker->setDate( date.year(), date.month(), date.day() ); 101 picker->setDate( date.year(), date.month(), date.day() );
101} 102}
102 103
103/* 104/*
104 * Destroys the object and frees any allocated resources 105 * Destroys the object and frees any allocated resources
105 */ 106 */
106NewTaskDialog::~NewTaskDialog() 107NewTaskDialog::~NewTaskDialog()
107{ 108{
108 // no need to delete child widgets, Qt does it all for us 109 // no need to delete child widgets, Qt does it all for us
109} 110}
110void NewTaskDialog::dateChanged( int y, int m, int d ) 111void NewTaskDialog::dateChanged( int y, int m, int d )
111{ 112{
112 date = QDate( y, m, d ); 113 date = QDate( y, m, d );
113 buttonDate->setText( TimeString::longDateString( date ) ); 114 buttonDate->setText( TimeString::longDateString( date ) );
114} 115}
115 116
116/*! 117/*!
117*/ 118*/
118 119
119ToDoEvent NewTaskDialog::todoEntry() 120ToDoEvent NewTaskDialog::todoEntry()
120{ 121{
121 if( checkDate->isChecked() ){ 122 if( checkDate->isChecked() ){
122 todo.setDate( date ); 123 todo.setDate( date );
123 todo.setHasDate( true ); 124 todo.setHasDate( true );
124 }else{ 125 }else{
125 todo.setHasDate( false ); 126 todo.setHasDate( false );
126 } 127 }
127 if ( comboCategory->currentCategory() != -1 ) { 128 if ( comboCategory->currentCategory() != -1 ) {
128 QArray<int> arr = comboCategory->currentCategories(); 129 QArray<int> arr = comboCategory->currentCategories();
129 QStringList list; 130 QStringList list;
130 list = QStringList::split(";", Qtopia::Record::idsToString( arr )) ; 131 list = QStringList::split(";", Qtopia::Record::idsToString( arr )) ;
131 todo.setCategories( list ); 132 todo.setCategories( list );
132 } 133 }
133 todo.setPriority( comboPriority->currentItem() + 1 ); 134 todo.setPriority( comboPriority->currentItem() + 1 );
134 todo.setCompleted( checkCompleted->isChecked() ); 135 todo.setCompleted( checkCompleted->isChecked() );
135 136
136 todo.setDescription( txtTodo->text() ); 137 todo.setDescription( txtTodo->text() );
137 todo.setSummary( lneSum->text() ); 138 todo.setSummary( lneSum->text() );
138 139 QString text = cmbProg->currentText();
140 todo.setProgress( text.remove( text.length()-1, 1 ).toUShort() );
139 return todo; 141 return todo;
140} 142}
141 143
142 144
143/*! 145/*!
144 146
145*/ 147*/
146 148
147void NewTaskDialog::accept() 149void NewTaskDialog::accept()
148{ 150{
149 QString strText = txtTodo->text(); 151 QString strText = txtTodo->text();
150 if ( strText.isEmpty() ) { 152 if ( strText.isEmpty() ) {
151 // hmm... just decline it then, the user obviously didn't care about it 153 // hmm... just decline it then, the user obviously didn't care about it
152 QDialog::reject(); 154 QDialog::reject();
153 return; 155 return;
154 } 156 }
155 QDialog::accept(); 157 QDialog::accept();
156} 158}