summaryrefslogtreecommitdiff
path: root/core/pim
authorhakan <hakan>2002-03-26 19:05:31 (UTC)
committer hakan <hakan>2002-03-26 19:05:31 (UTC)
commit78211642003f70797a5faa1767a5ab2f5f83606f (patch) (unidiff)
tree703df6b1f8a98dbd00066ab3c21419b7f97e41b4 /core/pim
parentdbbbe1c0600422e4bd2d6a6aba271476f457ed97 (diff)
downloadopie-78211642003f70797a5faa1767a5ab2f5f83606f.zip
opie-78211642003f70797a5faa1767a5ab2f5f83606f.tar.gz
opie-78211642003f70797a5faa1767a5ab2f5f83606f.tar.bz2
Added shortcut buttons to set the start time
Diffstat (limited to 'core/pim') (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
@@ -9,12 +9,22 @@ class ClickableLabel: public QLabel
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
@@ -207,6 +207,9 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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
@@ -226,6 +229,14 @@ void DateBook::receive( const QCString &msg, const QByteArray &data )
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()
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
@@ -11,7 +11,8 @@ HEADERS = datebookday.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 \
@@ -23,7 +24,8 @@ SOURCES = main.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 \
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
@@ -230,308 +230,19 @@
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">
@@ -544,307 +255,11 @@
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>
@@ -857,7 +272,7 @@
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>
@@ -868,7 +283,7 @@
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>
@@ -879,14 +294,14 @@
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>
@@ -909,7 +324,7 @@
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>
@@ -940,7 +355,7 @@
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>
@@ -963,7 +378,7 @@
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>
@@ -974,7 +389,7 @@
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>
@@ -989,7 +404,7 @@
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>
@@ -1027,6 +442,20 @@
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>
@@ -1047,7 +476,7 @@
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>
@@ -1059,9 +488,9 @@
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>
@@ -1088,7 +517,7 @@
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>
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
@@ -39,6 +39,8 @@
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>
@@ -60,18 +62,22 @@ DateEntry::DateEntry( bool startOnMonday, const QDateTime &start,
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,
@@ -103,45 +109,50 @@ DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock,
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()
@@ -171,6 +182,10 @@ void DateEntry::init()
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/*
@@ -240,8 +255,12 @@ void DateEntry::endTimeChanged( const QString &s )
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/*
@@ -270,12 +289,25 @@ void DateEntry::startDateChanged( int y, int m, int d )
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 */
@@ -286,16 +318,6 @@ void DateEntry::typeChanged( const QString &s )
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{
@@ -336,8 +358,11 @@ Event DateEntry::event()
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;
@@ -427,6 +452,7 @@ void DateEntry::setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundT
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 ) {
@@ -472,6 +498,7 @@ void DateEntry::initCombos()
472 } 498 }
473 } 499 }
474 } 500 }
501 */
475} 502}
476 503
477void DateEntry::slotChangeClock( bool whichClock ) 504void DateEntry::slotChangeClock( bool whichClock )
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
@@ -46,10 +46,12 @@ public:
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 );
@@ -59,6 +61,7 @@ private:
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;
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