-rw-r--r-- | core/pim/datebook/clickablelabel.cpp | 71 | ||||
-rw-r--r-- | core/pim/datebook/clickablelabel.h | 10 | ||||
-rw-r--r-- | core/pim/datebook/datebook.cpp | 11 | ||||
-rw-r--r-- | core/pim/datebook/datebook.pro | 6 | ||||
-rw-r--r-- | core/pim/datebook/dateentry.ui | 641 | ||||
-rw-r--r-- | core/pim/datebook/dateentryimpl.cpp | 97 | ||||
-rw-r--r-- | core/pim/datebook/dateentryimpl.h | 7 | ||||
-rw-r--r-- | core/pim/datebook/timepicker.cpp | 119 | ||||
-rw-r--r-- | core/pim/datebook/timepicker.h | 32 |
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,2 +1,3 @@ | |||
1 | #include "clickablelabel.h" | 1 | #include "clickablelabel.h" |
2 | #include <stdio.h> | ||
2 | 3 | ||
@@ -7,3 +8,6 @@ ClickableLabel::ClickableLabel(QWidget* parent = 0, | |||
7 | { | 8 | { |
8 | setFrameShape(NoFrame); | 9 | textInverted=false; |
10 | isToggle=false; | ||
11 | isDown=false; | ||
12 | showState(false); | ||
9 | setFrameShadow(Sunken); | 13 | setFrameShadow(Sunken); |
@@ -11,5 +15,12 @@ ClickableLabel::ClickableLabel(QWidget* parent = 0, | |||
11 | 15 | ||
16 | void ClickableLabel::setToggleButton(bool t) { | ||
17 | isToggle=t; | ||
18 | } | ||
19 | |||
12 | void ClickableLabel::mousePressEvent( QMouseEvent *e ) { | 20 | void ClickableLabel::mousePressEvent( QMouseEvent *e ) { |
13 | setFrameShape(Panel); | 21 | if (isToggle && isDown) { |
14 | repaint(); | 22 | showState(false); |
23 | } else { | ||
24 | showState(true); | ||
25 | } | ||
15 | } | 26 | } |
@@ -17,5 +28,14 @@ void ClickableLabel::mousePressEvent( QMouseEvent *e ) { | |||
17 | void ClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { | 28 | void 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(); |
@@ -26,6 +46,43 @@ void 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 | |||
61 | void 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 | |||
74 | void 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 | |||
85 | void 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 | |||
@@ -11,2 +11,3 @@ public: | |||
11 | WFlags fl = 0); | 11 | WFlags fl = 0); |
12 | void setToggleButton(bool t); | ||
12 | protected: | 13 | protected: |
@@ -15,4 +16,13 @@ public: | |||
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 | }; |
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 | |||
@@ -209,2 +209,5 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | |||
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 |
@@ -228,2 +231,10 @@ void DateBook::receive( const QCString &msg, const QByteArray &data ) | |||
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 | } |
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 | |||
@@ -13,3 +13,4 @@ HEADERS = datebookday.h \ | |||
13 | repeatentry.h \ | 13 | repeatentry.h \ |
14 | clickablelabel.h | 14 | clickablelabel.h \ |
15 | timepicker.h | ||
15 | 16 | ||
@@ -25,3 +26,4 @@ SOURCES = main.cpp \ | |||
25 | repeatentry.cpp \ | 26 | repeatentry.cpp \ |
26 | clickablelabel.cpp | 27 | clickablelabel.cpp \ |
28 | timepicker.cpp | ||
27 | 29 | ||
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 | |||
@@ -232,291 +232,3 @@ | |||
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"> |
@@ -525,11 +237,10 @@ | |||
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" > |
@@ -546,291 +257,3 @@ | |||
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"> |
@@ -839,10 +262,2 @@ | |||
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> |
@@ -859,3 +274,3 @@ | |||
859 | </widget> | 274 | </widget> |
860 | <widget row="5" column="0" > | 275 | <widget row="6" column="0" > |
861 | <class>QCheckBox</class> | 276 | <class>QCheckBox</class> |
@@ -870,3 +285,3 @@ | |||
870 | </widget> | 285 | </widget> |
871 | <widget row="6" column="0" > | 286 | <widget row="7" column="0" > |
872 | <class>QLabel</class> | 287 | <class>QLabel</class> |
@@ -881,3 +296,3 @@ | |||
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> |
@@ -888,3 +303,3 @@ | |||
888 | </widget> | 303 | </widget> |
889 | <widget row="7" column="0" > | 304 | <widget row="8" column="0" > |
890 | <class>QCheckBox</class> | 305 | <class>QCheckBox</class> |
@@ -911,3 +326,3 @@ | |||
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> |
@@ -942,3 +357,3 @@ | |||
942 | </widget> | 357 | </widget> |
943 | <widget row="7" column="3" > | 358 | <widget row="8" column="3" > |
944 | <class>QComboBox</class> | 359 | <class>QComboBox</class> |
@@ -965,3 +380,3 @@ | |||
965 | </widget> | 380 | </widget> |
966 | <widget row="8" column="0" > | 381 | <widget row="9" column="0" > |
967 | <class>QLabel</class> | 382 | <class>QLabel</class> |
@@ -976,3 +391,3 @@ | |||
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> |
@@ -991,3 +406,3 @@ | |||
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> |
@@ -1029,2 +444,16 @@ | |||
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> |
@@ -1049,3 +478,3 @@ | |||
1049 | <sender>comboEnd</sender> | 478 | <sender>comboEnd</sender> |
1050 | <signal>activated(const QString&)</signal> | 479 | <signal>textChanged(const QString&)</signal> |
1051 | <receiver>DateEntryBase</receiver> | 480 | <receiver>DateEntryBase</receiver> |
@@ -1061,5 +490,5 @@ | |||
1061 | <sender>comboStart</sender> | 490 | <sender>comboStart</sender> |
1062 | <signal>activated(int)</signal> | 491 | <signal>textChanged(const QString &)</signal> |
1063 | <receiver>DateEntryBase</receiver> | 492 | <receiver>DateEntryBase</receiver> |
1064 | <slot>startTimeChanged( int )</slot> | 493 | <slot>startTimeEdited( const QString & )</slot> |
1065 | </connection> | 494 | </connection> |
@@ -1090,3 +519,3 @@ | |||
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 & )</slot> |
1092 | <slot access="public">typeChanged( const QString & )</slot> | 521 | <slot access="public">typeChanged( const QString & )</slot> |
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 | |||
@@ -41,2 +41,4 @@ | |||
41 | 41 | ||
42 | #include "timepicker.h" | ||
43 | |||
42 | #include <stdlib.h> | 44 | #include <stdlib.h> |
@@ -62,3 +64,3 @@ DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, | |||
62 | setDates(start,end); | 64 | setDates(start,end); |
63 | setFocusProxy(comboDescription); | 65 | setFocusProxy(comboDescription); |
64 | } | 66 | } |
@@ -67,2 +69,3 @@ static 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++) { |
@@ -73,3 +76,6 @@ static void addOrPick( QComboBox* combo, const QString& t ) | |||
73 | } | 76 | } |
74 | combo->setEditText(t); | 77 | |
78 | // Else add one | ||
79 | combo->insertItem(t); | ||
80 | combo->setCurrentItem(combo->count()-1); | ||
75 | } | 81 | } |
@@ -105,6 +111,2 @@ void 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(); |
@@ -114,5 +116,14 @@ void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) | |||
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 | |||
121 | void 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 ) { |
@@ -120,3 +131,3 @@ void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) | |||
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 { |
@@ -124,5 +135,5 @@ void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) | |||
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" |
@@ -131,3 +142,3 @@ void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) | |||
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 { |
@@ -135,11 +146,11 @@ void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) | |||
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 | } |
@@ -173,2 +184,6 @@ void DateEntry::init() | |||
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 | } |
@@ -242,4 +257,8 @@ void DateEntry::endTimeChanged( const QString &s ) | |||
242 | endTime = startTime; | 257 | endTime = startTime; |
243 | comboEnd->setCurrentItem( comboStart->currentItem() ); | 258 | //comboEnd->setCurrentItem( comboStart->currentItem() ); |
244 | } | 259 | } |
260 | |||
261 | } | ||
262 | |||
263 | void DateEntry::endTimeChanged( const QTime &t ) { | ||
245 | } | 264 | } |
@@ -272,8 +291,21 @@ void DateEntry::startDateChanged( int y, int m, int d ) | |||
272 | */ | 291 | */ |
273 | void DateEntry::startTimeChanged( int index ) | 292 | void 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 | |||
300 | void DateEntry::startTimeChanged( const QTime &t ) | ||
301 | { | ||
302 | int duration=startTime.secsTo(endTime); | ||
303 | startTime = t; | ||
304 | endTime=t.addSecs(duration); | ||
305 | } | ||
306 | void DateEntry::startTimePicked( const QTime &t ) { | ||
307 | startTimeChanged(t); | ||
308 | updateTimeEdit(true,true); | ||
309 | } | ||
310 | |||
279 | /* | 311 | /* |
@@ -288,12 +320,2 @@ void DateEntry::typeChanged( const QString &s ) | |||
288 | } | 320 | } |
289 | /* | ||
290 | * public slot | ||
291 | */ | ||
292 | void 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 | ||
@@ -338,4 +360,7 @@ Event DateEntry::event() | |||
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 ) { |
@@ -429,2 +454,3 @@ void DateEntry::initCombos() | |||
429 | { | 454 | { |
455 | /* | ||
430 | comboStart->clear(); | 456 | comboStart->clear(); |
@@ -474,2 +500,3 @@ void DateEntry::initCombos() | |||
474 | } | 500 | } |
501 | */ | ||
475 | } | 502 | } |
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 | |||
@@ -48,6 +48,8 @@ public slots: | |||
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(); |
@@ -61,2 +63,3 @@ private: | |||
61 | void setRepeatLabel(); | 63 | void setRepeatLabel(); |
64 | void updateTimeEdit(bool,bool); | ||
62 | 65 | ||
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 | |||
9 | TimePicker::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 | |||
60 | void 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 | |||
77 | void 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 | |||
94 | void 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 | |||
108 | void 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 | |||
9 | class 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 | ||