summaryrefslogtreecommitdiff
authorhakan <hakan>2002-03-26 19:05:31 (UTC)
committer hakan <hakan>2002-03-26 19:05:31 (UTC)
commit78211642003f70797a5faa1767a5ab2f5f83606f (patch) (unidiff)
tree703df6b1f8a98dbd00066ab3c21419b7f97e41b4
parentdbbbe1c0600422e4bd2d6a6aba271476f457ed97 (diff)
downloadopie-78211642003f70797a5faa1767a5ab2f5f83606f.zip
opie-78211642003f70797a5faa1767a5ab2f5f83606f.tar.gz
opie-78211642003f70797a5faa1767a5ab2f5f83606f.tar.bz2
Added shortcut buttons to set the start time
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/clickablelabel.cpp71
-rw-r--r--core/pim/datebook/clickablelabel.h10
-rw-r--r--core/pim/datebook/datebook.cpp11
-rw-r--r--core/pim/datebook/datebook.pro6
-rw-r--r--core/pim/datebook/dateentry.ui641
-rw-r--r--core/pim/datebook/dateentryimpl.cpp97
-rw-r--r--core/pim/datebook/dateentryimpl.h7
-rw-r--r--core/pim/datebook/timepicker.cpp119
-rw-r--r--core/pim/datebook/timepicker.h32
9 files changed, 342 insertions, 652 deletions
diff --git a/core/pim/datebook/clickablelabel.cpp b/core/pim/datebook/clickablelabel.cpp
index 6912c34..1dd0d15 100644
--- a/core/pim/datebook/clickablelabel.cpp
+++ b/core/pim/datebook/clickablelabel.cpp
@@ -1,31 +1,88 @@
1#include "clickablelabel.h" 1#include "clickablelabel.h"
2#include <stdio.h>
2 3
3ClickableLabel::ClickableLabel(QWidget* parent = 0, 4ClickableLabel::ClickableLabel(QWidget* parent = 0,
4 const char* name = 0, 5 const char* name = 0,
5 WFlags fl = 0) : 6 WFlags fl = 0) :
6 QLabel(parent,name,fl) 7 QLabel(parent,name,fl)
7{ 8{
8 setFrameShape(NoFrame); 9 textInverted=false;
10 isToggle=false;
11 isDown=false;
12 showState(false);
9 setFrameShadow(Sunken); 13 setFrameShadow(Sunken);
10} 14}
11 15
16void ClickableLabel::setToggleButton(bool t) {
17 isToggle=t;
18}
19
12void ClickableLabel::mousePressEvent( QMouseEvent *e ) { 20void ClickableLabel::mousePressEvent( QMouseEvent *e ) {
13 setFrameShape(Panel); 21 if (isToggle && isDown) {
14 repaint(); 22 showState(false);
23 } else {
24 showState(true);
25 }
15} 26}
16 27
17void ClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { 28void ClickableLabel::mouseReleaseEvent( QMouseEvent *e ) {
18 setFrameShape(NoFrame); 29 if (rect().contains(e->pos()) && isToggle) isDown=!isDown;
19 repaint(); 30
31 if (isToggle && isDown) {
32 showState(true);
33 } else {
34 showState(false);
35 }
36
20 if (rect().contains(e->pos())) { 37 if (rect().contains(e->pos())) {
38 if (isToggle) {
39 emit toggled(isDown);
40 }
21 emit clicked(); 41 emit clicked();
22 } 42 }
23} 43}
24 44
25void ClickableLabel::mouseMoveEvent( QMouseEvent *e ) { 45void ClickableLabel::mouseMoveEvent( QMouseEvent *e ) {
26 if (rect().contains(e->pos())) { 46 if (rect().contains(e->pos())) {
27 setFrameShape(Panel); 47 if (isToggle && isDown) {
48 showState(false);
49 } else {
50 showState(true);
51 }
28 } else { 52 } else {
29 setFrameShape(NoFrame); 53 if (isToggle && isDown) {
54 showState(true);
55 } else {
56 showState(false);
57 }
30 } 58 }
31} 59}
60
61void ClickableLabel::showState(bool on) {
62 if (on) {
63 //setFrameShape(Panel);
64 setInverted(true);
65 setBackgroundMode(PaletteHighlight);
66 } else {
67 //setFrameShape(NoFrame);
68 setInverted(false);
69 setBackgroundMode(PaletteBackground);
70 }
71 repaint();
72}
73
74void ClickableLabel::setInverted(bool on) {
75 if ( (!textInverted && on) || (textInverted && !on) ) {
76 QPalette pal=palette();
77 QColor col=pal.color(QPalette::Normal, QColorGroup::Foreground);
78 col.setRgb(255-col.red(),255-col.green(),255-col.blue());
79 pal.setColor(QPalette::Normal, QColorGroup::Foreground, col);
80 setPalette(pal);
81 textInverted=!textInverted;
82 }
83}
84
85void ClickableLabel::setOn(bool on) {
86 isDown=on;
87 showState(isDown);
88}
diff --git a/core/pim/datebook/clickablelabel.h b/core/pim/datebook/clickablelabel.h
index b6d33ad..d00fee6 100644
--- a/core/pim/datebook/clickablelabel.h
+++ b/core/pim/datebook/clickablelabel.h
@@ -1,20 +1,30 @@
1#ifndef CLICKABLELABEL 1#ifndef CLICKABLELABEL
2#define CLICKABLELABEL 2#define CLICKABLELABEL
3 3
4#include <qlabel.h> 4#include <qlabel.h>
5 5
6class ClickableLabel: public QLabel 6class ClickableLabel: public QLabel
7{ 7{
8 Q_OBJECT 8 Q_OBJECT
9public: 9public:
10 ClickableLabel(QWidget* parent = 0, const char* name = 0, 10 ClickableLabel(QWidget* parent = 0, const char* name = 0,
11 WFlags fl = 0); 11 WFlags fl = 0);
12 void setToggleButton(bool t);
12 protected: 13 protected:
13 void mousePressEvent( QMouseEvent *e ); 14 void mousePressEvent( QMouseEvent *e );
14 void mouseReleaseEvent( QMouseEvent *e ); 15 void mouseReleaseEvent( QMouseEvent *e );
15 void mouseMoveEvent( QMouseEvent *e ); 16 void mouseMoveEvent( QMouseEvent *e );
17 public slots:
18 void setOn(bool on);
16 signals: 19 signals:
17 void clicked(); 20 void clicked();
21 void toggled(bool on);
22 private:
23 bool isToggle;
24 bool isDown;
25 void showState(bool on);
26 bool textInverted;
27 void setInverted(bool on);
18}; 28};
19 29
20#endif 30#endif
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 92dbdc8..2deb96f 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -194,51 +194,62 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
194 connect( qApp, SIGNAL(clockChanged(bool)), 194 connect( qApp, SIGNAL(clockChanged(bool)),
195 this, SLOT(changeClock(bool)) ); 195 this, SLOT(changeClock(bool)) );
196 connect( qApp, SIGNAL(weekChanged(bool)), 196 connect( qApp, SIGNAL(weekChanged(bool)),
197 this, SLOT(changeWeek(bool)) ); 197 this, SLOT(changeWeek(bool)) );
198 198
199#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 199#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
200 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), 200 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
201 this, SLOT(appMessage(const QCString&, const QByteArray&)) ); 201 this, SLOT(appMessage(const QCString&, const QByteArray&)) );
202#endif 202#endif
203 203
204 // listen on QPE/System 204 // listen on QPE/System
205#if defined(Q_WS_QWS) 205#if defined(Q_WS_QWS)
206#if !defined(QT_NO_COP) 206#if !defined(QT_NO_COP)
207 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 207 QCopChannel *channel = new QCopChannel( "QPE/System", this );
208 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 208 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
209 this, SLOT(receive(const QCString&, const QByteArray&)) ); 209 this, SLOT(receive(const QCString&, const QByteArray&)) );
210 channel = new QCopChannel( "QPE/Datebook", this );
211 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
212 this, SLOT(receive(const QCString&, const QByteArray&)) );
210#endif 213#endif
211#endif 214#endif
212 215
213 qDebug("done t=%d", t.elapsed() ); 216 qDebug("done t=%d", t.elapsed() );
214 217
215} 218}
216 219
217void DateBook::receive( const QCString &msg, const QByteArray &data ) 220void DateBook::receive( const QCString &msg, const QByteArray &data )
218{ 221{
219 QDataStream stream( data, IO_ReadOnly ); 222 QDataStream stream( data, IO_ReadOnly );
220 if ( msg == "timeChange(QString)" ) { 223 if ( msg == "timeChange(QString)" ) {
221 // update active view! 224 // update active view!
222 if ( dayAction->isOn() ) 225 if ( dayAction->isOn() )
223 viewDay(); 226 viewDay();
224 else if ( weekAction->isOn() ) 227 else if ( weekAction->isOn() )
225 viewWeek(); 228 viewWeek();
226 else if ( monthAction->isOn() ) 229 else if ( monthAction->isOn() )
227 viewMonth(); 230 viewMonth();
228 } 231 }
232 else if (msg == "editEvent(int)") {
233 /* Not yet working...
234 int uid;
235 stream >> uid;
236 Event e=db->getEvent(uid);
237 editEvent(e);
238 */
239 }
229} 240}
230 241
231DateBook::~DateBook() 242DateBook::~DateBook()
232{ 243{
233} 244}
234 245
235void DateBook::slotSettings() 246void DateBook::slotSettings()
236{ 247{
237 DateBookSettings frmSettings( ampm, this ); 248 DateBookSettings frmSettings( ampm, this );
238 frmSettings.setStartTime( startTime ); 249 frmSettings.setStartTime( startTime );
239 frmSettings.setAlarmPreset( aPreset, presetTime ); 250 frmSettings.setAlarmPreset( aPreset, presetTime );
240#if defined (Q_WS_QWS) || defined(_WS_QWS_) 251#if defined (Q_WS_QWS) || defined(_WS_QWS_)
241 frmSettings.showMaximized(); 252 frmSettings.showMaximized();
242#endif 253#endif
243 254
244 if ( frmSettings.exec() ) { 255 if ( frmSettings.exec() ) {
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro
index 314a56a..09d5c2d 100644
--- a/core/pim/datebook/datebook.pro
+++ b/core/pim/datebook/datebook.pro
@@ -1,42 +1,44 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG += qt warn_on release 2 CONFIG += qt warn_on release
3 DESTDIR = $(OPIEDIR)/bin 3 DESTDIR = $(OPIEDIR)/bin
4 4
5 HEADERS= datebookday.h \ 5 HEADERS= datebookday.h \
6 datebook.h \ 6 datebook.h \
7 dateentryimpl.h \ 7 dateentryimpl.h \
8 datebookdayheaderimpl.h \ 8 datebookdayheaderimpl.h \
9 datebooksettings.h \ 9 datebooksettings.h \
10 datebookweek.h \ 10 datebookweek.h \
11 datebookweeklst.h \ 11 datebookweeklst.h \
12 datebookweekheaderimpl.h \ 12 datebookweekheaderimpl.h \
13 repeatentry.h \ 13 repeatentry.h \
14 clickablelabel.h 14 clickablelabel.h \
15 timepicker.h
15 16
16 SOURCES= main.cpp \ 17 SOURCES= main.cpp \
17 datebookday.cpp \ 18 datebookday.cpp \
18 datebook.cpp \ 19 datebook.cpp \
19 dateentryimpl.cpp \ 20 dateentryimpl.cpp \
20 datebookdayheaderimpl.cpp \ 21 datebookdayheaderimpl.cpp \
21 datebooksettings.cpp \ 22 datebooksettings.cpp \
22 datebookweek.cpp \ 23 datebookweek.cpp \
23 datebookweeklst.cpp \ 24 datebookweeklst.cpp \
24 datebookweekheaderimpl.cpp \ 25 datebookweekheaderimpl.cpp \
25 repeatentry.cpp \ 26 repeatentry.cpp \
26 clickablelabel.cpp 27 clickablelabel.cpp \
28 timepicker.cpp
27 29
28 INTERFACES= dateentry.ui \ 30 INTERFACES= dateentry.ui \
29 datebookdayheader.ui \ 31 datebookdayheader.ui \
30 datebooksettingsbase.ui \ 32 datebooksettingsbase.ui \
31 datebookweekheader.ui \ 33 datebookweekheader.ui \
32 datebookweeklstheader.ui \ 34 datebookweeklstheader.ui \
33 datebookweeklstdayhdr.ui \ 35 datebookweeklstdayhdr.ui \
34 repeatentrybase.ui 36 repeatentrybase.ui
35 37
36INCLUDEPATH += $(OPIEDIR)/include 38INCLUDEPATH += $(OPIEDIR)/include
37 DEPENDPATH+= $(OPIEDIR)/include 39 DEPENDPATH+= $(OPIEDIR)/include
38LIBS += -lqpe 40LIBS += -lqpe
39 41
40 TARGET = datebook 42 TARGET = datebook
41 43
42TRANSLATIONS = ../i18n/de/datebook.ts 44TRANSLATIONS = ../i18n/de/datebook.ts
diff --git a/core/pim/datebook/dateentry.ui b/core/pim/datebook/dateentry.ui
index eac4e23..22ff32d 100644
--- a/core/pim/datebook/dateentry.ui
+++ b/core/pim/datebook/dateentry.ui
@@ -217,792 +217,207 @@
217 <name>text</name> 217 <name>text</name>
218 <string>Start</string> 218 <string>Start</string>
219 </property> 219 </property>
220 </widget> 220 </widget>
221 <widget row="3" column="1" > 221 <widget row="3" column="1" >
222 <class>QPushButton</class> 222 <class>QPushButton</class>
223 <property stdset="1"> 223 <property stdset="1">
224 <name>name</name> 224 <name>name</name>
225 <cstring>buttonStart</cstring> 225 <cstring>buttonStart</cstring>
226 </property> 226 </property>
227 <property stdset="1"> 227 <property stdset="1">
228 <name>text</name> 228 <name>text</name>
229 <string>Jan 02 00</string> 229 <string>Jan 02 00</string>
230 </property> 230 </property>
231 </widget> 231 </widget>
232 <widget row="3" column="2" rowspan="1" colspan="2" > 232 <widget row="3" column="2" rowspan="1" colspan="2" >
233 <class>QComboBox</class> 233 <class>QLineEdit</class>
234 <item>
235 <property>
236 <name>text</name>
237 <string>00:00</string>
238 </property>
239 </item>
240 <item>
241 <property>
242 <name>text</name>
243 <string>00:30</string>
244 </property>
245 </item>
246 <item>
247 <property>
248 <name>text</name>
249 <string>01:00</string>
250 </property>
251 </item>
252 <item>
253 <property>
254 <name>text</name>
255 <string>01:30</string>
256 </property>
257 </item>
258 <item>
259 <property>
260 <name>text</name>
261 <string>02:00</string>
262 </property>
263 </item>
264 <item>
265 <property>
266 <name>text</name>
267 <string>02:30</string>
268 </property>
269 </item>
270 <item>
271 <property>
272 <name>text</name>
273 <string>03:00</string>
274 </property>
275 </item>
276 <item>
277 <property>
278 <name>text</name>
279 <string>03:30</string>
280 </property>
281 </item>
282 <item>
283 <property>
284 <name>text</name>
285 <string>04:00</string>
286 </property>
287 </item>
288 <item>
289 <property>
290 <name>text</name>
291 <string>04:30</string>
292 </property>
293 </item>
294 <item>
295 <property>
296 <name>text</name>
297 <string>05:00</string>
298 </property>
299 </item>
300 <item>
301 <property>
302 <name>text</name>
303 <string>05:30</string>
304 </property>
305 </item>
306 <item>
307 <property>
308 <name>text</name>
309 <string>06:00</string>
310 </property>
311 </item>
312 <item>
313 <property>
314 <name>text</name>
315 <string>06:30</string>
316 </property>
317 </item>
318 <item>
319 <property>
320 <name>text</name>
321 <string>07:00</string>
322 </property>
323 </item>
324 <item>
325 <property>
326 <name>text</name>
327 <string>07:30</string>
328 </property>
329 </item>
330 <item>
331 <property>
332 <name>text</name>
333 <string>08:00</string>
334 </property>
335 </item>
336 <item>
337 <property>
338 <name>text</name>
339 <string>08:30</string>
340 </property>
341 </item>
342 <item>
343 <property>
344 <name>text</name>
345 <string>09:00</string>
346 </property>
347 </item>
348 <item>
349 <property>
350 <name>text</name>
351 <string>09:30</string>
352 </property>
353 </item>
354 <item>
355 <property>
356 <name>text</name>
357 <string>10:00</string>
358 </property>
359 </item>
360 <item>
361 <property>
362 <name>text</name>
363 <string>10:30</string>
364 </property>
365 </item>
366 <item>
367 <property>
368 <name>text</name>
369 <string>11:00</string>
370 </property>
371 </item>
372 <item>
373 <property>
374 <name>text</name>
375 <string>11:30</string>
376 </property>
377 </item>
378 <item>
379 <property>
380 <name>text</name>
381 <string>12:00</string>
382 </property>
383 </item>
384 <item>
385 <property>
386 <name>text</name>
387 <string>12:30</string>
388 </property>
389 </item>
390 <item>
391 <property>
392 <name>text</name>
393 <string>13:00</string>
394 </property>
395 </item>
396 <item>
397 <property>
398 <name>text</name>
399 <string>13:30</string>
400 </property>
401 </item>
402 <item>
403 <property>
404 <name>text</name>
405 <string>14:00</string>
406 </property>
407 </item>
408 <item>
409 <property>
410 <name>text</name>
411 <string>14:30</string>
412 </property>
413 </item>
414 <item>
415 <property>
416 <name>text</name>
417 <string>15:00</string>
418 </property>
419 </item>
420 <item>
421 <property>
422 <name>text</name>
423 <string>15:30</string>
424 </property>
425 </item>
426 <item>
427 <property>
428 <name>text</name>
429 <string>16:00</string>
430 </property>
431 </item>
432 <item>
433 <property>
434 <name>text</name>
435 <string>16:30</string>
436 </property>
437 </item>
438 <item>
439 <property>
440 <name>text</name>
441 <string>17:00</string>
442 </property>
443 </item>
444 <item>
445 <property>
446 <name>text</name>
447 <string>17:30</string>
448 </property>
449 </item>
450 <item>
451 <property>
452 <name>text</name>
453 <string>18:00</string>
454 </property>
455 </item>
456 <item>
457 <property>
458 <name>text</name>
459 <string>18:30</string>
460 </property>
461 </item>
462 <item>
463 <property>
464 <name>text</name>
465 <string>19:00</string>
466 </property>
467 </item>
468 <item>
469 <property>
470 <name>text</name>
471 <string>19:30</string>
472 </property>
473 </item>
474 <item>
475 <property>
476 <name>text</name>
477 <string>20:00</string>
478 </property>
479 </item>
480 <item>
481 <property>
482 <name>text</name>
483 <string>20:30</string>
484 </property>
485 </item>
486 <item>
487 <property>
488 <name>text</name>
489 <string>21:00</string>
490 </property>
491 </item>
492 <item>
493 <property>
494 <name>text</name>
495 <string>21:30</string>
496 </property>
497 </item>
498 <item>
499 <property>
500 <name>text</name>
501 <string>22:00</string>
502 </property>
503 </item>
504 <item>
505 <property>
506 <name>text</name>
507 <string>22:30</string>
508 </property>
509 </item>
510 <item>
511 <property>
512 <name>text</name>
513 <string>23:00</string>
514 </property>
515 </item>
516 <item>
517 <property>
518 <name>text</name>
519 <string>23:30</string>
520 </property>
521 </item>
522 <property stdset="1"> 234 <property stdset="1">
523 <name>name</name> 235 <name>name</name>
524 <cstring>comboStart</cstring> 236 <cstring>comboStart</cstring>
525 </property> 237 </property>
238 </widget>
239 <widget row="5" column="1" colspan="3">
240 <class>TimePicker</class>
526 <property stdset="1"> 241 <property stdset="1">
527 <name>editable</name> 242 <name>name</name>
528 <bool>true</bool> 243 <cstring>timePickerStart</cstring>
529 </property>
530 <property stdset="1">
531 <name>duplicatesEnabled</name>
532 <bool>false</bool>
533 </property> 244 </property>
534 </widget> 245 </widget>
535 <widget row="4" column="1" > 246 <widget row="4" column="1" >
536 <class>QPushButton</class> 247 <class>QPushButton</class>
537 <property stdset="1"> 248 <property stdset="1">
538 <name>name</name> 249 <name>name</name>
539 <cstring>buttonEnd</cstring> 250 <cstring>buttonEnd</cstring>
540 </property> 251 </property>
541 <property stdset="1"> 252 <property stdset="1">
542 <name>text</name> 253 <name>text</name>
543 <string>Jan 02 00</string> 254 <string>Jan 02 00</string>
544 </property> 255 </property>
545 </widget> 256 </widget>
546 <widget row="4" column="2" rowspan="1" colspan="2" > 257 <widget row="4" column="2" rowspan="1" colspan="2" >
547 <class>QComboBox</class> 258 <class>QLineEdit</class>
548 <item>
549 <property>
550 <name>text</name>
551 <string>00:00</string>
552 </property>
553 </item>
554 <item>
555 <property>
556 <name>text</name>
557 <string>00:30</string>
558 </property>
559 </item>
560 <item>
561 <property>
562 <name>text</name>
563 <string>01:00</string>
564 </property>
565 </item>
566 <item>
567 <property>
568 <name>text</name>
569 <string>01:30</string>
570 </property>
571 </item>
572 <item>
573 <property>
574 <name>text</name>
575 <string>02:00</string>
576 </property>
577 </item>
578 <item>
579 <property>
580 <name>text</name>
581 <string>02:30</string>
582 </property>
583 </item>
584 <item>
585 <property>
586 <name>text</name>
587 <string>03:00</string>
588 </property>
589 </item>
590 <item>
591 <property>
592 <name>text</name>
593 <string>03:30</string>
594 </property>
595 </item>
596 <item>
597 <property>
598 <name>text</name>
599 <string>04:00</string>
600 </property>
601 </item>
602 <item>
603 <property>
604 <name>text</name>
605 <string>04:30</string>
606 </property>
607 </item>
608 <item>
609 <property>
610 <name>text</name>
611 <string>05:00</string>
612 </property>
613 </item>
614 <item>
615 <property>
616 <name>text</name>
617 <string>05:30</string>
618 </property>
619 </item>
620 <item>
621 <property>
622 <name>text</name>
623 <string>06:00</string>
624 </property>
625 </item>
626 <item>
627 <property>
628 <name>text</name>
629 <string>06:30</string>
630 </property>
631 </item>
632 <item>
633 <property>
634 <name>text</name>
635 <string>07:00</string>
636 </property>
637 </item>
638 <item>
639 <property>
640 <name>text</name>
641 <string>07:30</string>
642 </property>
643 </item>
644 <item>
645 <property>
646 <name>text</name>
647 <string>08:00</string>
648 </property>
649 </item>
650 <item>
651 <property>
652 <name>text</name>
653 <string>08:30</string>
654 </property>
655 </item>
656 <item>
657 <property>
658 <name>text</name>
659 <string>09:00</string>
660 </property>
661 </item>
662 <item>
663 <property>
664 <name>text</name>
665 <string>09:30</string>
666 </property>
667 </item>
668 <item>
669 <property>
670 <name>text</name>
671 <string>10:00</string>
672 </property>
673 </item>
674 <item>
675 <property>
676 <name>text</name>
677 <string>10:30</string>
678 </property>
679 </item>
680 <item>
681 <property>
682 <name>text</name>
683 <string>11:00</string>
684 </property>
685 </item>
686 <item>
687 <property>
688 <name>text</name>
689 <string>11:30</string>
690 </property>
691 </item>
692 <item>
693 <property>
694 <name>text</name>
695 <string>12:00</string>
696 </property>
697 </item>
698 <item>
699 <property>
700 <name>text</name>
701 <string>12:30</string>
702 </property>
703 </item>
704 <item>
705 <property>
706 <name>text</name>
707 <string>13:00</string>
708 </property>
709 </item>
710 <item>
711 <property>
712 <name>text</name>
713 <string>13:30</string>
714 </property>
715 </item>
716 <item>
717 <property>
718 <name>text</name>
719 <string>14:00</string>
720 </property>
721 </item>
722 <item>
723 <property>
724 <name>text</name>
725 <string>14:30</string>
726 </property>
727 </item>
728 <item>
729 <property>
730 <name>text</name>
731 <string>15:00</string>
732 </property>
733 </item>
734 <item>
735 <property>
736 <name>text</name>
737 <string>15:30</string>
738 </property>
739 </item>
740 <item>
741 <property>
742 <name>text</name>
743 <string>16:00</string>
744 </property>
745 </item>
746 <item>
747 <property>
748 <name>text</name>
749 <string>16:30</string>
750 </property>
751 </item>
752 <item>
753 <property>
754 <name>text</name>
755 <string>17:00</string>
756 </property>
757 </item>
758 <item>
759 <property>
760 <name>text</name>
761 <string>17:30</string>
762 </property>
763 </item>
764 <item>
765 <property>
766 <name>text</name>
767 <string>18:00</string>
768 </property>
769 </item>
770 <item>
771 <property>
772 <name>text</name>
773 <string>18:30</string>
774 </property>
775 </item>
776 <item>
777 <property>
778 <name>text</name>
779 <string>19:00</string>
780 </property>
781 </item>
782 <item>
783 <property>
784 <name>text</name>
785 <string>19:30</string>
786 </property>
787 </item>
788 <item>
789 <property>
790 <name>text</name>
791 <string>20:00</string>
792 </property>
793 </item>
794 <item>
795 <property>
796 <name>text</name>
797 <string>20:30</string>
798 </property>
799 </item>
800 <item>
801 <property>
802 <name>text</name>
803 <string>21:00</string>
804 </property>
805 </item>
806 <item>
807 <property>
808 <name>text</name>
809 <string>21:30</string>
810 </property>
811 </item>
812 <item>
813 <property>
814 <name>text</name>
815 <string>22:00</string>
816 </property>
817 </item>
818 <item>
819 <property>
820 <name>text</name>
821 <string>22:30</string>
822 </property>
823 </item>
824 <item>
825 <property>
826 <name>text</name>
827 <string>23:00</string>
828 </property>
829 </item>
830 <item>
831 <property>
832 <name>text</name>
833 <string>23:30</string>
834 </property>
835 </item>
836 <property stdset="1"> 259 <property stdset="1">
837 <name>name</name> 260 <name>name</name>
838 <cstring>comboEnd</cstring> 261 <cstring>comboEnd</cstring>
839 </property> 262 </property>
840 <property stdset="1">
841 <name>editable</name>
842 <bool>true</bool>
843 </property>
844 <property stdset="1">
845 <name>duplicatesEnabled</name>
846 <bool>false</bool>
847 </property>
848 </widget> 263 </widget>
849 <widget row="4" column="0" > 264 <widget row="4" column="0" >
850 <class>QLabel</class> 265 <class>QLabel</class>
851 <property stdset="1"> 266 <property stdset="1">
852 <name>name</name> 267 <name>name</name>
853 <cstring>TextLabel3_2</cstring> 268 <cstring>TextLabel3_2</cstring>
854 </property> 269 </property>
855 <property stdset="1"> 270 <property stdset="1">
856 <name>text</name> 271 <name>text</name>
857 <string>End</string> 272 <string>End</string>
858 </property> 273 </property>
859 </widget> 274 </widget>
860 <widget row="5" column="0" > 275 <widget row="6" column="0" >
861 <class>QCheckBox</class> 276 <class>QCheckBox</class>
862 <property stdset="1"> 277 <property stdset="1">
863 <name>name</name> 278 <name>name</name>
864 <cstring>checkAllDay</cstring> 279 <cstring>checkAllDay</cstring>
865 </property> 280 </property>
866 <property stdset="1"> 281 <property stdset="1">
867 <name>text</name> 282 <name>text</name>
868 <string>All day</string> 283 <string>All day</string>
869 </property> 284 </property>
870 </widget> 285 </widget>
871 <widget row="6" column="0" > 286 <widget row="7" column="0" >
872 <class>QLabel</class> 287 <class>QLabel</class>
873 <property stdset="1"> 288 <property stdset="1">
874 <name>name</name> 289 <name>name</name>
875 <cstring>TextLabel3_2_2</cstring> 290 <cstring>TextLabel3_2_2</cstring>
876 </property> 291 </property>
877 <property stdset="1"> 292 <property stdset="1">
878 <name>text</name> 293 <name>text</name>
879 <string>Time zone:</string> 294 <string>Time zone:</string>
880 </property> 295 </property>
881 </widget> 296 </widget>
882 <widget row="6" column="1" rowspan="1" colspan="3" > 297 <widget row="7" column="1" rowspan="1" colspan="3" >
883 <class>TimeZoneSelector</class> 298 <class>TimeZoneSelector</class>
884 <property stdset="1"> 299 <property stdset="1">
885 <name>name</name> 300 <name>name</name>
886 <cstring>timezone</cstring> 301 <cstring>timezone</cstring>
887 </property> 302 </property>
888 </widget> 303 </widget>
889 <widget row="7" column="0" > 304 <widget row="8" column="0" >
890 <class>QCheckBox</class> 305 <class>QCheckBox</class>
891 <property stdset="1"> 306 <property stdset="1">
892 <name>name</name> 307 <name>name</name>
893 <cstring>checkAlarm</cstring> 308 <cstring>checkAlarm</cstring>
894 </property> 309 </property>
895 <property stdset="1"> 310 <property stdset="1">
896 <name>enabled</name> 311 <name>enabled</name>
897 <bool>true</bool> 312 <bool>true</bool>
898 </property> 313 </property>
899 <property stdset="1"> 314 <property stdset="1">
900 <name>autoMask</name> 315 <name>autoMask</name>
901 <bool>false</bool> 316 <bool>false</bool>
902 </property> 317 </property>
903 <property stdset="1"> 318 <property stdset="1">
904 <name>text</name> 319 <name>text</name>
905 <string>&amp;Alarm</string> 320 <string>&amp;Alarm</string>
906 </property> 321 </property>
907 <property stdset="1"> 322 <property stdset="1">
908 <name>checked</name> 323 <name>checked</name>
909 <bool>false</bool> 324 <bool>false</bool>
910 </property> 325 </property>
911 </widget> 326 </widget>
912 <widget row="7" column="1" rowspan="1" colspan="2" > 327 <widget row="8" column="1" rowspan="1" colspan="2" >
913 <class>QSpinBox</class> 328 <class>QSpinBox</class>
914 <property stdset="1"> 329 <property stdset="1">
915 <name>name</name> 330 <name>name</name>
916 <cstring>spinAlarm</cstring> 331 <cstring>spinAlarm</cstring>
917 </property> 332 </property>
918 <property stdset="1"> 333 <property stdset="1">
919 <name>enabled</name> 334 <name>enabled</name>
920 <bool>false</bool> 335 <bool>false</bool>
921 </property> 336 </property>
922 <property stdset="1"> 337 <property stdset="1">
923 <name>suffix</name> 338 <name>suffix</name>
924 <string> minutes</string> 339 <string> minutes</string>
925 </property> 340 </property>
926 <property stdset="1"> 341 <property stdset="1">
927 <name>maxValue</name> 342 <name>maxValue</name>
928 <number>180</number> 343 <number>180</number>
929 </property> 344 </property>
930 <property stdset="1"> 345 <property stdset="1">
931 <name>minValue</name> 346 <name>minValue</name>
932 <number>0</number> 347 <number>0</number>
933 </property> 348 </property>
934 <property stdset="1"> 349 <property stdset="1">
935 <name>lineStep</name> 350 <name>lineStep</name>
936 <number>5</number> 351 <number>5</number>
937 </property> 352 </property>
938 <property stdset="1"> 353 <property stdset="1">
939 <name>value</name> 354 <name>value</name>
940 <number>5</number> 355 <number>5</number>
941 </property> 356 </property>
942 </widget> 357 </widget>
943 <widget row="7" column="3" > 358 <widget row="8" column="3" >
944 <class>QComboBox</class> 359 <class>QComboBox</class>
945 <item> 360 <item>
946 <property> 361 <property>
947 <name>text</name> 362 <name>text</name>
948 <string>Silent</string> 363 <string>Silent</string>
949 </property> 364 </property>
950 </item> 365 </item>
951 <item> 366 <item>
952 <property> 367 <property>
953 <name>text</name> 368 <name>text</name>
954 <string>Loud</string> 369 <string>Loud</string>
955 </property> 370 </property>
956 </item> 371 </item>
957 <property stdset="1"> 372 <property stdset="1">
958 <name>name</name> 373 <name>name</name>
959 <cstring>comboSound</cstring> 374 <cstring>comboSound</cstring>
960 </property> 375 </property>
961 <property stdset="1"> 376 <property stdset="1">
962 <name>enabled</name> 377 <name>enabled</name>
963 <bool>false</bool> 378 <bool>false</bool>
964 </property> 379 </property>
965 </widget> 380 </widget>
966 <widget row="8" column="0" > 381 <widget row="9" column="0" >
967 <class>QLabel</class> 382 <class>QLabel</class>
968 <property stdset="1"> 383 <property stdset="1">
969 <name>name</name> 384 <name>name</name>
970 <cstring>lblRepeat</cstring> 385 <cstring>lblRepeat</cstring>
971 </property> 386 </property>
972 <property stdset="1"> 387 <property stdset="1">
973 <name>text</name> 388 <name>text</name>
974 <string>Repeat</string> 389 <string>Repeat</string>
975 </property> 390 </property>
976 </widget> 391 </widget>
977 <widget row="8" column="1" rowspan="1" colspan="3" > 392 <widget row="9" column="1" rowspan="1" colspan="3" >
978 <class>QToolButton</class> 393 <class>QToolButton</class>
979 <property stdset="1"> 394 <property stdset="1">
980 <name>name</name> 395 <name>name</name>
981 <cstring>cmdRepeat</cstring> 396 <cstring>cmdRepeat</cstring>
982 </property> 397 </property>
983 <property stdset="1"> 398 <property stdset="1">
984 <name>focusPolicy</name> 399 <name>focusPolicy</name>
985 <enum>TabFocus</enum> 400 <enum>TabFocus</enum>
986 </property> 401 </property>
987 <property stdset="1"> 402 <property stdset="1">
988 <name>text</name> 403 <name>text</name>
989 <string>No Repeat...</string> 404 <string>No Repeat...</string>
990 </property> 405 </property>
991 </widget> 406 </widget>
992 <widget row="9" column="0" rowspan="1" colspan="4" > 407 <widget row="10" column="0" rowspan="1" colspan="4" >
993 <class>QMultiLineEdit</class> 408 <class>QMultiLineEdit</class>
994 <property stdset="1"> 409 <property stdset="1">
995 <name>name</name> 410 <name>name</name>
996 <cstring>editNote</cstring> 411 <cstring>editNote</cstring>
997 </property> 412 </property>
998 </widget> 413 </widget>
999 </grid> 414 </grid>
1000</widget> 415</widget>
1001<customwidgets> 416<customwidgets>
1002 <customwidget> 417 <customwidget>
1003 <class>TimeZoneSelector</class> 418 <class>TimeZoneSelector</class>
1004 <header location="global">qpe/tzselect.h</header> 419 <header location="global">qpe/tzselect.h</header>
1005 <sizehint> 420 <sizehint>
1006 <width>21</width> 421 <width>21</width>
1007 <height>10</height> 422 <height>10</height>
1008 </sizehint> 423 </sizehint>
@@ -1014,82 +429,96 @@
1014 <pixmap>image0</pixmap> 429 <pixmap>image0</pixmap>
1015 </customwidget> 430 </customwidget>
1016 <customwidget> 431 <customwidget>
1017 <class>CategorySelect</class> 432 <class>CategorySelect</class>
1018 <header location="global">qpe/categoryselect.h</header> 433 <header location="global">qpe/categoryselect.h</header>
1019 <sizehint> 434 <sizehint>
1020 <width>-1</width> 435 <width>-1</width>
1021 <height>-1</height> 436 <height>-1</height>
1022 </sizehint> 437 </sizehint>
1023 <container>0</container> 438 <container>0</container>
1024 <sizepolicy> 439 <sizepolicy>
1025 <hordata>7</hordata> 440 <hordata>7</hordata>
1026 <verdata>1</verdata> 441 <verdata>1</verdata>
1027 </sizepolicy> 442 </sizepolicy>
1028 <pixmap>image1</pixmap> 443 <pixmap>image1</pixmap>
1029 </customwidget> 444 </customwidget>
445 <customwidget>
446 <class>TimePicker</class>
447 <header location="local">timepicker.h</header>
448 <sizehint>
449 <width>-1</width>
450 <height>-1</height>
451 </sizehint>
452 <container>0</container>
453 <sizepolicy>
454 <hordata>7</hordata>
455 <verdata>1</verdata>
456 </sizepolicy>
457 <pixmap>image1</pixmap>
458 </customwidget>
1030</customwidgets> 459</customwidgets>
1031<images> 460<images>
1032 <image> 461 <image>
1033 <name>image0</name> 462 <name>image0</name>
1034 <data format="XPM.GZ" length="45">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523250004143a55a6b2e0026630c4f</data> 463 <data format="XPM.GZ" length="45">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523250004143a55a6b2e0026630c4f</data>
1035 </image> 464 </image>
1036 <image> 465 <image>
1037 <name>image1</name> 466 <name>image1</name>
1038 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> 467 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
1039 </image> 468 </image>
1040</images> 469</images>
1041<connections> 470<connections>
1042 <connection> 471 <connection>
1043 <sender>checkAlarm</sender> 472 <sender>checkAlarm</sender>
1044 <signal>toggled(bool)</signal> 473 <signal>toggled(bool)</signal>
1045 <receiver>spinAlarm</receiver> 474 <receiver>spinAlarm</receiver>
1046 <slot>setEnabled(bool)</slot> 475 <slot>setEnabled(bool)</slot>
1047 </connection> 476 </connection>
1048 <connection> 477 <connection>
1049 <sender>comboEnd</sender> 478 <sender>comboEnd</sender>
1050 <signal>activated(const QString&amp;)</signal> 479 <signal>textChanged(const QString&amp;)</signal>
1051 <receiver>DateEntryBase</receiver> 480 <receiver>DateEntryBase</receiver>
1052 <slot>endTimeChanged( const QString &amp; )</slot> 481 <slot>endTimeChanged( const QString &amp; )</slot>
1053 </connection> 482 </connection>
1054 <connection> 483 <connection>
1055 <sender>cmdRepeat</sender> 484 <sender>cmdRepeat</sender>
1056 <signal>clicked()</signal> 485 <signal>clicked()</signal>
1057 <receiver>DateEntryBase</receiver> 486 <receiver>DateEntryBase</receiver>
1058 <slot>slotRepeat()</slot> 487 <slot>slotRepeat()</slot>
1059 </connection> 488 </connection>
1060 <connection> 489 <connection>
1061 <sender>comboStart</sender> 490 <sender>comboStart</sender>
1062 <signal>activated(int)</signal> 491 <signal>textChanged(const QString &amp;)</signal>
1063 <receiver>DateEntryBase</receiver> 492 <receiver>DateEntryBase</receiver>
1064 <slot>startTimeChanged( int )</slot> 493 <slot>startTimeEdited( const QString &amp; )</slot>
1065 </connection> 494 </connection>
1066 <connection> 495 <connection>
1067 <sender>checkAllDay</sender> 496 <sender>checkAllDay</sender>
1068 <signal>toggled(bool)</signal> 497 <signal>toggled(bool)</signal>
1069 <receiver>comboEnd</receiver> 498 <receiver>comboEnd</receiver>
1070 <slot>setDisabled(bool)</slot> 499 <slot>setDisabled(bool)</slot>
1071 </connection> 500 </connection>
1072 <connection> 501 <connection>
1073 <sender>checkAlarm</sender> 502 <sender>checkAlarm</sender>
1074 <signal>toggled(bool)</signal> 503 <signal>toggled(bool)</signal>
1075 <receiver>comboSound</receiver> 504 <receiver>comboSound</receiver>
1076 <slot>setEnabled(bool)</slot> 505 <slot>setEnabled(bool)</slot>
1077 </connection> 506 </connection>
1078 <connection> 507 <connection>
1079 <sender>checkAllDay</sender> 508 <sender>checkAllDay</sender>
1080 <signal>toggled(bool)</signal> 509 <signal>toggled(bool)</signal>
1081 <receiver>comboStart</receiver> 510 <receiver>comboStart</receiver>
1082 <slot>setDisabled(bool)</slot> 511 <slot>setDisabled(bool)</slot>
1083 </connection> 512 </connection>
1084 <slot access="public">endDateChanged( const QString &amp; )</slot> 513 <slot access="public">endDateChanged( const QString &amp; )</slot>
1085 <slot access="public">endDateChanged( int, int, int )</slot> 514 <slot access="public">endDateChanged( int, int, int )</slot>
1086 <slot access="public">endTimeChanged( const QString &amp; )</slot> 515 <slot access="public">endTimeChanged( const QString &amp; )</slot>
1087 <slot access="public">slotRepeat()</slot> 516 <slot access="public">slotRepeat()</slot>
1088 <slot access="public">slotWait( int )</slot> 517 <slot access="public">slotWait( int )</slot>
1089 <slot access="public">startDateChanged( const QString &amp; )</slot> 518 <slot access="public">startDateChanged( const QString &amp; )</slot>
1090 <slot access="public">startDateChanged(int, int, int)</slot> 519 <slot access="public">startDateChanged(int, int, int)</slot>
1091 <slot access="public">startTimeChanged( int )</slot> 520 <slot access="public">startTimeEdited( const QString &amp; )</slot>
1092 <slot access="public">typeChanged( const QString &amp; )</slot> 521 <slot access="public">typeChanged( const QString &amp; )</slot>
1093 <slot access="public">tzexecute(void)</slot> 522 <slot access="public">tzexecute(void)</slot>
1094</connections> 523</connections>
1095</UI> 524</UI>
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
index b2e3e3a..1c43363 100644
--- a/core/pim/datebook/dateentryimpl.cpp
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -26,164 +26,179 @@
26#include <qpe/datebookmonth.h> 26#include <qpe/datebookmonth.h>
27#include <qpe/global.h> 27#include <qpe/global.h>
28#include <qpe/timeconversion.h> 28#include <qpe/timeconversion.h>
29#include <qpe/timestring.h> 29#include <qpe/timestring.h>
30#include <qpe/tzselect.h> 30#include <qpe/tzselect.h>
31 31
32#include <qcheckbox.h> 32#include <qcheckbox.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qlineedit.h> 35#include <qlineedit.h>
36#include <qmultilineedit.h> 36#include <qmultilineedit.h>
37#include <qpopupmenu.h> 37#include <qpopupmenu.h>
38#include <qscrollview.h> 38#include <qscrollview.h>
39#include <qspinbox.h> 39#include <qspinbox.h>
40#include <qtoolbutton.h> 40#include <qtoolbutton.h>
41 41
42#include "timepicker.h"
43
42#include <stdlib.h> 44#include <stdlib.h>
43 45
44#include <stdiostream.h> 46#include <stdiostream.h>
45 47
46/* 48/*
47 * Constructs a DateEntry which is a child of 'parent', with the 49 * Constructs a DateEntry which is a child of 'parent', with the
48 * name 'name' and widget flags set to 'f' 50 * name 'name' and widget flags set to 'f'
49 * 51 *
50 * The dialog will by default be modeless, unless you set 'modal' to 52 * The dialog will by default be modeless, unless you set 'modal' to
51 * TRUE to construct a modal dialog. 53 * TRUE to construct a modal dialog.
52 */ 54 */
53 55
54DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, 56DateEntry::DateEntry( bool startOnMonday, const QDateTime &start,
55 const QDateTime &end, bool whichClock, QWidget* parent, 57 const QDateTime &end, bool whichClock, QWidget* parent,
56 const char* name ) 58 const char* name )
57 : DateEntryBase( parent, name ), 59 : DateEntryBase( parent, name ),
58 ampm( whichClock ), 60 ampm( whichClock ),
59 startWeekOnMonday( startOnMonday ) 61 startWeekOnMonday( startOnMonday )
60{ 62{
61 init(); 63 init();
62 setDates(start,end); 64 setDates(start,end);
63 setFocusProxy(comboDescription); 65 setFocusProxy(comboDescription);
64} 66}
65 67
66static void addOrPick( QComboBox* combo, const QString& t ) 68static void addOrPick( QComboBox* combo, const QString& t )
67{ 69{
70 // Pick an item if one excists
68 for (int i=0; i<combo->count(); i++) { 71 for (int i=0; i<combo->count(); i++) {
69 if ( combo->text(i) == t ) { 72 if ( combo->text(i) == t ) {
70 combo->setCurrentItem(i); 73 combo->setCurrentItem(i);
71 return; 74 return;
72 } 75 }
73 } 76 }
74 combo->setEditText(t); 77
78 // Else add one
79 combo->insertItem(t);
80 combo->setCurrentItem(combo->count()-1);
75} 81}
76 82
77DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, 83DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock,
78 QWidget* parent, const char* name ) 84 QWidget* parent, const char* name )
79 : DateEntryBase( parent, name ), 85 : DateEntryBase( parent, name ),
80 ampm( whichClock ), 86 ampm( whichClock ),
81 startWeekOnMonday( startOnMonday ) 87 startWeekOnMonday( startOnMonday )
82{ 88{
83 init(); 89 init();
84 setDates(event.start(),event.end()); 90 setDates(event.start(),event.end());
85 comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") ); 91 comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") );
86 if(!event.description().isEmpty()) 92 if(!event.description().isEmpty())
87 addOrPick( comboDescription, event.description() ); 93 addOrPick( comboDescription, event.description() );
88 if(!event.location().isEmpty()) 94 if(!event.location().isEmpty())
89 addOrPick( comboLocation, event.location() ); 95 addOrPick( comboLocation, event.location() );
90 checkAlarm->setChecked( event.hasAlarm() ); 96 checkAlarm->setChecked( event.hasAlarm() );
91 checkAllDay->setChecked( event.type() == Event::AllDay ); 97 checkAllDay->setChecked( event.type() == Event::AllDay );
92 if(!event.notes().isEmpty()) 98 if(!event.notes().isEmpty())
93 editNote->setText(event.notes()); 99 editNote->setText(event.notes());
94 spinAlarm->setValue(event.alarmTime()); 100 spinAlarm->setValue(event.alarmTime());
95 if ( event.alarmSound() != Event::Silent ) 101 if ( event.alarmSound() != Event::Silent )
96 comboSound->setCurrentItem( 1 ); 102 comboSound->setCurrentItem( 1 );
97 if ( event.hasRepeat() ) { 103 if ( event.hasRepeat() ) {
98 rp = event.repeatPattern(); 104 rp = event.repeatPattern();
99 cmdRepeat->setText( tr("Repeat...") ); 105 cmdRepeat->setText( tr("Repeat...") );
100 } 106 }
101 setRepeatLabel(); 107 setRepeatLabel();
102} 108}
103 109
104void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) 110void DateEntry::setDates( const QDateTime& s, const QDateTime& e )
105{ 111{
106 int shour,
107 ehour;
108 QString strStart,
109 strEnd;
110 startDate = s.date(); 112 startDate = s.date();
111 endDate = e.date(); 113 endDate = e.date();
112 startTime = s.time(); 114 startTime = s.time();
113 endTime = e.time(); 115 endTime = e.time();
114 startDateChanged( s.date().year(), s.date().month(), s.date().day() ); 116 startDateChanged( s.date().year(), s.date().month(), s.date().day() );
117 endDateChanged( e.date().year(), e.date().month(), e.date().day() );
118 updateTimeEdit(true,true);
119}
120
121void DateEntry::updateTimeEdit(bool s, bool e) {
122
123 // Comboboxes
124 QString strStart, strEnd;
125 int shour, ehour;
115 if ( ampm ) { 126 if ( ampm ) {
116 shour = s.time().hour(); 127 shour = startTime.hour();
117 ehour = e.time().hour(); 128 ehour = endTime.hour();
118 if ( shour >= 12 ) { 129 if ( shour >= 12 ) {
119 if ( shour > 12 ) 130 if ( shour > 12 )
120 shour -= 12; 131 shour -= 12;
121 strStart.sprintf( "%d:%02d PM", shour, s.time().minute() ); 132 strStart.sprintf( "%d:%02d PM", shour, startTime.minute() );
122 } else { 133 } else {
123 if ( shour == 0 ) 134 if ( shour == 0 )
124 shour = 12; 135 shour = 12;
125 strStart.sprintf( "%d:%02d AM", shour, s.time().minute() ); 136 strStart.sprintf( "%d:%02d AM", shour, startTime.minute() );
126 } 137 }
127 if ( ehour == 24 && e.time().minute() == 0 ) { 138 if ( ehour == 24 && endTime.minute() == 0 ) {
128 strEnd = "11:59 PM"; // or "midnight" 139 strEnd = "11:59 PM"; // or "midnight"
129 } else if ( ehour >= 12 ) { 140 } else if ( ehour >= 12 ) {
130 if ( ehour > 12 ) 141 if ( ehour > 12 )
131 ehour -= 12; 142 ehour -= 12;
132 strEnd.sprintf( "%d:%02d PM", ehour, e.time().minute() ); 143 strEnd.sprintf( "%d:%02d PM", ehour, endTime.minute() );
133 } else { 144 } else {
134 if ( ehour == 0 ) 145 if ( ehour == 0 )
135 ehour = 12; 146 ehour = 12;
136 strEnd.sprintf( "%d:%02d AM", ehour, e.time().minute() ); 147 strEnd.sprintf( "%d:%02d AM", ehour, endTime.minute() );
137 } 148 }
138 } else { 149 } else {
139 strStart.sprintf( "%02d:%02d", s.time().hour(), s.time().minute() ); 150 strStart.sprintf( "%02d:%02d", startTime.hour(), startTime.minute() );
140 strEnd.sprintf( "%02d:%02d", e.time().hour(), e.time().minute() ); 151 strEnd.sprintf( "%02d:%02d", endTime.hour(), endTime.minute() );
141 } 152 }
142 addOrPick(comboStart, strStart ); 153
143 endDateChanged( e.date().year(), e.date().month(), e.date().day() ); 154 if (s) comboStart->setText(strStart);
144 addOrPick(comboEnd, strEnd ); 155 if (e) comboEnd->setText(strEnd);
145} 156}
146 157
147void DateEntry::init() 158void DateEntry::init()
148{ 159{
149 comboDescription->setInsertionPolicy(QComboBox::AtCurrent); 160 comboDescription->setInsertionPolicy(QComboBox::AtCurrent);
150 comboLocation->setInsertionPolicy(QComboBox::AtCurrent); 161 comboLocation->setInsertionPolicy(QComboBox::AtCurrent);
151 162
152 initCombos(); 163 initCombos();
153 QPopupMenu *m1 = new QPopupMenu( this ); 164 QPopupMenu *m1 = new QPopupMenu( this );
154 startPicker = new DateBookMonth( m1, 0, TRUE ); 165 startPicker = new DateBookMonth( m1, 0, TRUE );
155 m1->insertItem( startPicker ); 166 m1->insertItem( startPicker );
156 buttonStart->setPopup( m1 ); 167 buttonStart->setPopup( m1 );
157 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), 168 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ),
158 this, SLOT( startDateChanged( int, int, int ) ) ); 169 this, SLOT( startDateChanged( int, int, int ) ) );
159 170
160 //Let start button change both start and end dates 171 //Let start button change both start and end dates
161 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), 172 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ),
162 this, SLOT( endDateChanged( int, int, int ) ) ); 173 this, SLOT( endDateChanged( int, int, int ) ) );
163 connect( qApp, SIGNAL( clockChanged( bool ) ), 174 connect( qApp, SIGNAL( clockChanged( bool ) ),
164 this, SLOT( slotChangeClock( bool ) ) ); 175 this, SLOT( slotChangeClock( bool ) ) );
165 connect( qApp, SIGNAL(weekChanged(bool)), 176 connect( qApp, SIGNAL(weekChanged(bool)),
166 this, SLOT(slotChangeStartOfWeek(bool)) ); 177 this, SLOT(slotChangeStartOfWeek(bool)) );
167 178
168 QPopupMenu *m2 = new QPopupMenu( this ); 179 QPopupMenu *m2 = new QPopupMenu( this );
169 endPicker = new DateBookMonth( m2, 0, TRUE ); 180 endPicker = new DateBookMonth( m2, 0, TRUE );
170 m2->insertItem( endPicker ); 181 m2->insertItem( endPicker );
171 buttonEnd->setPopup( m2 ); 182 buttonEnd->setPopup( m2 );
172 connect( endPicker, SIGNAL( dateClicked( int, int, int ) ), 183 connect( endPicker, SIGNAL( dateClicked( int, int, int ) ),
173 this, SLOT( endDateChanged( int, int, int ) ) ); 184 this, SLOT( endDateChanged( int, int, int ) ) );
185
186 connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ),
187 this, SLOT( startTimePicked(const QTime &) ));
188 editNote->setFixedVisibleLines(3);
174} 189}
175 190
176/* 191/*
177 * Destroys the object and frees any allocated resources 192 * Destroys the object and frees any allocated resources
178 */ 193 */
179DateEntry::~DateEntry() 194DateEntry::~DateEntry()
180{ 195{
181 // no need to delete child widgets, Qt does it all for us 196 // no need to delete child widgets, Qt does it all for us
182 //cout << "Del: " << comboStart->currentText() << endl; 197 //cout << "Del: " << comboStart->currentText() << endl;
183} 198}
184 199
185/* 200/*
186 * public slot 201 * public slot
187 */ 202 */
188void DateEntry::endDateChanged( int y, int m, int d ) 203void DateEntry::endDateChanged( int y, int m, int d )
189{ 204{
@@ -227,88 +242,95 @@ static QTime parseTime( const QString& s, bool ampm )
227 } else if ( hour < 0 ) 242 } else if ( hour < 0 )
228 hour = 0; 243 hour = 0;
229 tmpTime.setHMS( hour, minute, 0 ); 244 tmpTime.setHMS( hour, minute, 0 );
230 return tmpTime; 245 return tmpTime;
231} 246}
232 247
233/* 248/*
234 * public slot 249 * public slot
235 */ 250 */
236void DateEntry::endTimeChanged( const QString &s ) 251void DateEntry::endTimeChanged( const QString &s )
237{ 252{
238 QTime tmpTime = parseTime(s,ampm); 253 QTime tmpTime = parseTime(s,ampm);
239 if ( endDate > startDate || tmpTime >= startTime ) { 254 if ( endDate > startDate || tmpTime >= startTime ) {
240 endTime = tmpTime; 255 endTime = tmpTime;
241 } else { 256 } else {
242 endTime = startTime; 257 endTime = startTime;
243 comboEnd->setCurrentItem( comboStart->currentItem() ); 258 //comboEnd->setCurrentItem( comboStart->currentItem() );
244 } 259 }
260
261}
262
263void DateEntry::endTimeChanged( const QTime &t ) {
245} 264}
246 265
247/* 266/*
248 * public slot 267 * public slot
249 */ 268 */
250void DateEntry::startDateChanged( int y, int m, int d ) 269void DateEntry::startDateChanged( int y, int m, int d )
251{ 270{
252 QDate prev = startDate; 271 QDate prev = startDate;
253 startDate.setYMD( y, m, d ); 272 startDate.setYMD( y, m, d );
254 if ( rp.type == Event::Weekly && 273 if ( rp.type == Event::Weekly &&
255 startDate.dayOfWeek() != prev.dayOfWeek() ) { 274 startDate.dayOfWeek() != prev.dayOfWeek() ) {
256 // if we change the start of a weekly repeating event 275 // if we change the start of a weekly repeating event
257 // set the repeating day appropriately 276 // set the repeating day appropriately
258 char mask = 1 << (prev.dayOfWeek()-1); 277 char mask = 1 << (prev.dayOfWeek()-1);
259 rp.days &= (~mask); 278 rp.days &= (~mask);
260 rp.days |= 1 << (startDate.dayOfWeek()-1); 279 rp.days |= 1 << (startDate.dayOfWeek()-1);
261 } 280 }
262 281
263 buttonStart->setText( TimeString::shortDate( startDate ) ); 282 buttonStart->setText( TimeString::shortDate( startDate ) );
264 283
265 // our pickers must be reset... 284 // our pickers must be reset...
266 startPicker->setDate( y, m, d ); 285 startPicker->setDate( y, m, d );
267 endPicker->setDate( y, m, d ); 286 endPicker->setDate( y, m, d );
268} 287}
269 288
270/* 289/*
271 * public slot 290 * public slot
272 */ 291 */
273void DateEntry::startTimeChanged( int index ) 292void DateEntry::startTimeEdited( const QString &s )
274{ 293{
275 startTime = parseTime(comboStart->text(index),ampm); 294 startTimeChanged(parseTime(s,ampm));
276 changeEndCombo( index ); 295 updateTimeEdit(false,true);
277 //cout << "Start: " << comboStart->currentText() << endl; 296 timePickerStart->setHour(startTime.hour());
297 timePickerStart->setMinute(startTime.minute());
278} 298}
299
300void DateEntry::startTimeChanged( const QTime &t )
301{
302 int duration=startTime.secsTo(endTime);
303 startTime = t;
304 endTime=t.addSecs(duration);
305}
306void DateEntry::startTimePicked( const QTime &t ) {
307 startTimeChanged(t);
308 updateTimeEdit(true,true);
309}
310
279/* 311/*
280 * public slot 312 * public slot
281 */ 313 */
282void DateEntry::typeChanged( const QString &s ) 314void DateEntry::typeChanged( const QString &s )
283{ 315{
284 bool b = s != "All Day"; 316 bool b = s != "All Day";
285 buttonStart->setEnabled( b ); 317 buttonStart->setEnabled( b );
286 comboStart->setEnabled( b ); 318 comboStart->setEnabled( b );
287 comboEnd->setEnabled( b ); 319 comboEnd->setEnabled( b );
288} 320}
289/*
290 * public slot
291 */
292void DateEntry::changeEndCombo( int change )
293{
294 if ( change + 2 < comboEnd->count() )
295 change += 2;
296 comboEnd->setCurrentItem( change );
297 endTimeChanged( comboEnd->currentText() );
298}
299 321
300void DateEntry::slotRepeat() 322void DateEntry::slotRepeat()
301{ 323{
302 // Work around for compiler Bug.. 324 // Work around for compiler Bug..
303 RepeatEntry *e; 325 RepeatEntry *e;
304 326
305 // it is better in my opinion to just grab this from the mother, 327 // it is better in my opinion to just grab this from the mother,
306 // since, this dialog doesn't need to keep track of it... 328 // since, this dialog doesn't need to keep track of it...
307 if ( rp.type != Event::NoRepeat ) 329 if ( rp.type != Event::NoRepeat )
308 e = new RepeatEntry( startWeekOnMonday, rp, startDate, this); 330 e = new RepeatEntry( startWeekOnMonday, rp, startDate, this);
309 else 331 else
310 e = new RepeatEntry( startWeekOnMonday, startDate, this ); 332 e = new RepeatEntry( startWeekOnMonday, startDate, this );
311 333
312#if defined(Q_WS_QWS) || defined(_WS_QWS_) 334#if defined(Q_WS_QWS) || defined(_WS_QWS_)
313 e->showMaximized(); 335 e->showMaximized();
314#endif 336#endif
@@ -323,34 +345,37 @@ void DateEntry::slotChangeStartOfWeek( bool onMonday )
323 startWeekOnMonday = onMonday; 345 startWeekOnMonday = onMonday;
324} 346}
325 347
326Event DateEntry::event() 348Event DateEntry::event()
327{ 349{
328 Event ev; 350 Event ev;
329 Event::SoundTypeChoice st; 351 Event::SoundTypeChoice st;
330 ev.setDescription( comboDescription->currentText() ); 352 ev.setDescription( comboDescription->currentText() );
331 ev.setLocation( comboLocation->currentText() ); 353 ev.setLocation( comboLocation->currentText() );
332 ev.setCategories( comboCategory->currentCategories() ); 354 ev.setCategories( comboCategory->currentCategories() );
333 ev.setType( checkAllDay->isChecked() ? Event::AllDay : Event::Normal ); 355 ev.setType( checkAllDay->isChecked() ? Event::AllDay : Event::Normal );
334 if ( startDate > endDate ) { 356 if ( startDate > endDate ) {
335 QDate tmp = endDate; 357 QDate tmp = endDate;
336 endDate = startDate; 358 endDate = startDate;
337 startDate = tmp; 359 startDate = tmp;
338 } 360 }
339 startTime = parseTime( comboStart->currentText(), ampm ); 361
340 endTime = parseTime( comboEnd->currentText(), ampm ); 362 // This is now done in the changed slots
363 // startTime = parseTime( comboStart->text(), ampm );
364 //endTime = parseTime( comboEnd->text(), ampm );
365
341 if ( startTime > endTime && endDate == startDate ) { 366 if ( startTime > endTime && endDate == startDate ) {
342 QTime tmp = endTime; 367 QTime tmp = endTime;
343 endTime = startTime; 368 endTime = startTime;
344 startTime = tmp; 369 startTime = tmp;
345 } 370 }
346 // don't set the time if theres no need too 371 // don't set the time if theres no need too
347 if ( ev.type() == Event::AllDay ) { 372 if ( ev.type() == Event::AllDay ) {
348 startTime.setHMS( 0, 0, 0 ); 373 startTime.setHMS( 0, 0, 0 );
349 endTime.setHMS( 23, 59, 59 ); 374 endTime.setHMS( 23, 59, 59 );
350 } 375 }
351 376
352 // adjust start and end times based on timezone 377 // adjust start and end times based on timezone
353 QDateTime start( startDate, startTime ); 378 QDateTime start( startDate, startTime );
354 QDateTime end( endDate, endTime ); 379 QDateTime end( endDate, endTime );
355 time_t start_utc, end_utc; 380 time_t start_utc, end_utc;
356 381
@@ -414,32 +439,33 @@ void DateEntry::setRepeatLabel()
414 cmdRepeat->setText( tr("No Repeat...") ); 439 cmdRepeat->setText( tr("No Repeat...") );
415 } 440 }
416} 441}
417 442
418void DateEntry::setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice sound ) 443void DateEntry::setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice sound )
419{ 444{
420 checkAlarm->setChecked( alarmPreset ); 445 checkAlarm->setChecked( alarmPreset );
421 spinAlarm->setValue( presetTime ); 446 spinAlarm->setValue( presetTime );
422 if ( sound != Event::Silent ) 447 if ( sound != Event::Silent )
423 comboSound->setCurrentItem( 1 ); 448 comboSound->setCurrentItem( 1 );
424 else 449 else
425 comboSound->setCurrentItem( 0 ); 450 comboSound->setCurrentItem( 0 );
426} 451}
427 452
428void DateEntry::initCombos() 453void DateEntry::initCombos()
429{ 454{
455 /*
430 comboStart->clear(); 456 comboStart->clear();
431 comboEnd->clear(); 457 comboEnd->clear();
432 if ( ampm ) { 458 if ( ampm ) {
433 for ( int i = 0; i < 24; i++ ) { 459 for ( int i = 0; i < 24; i++ ) {
434 if ( i == 0 ) { 460 if ( i == 0 ) {
435 comboStart->insertItem( "12:00 AM" ); 461 comboStart->insertItem( "12:00 AM" );
436 comboStart->insertItem( "12:30 AM" ); 462 comboStart->insertItem( "12:30 AM" );
437 comboEnd->insertItem( "12:00 AM" ); 463 comboEnd->insertItem( "12:00 AM" );
438 comboEnd->insertItem( "12:30 AM" ); 464 comboEnd->insertItem( "12:30 AM" );
439 } else if ( i == 12 ) { 465 } else if ( i == 12 ) {
440 comboStart->insertItem( "12:00 PM" ); 466 comboStart->insertItem( "12:00 PM" );
441 comboStart->insertItem( "12:30 PM" ); 467 comboStart->insertItem( "12:30 PM" );
442 comboEnd->insertItem( "12:00 PM" ); 468 comboEnd->insertItem( "12:00 PM" );
443 comboEnd->insertItem( "12:30 PM" ); 469 comboEnd->insertItem( "12:30 PM" );
444 } else if ( i > 12 ) { 470 } else if ( i > 12 ) {
445 comboStart->insertItem( QString::number( i - 12 ) + ":00 PM" ); 471 comboStart->insertItem( QString::number( i - 12 ) + ":00 PM" );
@@ -459,24 +485,25 @@ void DateEntry::initCombos()
459 comboStart->insertItem( QString("0") 485 comboStart->insertItem( QString("0")
460 + QString::number(i) + ":00" ); 486 + QString::number(i) + ":00" );
461 comboStart->insertItem( QString("0") 487 comboStart->insertItem( QString("0")
462 + QString::number(i) + ":30" ); 488 + QString::number(i) + ":30" );
463 comboEnd->insertItem( QString("0") 489 comboEnd->insertItem( QString("0")
464 + QString::number(i) + ":00" ); 490 + QString::number(i) + ":00" );
465 comboEnd->insertItem( QString("0") 491 comboEnd->insertItem( QString("0")
466 + QString::number(i) + ":30" ); 492 + QString::number(i) + ":30" );
467 } else { 493 } else {
468 comboStart->insertItem( QString::number(i) + ":00" ); 494 comboStart->insertItem( QString::number(i) + ":00" );
469 comboStart->insertItem( QString::number(i) + ":30" ); 495 comboStart->insertItem( QString::number(i) + ":30" );
470 comboEnd->insertItem( QString::number(i) + ":00" ); 496 comboEnd->insertItem( QString::number(i) + ":00" );
471 comboEnd->insertItem( QString::number(i) + ":30" ); 497 comboEnd->insertItem( QString::number(i) + ":30" );
472 } 498 }
473 } 499 }
474 } 500 }
501 */
475} 502}
476 503
477void DateEntry::slotChangeClock( bool whichClock ) 504void DateEntry::slotChangeClock( bool whichClock )
478{ 505{
479 ampm = whichClock; 506 ampm = whichClock;
480 initCombos(); 507 initCombos();
481 setDates( QDateTime( startDate, startTime ), QDateTime( endDate, endTime ) ); 508 setDates( QDateTime( startDate, startTime ), QDateTime( endDate, endTime ) );
482} 509}
diff --git a/core/pim/datebook/dateentryimpl.h b/core/pim/datebook/dateentryimpl.h
index 785af7a..bde3119 100644
--- a/core/pim/datebook/dateentryimpl.h
+++ b/core/pim/datebook/dateentryimpl.h
@@ -33,39 +33,42 @@ class DateEntry : public DateEntryBase
33 Q_OBJECT 33 Q_OBJECT
34 34
35public: 35public:
36 DateEntry( bool startOnMonday, const QDateTime &start, 36 DateEntry( bool startOnMonday, const QDateTime &start,
37 const QDateTime &end, bool whichClock = FALSE, 37 const QDateTime &end, bool whichClock = FALSE,
38 QWidget* parent = 0, const char* name = 0 ); 38 QWidget* parent = 0, const char* name = 0 );
39 DateEntry( bool startOnMonday, const Event &event, bool whichCLock = FALSE, 39 DateEntry( bool startOnMonday, const Event &event, bool whichCLock = FALSE,
40 QWidget* parent = 0, const char* name = 0 ); 40 QWidget* parent = 0, const char* name = 0 );
41 ~DateEntry(); 41 ~DateEntry();
42 42
43 Event event(); 43 Event event();
44 void setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice ); 44 void setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice );
45 45
46public slots: 46public slots:
47 void endDateChanged( int, int, int ); 47 void endDateChanged( int, int, int );
48 void endTimeChanged( const QString & ); 48 void endTimeChanged( const QString & );
49 void endTimeChanged( const QTime & );
49 void startDateChanged(int, int, int); 50 void startDateChanged(int, int, int);
50 void startTimeChanged( int index ); 51 void startTimeEdited( const QString & );
52 void startTimeChanged( const QTime & );
53 void startTimePicked( const QTime & );
51 void typeChanged( const QString & ); 54 void typeChanged( const QString & );
52 void changeEndCombo( int change );
53 void slotRepeat(); 55 void slotRepeat();
54 void slotChangeClock( bool ); 56 void slotChangeClock( bool );
55 void slotChangeStartOfWeek( bool ); 57 void slotChangeStartOfWeek( bool );
56 58
57private: 59private:
58 void init(); 60 void init();
59 void initCombos(); 61 void initCombos();
60 void setDates( const QDateTime& s, const QDateTime& e ); 62 void setDates( const QDateTime& s, const QDateTime& e );
61 void setRepeatLabel(); 63 void setRepeatLabel();
64 void updateTimeEdit(bool,bool);
62 65
63 DateBookMonth *startPicker, *endPicker; 66 DateBookMonth *startPicker, *endPicker;
64 QDate startDate, endDate; 67 QDate startDate, endDate;
65 QTime startTime, endTime; 68 QTime startTime, endTime;
66 Event::RepeatPattern rp; 69 Event::RepeatPattern rp;
67 bool ampm; 70 bool ampm;
68 bool startWeekOnMonday; 71 bool startWeekOnMonday;
69}; 72};
70 73
71#endif // DATEENTRY_H 74#endif // DATEENTRY_H
diff --git a/core/pim/datebook/timepicker.cpp b/core/pim/datebook/timepicker.cpp
new file mode 100644
index 0000000..5f08a05
--- a/dev/null
+++ b/core/pim/datebook/timepicker.cpp
@@ -0,0 +1,119 @@
1#include "timepicker.h"
2
3#include <qbuttongroup.h>
4#include <qtoolbutton.h>
5#include <qlayout.h>
6#include "clickablelabel.h"
7#include <qstring.h>
8
9TimePicker::TimePicker(QWidget* parent = 0, const char* name = 0,
10 WFlags fl = 0) :
11 QWidget(parent,name,fl)
12{
13 QVBoxLayout *vbox=new QVBoxLayout(this);
14
15 ClickableLabel *r;
16 QString s;
17
18 // Hour Row
19 QWidget *row=new QWidget(this);
20 QHBoxLayout *l=new QHBoxLayout(row);
21 vbox->addWidget(row);
22
23
24 for (int i=0; i<24; i++) {
25 r=new ClickableLabel(row);
26 hourLst.append(r);
27 s.sprintf("%.2d",i);
28 r->setText(s);
29 r->setToggleButton(true);
30 r->setAlignment(AlignHCenter | AlignVCenter);
31 l->addWidget(r);
32 connect(r, SIGNAL(toggled(bool)),
33 this, SLOT(slotHour(bool)));
34
35 if (i==11) { // Second row
36 row=new QWidget(this);
37 l=new QHBoxLayout(row);
38 vbox->addWidget(row);
39 }
40 }
41
42 // Minute Row
43 row=new QWidget(this);
44 l=new QHBoxLayout(row);
45 vbox->addWidget(row);
46
47 for (int i=0; i<60; i+=5) {
48 r=new ClickableLabel(row);
49 minuteLst.append(r);
50 s.sprintf("%.2d",i);
51 r->setText(s);
52 r->setToggleButton(true);
53 r->setAlignment(AlignHCenter | AlignVCenter);
54 l->addWidget(r);
55 connect(r, SIGNAL(toggled(bool)),
56 this, SLOT(slotMinute(bool)));
57 }
58}
59
60void TimePicker::slotHour(bool b) {
61
62 ClickableLabel *r = (ClickableLabel *) sender();
63
64 if (b) {
65 QValueListIterator<ClickableLabel *> it;
66 for (it=hourLst.begin(); it!=hourLst.end(); it++) {
67 if (*it != r) (*it)->setOn(false);
68 else tm.setHMS((*it)->text().toInt(), tm.minute(), 0);
69 }
70 emit timeChanged(tm);
71 } else {
72 r->setOn(true);
73 }
74
75}
76
77void TimePicker::slotMinute(bool b) {
78
79 ClickableLabel *r = (ClickableLabel *) sender();
80
81 if (b) {
82 QValueListIterator<ClickableLabel *> it;
83 for (it=minuteLst.begin(); it!=minuteLst.end(); it++) {
84 if (*it != r) (*it)->setOn(false);
85 else tm.setHMS(tm.hour(),(*it)->text().toInt(), 0);
86 }
87 emit timeChanged(tm);
88 } else {
89 r->setOn(true);
90 }
91
92}
93
94void TimePicker::setMinute(int m) {
95
96 QString minute;
97 minute.sprintf("%.2d",m);
98
99 QValueListIterator<ClickableLabel *> it;
100 for (it=minuteLst.begin(); it!=minuteLst.end(); it++) {
101 if ((*it)->text() == minute) (*it)->setOn(true);
102 else (*it)->setOn(false);
103 }
104
105 tm.setHMS(tm.hour(),m,0);
106}
107
108void TimePicker::setHour(int h) {
109
110 QString hour;
111 hour.sprintf("%.2d",h);
112
113 QValueListIterator<ClickableLabel *> it;
114 for (it=hourLst.begin(); it!=hourLst.end(); it++) {
115 if ((*it)->text() == hour) (*it)->setOn(true);
116 else (*it)->setOn(false);
117 }
118 tm.setHMS(h,tm.minute(),0);
119}
diff --git a/core/pim/datebook/timepicker.h b/core/pim/datebook/timepicker.h
new file mode 100644
index 0000000..0acadcb
--- a/dev/null
+++ b/core/pim/datebook/timepicker.h
@@ -0,0 +1,32 @@
1#ifndef TIMEPICKER_H
2#define TIMEPICKER_H
3
4#include <qwidget.h>
5#include <qvaluelist.h>
6#include "clickablelabel.h"
7#include <qdatetime.h>
8
9class TimePicker: public QWidget {
10 Q_OBJECT
11
12 public:
13 TimePicker(QWidget* parent = 0, const char* name = 0,
14 WFlags fl = 0);
15 void setHour(int h);
16 void setMinute(int m);
17
18 private:
19 QValueList<ClickableLabel *> hourLst;
20 QValueList<ClickableLabel *> minuteLst;
21 QTime tm;
22
23 private slots:
24 void slotHour(bool b);
25 void slotMinute(bool b);
26
27 signals:
28 void timeChanged(const QTime &);
29};
30
31
32#endif