author | simon <simon> | 2002-04-30 14:28:04 (UTC) |
---|---|---|
committer | simon <simon> | 2002-04-30 14:28:04 (UTC) |
commit | b7b0040f0a8069d36e3f5ad0bed0ce992dd30780 (patch) (unidiff) | |
tree | 39ac29f14f3e2e153af816b7a9f0f2d821bb075a | |
parent | 972fbb128294c821ff0f13ea59a83edb015d571e (diff) | |
download | opie-b7b0040f0a8069d36e3f5ad0bed0ce992dd30780.zip opie-b7b0040f0a8069d36e3f5ad0bed0ce992dd30780.tar.gz opie-b7b0040f0a8069d36e3f5ad0bed0ce992dd30780.tar.bz2 |
- no default args in method impls
- resolved parameter shadowing problem
-rw-r--r-- | core/pim/datebook/clickablelabel.cpp | 6 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.cpp | 8 | ||||
-rw-r--r-- | core/pim/datebook/datebookweek.cpp | 2 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 12 | ||||
-rw-r--r-- | core/pim/datebook/timepicker.cpp | 4 |
5 files changed, 16 insertions, 16 deletions
diff --git a/core/pim/datebook/clickablelabel.cpp b/core/pim/datebook/clickablelabel.cpp index 1dd0d15..128bebb 100644 --- a/core/pim/datebook/clickablelabel.cpp +++ b/core/pim/datebook/clickablelabel.cpp | |||
@@ -1,54 +1,54 @@ | |||
1 | #include "clickablelabel.h" | 1 | #include "clickablelabel.h" |
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | 3 | ||
4 | ClickableLabel::ClickableLabel(QWidget* parent = 0, | 4 | ClickableLabel::ClickableLabel(QWidget* parent, |
5 | const char* name = 0, | 5 | const char* name, |
6 | WFlags fl = 0) : | 6 | WFlags fl) : |
7 | QLabel(parent,name,fl) | 7 | QLabel(parent,name,fl) |
8 | { | 8 | { |
9 | textInverted=false; | 9 | textInverted=false; |
10 | isToggle=false; | 10 | isToggle=false; |
11 | isDown=false; | 11 | isDown=false; |
12 | showState(false); | 12 | showState(false); |
13 | setFrameShadow(Sunken); | 13 | setFrameShadow(Sunken); |
14 | } | 14 | } |
15 | 15 | ||
16 | void ClickableLabel::setToggleButton(bool t) { | 16 | void ClickableLabel::setToggleButton(bool t) { |
17 | isToggle=t; | 17 | isToggle=t; |
18 | } | 18 | } |
19 | 19 | ||
20 | void ClickableLabel::mousePressEvent( QMouseEvent *e ) { | 20 | void ClickableLabel::mousePressEvent( QMouseEvent *e ) { |
21 | if (isToggle && isDown) { | 21 | if (isToggle && isDown) { |
22 | showState(false); | 22 | showState(false); |
23 | } else { | 23 | } else { |
24 | showState(true); | 24 | showState(true); |
25 | } | 25 | } |
26 | } | 26 | } |
27 | 27 | ||
28 | void ClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { | 28 | void ClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { |
29 | if (rect().contains(e->pos()) && isToggle) isDown=!isDown; | 29 | if (rect().contains(e->pos()) && isToggle) isDown=!isDown; |
30 | 30 | ||
31 | if (isToggle && isDown) { | 31 | if (isToggle && isDown) { |
32 | showState(true); | 32 | showState(true); |
33 | } else { | 33 | } else { |
34 | showState(false); | 34 | showState(false); |
35 | } | 35 | } |
36 | 36 | ||
37 | if (rect().contains(e->pos())) { | 37 | if (rect().contains(e->pos())) { |
38 | if (isToggle) { | 38 | if (isToggle) { |
39 | emit toggled(isDown); | 39 | emit toggled(isDown); |
40 | } | 40 | } |
41 | emit clicked(); | 41 | emit clicked(); |
42 | } | 42 | } |
43 | } | 43 | } |
44 | 44 | ||
45 | void ClickableLabel::mouseMoveEvent( QMouseEvent *e ) { | 45 | void ClickableLabel::mouseMoveEvent( QMouseEvent *e ) { |
46 | if (rect().contains(e->pos())) { | 46 | if (rect().contains(e->pos())) { |
47 | if (isToggle && isDown) { | 47 | if (isToggle && isDown) { |
48 | showState(false); | 48 | showState(false); |
49 | } else { | 49 | } else { |
50 | showState(true); | 50 | showState(true); |
51 | } | 51 | } |
52 | } else { | 52 | } else { |
53 | if (isToggle && isDown) { | 53 | if (isToggle && isDown) { |
54 | showState(true); | 54 | showState(true); |
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index d5daab2..67a88e9 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp | |||
@@ -440,100 +440,100 @@ DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e, | |||
440 | while ( where != -1 ) { | 440 | while ( where != -1 ) { |
441 | strDesc.remove( where, 1 ); | 441 | strDesc.remove( where, 1 ); |
442 | strDesc.insert( where, "<" ); | 442 | strDesc.insert( where, "<" ); |
443 | where = strDesc.find( "<", where ); | 443 | where = strDesc.find( "<", where ); |
444 | } | 444 | } |
445 | 445 | ||
446 | QString strCat; | 446 | QString strCat; |
447 | // ### Fix later... | 447 | // ### Fix later... |
448 | // QString strCat = ev.category(); | 448 | // QString strCat = ev.category(); |
449 | // where = strCat.find( "<" ); | 449 | // where = strCat.find( "<" ); |
450 | // while ( where != -1 ) { | 450 | // while ( where != -1 ) { |
451 | // strCat.remove( where, 1 ); | 451 | // strCat.remove( where, 1 ); |
452 | // strCat.insert( where, "<" ); | 452 | // strCat.insert( where, "<" ); |
453 | // where = strCat.find( "<", where ); | 453 | // where = strCat.find( "<", where ); |
454 | // } | 454 | // } |
455 | 455 | ||
456 | QString strNote = ev.notes(); | 456 | QString strNote = ev.notes(); |
457 | where = strNote.find( "<" ); | 457 | where = strNote.find( "<" ); |
458 | while ( where != -1 ) { | 458 | while ( where != -1 ) { |
459 | strNote.remove( where, 1 ); | 459 | strNote.remove( where, 1 ); |
460 | strNote.insert( where, "<" ); | 460 | strNote.insert( where, "<" ); |
461 | where = strNote.find( "<", where ); | 461 | where = strNote.find( "<", where ); |
462 | } | 462 | } |
463 | 463 | ||
464 | text = "<b>" + strDesc + "</b><br>" + "<i>" | 464 | text = "<b>" + strDesc + "</b><br>" + "<i>" |
465 | + strCat + "</i>" | 465 | + strCat + "</i>" |
466 | + "<br><b>" + tr("Start") + "</b>: "; | 466 | + "<br><b>" + tr("Start") + "</b>: "; |
467 | 467 | ||
468 | 468 | ||
469 | if ( e.startDate() != ev.date() ) { | 469 | if ( e.startDate() != ev.date() ) { |
470 | // multi-day event. Show start date | 470 | // multi-day event. Show start date |
471 | text += TimeString::longDateString( e.startDate() ); | 471 | text += TimeString::longDateString( e.startDate() ); |
472 | } else { | 472 | } else { |
473 | // Show start time. | 473 | // Show start time. |
474 | text += TimeString::timeString( ev.start(), whichClock, FALSE ); | 474 | text += TimeString::timeString( ev.start(), whichClock, FALSE ); |
475 | } | 475 | } |
476 | 476 | ||
477 | text += "<br><b>" + tr("End") + "</b>: "; | 477 | text += "<br><b>" + tr("End") + "</b>: "; |
478 | if ( e.endDate() != ev.date() ) { | 478 | if ( e.endDate() != ev.date() ) { |
479 | // multi-day event. Show end date | 479 | // multi-day event. Show end date |
480 | text += TimeString::longDateString( e.endDate() ); | 480 | text += TimeString::longDateString( e.endDate() ); |
481 | } else { | 481 | } else { |
482 | // Show end time. | 482 | // Show end time. |
483 | text += TimeString::timeString( ev.end(), whichClock, FALSE ); | 483 | text += TimeString::timeString( ev.end(), whichClock, FALSE ); |
484 | } | 484 | } |
485 | text += "<br><br>" + strNote; | 485 | text += "<br><br>" + strNote; |
486 | setBackgroundMode( PaletteBase ); | 486 | setBackgroundMode( PaletteBase ); |
487 | 487 | ||
488 | QTime s = ev.start(); | 488 | QTime start = ev.start(); |
489 | QTime e = ev.end(); | 489 | QTime end = ev.end(); |
490 | int y = s.hour()*60+s.minute(); | 490 | int y = start.hour()*60+start.minute(); |
491 | int h = e.hour()*60+e.minute()-y; | 491 | int h = end.hour()*60+end.minute()-y; |
492 | int rh = dateBook->dayView()->rowHeight(0); | 492 | int rh = dateBook->dayView()->rowHeight(0); |
493 | y = y*rh/60; | 493 | y = y*rh/60; |
494 | h = h*rh/60; | 494 | h = h*rh/60; |
495 | if ( h < 3 ) | 495 | if ( h < 3 ) |
496 | h = 3; | 496 | h = 3; |
497 | geom.setY( y ); | 497 | geom.setY( y ); |
498 | geom.setHeight( h ); | 498 | geom.setHeight( h ); |
499 | } | 499 | } |
500 | 500 | ||
501 | DateBookDayWidget::~DateBookDayWidget() | 501 | DateBookDayWidget::~DateBookDayWidget() |
502 | { | 502 | { |
503 | } | 503 | } |
504 | 504 | ||
505 | void DateBookDayWidget::paintEvent( QPaintEvent *e ) | 505 | void DateBookDayWidget::paintEvent( QPaintEvent *e ) |
506 | { | 506 | { |
507 | QPainter p( this ); | 507 | QPainter p( this ); |
508 | p.setPen( QColor(100, 100, 100) ); | 508 | p.setPen( QColor(100, 100, 100) ); |
509 | p.setBrush( QColor( 255, 240, 230 ) ); // based on priority? | 509 | p.setBrush( QColor( 255, 240, 230 ) ); // based on priority? |
510 | p.drawRect(rect()); | 510 | p.drawRect(rect()); |
511 | 511 | ||
512 | int y = 0; | 512 | int y = 0; |
513 | int d = 0; | 513 | int d = 0; |
514 | 514 | ||
515 | if ( ev.event().hasAlarm() ) { | 515 | if ( ev.event().hasAlarm() ) { |
516 | p.drawPixmap( width() - 16, 0, Resource::loadPixmap( "bell" ) ); | 516 | p.drawPixmap( width() - 16, 0, Resource::loadPixmap( "bell" ) ); |
517 | y = 20; | 517 | y = 20; |
518 | d = 20; | 518 | d = 20; |
519 | } | 519 | } |
520 | 520 | ||
521 | if ( ev.event().hasRepeat() ) { | 521 | if ( ev.event().hasRepeat() ) { |
522 | p.drawPixmap( width() - 16, y, Resource::loadPixmap( "repeat" ) ); | 522 | p.drawPixmap( width() - 16, y, Resource::loadPixmap( "repeat" ) ); |
523 | d = 20; | 523 | d = 20; |
524 | } | 524 | } |
525 | 525 | ||
526 | QSimpleRichText rt( text, font() ); | 526 | QSimpleRichText rt( text, font() ); |
527 | rt.setWidth( geom.width() - d - 6 ); | 527 | rt.setWidth( geom.width() - d - 6 ); |
528 | rt.draw( &p, 3, 0, e->region(), colorGroup() ); | 528 | rt.draw( &p, 3, 0, e->region(), colorGroup() ); |
529 | } | 529 | } |
530 | 530 | ||
531 | void DateBookDayWidget::mousePressEvent( QMouseEvent *e ) | 531 | void DateBookDayWidget::mousePressEvent( QMouseEvent *e ) |
532 | { | 532 | { |
533 | QPopupMenu m; | 533 | QPopupMenu m; |
534 | m.insertItem( tr( "Edit" ), 1 ); | 534 | m.insertItem( tr( "Edit" ), 1 ); |
535 | m.insertItem( tr( "Delete" ), 2 ); | 535 | m.insertItem( tr( "Delete" ), 2 ); |
536 | m.insertItem( tr( "Beam" ), 3 ); | 536 | m.insertItem( tr( "Beam" ), 3 ); |
537 | int r = m.exec( e->globalPos() ); | 537 | int r = m.exec( e->globalPos() ); |
538 | if ( r == 1 ) { | 538 | if ( r == 1 ) { |
539 | emit editMe( ev.event() ); | 539 | emit editMe( ev.event() ); |
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp index e9fcc39..6532ba4 100644 --- a/core/pim/datebook/datebookweek.cpp +++ b/core/pim/datebook/datebookweek.cpp | |||
@@ -567,97 +567,97 @@ void DateBookWeek::setTotalWeeks( int numWeeks ) | |||
567 | 567 | ||
568 | int DateBookWeek::totalWeeks() const | 568 | int DateBookWeek::totalWeeks() const |
569 | { | 569 | { |
570 | return header->spinWeek->maxValue(); | 570 | return header->spinWeek->maxValue(); |
571 | } | 571 | } |
572 | 572 | ||
573 | void DateBookWeek::slotWeekChanged( bool onMonday ) | 573 | void DateBookWeek::slotWeekChanged( bool onMonday ) |
574 | { | 574 | { |
575 | bStartOnMonday = onMonday; | 575 | bStartOnMonday = onMonday; |
576 | view->setStartOfWeek( bStartOnMonday ); | 576 | view->setStartOfWeek( bStartOnMonday ); |
577 | header->setStartOfWeek( bStartOnMonday ); | 577 | header->setStartOfWeek( bStartOnMonday ); |
578 | redraw(); | 578 | redraw(); |
579 | } | 579 | } |
580 | 580 | ||
581 | void DateBookWeek::slotClockChanged( bool ap ) | 581 | void DateBookWeek::slotClockChanged( bool ap ) |
582 | { | 582 | { |
583 | ampm = ap; | 583 | ampm = ap; |
584 | } | 584 | } |
585 | 585 | ||
586 | // return the date at the beginning of the week... | 586 | // return the date at the beginning of the week... |
587 | QDate DateBookWeek::weekDate() const | 587 | QDate DateBookWeek::weekDate() const |
588 | { | 588 | { |
589 | return dateFromWeek( _week, year, bStartOnMonday ); | 589 | return dateFromWeek( _week, year, bStartOnMonday ); |
590 | } | 590 | } |
591 | 591 | ||
592 | // this used to only be needed by datebook.cpp, but now we need it inside | 592 | // this used to only be needed by datebook.cpp, but now we need it inside |
593 | // week view since | 593 | // week view since |
594 | // we need to be able to figure out our total number of weeks on the fly... | 594 | // we need to be able to figure out our total number of weeks on the fly... |
595 | // this is probably the best place to put it.. | 595 | // this is probably the best place to put it.. |
596 | 596 | ||
597 | // For Weeks that start on Monday... (EASY!) | 597 | // For Weeks that start on Monday... (EASY!) |
598 | // At the moment we will use ISO 8601 method for computing | 598 | // At the moment we will use ISO 8601 method for computing |
599 | // the week. Granted, other countries use other methods, | 599 | // the week. Granted, other countries use other methods, |
600 | // bet we aren't doing any Locale stuff at the moment. So, | 600 | // bet we aren't doing any Locale stuff at the moment. So, |
601 | // this should pass. This Algorithim is public domain and | 601 | // this should pass. This Algorithim is public domain and |
602 | // available at: | 602 | // available at: |
603 | // http://personal.ecu.edu/mccartyr/ISOwdALG.txt | 603 | // http://personal.ecu.edu/mccartyr/ISOwdALG.txt |
604 | // the week number is return, and the year number is returned in year | 604 | // the week number is return, and the year number is returned in year |
605 | // for Instance 2001/12/31 is actually the first week in 2002. | 605 | // for Instance 2001/12/31 is actually the first week in 2002. |
606 | // There is a more mathematical definition, but I will implement it when | 606 | // There is a more mathematical definition, but I will implement it when |
607 | // we are pass our deadline. | 607 | // we are pass our deadline. |
608 | 608 | ||
609 | // For Weeks that start on Sunday... (ahh... home rolled) | 609 | // For Weeks that start on Sunday... (ahh... home rolled) |
610 | // okay, if Jan 1 is on Friday or Saturday, | 610 | // okay, if Jan 1 is on Friday or Saturday, |
611 | // it will go to the pervious | 611 | // it will go to the pervious |
612 | // week... | 612 | // week... |
613 | 613 | ||
614 | bool calcWeek( const QDate &d, int &week, int &year, | 614 | bool calcWeek( const QDate &d, int &week, int &year, |
615 | bool startOnMonday = false ) | 615 | bool startOnMonday ) |
616 | { | 616 | { |
617 | int weekNumber; | 617 | int weekNumber; |
618 | int yearNumber; | 618 | int yearNumber; |
619 | 619 | ||
620 | // remove a pesky warning, (Optimizations on g++) | 620 | // remove a pesky warning, (Optimizations on g++) |
621 | weekNumber = -1; | 621 | weekNumber = -1; |
622 | int jan1WeekDay = QDate(d.year(), 1, 1).dayOfWeek(); | 622 | int jan1WeekDay = QDate(d.year(), 1, 1).dayOfWeek(); |
623 | int dayOfWeek = d.dayOfWeek(); | 623 | int dayOfWeek = d.dayOfWeek(); |
624 | 624 | ||
625 | if ( !d.isValid() ) | 625 | if ( !d.isValid() ) |
626 | return false; | 626 | return false; |
627 | 627 | ||
628 | if ( startOnMonday ) { | 628 | if ( startOnMonday ) { |
629 | // find the Jan1Weekday; | 629 | // find the Jan1Weekday; |
630 | if ( d.dayOfYear() <= ( 8 - jan1WeekDay) && jan1WeekDay > 4 ) { | 630 | if ( d.dayOfYear() <= ( 8 - jan1WeekDay) && jan1WeekDay > 4 ) { |
631 | yearNumber = d.year() - 1; | 631 | yearNumber = d.year() - 1; |
632 | if ( jan1WeekDay == 5 || ( jan1WeekDay == 6 && QDate::leapYear(yearNumber) ) ) | 632 | if ( jan1WeekDay == 5 || ( jan1WeekDay == 6 && QDate::leapYear(yearNumber) ) ) |
633 | weekNumber = 53; | 633 | weekNumber = 53; |
634 | else | 634 | else |
635 | weekNumber = 52; | 635 | weekNumber = 52; |
636 | } else | 636 | } else |
637 | yearNumber = d.year(); | 637 | yearNumber = d.year(); |
638 | if ( yearNumber == d.year() ) { | 638 | if ( yearNumber == d.year() ) { |
639 | int totalDays = 365; | 639 | int totalDays = 365; |
640 | if ( QDate::leapYear(yearNumber) ) | 640 | if ( QDate::leapYear(yearNumber) ) |
641 | totalDays++; | 641 | totalDays++; |
642 | if ( ((totalDays - d.dayOfYear()) < (4 - dayOfWeek) ) | 642 | if ( ((totalDays - d.dayOfYear()) < (4 - dayOfWeek) ) |
643 | || (jan1WeekDay == 7) && (totalDays - d.dayOfYear()) < 3) { | 643 | || (jan1WeekDay == 7) && (totalDays - d.dayOfYear()) < 3) { |
644 | yearNumber++; | 644 | yearNumber++; |
645 | weekNumber = 1; | 645 | weekNumber = 1; |
646 | } | 646 | } |
647 | } | 647 | } |
648 | if ( yearNumber == d.year() ) { | 648 | if ( yearNumber == d.year() ) { |
649 | int j = d.dayOfYear() + (7 - dayOfWeek) + ( jan1WeekDay - 1 ); | 649 | int j = d.dayOfYear() + (7 - dayOfWeek) + ( jan1WeekDay - 1 ); |
650 | weekNumber = j / 7; | 650 | weekNumber = j / 7; |
651 | if ( jan1WeekDay > 4 ) | 651 | if ( jan1WeekDay > 4 ) |
652 | weekNumber--; | 652 | weekNumber--; |
653 | } | 653 | } |
654 | } else { | 654 | } else { |
655 | // it's better to keep these cases separate... | 655 | // it's better to keep these cases separate... |
656 | if ( d.dayOfYear() <= (7 - jan1WeekDay) && jan1WeekDay > 4 | 656 | if ( d.dayOfYear() <= (7 - jan1WeekDay) && jan1WeekDay > 4 |
657 | && jan1WeekDay != 7 ) { | 657 | && jan1WeekDay != 7 ) { |
658 | yearNumber = d.year() - 1; | 658 | yearNumber = d.year() - 1; |
659 | if ( jan1WeekDay == 6 | 659 | if ( jan1WeekDay == 6 |
660 | || (jan1WeekDay == 7 && QDate::leapYear(yearNumber) ) ) { | 660 | || (jan1WeekDay == 7 && QDate::leapYear(yearNumber) ) ) { |
661 | weekNumber = 53; | 661 | weekNumber = 53; |
662 | }else | 662 | }else |
663 | weekNumber = 52; | 663 | weekNumber = 52; |
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index 7083bc5..85c745a 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp | |||
@@ -47,147 +47,147 @@ DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, | |||
47 | connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); | 47 | connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); |
48 | onMonday=onM; | 48 | onMonday=onM; |
49 | } | 49 | } |
50 | DateBookWeekLstHeader::~DateBookWeekLstHeader(){} | 50 | DateBookWeekLstHeader::~DateBookWeekLstHeader(){} |
51 | void DateBookWeekLstHeader::setDate(const QDate &d) { | 51 | void DateBookWeekLstHeader::setDate(const QDate &d) { |
52 | date=d; | 52 | date=d; |
53 | 53 | ||
54 | int year,week; | 54 | int year,week; |
55 | calcWeek(d,week,year,onMonday); | 55 | calcWeek(d,week,year,onMonday); |
56 | labelWeek->setText("W: " + QString::number(week)); | 56 | labelWeek->setText("W: " + QString::number(week)); |
57 | 57 | ||
58 | QDate start=date; | 58 | QDate start=date; |
59 | QDate stop=start.addDays(6); | 59 | QDate stop=start.addDays(6); |
60 | labelDate->setText( QString::number(start.day()) + " " + | 60 | labelDate->setText( QString::number(start.day()) + " " + |
61 | start.monthName(start.month()) + " - " + | 61 | start.monthName(start.month()) + " - " + |
62 | QString::number(stop.day()) + " " + | 62 | QString::number(stop.day()) + " " + |
63 | start.monthName(stop.month()) ); | 63 | start.monthName(stop.month()) ); |
64 | emit dateChanged(year,week); | 64 | emit dateChanged(year,week); |
65 | } | 65 | } |
66 | void DateBookWeekLstHeader::pickDate() { | 66 | void DateBookWeekLstHeader::pickDate() { |
67 | static QPopupMenu *m1 = 0; | 67 | static QPopupMenu *m1 = 0; |
68 | static DateBookMonth *picker = 0; | 68 | static DateBookMonth *picker = 0; |
69 | if ( !m1 ) { | 69 | if ( !m1 ) { |
70 | m1 = new QPopupMenu( this ); | 70 | m1 = new QPopupMenu( this ); |
71 | picker = new DateBookMonth( m1, 0, TRUE ); | 71 | picker = new DateBookMonth( m1, 0, TRUE ); |
72 | m1->insertItem( picker ); | 72 | m1->insertItem( picker ); |
73 | connect( picker, SIGNAL( dateClicked( int, int, int ) ), | 73 | connect( picker, SIGNAL( dateClicked( int, int, int ) ), |
74 | this, SLOT( setDate( int, int, int ) ) ); | 74 | this, SLOT( setDate( int, int, int ) ) ); |
75 | //connect( m1, SIGNAL( aboutToHide() ), | 75 | //connect( m1, SIGNAL( aboutToHide() ), |
76 | //this, SLOT( gotHide() ) ); | 76 | //this, SLOT( gotHide() ) ); |
77 | } | 77 | } |
78 | picker->setDate( date.year(), date.month(), date.day() ); | 78 | picker->setDate( date.year(), date.month(), date.day() ); |
79 | m1->popup(mapToGlobal(labelWeek->pos()+QPoint(0,labelWeek->height()))); | 79 | m1->popup(mapToGlobal(labelWeek->pos()+QPoint(0,labelWeek->height()))); |
80 | picker->setFocus(); | 80 | picker->setFocus(); |
81 | } | 81 | } |
82 | void DateBookWeekLstHeader::setDate(int y, int m, int d) { | 82 | void DateBookWeekLstHeader::setDate(int y, int m, int d) { |
83 | QDate new_date(y,m,d); | 83 | QDate new_date(y,m,d); |
84 | setDate(new_date); | 84 | setDate(new_date); |
85 | } | 85 | } |
86 | 86 | ||
87 | void DateBookWeekLstHeader::nextWeek() { | 87 | void DateBookWeekLstHeader::nextWeek() { |
88 | setDate(date.addDays(7)); | 88 | setDate(date.addDays(7)); |
89 | } | 89 | } |
90 | void DateBookWeekLstHeader::prevWeek() { | 90 | void DateBookWeekLstHeader::prevWeek() { |
91 | setDate(date.addDays(-7)); | 91 | setDate(date.addDays(-7)); |
92 | } | 92 | } |
93 | 93 | ||
94 | DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool onM, | 94 | DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool onM, |
95 | QWidget* parent = 0, | 95 | QWidget* parent, |
96 | const char* name = 0, | 96 | const char* name, |
97 | WFlags fl = 0 ) | 97 | WFlags fl ) |
98 | : DateBookWeekLstDayHdrBase(parent, name, fl) { | 98 | : DateBookWeekLstDayHdrBase(parent, name, fl) { |
99 | 99 | ||
100 | date=d; | 100 | date=d; |
101 | 101 | ||
102 | static const char *wdays="MTWTFSS"; | 102 | static const char *wdays="MTWTFSS"; |
103 | char day=wdays[d.dayOfWeek()-1]; | 103 | char day=wdays[d.dayOfWeek()-1]; |
104 | 104 | ||
105 | label->setText( QString(QChar(day)) + " " + | 105 | label->setText( QString(QChar(day)) + " " + |
106 | QString::number(d.day()) ); | 106 | QString::number(d.day()) ); |
107 | add->setText("+"); | 107 | add->setText("+"); |
108 | 108 | ||
109 | if (d == QDate::currentDate()) { | 109 | if (d == QDate::currentDate()) { |
110 | QPalette pal=label->palette(); | 110 | QPalette pal=label->palette(); |
111 | pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); | 111 | pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); |
112 | label->setPalette(pal); | 112 | label->setPalette(pal); |
113 | 113 | ||
114 | /* | 114 | /* |
115 | QFont f=label->font(); | 115 | QFont f=label->font(); |
116 | f.setItalic(true); | 116 | f.setItalic(true); |
117 | label->setFont(f); | 117 | label->setFont(f); |
118 | label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); | 118 | label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); |
119 | */ | 119 | */ |
120 | } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday | 120 | } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday |
121 | QPalette pal=label->palette(); | 121 | QPalette pal=label->palette(); |
122 | pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); | 122 | pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); |
123 | label->setPalette(pal); | 123 | label->setPalette(pal); |
124 | } | 124 | } |
125 | 125 | ||
126 | 126 | ||
127 | connect (label, SIGNAL(clicked()), this, SLOT(showDay())); | 127 | connect (label, SIGNAL(clicked()), this, SLOT(showDay())); |
128 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); | 128 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); |
129 | } | 129 | } |
130 | 130 | ||
131 | void DateBookWeekLstDayHdr::showDay() { | 131 | void DateBookWeekLstDayHdr::showDay() { |
132 | emit showDate(date.year(), date.month(), date.day()); | 132 | emit showDate(date.year(), date.month(), date.day()); |
133 | } | 133 | } |
134 | void DateBookWeekLstDayHdr::newEvent() { | 134 | void DateBookWeekLstDayHdr::newEvent() { |
135 | QDateTime start, stop; | 135 | QDateTime start, stop; |
136 | start=stop=date; | 136 | start=stop=date; |
137 | start.setTime(QTime(10,0)); | 137 | start.setTime(QTime(10,0)); |
138 | stop.setTime(QTime(12,0)); | 138 | stop.setTime(QTime(12,0)); |
139 | 139 | ||
140 | emit addEvent(start,stop,""); | 140 | emit addEvent(start,stop,""); |
141 | } | 141 | } |
142 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, | 142 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, |
143 | QWidget* parent = 0, | 143 | QWidget* parent, |
144 | const char* name = 0, | 144 | const char* name, |
145 | WFlags fl = 0) : | 145 | WFlags fl) : |
146 | ClickableLabel(parent,name,fl), | 146 | ClickableLabel(parent,name,fl), |
147 | event(ev) | 147 | event(ev) |
148 | { | 148 | { |
149 | char s[10]; | 149 | char s[10]; |
150 | if ( ev.startDate() != ev.date() ) { // multiday event (not first day) | 150 | if ( ev.startDate() != ev.date() ) { // multiday event (not first day) |
151 | if ( ev.endDate() == ev.date() ) { // last day | 151 | if ( ev.endDate() == ev.date() ) { // last day |
152 | strcpy(s, "__|__"); | 152 | strcpy(s, "__|__"); |
153 | } else { | 153 | } else { |
154 | strcpy(s, " |---"); | 154 | strcpy(s, " |---"); |
155 | } | 155 | } |
156 | } else { | 156 | } else { |
157 | sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute()); | 157 | sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute()); |
158 | } | 158 | } |
159 | setText(QString(s) + " " + ev.description()); | 159 | setText(QString(s) + " " + ev.description()); |
160 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 160 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
161 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 161 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
162 | } | 162 | } |
163 | void DateBookWeekLstEvent::editMe() { | 163 | void DateBookWeekLstEvent::editMe() { |
164 | emit editEvent(event.event()); | 164 | emit editEvent(event.event()); |
165 | } | 165 | } |
166 | 166 | ||
167 | 167 | ||
168 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | 168 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, |
169 | const QDate &d, bool onM, | 169 | const QDate &d, bool onM, |
170 | QWidget* parent, | 170 | QWidget* parent, |
171 | const char* name, WFlags fl) | 171 | const char* name, WFlags fl) |
172 | : QWidget( parent, name, fl ) | 172 | : QWidget( parent, name, fl ) |
173 | { | 173 | { |
174 | onMonday=onM; | 174 | onMonday=onM; |
175 | setPalette(white); | 175 | setPalette(white); |
176 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); | 176 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); |
177 | 177 | ||
178 | QVBoxLayout *layout = new QVBoxLayout( this ); | 178 | QVBoxLayout *layout = new QVBoxLayout( this ); |
179 | 179 | ||
180 | qBubbleSort(ev); | 180 | qBubbleSort(ev); |
181 | QValueListIterator<EffectiveEvent> it; | 181 | QValueListIterator<EffectiveEvent> it; |
182 | it=ev.begin(); | 182 | it=ev.begin(); |
183 | 183 | ||
184 | int dayOrder[7]; | 184 | int dayOrder[7]; |
185 | if (onMonday) | 185 | if (onMonday) |
186 | for (int d=0; d<7; d++) dayOrder[d]=d+1; | 186 | for (int d=0; d<7; d++) dayOrder[d]=d+1; |
187 | else { | 187 | else { |
188 | for (int d=0; d<7; d++) dayOrder[d]=d; | 188 | for (int d=0; d<7; d++) dayOrder[d]=d; |
189 | dayOrder[0]=7; | 189 | dayOrder[0]=7; |
190 | } | 190 | } |
191 | 191 | ||
192 | for (int i=0; i<7; i++) { | 192 | for (int i=0; i<7; i++) { |
193 | // Header | 193 | // Header |
diff --git a/core/pim/datebook/timepicker.cpp b/core/pim/datebook/timepicker.cpp index 9097e1b..43e05ad 100644 --- a/core/pim/datebook/timepicker.cpp +++ b/core/pim/datebook/timepicker.cpp | |||
@@ -1,59 +1,59 @@ | |||
1 | #include "timepicker.h" | 1 | #include "timepicker.h" |
2 | 2 | ||
3 | #include <qbuttongroup.h> | 3 | #include <qbuttongroup.h> |
4 | #include <qtoolbutton.h> | 4 | #include <qtoolbutton.h> |
5 | #include <qlayout.h> | 5 | #include <qlayout.h> |
6 | #include "clickablelabel.h" | 6 | #include "clickablelabel.h" |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | #include <stdio.h> | 8 | #include <stdio.h> |
9 | 9 | ||
10 | TimePicker::TimePicker(QWidget* parent = 0, const char* name = 0, | 10 | TimePicker::TimePicker(QWidget* parent, const char* name, |
11 | WFlags fl = 0) : | 11 | WFlags fl) : |
12 | QWidget(parent,name,fl) | 12 | QWidget(parent,name,fl) |
13 | { | 13 | { |
14 | QVBoxLayout *vbox=new QVBoxLayout(this); | 14 | QVBoxLayout *vbox=new QVBoxLayout(this); |
15 | 15 | ||
16 | ClickableLabel *r; | 16 | ClickableLabel *r; |
17 | QString s; | 17 | QString s; |
18 | 18 | ||
19 | // Hour Row | 19 | // Hour Row |
20 | QWidget *row=new QWidget(this); | 20 | QWidget *row=new QWidget(this); |
21 | QHBoxLayout *l=new QHBoxLayout(row); | 21 | QHBoxLayout *l=new QHBoxLayout(row); |
22 | vbox->addWidget(row); | 22 | vbox->addWidget(row); |
23 | 23 | ||
24 | 24 | ||
25 | for (int i=0; i<24; i++) { | 25 | for (int i=0; i<24; i++) { |
26 | r=new ClickableLabel(row); | 26 | r=new ClickableLabel(row); |
27 | hourLst.append(r); | 27 | hourLst.append(r); |
28 | s.sprintf("%.2d",i); | 28 | s.sprintf("%.2d",i); |
29 | r->setText(s); | 29 | r->setText(s); |
30 | r->setToggleButton(true); | 30 | r->setToggleButton(true); |
31 | r->setAlignment(AlignHCenter | AlignVCenter); | 31 | r->setAlignment(AlignHCenter | AlignVCenter); |
32 | l->addWidget(r); | 32 | l->addWidget(r); |
33 | connect(r, SIGNAL(toggled(bool)), | 33 | connect(r, SIGNAL(toggled(bool)), |
34 | this, SLOT(slotHour(bool))); | 34 | this, SLOT(slotHour(bool))); |
35 | 35 | ||
36 | if (i==11) { // Second row | 36 | if (i==11) { // Second row |
37 | row=new QWidget(this); | 37 | row=new QWidget(this); |
38 | l=new QHBoxLayout(row); | 38 | l=new QHBoxLayout(row); |
39 | vbox->addWidget(row); | 39 | vbox->addWidget(row); |
40 | } | 40 | } |
41 | } | 41 | } |
42 | 42 | ||
43 | // Minute Row | 43 | // Minute Row |
44 | row=new QWidget(this); | 44 | row=new QWidget(this); |
45 | l=new QHBoxLayout(row); | 45 | l=new QHBoxLayout(row); |
46 | vbox->addWidget(row); | 46 | vbox->addWidget(row); |
47 | 47 | ||
48 | for (int i=0; i<60; i+=5) { | 48 | for (int i=0; i<60; i+=5) { |
49 | r=new ClickableLabel(row); | 49 | r=new ClickableLabel(row); |
50 | minuteLst.append(r); | 50 | minuteLst.append(r); |
51 | s.sprintf("%.2d",i); | 51 | s.sprintf("%.2d",i); |
52 | r->setText(s); | 52 | r->setText(s); |
53 | r->setToggleButton(true); | 53 | r->setToggleButton(true); |
54 | r->setAlignment(AlignHCenter | AlignVCenter); | 54 | r->setAlignment(AlignHCenter | AlignVCenter); |
55 | l->addWidget(r); | 55 | l->addWidget(r); |
56 | connect(r, SIGNAL(toggled(bool)), | 56 | connect(r, SIGNAL(toggled(bool)), |
57 | this, SLOT(slotMinute(bool))); | 57 | this, SLOT(slotMinute(bool))); |
58 | } | 58 | } |
59 | } | 59 | } |