author | zautrix <zautrix> | 2005-04-19 08:56:03 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-19 08:56:03 (UTC) |
commit | 5d7012677b05091bbf16c7405f792bf02720d775 (patch) (unidiff) | |
tree | 1c31bcd5f90347edcdcdd359e377a6141853ec7d | |
parent | facfeef650a79cdd97414c47a571ae6ba30d36b3 (diff) | |
download | kdepimpi-5d7012677b05091bbf16c7405f792bf02720d775.zip kdepimpi-5d7012677b05091bbf16c7405f792bf02720d775.tar.gz kdepimpi-5d7012677b05091bbf16c7405f792bf02720d775.tar.bz2 |
rec fix
-rw-r--r-- | korganizer/koeditorrecurrence.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index 47e73dd..e165017 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp | |||
@@ -544,385 +544,385 @@ RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent, | |||
544 | rangeButtonGroup->insert( mEndDateButton ); | 544 | rangeButtonGroup->insert( mEndDateButton ); |
545 | endDateLayout->addWidget( mEndDateButton ); | 545 | endDateLayout->addWidget( mEndDateButton ); |
546 | 546 | ||
547 | mEndDateEdit = new KDateEdit( rangeBox ); | 547 | mEndDateEdit = new KDateEdit( rangeBox ); |
548 | endDateLayout->addWidget( mEndDateEdit ); | 548 | endDateLayout->addWidget( mEndDateEdit ); |
549 | 549 | ||
550 | //endDateLayout->addStretch( 1 ); | 550 | //endDateLayout->addStretch( 1 ); |
551 | 551 | ||
552 | connect( mNoEndDateButton, SIGNAL( toggled( bool ) ), | 552 | connect( mNoEndDateButton, SIGNAL( toggled( bool ) ), |
553 | SLOT( showCurrentRange() ) ); | 553 | SLOT( showCurrentRange() ) ); |
554 | connect( mEndDurationButton, SIGNAL( toggled( bool ) ), | 554 | connect( mEndDurationButton, SIGNAL( toggled( bool ) ), |
555 | SLOT( showCurrentRange() ) ); | 555 | SLOT( showCurrentRange() ) ); |
556 | connect( mEndDateButton, SIGNAL( toggled( bool ) ), | 556 | connect( mEndDateButton, SIGNAL( toggled( bool ) ), |
557 | SLOT( showCurrentRange() ) ); | 557 | SLOT( showCurrentRange() ) ); |
558 | } | 558 | } |
559 | 559 | ||
560 | void RecurrenceRangeWidget::setDefaults( const QDateTime &from ) | 560 | void RecurrenceRangeWidget::setDefaults( const QDateTime &from ) |
561 | { | 561 | { |
562 | mNoEndDateButton->setChecked( true ); | 562 | mNoEndDateButton->setChecked( true ); |
563 | 563 | ||
564 | setDateTimes( from ); | 564 | setDateTimes( from ); |
565 | mEndDateEdit->setDate( from.date() ); | 565 | mEndDateEdit->setDate( from.date() ); |
566 | } | 566 | } |
567 | 567 | ||
568 | void RecurrenceRangeWidget::setDuration( int duration ) | 568 | void RecurrenceRangeWidget::setDuration( int duration ) |
569 | { | 569 | { |
570 | if ( duration == -1 ) { | 570 | if ( duration == -1 ) { |
571 | mNoEndDateButton->setChecked( true ); | 571 | mNoEndDateButton->setChecked( true ); |
572 | } else if ( duration == 0 ) { | 572 | } else if ( duration == 0 ) { |
573 | mEndDateButton->setChecked( true ); | 573 | mEndDateButton->setChecked( true ); |
574 | } else { | 574 | } else { |
575 | mEndDurationButton->setChecked( true ); | 575 | mEndDurationButton->setChecked( true ); |
576 | mEndDurationEdit->setValue( duration ); | 576 | mEndDurationEdit->setValue( duration ); |
577 | } | 577 | } |
578 | } | 578 | } |
579 | 579 | ||
580 | int RecurrenceRangeWidget::duration() | 580 | int RecurrenceRangeWidget::duration() |
581 | { | 581 | { |
582 | if ( mNoEndDateButton->isChecked() ) { | 582 | if ( mNoEndDateButton->isChecked() ) { |
583 | return -1; | 583 | return -1; |
584 | } else if ( mEndDurationButton->isChecked() ) { | 584 | } else if ( mEndDurationButton->isChecked() ) { |
585 | return mEndDurationEdit->value(); | 585 | return mEndDurationEdit->value(); |
586 | } else { | 586 | } else { |
587 | return 0; | 587 | return 0; |
588 | } | 588 | } |
589 | } | 589 | } |
590 | 590 | ||
591 | void RecurrenceRangeWidget::setEndDate( const QDate &date ) | 591 | void RecurrenceRangeWidget::setEndDate( const QDate &date ) |
592 | { | 592 | { |
593 | mEndDateEdit->setDate( date ); | 593 | mEndDateEdit->setDate( date ); |
594 | } | 594 | } |
595 | 595 | ||
596 | QDate RecurrenceRangeWidget::endDate() | 596 | QDate RecurrenceRangeWidget::endDate() |
597 | { | 597 | { |
598 | return mEndDateEdit->date(); | 598 | return mEndDateEdit->date(); |
599 | } | 599 | } |
600 | 600 | ||
601 | void RecurrenceRangeWidget::showCurrentRange() | 601 | void RecurrenceRangeWidget::showCurrentRange() |
602 | { | 602 | { |
603 | mEndDurationEdit->setEnabled( mEndDurationButton->isChecked() ); | 603 | mEndDurationEdit->setEnabled( mEndDurationButton->isChecked() ); |
604 | mEndDateEdit->setEnabled( mEndDateButton->isChecked() ); | 604 | mEndDateEdit->setEnabled( mEndDateButton->isChecked() ); |
605 | } | 605 | } |
606 | 606 | ||
607 | void RecurrenceRangeWidget::setDateTimes( const QDateTime &start, | 607 | void RecurrenceRangeWidget::setDateTimes( const QDateTime &start, |
608 | const QDateTime & ) | 608 | const QDateTime & ) |
609 | { | 609 | { |
610 | mStartDateLabel->setText( i18n("Start date: %1") | 610 | mStartDateLabel->setText( i18n("Start date: %1") |
611 | .arg( KGlobal::locale()->formatDate( start.date() ) ) ); | 611 | .arg( KGlobal::locale()->formatDate( start.date() ) ) ); |
612 | 612 | ||
613 | if(!mEndDateButton->isChecked()) | 613 | if(!mEndDateButton->isChecked()) |
614 | mEndDateEdit->setDate( start.date() ); | 614 | mEndDateEdit->setDate( start.date() ); |
615 | } | 615 | } |
616 | 616 | ||
617 | ///////////////////////// RecurrenceRangeDialog /////////////////////////// | 617 | ///////////////////////// RecurrenceRangeDialog /////////////////////////// |
618 | 618 | ||
619 | RecurrenceRangeDialog::RecurrenceRangeDialog( QWidget *parent, | 619 | RecurrenceRangeDialog::RecurrenceRangeDialog( QWidget *parent, |
620 | const char *name ) : | 620 | const char *name ) : |
621 | KDialogBase( parent, name, true, i18n("Edit Recurrence Range"), Ok|Cancel ) | 621 | KDialogBase( parent, name, true, i18n("Edit Recurrence Range"), Ok|Cancel ) |
622 | { | 622 | { |
623 | mRecurrenceRangeWidget = new RecurrenceRangeWidget( this ); | 623 | mRecurrenceRangeWidget = new RecurrenceRangeWidget( this ); |
624 | setMainWidget( mRecurrenceRangeWidget ); | 624 | setMainWidget( mRecurrenceRangeWidget ); |
625 | } | 625 | } |
626 | 626 | ||
627 | void RecurrenceRangeDialog::setDefaults( const QDateTime &from ) | 627 | void RecurrenceRangeDialog::setDefaults( const QDateTime &from ) |
628 | { | 628 | { |
629 | mRecurrenceRangeWidget->setDefaults( from ); | 629 | mRecurrenceRangeWidget->setDefaults( from ); |
630 | } | 630 | } |
631 | 631 | ||
632 | void RecurrenceRangeDialog::setDuration( int duration ) | 632 | void RecurrenceRangeDialog::setDuration( int duration ) |
633 | { | 633 | { |
634 | mRecurrenceRangeWidget->setDuration( duration ); | 634 | mRecurrenceRangeWidget->setDuration( duration ); |
635 | } | 635 | } |
636 | 636 | ||
637 | int RecurrenceRangeDialog::duration() | 637 | int RecurrenceRangeDialog::duration() |
638 | { | 638 | { |
639 | return mRecurrenceRangeWidget->duration(); | 639 | return mRecurrenceRangeWidget->duration(); |
640 | } | 640 | } |
641 | 641 | ||
642 | void RecurrenceRangeDialog::setEndDate( const QDate &date ) | 642 | void RecurrenceRangeDialog::setEndDate( const QDate &date ) |
643 | { | 643 | { |
644 | mRecurrenceRangeWidget->setEndDate( date ); | 644 | mRecurrenceRangeWidget->setEndDate( date ); |
645 | } | 645 | } |
646 | 646 | ||
647 | QDate RecurrenceRangeDialog::endDate() | 647 | QDate RecurrenceRangeDialog::endDate() |
648 | { | 648 | { |
649 | return mRecurrenceRangeWidget->endDate(); | 649 | return mRecurrenceRangeWidget->endDate(); |
650 | } | 650 | } |
651 | 651 | ||
652 | void RecurrenceRangeDialog::setDateTimes( const QDateTime &start, | 652 | void RecurrenceRangeDialog::setDateTimes( const QDateTime &start, |
653 | const QDateTime &end ) | 653 | const QDateTime &end ) |
654 | { | 654 | { |
655 | mRecurrenceRangeWidget->setDateTimes( start, end ); | 655 | mRecurrenceRangeWidget->setDateTimes( start, end ); |
656 | } | 656 | } |
657 | 657 | ||
658 | //////////////////////////// RecurrenceChooser //////////////////////// | 658 | //////////////////////////// RecurrenceChooser //////////////////////// |
659 | 659 | ||
660 | RecurrenceChooser::RecurrenceChooser( QWidget *parent, const char *name ) : | 660 | RecurrenceChooser::RecurrenceChooser( QWidget *parent, const char *name ) : |
661 | QWidget( parent, name ) | 661 | QWidget( parent, name ) |
662 | { | 662 | { |
663 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 663 | QBoxLayout *topLayout = new QVBoxLayout( this ); |
664 | 664 | ||
665 | mTypeCombo = new QComboBox( this ); | 665 | mTypeCombo = new QComboBox( this ); |
666 | mTypeCombo->insertItem( i18n("Daily") ); | 666 | mTypeCombo->insertItem( i18n("Daily") ); |
667 | mTypeCombo->insertItem( i18n("Weekly") ); | 667 | mTypeCombo->insertItem( i18n("Weekly") ); |
668 | mTypeCombo->insertItem( i18n("Monthly") ); | 668 | mTypeCombo->insertItem( i18n("Monthly") ); |
669 | mTypeCombo->insertItem( i18n("Yearly") ); | 669 | mTypeCombo->insertItem( i18n("Yearly") ); |
670 | 670 | ||
671 | topLayout->addWidget( mTypeCombo ); | 671 | topLayout->addWidget( mTypeCombo ); |
672 | 672 | ||
673 | connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( emitChoice() ) ); | 673 | connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( emitChoice() ) ); |
674 | 674 | ||
675 | } | 675 | } |
676 | 676 | ||
677 | int RecurrenceChooser::type() | 677 | int RecurrenceChooser::type() |
678 | { | 678 | { |
679 | if ( mTypeCombo ) { | 679 | if ( mTypeCombo ) { |
680 | return mTypeCombo->currentItem(); | 680 | return mTypeCombo->currentItem(); |
681 | } else { | 681 | } else { |
682 | if ( mDailyButton->isChecked() ) return Daily; | 682 | if ( mDailyButton->isChecked() ) return Daily; |
683 | else if ( mWeeklyButton->isChecked() ) return Weekly; | 683 | else if ( mWeeklyButton->isChecked() ) return Weekly; |
684 | else if ( mMonthlyButton->isChecked() ) return Monthly; | 684 | else if ( mMonthlyButton->isChecked() ) return Monthly; |
685 | else return Yearly; | 685 | else return Yearly; |
686 | } | 686 | } |
687 | } | 687 | } |
688 | 688 | ||
689 | void RecurrenceChooser::setType( int type ) | 689 | void RecurrenceChooser::setType( int type ) |
690 | { | 690 | { |
691 | if ( mTypeCombo ) { | 691 | if ( mTypeCombo ) { |
692 | mTypeCombo->setCurrentItem( type ); | 692 | mTypeCombo->setCurrentItem( type ); |
693 | } else { | 693 | } else { |
694 | switch ( type ) { | 694 | switch ( type ) { |
695 | case Daily: | 695 | case Daily: |
696 | mDailyButton->setChecked( true ); | 696 | mDailyButton->setChecked( true ); |
697 | break; | 697 | break; |
698 | case Weekly: | 698 | case Weekly: |
699 | mWeeklyButton->setChecked( true ); | 699 | mWeeklyButton->setChecked( true ); |
700 | break; | 700 | break; |
701 | case Monthly: | 701 | case Monthly: |
702 | mMonthlyButton->setChecked( true ); | 702 | mMonthlyButton->setChecked( true ); |
703 | break; | 703 | break; |
704 | case Yearly: | 704 | case Yearly: |
705 | default: | 705 | default: |
706 | mYearlyButton->setChecked( true ); | 706 | mYearlyButton->setChecked( true ); |
707 | break; | 707 | break; |
708 | } | 708 | } |
709 | } | 709 | } |
710 | } | 710 | } |
711 | 711 | ||
712 | void RecurrenceChooser::emitChoice() | 712 | void RecurrenceChooser::emitChoice() |
713 | { | 713 | { |
714 | emit chosen ( type() ); | 714 | emit chosen ( type() ); |
715 | } | 715 | } |
716 | 716 | ||
717 | /////////////////////////////// Main Widget ///////////////////////////// | 717 | /////////////////////////////// Main Widget ///////////////////////////// |
718 | 718 | ||
719 | KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) : | 719 | KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) : |
720 | QWidget( parent, name ) | 720 | QWidget( parent, name ) |
721 | { | 721 | { |
722 | QGridLayout *topLayout = new QGridLayout( this, 2,2 ); | 722 | QGridLayout *topLayout = new QGridLayout( this, 2,2 ); |
723 | topLayout->setSpacing( KDialog::spacingHint() ); | 723 | topLayout->setSpacing( KDialog::spacingHint() ); |
724 | topLayout->setMargin( KDialog::marginHintSmall() ); | 724 | topLayout->setMargin( KDialog::marginHintSmall() ); |
725 | 725 | ||
726 | mEnabledCheck = new QCheckBox( i18n("Enable Recurrence"), this ); | 726 | mEnabledCheck = new QCheckBox( i18n("Enable Recurrence"), this ); |
727 | connect( mEnabledCheck, SIGNAL( toggled( bool ) ), | 727 | connect( mEnabledCheck, SIGNAL( toggled( bool ) ), |
728 | SLOT( setEnabled( bool ) ) ); | 728 | SLOT( setEnabled( bool ) ) ); |
729 | topLayout->addMultiCellWidget( mEnabledCheck, 0, 0, 0, 1 ); | 729 | topLayout->addMultiCellWidget( mEnabledCheck, 0, 0, 0, 1 ); |
730 | 730 | ||
731 | 731 | ||
732 | mTimeGroupBox = new QGroupBox( 1, Horizontal, i18n("Time"), | 732 | mTimeGroupBox = new QGroupBox( 1, Horizontal, i18n("Time"), |
733 | this ); | 733 | this ); |
734 | topLayout->addMultiCellWidget( mTimeGroupBox, 1, 1 , 0 , 1 ); | 734 | topLayout->addMultiCellWidget( mTimeGroupBox, 1, 1 , 0 , 1 ); |
735 | 735 | ||
736 | if ( QApplication::desktop()->width() <= 320) { | 736 | if ( QApplication::desktop()->width() <= 640 ) { |
737 | mTimeGroupBox->hide(); | 737 | mTimeGroupBox->hide(); |
738 | } | 738 | } |
739 | 739 | ||
740 | // QFrame *timeFrame = new QFrame( mTimeGroupBox ); | 740 | // QFrame *timeFrame = new QFrame( mTimeGroupBox ); |
741 | // QBoxLayout *layoutTimeFrame = new QHBoxLayout( timeFrame ); | 741 | // QBoxLayout *layoutTimeFrame = new QHBoxLayout( timeFrame ); |
742 | // layoutTimeFrame->setSpacing( KDialog::spacingHint() ); | 742 | // layoutTimeFrame->setSpacing( KDialog::spacingHint() ); |
743 | 743 | ||
744 | mDateTimeLabel = new QLabel( mTimeGroupBox ); | 744 | mDateTimeLabel = new QLabel( mTimeGroupBox ); |
745 | // mDateTimeLabel = new QLabel( timeFrame ); | 745 | // mDateTimeLabel = new QLabel( timeFrame ); |
746 | // layoutTimeFrame->addWidget( mDateTimeLabel ); | 746 | // layoutTimeFrame->addWidget( mDateTimeLabel ); |
747 | //mTimeGroupBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) ); | 747 | //mTimeGroupBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) ); |
748 | //mDateTimeLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum) ); | 748 | //mDateTimeLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum) ); |
749 | mRuleBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Rule"), this ); | 749 | mRuleBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Rule"), this ); |
750 | topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 ); | 750 | topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 ); |
751 | mRecurrenceChooser = new RecurrenceChooser( mRuleBox ); | 751 | mRecurrenceChooser = new RecurrenceChooser( mRuleBox ); |
752 | connect( mRecurrenceChooser, SIGNAL( chosen( int ) ), | 752 | connect( mRecurrenceChooser, SIGNAL( chosen( int ) ), |
753 | SLOT( showCurrentRule( int ) ) ); | 753 | SLOT( showCurrentRule( int ) ) ); |
754 | 754 | ||
755 | 755 | ||
756 | mRuleStack = new QWidgetStack( mRuleBox ); | 756 | mRuleStack = new QWidgetStack( mRuleBox ); |
757 | 757 | ||
758 | mDaily = new RecurDaily( mRuleStack ); | 758 | mDaily = new RecurDaily( mRuleStack ); |
759 | mRuleStack->addWidget( mDaily, 0 ); | 759 | mRuleStack->addWidget( mDaily, 0 ); |
760 | 760 | ||
761 | mWeekly = new RecurWeekly( mRuleStack ); | 761 | mWeekly = new RecurWeekly( mRuleStack ); |
762 | mRuleStack->addWidget( mWeekly, 0 ); | 762 | mRuleStack->addWidget( mWeekly, 0 ); |
763 | 763 | ||
764 | mMonthly = new RecurMonthly( mRuleStack ); | 764 | mMonthly = new RecurMonthly( mRuleStack ); |
765 | mRuleStack->addWidget( mMonthly, 0 ); | 765 | mRuleStack->addWidget( mMonthly, 0 ); |
766 | 766 | ||
767 | mYearly = new RecurYearly( mRuleStack ); | 767 | mYearly = new RecurYearly( mRuleStack ); |
768 | mRuleStack->addWidget( mYearly, 0 ); | 768 | mRuleStack->addWidget( mYearly, 0 ); |
769 | 769 | ||
770 | showCurrentRule( mRecurrenceChooser->type() ); | 770 | showCurrentRule( mRecurrenceChooser->type() ); |
771 | mRecurrenceRangeWidget = 0; | 771 | mRecurrenceRangeWidget = 0; |
772 | mRecurrenceRangeDialog = new RecurrenceRangeDialog( this ); | 772 | mRecurrenceRangeDialog = new RecurrenceRangeDialog( this ); |
773 | mRecurrenceRange = mRecurrenceRangeDialog; | 773 | mRecurrenceRange = mRecurrenceRangeDialog; |
774 | mRecurrenceRangeButton = new QPushButton( i18n("Recurrence Range..."), | 774 | mRecurrenceRangeButton = new QPushButton( i18n("Recurrence Range..."), |
775 | this ); | 775 | this ); |
776 | 776 | ||
777 | connect( mRecurrenceRangeButton, SIGNAL( clicked() ), | 777 | connect( mRecurrenceRangeButton, SIGNAL( clicked() ), |
778 | SLOT( showRecurrenceRangeDialog() ) ); | 778 | SLOT( showRecurrenceRangeDialog() ) ); |
779 | 779 | ||
780 | mExceptionsWidget = 0; | 780 | mExceptionsWidget = 0; |
781 | mExceptionsDialog = new ExceptionsDialog( this ); | 781 | mExceptionsDialog = new ExceptionsDialog( this ); |
782 | mExceptions = mExceptionsDialog; | 782 | mExceptions = mExceptionsDialog; |
783 | mExceptionsButton = new QPushButton( i18n("Exceptions..."), this ); | 783 | mExceptionsButton = new QPushButton( i18n("Exceptions..."), this ); |
784 | if ( QApplication::desktop()->width() < 320 ) { | 784 | if ( QApplication::desktop()->width() < 320 ) { |
785 | topLayout->addMultiCellWidget( mRecurrenceRangeButton, 3, 3, 0, 1 ); | 785 | topLayout->addMultiCellWidget( mRecurrenceRangeButton, 3, 3, 0, 1 ); |
786 | topLayout->addMultiCellWidget( mExceptionsButton, 4, 4, 0, 1 ); | 786 | topLayout->addMultiCellWidget( mExceptionsButton, 4, 4, 0, 1 ); |
787 | } else { | 787 | } else { |
788 | topLayout->addWidget( mRecurrenceRangeButton, 3, 0 ); | 788 | topLayout->addWidget( mRecurrenceRangeButton, 3, 0 ); |
789 | topLayout->addWidget( mExceptionsButton, 3, 1 ); | 789 | topLayout->addWidget( mExceptionsButton, 3, 1 ); |
790 | } | 790 | } |
791 | connect( mExceptionsButton, SIGNAL( clicked() ), | 791 | connect( mExceptionsButton, SIGNAL( clicked() ), |
792 | SLOT( showExceptionsDialog() ) ); | 792 | SLOT( showExceptionsDialog() ) ); |
793 | } | 793 | } |
794 | 794 | ||
795 | KOEditorRecurrence::~KOEditorRecurrence() | 795 | KOEditorRecurrence::~KOEditorRecurrence() |
796 | { | 796 | { |
797 | } | 797 | } |
798 | 798 | ||
799 | void KOEditorRecurrence::setEnabled( bool enabled ) | 799 | void KOEditorRecurrence::setEnabled( bool enabled ) |
800 | { | 800 | { |
801 | // kdDebug() << "KOEditorRecurrence::setEnabled(): " << (enabled ? "on" : "off") << endl; | 801 | // kdDebug() << "KOEditorRecurrence::setEnabled(): " << (enabled ? "on" : "off") << endl; |
802 | 802 | ||
803 | mTimeGroupBox->setEnabled( enabled ); | 803 | mTimeGroupBox->setEnabled( enabled ); |
804 | if ( mRecurrenceRangeWidget ) mRecurrenceRangeWidget->setEnabled( enabled ); | 804 | if ( mRecurrenceRangeWidget ) mRecurrenceRangeWidget->setEnabled( enabled ); |
805 | if ( mRecurrenceRangeButton ) mRecurrenceRangeButton->setEnabled( enabled ); | 805 | if ( mRecurrenceRangeButton ) mRecurrenceRangeButton->setEnabled( enabled ); |
806 | if ( mExceptionsWidget ) mExceptionsWidget->setEnabled( enabled ); | 806 | if ( mExceptionsWidget ) mExceptionsWidget->setEnabled( enabled ); |
807 | if ( mExceptionsButton ) mExceptionsButton->setEnabled( enabled ); | 807 | if ( mExceptionsButton ) mExceptionsButton->setEnabled( enabled ); |
808 | mRuleBox->setEnabled( enabled ); | 808 | mRuleBox->setEnabled( enabled ); |
809 | } | 809 | } |
810 | 810 | ||
811 | void KOEditorRecurrence::showCurrentRule( int current ) | 811 | void KOEditorRecurrence::showCurrentRule( int current ) |
812 | { | 812 | { |
813 | switch ( current ) { | 813 | switch ( current ) { |
814 | case Daily: | 814 | case Daily: |
815 | mRuleStack->raiseWidget( mDaily ); | 815 | mRuleStack->raiseWidget( mDaily ); |
816 | break; | 816 | break; |
817 | case Weekly: | 817 | case Weekly: |
818 | mRuleStack->raiseWidget( mWeekly ); | 818 | mRuleStack->raiseWidget( mWeekly ); |
819 | break; | 819 | break; |
820 | case Monthly: | 820 | case Monthly: |
821 | mRuleStack->raiseWidget( mMonthly ); | 821 | mRuleStack->raiseWidget( mMonthly ); |
822 | break; | 822 | break; |
823 | default: | 823 | default: |
824 | case Yearly: | 824 | case Yearly: |
825 | mRuleStack->raiseWidget( mYearly ); | 825 | mRuleStack->raiseWidget( mYearly ); |
826 | break; | 826 | break; |
827 | } | 827 | } |
828 | } | 828 | } |
829 | 829 | ||
830 | void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end ) | 830 | void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end ) |
831 | { | 831 | { |
832 | // kdDebug() << "KOEditorRecurrence::setDateTimes" << endl; | 832 | // kdDebug() << "KOEditorRecurrence::setDateTimes" << endl; |
833 | 833 | ||
834 | mRecurrenceRange->setDateTimes( start, end ); | 834 | mRecurrenceRange->setDateTimes( start, end ); |
835 | mExceptions->setDefaults( end ); | 835 | mExceptions->setDefaults( end ); |
836 | 836 | ||
837 | } | 837 | } |
838 | 838 | ||
839 | void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) | 839 | void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) |
840 | { | 840 | { |
841 | 841 | ||
842 | // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() ); | 842 | // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() ); |
843 | setDateTimes( from, to ); | 843 | setDateTimes( from, to ); |
844 | 844 | ||
845 | bool enabled = false; | 845 | bool enabled = false; |
846 | mEnabledCheck->setChecked( enabled ); | 846 | mEnabledCheck->setChecked( enabled ); |
847 | setEnabled( enabled ); | 847 | setEnabled( enabled ); |
848 | 848 | ||
849 | mExceptions->setDefaults( to ); | 849 | mExceptions->setDefaults( to ); |
850 | mRecurrenceRange->setDefaults( to ); | 850 | mRecurrenceRange->setDefaults( to ); |
851 | 851 | ||
852 | mRecurrenceChooser->setType( RecurrenceChooser::Weekly ); | 852 | mRecurrenceChooser->setType( RecurrenceChooser::Weekly ); |
853 | showCurrentRule( mRecurrenceChooser->type() ); | 853 | showCurrentRule( mRecurrenceChooser->type() ); |
854 | 854 | ||
855 | mDaily->setFrequency( 1 ); | 855 | mDaily->setFrequency( 1 ); |
856 | 856 | ||
857 | mWeekly->setFrequency( 1 ); | 857 | mWeekly->setFrequency( 1 ); |
858 | QBitArray days( 7 ); | 858 | QBitArray days( 7 ); |
859 | days.fill( 0 ); | 859 | days.fill( 0 ); |
860 | days.setBit( from.date().dayOfWeek()- 1); | 860 | days.setBit( from.date().dayOfWeek()- 1); |
861 | mWeekly->setDays( days ); | 861 | mWeekly->setDays( days ); |
862 | mMonthly->setFrequency( 1 ); | 862 | mMonthly->setFrequency( 1 ); |
863 | mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); | 863 | mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); |
864 | mMonthly->setByDay( from.date().day()-1 ); | 864 | mMonthly->setByDay( from.date().day()-1 ); |
865 | mYearly->setFrequency( 1 ); | 865 | mYearly->setFrequency( 1 ); |
866 | mYearly->setByDay( from.date().dayOfYear() ); | 866 | mYearly->setByDay( from.date().dayOfYear() ); |
867 | mYearly->setByMonth( from.date().month(), from.date().day() ); | 867 | mYearly->setByMonth( from.date().month(), from.date().day() ); |
868 | } | 868 | } |
869 | 869 | ||
870 | void KOEditorRecurrence::readEvent(Incidence *event) | 870 | void KOEditorRecurrence::readEvent(Incidence *event) |
871 | { | 871 | { |
872 | 872 | ||
873 | QDateTime dtEnd; | 873 | QDateTime dtEnd; |
874 | if ( event->type() == "Event" ) | 874 | if ( event->type() == "Event" ) |
875 | dtEnd = ((Event*)event)->dtEnd(); | 875 | dtEnd = ((Event*)event)->dtEnd(); |
876 | else | 876 | else |
877 | dtEnd = ((Todo*)event)->dtDue(); | 877 | dtEnd = ((Todo*)event)->dtDue(); |
878 | 878 | ||
879 | setDefaults( event->dtStart(), dtEnd, true ); | 879 | setDefaults( event->dtStart(), dtEnd, true ); |
880 | QBitArray rDays( 7 ); | 880 | QBitArray rDays( 7 ); |
881 | QPtrList<Recurrence::rMonthPos> rmp; | 881 | QPtrList<Recurrence::rMonthPos> rmp; |
882 | QPtrList<int> rmd; | 882 | QPtrList<int> rmd; |
883 | int day = 0; | 883 | int day = 0; |
884 | int count = 0; | 884 | int count = 0; |
885 | int month = 0; | 885 | int month = 0; |
886 | setDateTimes( event->dtStart(), dtEnd ); | 886 | setDateTimes( event->dtStart(), dtEnd ); |
887 | 887 | ||
888 | Recurrence *r = event->recurrence(); | 888 | Recurrence *r = event->recurrence(); |
889 | int f = r->frequency(); | 889 | int f = r->frequency(); |
890 | 890 | ||
891 | int recurs = r->doesRecur(); | 891 | int recurs = r->doesRecur(); |
892 | 892 | ||
893 | mEnabledCheck->setChecked( recurs ); | 893 | mEnabledCheck->setChecked( recurs ); |
894 | setEnabled( recurs ); | 894 | setEnabled( recurs ); |
895 | 895 | ||
896 | int recurrenceType = RecurrenceChooser::Weekly; | 896 | int recurrenceType = RecurrenceChooser::Weekly; |
897 | 897 | ||
898 | switch ( recurs ) { | 898 | switch ( recurs ) { |
899 | case Recurrence::rNone: | 899 | case Recurrence::rNone: |
900 | setDefaults( event->dtStart(), dtEnd, true ); | 900 | setDefaults( event->dtStart(), dtEnd, true ); |
901 | break; | 901 | break; |
902 | case Recurrence::rDaily: | 902 | case Recurrence::rDaily: |
903 | recurrenceType = RecurrenceChooser::Daily; | 903 | recurrenceType = RecurrenceChooser::Daily; |
904 | mDaily->setFrequency( f ); | 904 | mDaily->setFrequency( f ); |
905 | break; | 905 | break; |
906 | case Recurrence::rWeekly: | 906 | case Recurrence::rWeekly: |
907 | recurrenceType = RecurrenceChooser::Weekly; | 907 | recurrenceType = RecurrenceChooser::Weekly; |
908 | mWeekly->setFrequency( f ); | 908 | mWeekly->setFrequency( f ); |
909 | mWeekly->setDays( r->days() ); | 909 | mWeekly->setDays( r->days() ); |
910 | break; | 910 | break; |
911 | case Recurrence::rMonthlyPos: | 911 | case Recurrence::rMonthlyPos: |
912 | // we only handle one possibility in the list right now, | 912 | // we only handle one possibility in the list right now, |
913 | // so I have hardcoded calls with first(). If we make the GUI | 913 | // so I have hardcoded calls with first(). If we make the GUI |
914 | // more extended, this can be changed. | 914 | // more extended, this can be changed. |
915 | recurrenceType = RecurrenceChooser::Monthly; | 915 | recurrenceType = RecurrenceChooser::Monthly; |
916 | 916 | ||
917 | rmp = r->monthPositions(); | 917 | rmp = r->monthPositions(); |
918 | if ( rmp.first()->negative ) | 918 | if ( rmp.first()->negative ) |
919 | count = 5 - rmp.first()->rPos - 1; | 919 | count = 5 - rmp.first()->rPos - 1; |
920 | else | 920 | else |
921 | count = rmp.first()->rPos - 1; | 921 | count = rmp.first()->rPos - 1; |
922 | day = 0; | 922 | day = 0; |
923 | while ( !rmp.first()->rDays.testBit( day ) ) ++day; | 923 | while ( !rmp.first()->rDays.testBit( day ) ) ++day; |
924 | mMonthly->setByPos( count, day ); | 924 | mMonthly->setByPos( count, day ); |
925 | 925 | ||
926 | mMonthly->setFrequency( f ); | 926 | mMonthly->setFrequency( f ); |
927 | 927 | ||
928 | break; | 928 | break; |