author | zautrix <zautrix> | 2005-01-30 15:38:08 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-30 15:38:08 (UTC) |
commit | 11736af9b5348f251b0e8a3cf90fdb960c877936 (patch) (unidiff) | |
tree | eda181731c3dd76cb448d103b8d8f9d30757450c /korganizer | |
parent | 8d543aa1d1d1ed20001c8b18352d1d29c2979e48 (diff) | |
download | kdepimpi-11736af9b5348f251b0e8a3cf90fdb960c877936.zip kdepimpi-11736af9b5348f251b0e8a3cf90fdb960c877936.tar.gz kdepimpi-11736af9b5348f251b0e8a3cf90fdb960c877936.tar.bz2 |
fix
-rw-r--r-- | korganizer/calendarview.cpp | 2 | ||||
-rw-r--r-- | korganizer/datenavigator.cpp | 3 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 9 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 4 |
4 files changed, 8 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 96fb5ca..db33017 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3500,385 +3500,385 @@ void CalendarView::showDates(const DateList &selectedDates) | |||
3500 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 3500 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
3501 | else { | 3501 | else { |
3502 | QString addString; | 3502 | QString addString; |
3503 | if ( selectedDates.first() == QDateTime::currentDateTime().date() ) | 3503 | if ( selectedDates.first() == QDateTime::currentDateTime().date() ) |
3504 | addString = i18n("Today"); | 3504 | addString = i18n("Today"); |
3505 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) | 3505 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) |
3506 | addString = i18n("Tomorrow"); | 3506 | addString = i18n("Tomorrow"); |
3507 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) | 3507 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) |
3508 | addString = i18n("Yesterday"); | 3508 | addString = i18n("Yesterday"); |
3509 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) | 3509 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) |
3510 | addString = i18n("Day before yesterday"); | 3510 | addString = i18n("Day before yesterday"); |
3511 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) | 3511 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) |
3512 | addString = i18n("Day after tomorrow"); | 3512 | addString = i18n("Day after tomorrow"); |
3513 | if ( !addString.isEmpty() ) { | 3513 | if ( !addString.isEmpty() ) { |
3514 | topLevelWidget()->setCaption( addString+", " + selDates ); | 3514 | topLevelWidget()->setCaption( addString+", " + selDates ); |
3515 | return; | 3515 | return; |
3516 | } | 3516 | } |
3517 | } | 3517 | } |
3518 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 3518 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
3519 | 3519 | ||
3520 | } | 3520 | } |
3521 | 3521 | ||
3522 | QPtrList<CalFilter> CalendarView::filters() | 3522 | QPtrList<CalFilter> CalendarView::filters() |
3523 | { | 3523 | { |
3524 | return mFilters; | 3524 | return mFilters; |
3525 | 3525 | ||
3526 | } | 3526 | } |
3527 | void CalendarView::editFilters() | 3527 | void CalendarView::editFilters() |
3528 | { | 3528 | { |
3529 | // kdDebug() << "CalendarView::editFilters()" << endl; | 3529 | // kdDebug() << "CalendarView::editFilters()" << endl; |
3530 | 3530 | ||
3531 | CalFilter *filter = mFilters.first(); | 3531 | CalFilter *filter = mFilters.first(); |
3532 | while(filter) { | 3532 | while(filter) { |
3533 | kdDebug() << " Filter: " << filter->name() << endl; | 3533 | kdDebug() << " Filter: " << filter->name() << endl; |
3534 | filter = mFilters.next(); | 3534 | filter = mFilters.next(); |
3535 | } | 3535 | } |
3536 | 3536 | ||
3537 | mDialogManager->showFilterEditDialog(&mFilters); | 3537 | mDialogManager->showFilterEditDialog(&mFilters); |
3538 | } | 3538 | } |
3539 | void CalendarView::toggleFilter() | 3539 | void CalendarView::toggleFilter() |
3540 | { | 3540 | { |
3541 | showFilter(! mFilterView->isVisible()); | 3541 | showFilter(! mFilterView->isVisible()); |
3542 | } | 3542 | } |
3543 | 3543 | ||
3544 | KOFilterView *CalendarView::filterView() | 3544 | KOFilterView *CalendarView::filterView() |
3545 | { | 3545 | { |
3546 | return mFilterView; | 3546 | return mFilterView; |
3547 | } | 3547 | } |
3548 | void CalendarView::selectFilter( int fil ) | 3548 | void CalendarView::selectFilter( int fil ) |
3549 | { | 3549 | { |
3550 | mFilterView->setSelectedFilter( fil ); | 3550 | mFilterView->setSelectedFilter( fil ); |
3551 | } | 3551 | } |
3552 | void CalendarView::showFilter(bool visible) | 3552 | void CalendarView::showFilter(bool visible) |
3553 | { | 3553 | { |
3554 | if (visible) mFilterView->show(); | 3554 | if (visible) mFilterView->show(); |
3555 | else mFilterView->hide(); | 3555 | else mFilterView->hide(); |
3556 | } | 3556 | } |
3557 | void CalendarView::toggleFilerEnabled( ) | 3557 | void CalendarView::toggleFilerEnabled( ) |
3558 | { | 3558 | { |
3559 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); | 3559 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); |
3560 | if ( !mFilterView->filtersEnabled() ) | 3560 | if ( !mFilterView->filtersEnabled() ) |
3561 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); | 3561 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); |
3562 | 3562 | ||
3563 | } | 3563 | } |
3564 | void CalendarView::updateFilter() | 3564 | void CalendarView::updateFilter() |
3565 | { | 3565 | { |
3566 | CalFilter *filter = mFilterView->selectedFilter(); | 3566 | CalFilter *filter = mFilterView->selectedFilter(); |
3567 | if (filter) { | 3567 | if (filter) { |
3568 | if (mFilterView->filtersEnabled()) { | 3568 | if (mFilterView->filtersEnabled()) { |
3569 | topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); | 3569 | topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); |
3570 | filter->setEnabled(true); | 3570 | filter->setEnabled(true); |
3571 | } | 3571 | } |
3572 | else filter->setEnabled(false); | 3572 | else filter->setEnabled(false); |
3573 | mCalendar->setFilter(filter); | 3573 | mCalendar->setFilter(filter); |
3574 | updateView(); | 3574 | updateView(); |
3575 | } | 3575 | } |
3576 | } | 3576 | } |
3577 | 3577 | ||
3578 | void CalendarView::filterEdited() | 3578 | void CalendarView::filterEdited() |
3579 | { | 3579 | { |
3580 | mFilterView->updateFilters(); | 3580 | mFilterView->updateFilters(); |
3581 | updateFilter(); | 3581 | updateFilter(); |
3582 | writeSettings(); | 3582 | writeSettings(); |
3583 | } | 3583 | } |
3584 | 3584 | ||
3585 | 3585 | ||
3586 | void CalendarView::takeOverEvent() | 3586 | void CalendarView::takeOverEvent() |
3587 | { | 3587 | { |
3588 | Incidence *incidence = currentSelection(); | 3588 | Incidence *incidence = currentSelection(); |
3589 | 3589 | ||
3590 | if (!incidence) return; | 3590 | if (!incidence) return; |
3591 | 3591 | ||
3592 | incidence->setOrganizer(KOPrefs::instance()->email()); | 3592 | incidence->setOrganizer(KOPrefs::instance()->email()); |
3593 | incidence->recreate(); | 3593 | incidence->recreate(); |
3594 | incidence->setReadOnly(false); | 3594 | incidence->setReadOnly(false); |
3595 | 3595 | ||
3596 | updateView(); | 3596 | updateView(); |
3597 | } | 3597 | } |
3598 | 3598 | ||
3599 | void CalendarView::takeOverCalendar() | 3599 | void CalendarView::takeOverCalendar() |
3600 | { | 3600 | { |
3601 | // TODO: Create Calendar::allIncidences() function and use it here | 3601 | // TODO: Create Calendar::allIncidences() function and use it here |
3602 | 3602 | ||
3603 | QPtrList<Event> events = mCalendar->events(); | 3603 | QPtrList<Event> events = mCalendar->events(); |
3604 | for(uint i=0; i<events.count(); ++i) { | 3604 | for(uint i=0; i<events.count(); ++i) { |
3605 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3605 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3606 | events.at(i)->recreate(); | 3606 | events.at(i)->recreate(); |
3607 | events.at(i)->setReadOnly(false); | 3607 | events.at(i)->setReadOnly(false); |
3608 | } | 3608 | } |
3609 | 3609 | ||
3610 | QPtrList<Todo> todos = mCalendar->todos(); | 3610 | QPtrList<Todo> todos = mCalendar->todos(); |
3611 | for(uint i=0; i<todos.count(); ++i) { | 3611 | for(uint i=0; i<todos.count(); ++i) { |
3612 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3612 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3613 | todos.at(i)->recreate(); | 3613 | todos.at(i)->recreate(); |
3614 | todos.at(i)->setReadOnly(false); | 3614 | todos.at(i)->setReadOnly(false); |
3615 | } | 3615 | } |
3616 | 3616 | ||
3617 | QPtrList<Journal> journals = mCalendar->journals(); | 3617 | QPtrList<Journal> journals = mCalendar->journals(); |
3618 | for(uint i=0; i<journals.count(); ++i) { | 3618 | for(uint i=0; i<journals.count(); ++i) { |
3619 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3619 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3620 | journals.at(i)->recreate(); | 3620 | journals.at(i)->recreate(); |
3621 | journals.at(i)->setReadOnly(false); | 3621 | journals.at(i)->setReadOnly(false); |
3622 | } | 3622 | } |
3623 | 3623 | ||
3624 | updateView(); | 3624 | updateView(); |
3625 | } | 3625 | } |
3626 | 3626 | ||
3627 | void CalendarView::showIntro() | 3627 | void CalendarView::showIntro() |
3628 | { | 3628 | { |
3629 | kdDebug() << "To be implemented." << endl; | 3629 | kdDebug() << "To be implemented." << endl; |
3630 | } | 3630 | } |
3631 | 3631 | ||
3632 | QWidgetStack *CalendarView::viewStack() | 3632 | QWidgetStack *CalendarView::viewStack() |
3633 | { | 3633 | { |
3634 | return mRightFrame; | 3634 | return mRightFrame; |
3635 | } | 3635 | } |
3636 | 3636 | ||
3637 | QWidget *CalendarView::leftFrame() | 3637 | QWidget *CalendarView::leftFrame() |
3638 | { | 3638 | { |
3639 | return mLeftFrame; | 3639 | return mLeftFrame; |
3640 | } | 3640 | } |
3641 | 3641 | ||
3642 | DateNavigator *CalendarView::dateNavigator() | 3642 | DateNavigator *CalendarView::dateNavigator() |
3643 | { | 3643 | { |
3644 | return mNavigator; | 3644 | return mNavigator; |
3645 | } | 3645 | } |
3646 | 3646 | ||
3647 | KDateNavigator* CalendarView::dateNavigatorWidget() | 3647 | KDateNavigator* CalendarView::dateNavigatorWidget() |
3648 | { | 3648 | { |
3649 | return mDateNavigator; | 3649 | return mDateNavigator; |
3650 | } | 3650 | } |
3651 | void CalendarView::toggleDateNavigatorWidget() | 3651 | void CalendarView::toggleDateNavigatorWidget() |
3652 | { | 3652 | { |
3653 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; | 3653 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; |
3654 | if (!KOPrefs::instance()->mShowDateNavigator ) | 3654 | if (!KOPrefs::instance()->mShowDateNavigator ) |
3655 | mDateNavigator->hide(); | 3655 | mDateNavigator->hide(); |
3656 | else | 3656 | else |
3657 | mDateNavigator->show(); | 3657 | mDateNavigator->show(); |
3658 | } | 3658 | } |
3659 | void CalendarView::addView(KOrg::BaseView *view) | 3659 | void CalendarView::addView(KOrg::BaseView *view) |
3660 | { | 3660 | { |
3661 | mViewManager->addView(view); | 3661 | mViewManager->addView(view); |
3662 | } | 3662 | } |
3663 | 3663 | ||
3664 | void CalendarView::showView(KOrg::BaseView *view) | 3664 | void CalendarView::showView(KOrg::BaseView *view) |
3665 | { | 3665 | { |
3666 | mViewManager->showView(view, mLeftFrame->isVisible()); | 3666 | mViewManager->showView(view, mLeftFrame->isVisible()); |
3667 | } | 3667 | } |
3668 | 3668 | ||
3669 | Incidence *CalendarView::currentSelection() | 3669 | Incidence *CalendarView::currentSelection() |
3670 | { | 3670 | { |
3671 | return mViewManager->currentSelection(); | 3671 | return mViewManager->currentSelection(); |
3672 | } | 3672 | } |
3673 | void CalendarView::toggleAllDaySize() | 3673 | void CalendarView::toggleAllDaySize() |
3674 | { | 3674 | { |
3675 | /* | 3675 | /* |
3676 | if ( KOPrefs::instance()->mAllDaySize > 47 ) | 3676 | if ( KOPrefs::instance()->mAllDaySize > 47 ) |
3677 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; | 3677 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; |
3678 | else | 3678 | else |
3679 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; | 3679 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; |
3680 | */ | 3680 | */ |
3681 | viewManager()->agendaView()->toggleAllDay(); | 3681 | viewManager()->agendaView()->toggleAllDay(); |
3682 | } | 3682 | } |
3683 | void CalendarView::toggleExpand() | 3683 | void CalendarView::toggleExpand() |
3684 | { | 3684 | { |
3685 | // if ( mLeftFrame->isHidden() ) { | 3685 | // if ( mLeftFrame->isHidden() ) { |
3686 | // mLeftFrame->show(); | 3686 | // mLeftFrame->show(); |
3687 | // emit calendarViewExpanded( false ); | 3687 | // emit calendarViewExpanded( false ); |
3688 | // } else { | 3688 | // } else { |
3689 | // mLeftFrame->hide(); | 3689 | // mLeftFrame->hide(); |
3690 | // emit calendarViewExpanded( true ); | 3690 | // emit calendarViewExpanded( true ); |
3691 | // } | 3691 | // } |
3692 | 3692 | //qDebug(" CalendarView::toggleExpand()"); | |
3693 | globalFlagBlockAgenda = 1; | 3693 | globalFlagBlockAgenda = 1; |
3694 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); | 3694 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); |
3695 | globalFlagBlockAgenda = 5; | 3695 | globalFlagBlockAgenda = 5; |
3696 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); | 3696 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); |
3697 | //mViewManager->showView( 0, true ); | 3697 | //mViewManager->showView( 0, true ); |
3698 | } | 3698 | } |
3699 | 3699 | ||
3700 | void CalendarView::calendarModified( bool modified, Calendar * ) | 3700 | void CalendarView::calendarModified( bool modified, Calendar * ) |
3701 | { | 3701 | { |
3702 | setModified( modified ); | 3702 | setModified( modified ); |
3703 | } | 3703 | } |
3704 | 3704 | ||
3705 | Todo *CalendarView::selectedTodo() | 3705 | Todo *CalendarView::selectedTodo() |
3706 | { | 3706 | { |
3707 | Incidence *incidence = currentSelection(); | 3707 | Incidence *incidence = currentSelection(); |
3708 | if ( incidence && incidence->type() == "Todo" ) { | 3708 | if ( incidence && incidence->type() == "Todo" ) { |
3709 | return static_cast<Todo *>( incidence ); | 3709 | return static_cast<Todo *>( incidence ); |
3710 | } | 3710 | } |
3711 | 3711 | ||
3712 | incidence = mTodoList->selectedIncidences().first(); | 3712 | incidence = mTodoList->selectedIncidences().first(); |
3713 | if ( incidence && incidence->type() == "Todo" ) { | 3713 | if ( incidence && incidence->type() == "Todo" ) { |
3714 | return static_cast<Todo *>( incidence ); | 3714 | return static_cast<Todo *>( incidence ); |
3715 | } | 3715 | } |
3716 | 3716 | ||
3717 | return 0; | 3717 | return 0; |
3718 | } | 3718 | } |
3719 | 3719 | ||
3720 | void CalendarView::dialogClosing(Incidence *in) | 3720 | void CalendarView::dialogClosing(Incidence *in) |
3721 | { | 3721 | { |
3722 | // mDialogList.remove(in); | 3722 | // mDialogList.remove(in); |
3723 | } | 3723 | } |
3724 | 3724 | ||
3725 | void CalendarView::showIncidence() | 3725 | void CalendarView::showIncidence() |
3726 | { | 3726 | { |
3727 | Incidence *incidence = currentSelection(); | 3727 | Incidence *incidence = currentSelection(); |
3728 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3728 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3729 | if ( incidence ) { | 3729 | if ( incidence ) { |
3730 | ShowIncidenceVisitor v; | 3730 | ShowIncidenceVisitor v; |
3731 | v.act( incidence, this ); | 3731 | v.act( incidence, this ); |
3732 | } | 3732 | } |
3733 | } | 3733 | } |
3734 | void CalendarView::editIncidenceDescription() | 3734 | void CalendarView::editIncidenceDescription() |
3735 | { | 3735 | { |
3736 | mFlagEditDescription = true; | 3736 | mFlagEditDescription = true; |
3737 | editIncidence(); | 3737 | editIncidence(); |
3738 | mFlagEditDescription = false; | 3738 | mFlagEditDescription = false; |
3739 | } | 3739 | } |
3740 | void CalendarView::editIncidence() | 3740 | void CalendarView::editIncidence() |
3741 | { | 3741 | { |
3742 | // qDebug("editIncidence() "); | 3742 | // qDebug("editIncidence() "); |
3743 | Incidence *incidence = currentSelection(); | 3743 | Incidence *incidence = currentSelection(); |
3744 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3744 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3745 | if ( incidence ) { | 3745 | if ( incidence ) { |
3746 | EditIncidenceVisitor v; | 3746 | EditIncidenceVisitor v; |
3747 | v.act( incidence, this ); | 3747 | v.act( incidence, this ); |
3748 | } | 3748 | } |
3749 | } | 3749 | } |
3750 | 3750 | ||
3751 | void CalendarView::deleteIncidence() | 3751 | void CalendarView::deleteIncidence() |
3752 | { | 3752 | { |
3753 | Incidence *incidence = currentSelection(); | 3753 | Incidence *incidence = currentSelection(); |
3754 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3754 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3755 | if ( incidence ) { | 3755 | if ( incidence ) { |
3756 | deleteIncidence(incidence); | 3756 | deleteIncidence(incidence); |
3757 | } | 3757 | } |
3758 | } | 3758 | } |
3759 | 3759 | ||
3760 | void CalendarView::showIncidence(Incidence *incidence) | 3760 | void CalendarView::showIncidence(Incidence *incidence) |
3761 | { | 3761 | { |
3762 | if ( incidence ) { | 3762 | if ( incidence ) { |
3763 | ShowIncidenceVisitor v; | 3763 | ShowIncidenceVisitor v; |
3764 | v.act( incidence, this ); | 3764 | v.act( incidence, this ); |
3765 | } | 3765 | } |
3766 | } | 3766 | } |
3767 | 3767 | ||
3768 | void CalendarView::editIncidence(Incidence *incidence) | 3768 | void CalendarView::editIncidence(Incidence *incidence) |
3769 | { | 3769 | { |
3770 | if ( incidence ) { | 3770 | if ( incidence ) { |
3771 | 3771 | ||
3772 | EditIncidenceVisitor v; | 3772 | EditIncidenceVisitor v; |
3773 | v.act( incidence, this ); | 3773 | v.act( incidence, this ); |
3774 | 3774 | ||
3775 | } | 3775 | } |
3776 | } | 3776 | } |
3777 | 3777 | ||
3778 | void CalendarView::deleteIncidence(Incidence *incidence) | 3778 | void CalendarView::deleteIncidence(Incidence *incidence) |
3779 | { | 3779 | { |
3780 | //qDebug(" CalendarView::deleteIncidence "); | 3780 | //qDebug(" CalendarView::deleteIncidence "); |
3781 | if ( incidence ) { | 3781 | if ( incidence ) { |
3782 | DeleteIncidenceVisitor v; | 3782 | DeleteIncidenceVisitor v; |
3783 | v.act( incidence, this ); | 3783 | v.act( incidence, this ); |
3784 | } | 3784 | } |
3785 | } | 3785 | } |
3786 | 3786 | ||
3787 | 3787 | ||
3788 | void CalendarView::lookForOutgoingMessages() | 3788 | void CalendarView::lookForOutgoingMessages() |
3789 | { | 3789 | { |
3790 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); | 3790 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); |
3791 | ogd->loadMessages(); | 3791 | ogd->loadMessages(); |
3792 | } | 3792 | } |
3793 | 3793 | ||
3794 | void CalendarView::lookForIncomingMessages() | 3794 | void CalendarView::lookForIncomingMessages() |
3795 | { | 3795 | { |
3796 | IncomingDialog *icd = mDialogManager->incomingDialog(); | 3796 | IncomingDialog *icd = mDialogManager->incomingDialog(); |
3797 | icd->retrieve(); | 3797 | icd->retrieve(); |
3798 | } | 3798 | } |
3799 | 3799 | ||
3800 | bool CalendarView::removeCompletedSubTodos( Todo* t ) | 3800 | bool CalendarView::removeCompletedSubTodos( Todo* t ) |
3801 | { | 3801 | { |
3802 | bool deleteTodo = true; | 3802 | bool deleteTodo = true; |
3803 | QPtrList<Incidence> subTodos; | 3803 | QPtrList<Incidence> subTodos; |
3804 | Incidence *aTodo; | 3804 | Incidence *aTodo; |
3805 | subTodos = t->relations(); | 3805 | subTodos = t->relations(); |
3806 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 3806 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
3807 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 3807 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
3808 | deleteTodo = false; | 3808 | deleteTodo = false; |
3809 | } | 3809 | } |
3810 | if ( deleteTodo ) { | 3810 | if ( deleteTodo ) { |
3811 | if ( t->isCompleted() ) { | 3811 | if ( t->isCompleted() ) { |
3812 | checkExternalId( t ); | 3812 | checkExternalId( t ); |
3813 | mCalendar->deleteTodo( t ); | 3813 | mCalendar->deleteTodo( t ); |
3814 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 3814 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
3815 | } | 3815 | } |
3816 | else | 3816 | else |
3817 | deleteTodo = false; | 3817 | deleteTodo = false; |
3818 | } | 3818 | } |
3819 | return deleteTodo; | 3819 | return deleteTodo; |
3820 | 3820 | ||
3821 | } | 3821 | } |
3822 | void CalendarView::purgeCompleted() | 3822 | void CalendarView::purgeCompleted() |
3823 | { | 3823 | { |
3824 | int result = KMessageBox::warningContinueCancel(this, | 3824 | int result = KMessageBox::warningContinueCancel(this, |
3825 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); | 3825 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); |
3826 | 3826 | ||
3827 | if (result == KMessageBox::Continue) { | 3827 | if (result == KMessageBox::Continue) { |
3828 | 3828 | ||
3829 | QPtrList<Todo> todoCal; | 3829 | QPtrList<Todo> todoCal; |
3830 | QPtrList<Todo> rootTodos; | 3830 | QPtrList<Todo> rootTodos; |
3831 | //QPtrList<Incidence> rel; | 3831 | //QPtrList<Incidence> rel; |
3832 | Todo *aTodo;//, *rTodo; | 3832 | Todo *aTodo;//, *rTodo; |
3833 | Incidence *rIncidence; | 3833 | Incidence *rIncidence; |
3834 | bool childDelete = false; | 3834 | bool childDelete = false; |
3835 | bool deletedOne = true; | 3835 | bool deletedOne = true; |
3836 | todoCal = calendar()->todos(); | 3836 | todoCal = calendar()->todos(); |
3837 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { | 3837 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { |
3838 | if ( !aTodo->relatedTo() ) | 3838 | if ( !aTodo->relatedTo() ) |
3839 | rootTodos.append( aTodo ); | 3839 | rootTodos.append( aTodo ); |
3840 | } | 3840 | } |
3841 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { | 3841 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { |
3842 | removeCompletedSubTodos( aTodo ); | 3842 | removeCompletedSubTodos( aTodo ); |
3843 | } | 3843 | } |
3844 | 3844 | ||
3845 | updateView(); | 3845 | updateView(); |
3846 | } | 3846 | } |
3847 | } | 3847 | } |
3848 | 3848 | ||
3849 | void CalendarView::slotCalendarChanged() | 3849 | void CalendarView::slotCalendarChanged() |
3850 | { | 3850 | { |
3851 | ; | 3851 | ; |
3852 | } | 3852 | } |
3853 | 3853 | ||
3854 | NavigatorBar *CalendarView::navigatorBar() | 3854 | NavigatorBar *CalendarView::navigatorBar() |
3855 | { | 3855 | { |
3856 | return mNavigatorBar; | 3856 | return mNavigatorBar; |
3857 | } | 3857 | } |
3858 | 3858 | ||
3859 | 3859 | ||
3860 | 3860 | ||
3861 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 3861 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
3862 | { | 3862 | { |
3863 | //qDebug(" alendarView::keyPressEvent "); | 3863 | //qDebug(" alendarView::keyPressEvent "); |
3864 | e->ignore(); | 3864 | e->ignore(); |
3865 | } | 3865 | } |
3866 | 3866 | ||
3867 | 3867 | ||
3868 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 3868 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) |
3869 | { | 3869 | { |
3870 | // mSyncManager = manager; | 3870 | // mSyncManager = manager; |
3871 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 3871 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
3872 | qDebug("KO: SyncKDE request detected!"); | 3872 | qDebug("KO: SyncKDE request detected!"); |
3873 | } | 3873 | } |
3874 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3874 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3875 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3875 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3876 | return syncCalendar( filename, mode ); | 3876 | return syncCalendar( filename, mode ); |
3877 | } | 3877 | } |
3878 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 3878 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
3879 | { | 3879 | { |
3880 | //mSyncManager = manager; | 3880 | //mSyncManager = manager; |
3881 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3881 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3882 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3882 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3883 | if ( resource == "sharp" ) | 3883 | if ( resource == "sharp" ) |
3884 | syncExternal( 0 ); | 3884 | syncExternal( 0 ); |
diff --git a/korganizer/datenavigator.cpp b/korganizer/datenavigator.cpp index 3156b2b..d2824de 100644 --- a/korganizer/datenavigator.cpp +++ b/korganizer/datenavigator.cpp | |||
@@ -21,273 +21,272 @@ | |||
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include "datenavigator.h" | 24 | #include "datenavigator.h" |
25 | 25 | ||
26 | #include "koglobals.h" | 26 | #include "koglobals.h" |
27 | 27 | ||
28 | #include <kcalendarsystem.h> | 28 | #include <kcalendarsystem.h> |
29 | 29 | ||
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <klocale.h> | 32 | #include <klocale.h> |
33 | 33 | ||
34 | using namespace KCal; | 34 | using namespace KCal; |
35 | 35 | ||
36 | DateNavigator::DateNavigator( QObject *parent, const char *name , KOViewManager * v) | 36 | DateNavigator::DateNavigator( QObject *parent, const char *name , KOViewManager * v) |
37 | : QObject( parent, name ) | 37 | : QObject( parent, name ) |
38 | { | 38 | { |
39 | mViewManager = v; | 39 | mViewManager = v; |
40 | mSelectedDates.append( QDate::currentDate() ); | 40 | mSelectedDates.append( QDate::currentDate() ); |
41 | } | 41 | } |
42 | 42 | ||
43 | DateNavigator::~DateNavigator() | 43 | DateNavigator::~DateNavigator() |
44 | { | 44 | { |
45 | } | 45 | } |
46 | 46 | ||
47 | void DateNavigator::slotMonthSelect( int m ) | 47 | void DateNavigator::slotMonthSelect( int m ) |
48 | { | 48 | { |
49 | QDate firstSelected = mSelectedDates.first(); | 49 | QDate firstSelected = mSelectedDates.first(); |
50 | int weekDay = firstSelected.dayOfWeek(); | 50 | int weekDay = firstSelected.dayOfWeek(); |
51 | int diff = m - firstSelected.month() ; | 51 | int diff = m - firstSelected.month() ; |
52 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, diff ); | 52 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, diff ); |
53 | 53 | ||
54 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) | 54 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) |
55 | selectMonthByDate( firstSelected ); | 55 | selectMonthByDate( firstSelected ); |
56 | else | 56 | else |
57 | selectWeekByDay( weekDay, firstSelected ); | 57 | selectWeekByDay( weekDay, firstSelected ); |
58 | 58 | ||
59 | } | 59 | } |
60 | 60 | ||
61 | void DateNavigator::slotDaySelect( QDate d ) | 61 | void DateNavigator::slotDaySelect( QDate d ) |
62 | { | 62 | { |
63 | QDate firstSelected = mSelectedDates.first(); | 63 | QDate firstSelected = mSelectedDates.first(); |
64 | int weekDay = firstSelected.dayOfWeek(); | 64 | int weekDay = firstSelected.dayOfWeek(); |
65 | //int diff = firstSelected.daysTo( d ) ; | 65 | //int diff = firstSelected.daysTo( d ) ; |
66 | firstSelected = firstSelected.addDays( firstSelected .daysTo( d ) ); | 66 | firstSelected = firstSelected.addDays( firstSelected .daysTo( d ) ); |
67 | 67 | ||
68 | selectWeekByDay( weekDay, firstSelected ); | 68 | selectWeekByDay( weekDay, firstSelected ); |
69 | 69 | ||
70 | } | 70 | } |
71 | 71 | ||
72 | void DateNavigator::selectMonthByDate( const QDate & firstSelected ) | 72 | void DateNavigator::selectMonthByDate( const QDate & firstSelected ) |
73 | { | 73 | { |
74 | 74 | ||
75 | int monthDay = firstSelected.day(); | 75 | int monthDay = firstSelected.day(); |
76 | QDate date = firstSelected.addDays( 1-monthDay ); | 76 | QDate date = firstSelected.addDays( 1-monthDay ); |
77 | selectDates( date , date.daysInMonth ()); | 77 | selectDates( date , date.daysInMonth ()); |
78 | 78 | ||
79 | } | 79 | } |
80 | void DateNavigator::selectMonth() | 80 | void DateNavigator::selectMonth() |
81 | { | 81 | { |
82 | 82 | ||
83 | QDate date =mSelectedDates.first(); | 83 | QDate date =mSelectedDates.first(); |
84 | selectMonthByDate( date ); | 84 | selectMonthByDate( date ); |
85 | } | 85 | } |
86 | 86 | ||
87 | DateList DateNavigator::selectedDates() | 87 | DateList DateNavigator::selectedDates() |
88 | { | 88 | { |
89 | return mSelectedDates; | 89 | return mSelectedDates; |
90 | } | 90 | } |
91 | 91 | ||
92 | int DateNavigator::datesCount() const | 92 | int DateNavigator::datesCount() const |
93 | { | 93 | { |
94 | return mSelectedDates.count(); | 94 | return mSelectedDates.count(); |
95 | } | 95 | } |
96 | 96 | ||
97 | void DateNavigator::selectDates( const DateList& dateList ) | 97 | void DateNavigator::selectDates( const DateList& dateList ) |
98 | { | 98 | { |
99 | if (dateList.count() > 0) { | 99 | if (dateList.count() > 0) { |
100 | mSelectedDates = dateList; | 100 | mSelectedDates = dateList; |
101 | emitSelected(); | 101 | emitSelected(); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | void DateNavigator::selectDate( const QDate &date ) | 105 | void DateNavigator::selectDate( const QDate &date ) |
106 | { | 106 | { |
107 | QDate d = date; | 107 | QDate d = date; |
108 | 108 | ||
109 | if ( !d.isValid() ) { | 109 | if ( !d.isValid() ) { |
110 | d = QDate::currentDate(); | 110 | d = QDate::currentDate(); |
111 | } | 111 | } |
112 | 112 | ||
113 | mSelectedDates.clear(); | 113 | mSelectedDates.clear(); |
114 | mSelectedDates.append( d ); | 114 | mSelectedDates.append( d ); |
115 | 115 | ||
116 | emitSelected(); | 116 | emitSelected(); |
117 | } | 117 | } |
118 | 118 | ||
119 | void DateNavigator::selectDates( int count ) | 119 | void DateNavigator::selectDates( int count ) |
120 | { | 120 | { |
121 | 121 | ||
122 | QDate d = mSelectedDates.first(); | 122 | QDate d = mSelectedDates.first(); |
123 | selectDates( d, count ); | 123 | selectDates( d, count ); |
124 | } | 124 | } |
125 | 125 | ||
126 | void DateNavigator::selectDates( const QDate &d, int count ) | 126 | void DateNavigator::selectDates( const QDate &d, int count ) |
127 | { | 127 | { |
128 | DateList dates; | 128 | DateList dates; |
129 | 129 | ||
130 | int i; | 130 | int i; |
131 | for( i = 0; i < count; ++i ) { | 131 | for( i = 0; i < count; ++i ) { |
132 | dates.append( d.addDays( i ) ); | 132 | dates.append( d.addDays( i ) ); |
133 | } | 133 | } |
134 | 134 | ||
135 | mSelectedDates = dates; | 135 | mSelectedDates = dates; |
136 | 136 | ||
137 | emitSelected(); | 137 | emitSelected(); |
138 | } | 138 | } |
139 | 139 | ||
140 | void DateNavigator::selectWeekByDay( int weekDay, const QDate &d ) | 140 | void DateNavigator::selectWeekByDay( int weekDay, const QDate &d ) |
141 | { | 141 | { |
142 | // qDebug("selectWeekByDay( %d %s ", weekDay, d.toString().latin1()); | 142 | // qDebug("selectWeekByDay( %d %s ", weekDay, d.toString().latin1()); |
143 | int dateCount = mSelectedDates.count(); | 143 | int dateCount = mSelectedDates.count(); |
144 | bool weekStart = ( weekDay == KGlobal::locale()->weekStartDay() ); | 144 | bool weekStart = ( weekDay == KGlobal::locale()->weekStartDay() ); |
145 | if ( weekDay == 1 && dateCount == 5 ) selectWorkWeek( d ); | 145 | if ( weekDay == 1 && dateCount == 5 ) selectWorkWeek( d ); |
146 | else if ( weekStart && dateCount == 7 ) selectWeek( d ); | 146 | else if ( weekStart && dateCount == 7 ) selectWeek( d ); |
147 | else selectDates( d, dateCount ); | 147 | else selectDates( d, dateCount ); |
148 | } | 148 | } |
149 | 149 | ||
150 | void DateNavigator::selectWeek() | 150 | void DateNavigator::selectWeek() |
151 | { | 151 | { |
152 | QDate d = mSelectedDates.first(); | 152 | QDate d = mSelectedDates.first(); |
153 | selectWeek( d ); | 153 | selectWeek( d ); |
154 | } | 154 | } |
155 | void DateNavigator::selectWeek( int num ) | 155 | void DateNavigator::selectWeek( int num ) |
156 | { | 156 | { |
157 | int year = mSelectedDates.first().year(); | 157 | int year = mSelectedDates.first().year(); |
158 | if ( mSelectedDates.first().dayOfYear() > 300 && num < 10 ) | 158 | if ( mSelectedDates.first().dayOfYear() > 300 && num < 10 ) |
159 | ++year; | 159 | ++year; |
160 | if ( mSelectedDates.first().dayOfYear() < 70 && num > 40 ) | 160 | if ( mSelectedDates.first().dayOfYear() < 70 && num > 40 ) |
161 | --year; | 161 | --year; |
162 | QDate d = QDate ( year, 1,1); | 162 | QDate d = QDate ( year, 1,1); |
163 | while ( d.dayOfWeek() != 4 ) | 163 | while ( d.dayOfWeek() != 4 ) |
164 | d = d.addDays( 1 ); | 164 | d = d.addDays( 1 ); |
165 | selectWeek( d.addDays ( (num-1) *7 ) ); | 165 | selectWeek( d.addDays ( (num-1) *7 ) ); |
166 | } | 166 | } |
167 | void DateNavigator::selectWeek( const QDate &d ) | 167 | void DateNavigator::selectWeek( const QDate &d ) |
168 | { | 168 | { |
169 | int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); | 169 | int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); |
170 | 170 | ||
171 | int weekStart = KGlobal::locale()->weekStartDay(); | 171 | int weekStart = KGlobal::locale()->weekStartDay(); |
172 | QDate firstDate = d.addDays( weekStart - dayOfWeek ); | 172 | QDate firstDate = d.addDays( weekStart - dayOfWeek ); |
173 | 173 | ||
174 | if ( weekStart != 1 && dayOfWeek < weekStart ) { | 174 | if ( weekStart != 1 && dayOfWeek < weekStart ) { |
175 | firstDate = firstDate.addDays(-7 ); | 175 | firstDate = firstDate.addDays(-7 ); |
176 | } | 176 | } |
177 | 177 | ||
178 | 178 | ||
179 | selectDates( firstDate, 7 ); | 179 | selectDates( firstDate, 7 ); |
180 | } | 180 | } |
181 | 181 | ||
182 | void DateNavigator::selectWorkWeek() | 182 | void DateNavigator::selectWorkWeek() |
183 | { | 183 | { |
184 | QDate d = mSelectedDates.first(); | 184 | QDate d = mSelectedDates.first(); |
185 | selectWorkWeek( d ); | 185 | selectWorkWeek( d ); |
186 | } | 186 | } |
187 | 187 | ||
188 | void DateNavigator::selectWorkWeek( const QDate &d ) | 188 | void DateNavigator::selectWorkWeek( const QDate &d ) |
189 | { | 189 | { |
190 | int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); | 190 | int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); |
191 | 191 | ||
192 | QDate firstDate = d.addDays( 1 - dayOfWeek ); | 192 | QDate firstDate = d.addDays( 1 - dayOfWeek ); |
193 | 193 | ||
194 | int weekStart = KGlobal::locale()->weekStartDay(); | 194 | int weekStart = KGlobal::locale()->weekStartDay(); |
195 | if ( weekStart != 1 && dayOfWeek >= weekStart ) { | 195 | if ( weekStart != 1 && dayOfWeek >= weekStart ) { |
196 | firstDate = firstDate.addDays( 7 ); | 196 | firstDate = firstDate.addDays( 7 ); |
197 | } | 197 | } |
198 | 198 | ||
199 | selectDates( firstDate, 5 ); | 199 | selectDates( firstDate, 5 ); |
200 | } | 200 | } |
201 | 201 | ||
202 | void DateNavigator::selectTodayMonth() | 202 | void DateNavigator::selectTodayMonth() |
203 | { | 203 | { |
204 | QDate date = QDate::currentDate().addDays( 1-QDate::currentDate().day() ); | 204 | QDate date = QDate::currentDate().addDays( 1-QDate::currentDate().day() ); |
205 | selectDates( date , date.daysInMonth ()); | 205 | selectDates( date , date.daysInMonth ()); |
206 | 206 | ||
207 | } | 207 | } |
208 | void DateNavigator::selectToday() | 208 | void DateNavigator::selectToday() |
209 | { | 209 | { |
210 | QDate d = QDate::currentDate(); | 210 | QDate d = QDate::currentDate(); |
211 | 211 | ||
212 | int dateCount = mSelectedDates.count(); | 212 | int dateCount = mSelectedDates.count(); |
213 | 213 | if ( dateCount == 5 && d.dayOfWeek() < 6 ) selectWorkWeek( d ); | |
214 | if ( dateCount == 5 ) selectWorkWeek( d ); | ||
215 | else if ( dateCount == 7 ) selectWeek( d ); | 214 | else if ( dateCount == 7 ) selectWeek( d ); |
216 | else selectDates( d, dateCount ); | 215 | else selectDates( d, dateCount ); |
217 | } | 216 | } |
218 | 217 | ||
219 | void DateNavigator::selectPreviousYear() | 218 | void DateNavigator::selectPreviousYear() |
220 | { | 219 | { |
221 | QDate firstSelected = mSelectedDates.first(); | 220 | QDate firstSelected = mSelectedDates.first(); |
222 | int weekDay = firstSelected.dayOfWeek(); | 221 | int weekDay = firstSelected.dayOfWeek(); |
223 | firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 ); | 222 | firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 ); |
224 | 223 | ||
225 | selectWeekByDay( weekDay, firstSelected ); | 224 | selectWeekByDay( weekDay, firstSelected ); |
226 | } | 225 | } |
227 | 226 | ||
228 | void DateNavigator::selectPreviousMonth() | 227 | void DateNavigator::selectPreviousMonth() |
229 | { | 228 | { |
230 | QDate firstSelected = mSelectedDates.first(); | 229 | QDate firstSelected = mSelectedDates.first(); |
231 | int weekDay = firstSelected.dayOfWeek(); | 230 | int weekDay = firstSelected.dayOfWeek(); |
232 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, -1 ); | 231 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, -1 ); |
233 | 232 | ||
234 | 233 | ||
235 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) | 234 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) |
236 | selectMonthByDate( firstSelected ); | 235 | selectMonthByDate( firstSelected ); |
237 | else | 236 | else |
238 | selectWeekByDay( weekDay, firstSelected ); | 237 | selectWeekByDay( weekDay, firstSelected ); |
239 | } | 238 | } |
240 | 239 | ||
241 | void DateNavigator::selectNextMonth() | 240 | void DateNavigator::selectNextMonth() |
242 | { | 241 | { |
243 | QDate firstSelected = mSelectedDates.first(); | 242 | QDate firstSelected = mSelectedDates.first(); |
244 | int weekDay = firstSelected.dayOfWeek(); | 243 | int weekDay = firstSelected.dayOfWeek(); |
245 | 244 | ||
246 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, 1 ); | 245 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, 1 ); |
247 | 246 | ||
248 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) | 247 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) |
249 | selectMonthByDate( firstSelected ); | 248 | selectMonthByDate( firstSelected ); |
250 | else | 249 | else |
251 | selectWeekByDay( weekDay, firstSelected ); | 250 | selectWeekByDay( weekDay, firstSelected ); |
252 | 251 | ||
253 | } | 252 | } |
254 | 253 | ||
255 | void DateNavigator::selectNextYear() | 254 | void DateNavigator::selectNextYear() |
256 | { | 255 | { |
257 | QDate firstSelected = mSelectedDates.first(); | 256 | QDate firstSelected = mSelectedDates.first(); |
258 | int weekDay = firstSelected.dayOfWeek(); | 257 | int weekDay = firstSelected.dayOfWeek(); |
259 | firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, 1 ); | 258 | firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, 1 ); |
260 | 259 | ||
261 | selectWeekByDay( weekDay, firstSelected ); | 260 | selectWeekByDay( weekDay, firstSelected ); |
262 | } | 261 | } |
263 | 262 | ||
264 | void DateNavigator::selectPrevious() | 263 | void DateNavigator::selectPrevious() |
265 | { | 264 | { |
266 | int offset = -7; | 265 | int offset = -7; |
267 | if ( datesCount() == 1 ) { | 266 | if ( datesCount() == 1 ) { |
268 | offset = -1; | 267 | offset = -1; |
269 | } | 268 | } |
270 | if ( mViewManager ) | 269 | if ( mViewManager ) |
271 | if ( mViewManager->showsNextDays() ) | 270 | if ( mViewManager->showsNextDays() ) |
272 | offset = -datesCount(); | 271 | offset = -datesCount(); |
273 | selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); | 272 | selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); |
274 | } | 273 | } |
275 | 274 | ||
276 | void DateNavigator::selectNext() | 275 | void DateNavigator::selectNext() |
277 | { | 276 | { |
278 | int offset = 7; | 277 | int offset = 7; |
279 | if ( datesCount() == 1 ) { | 278 | if ( datesCount() == 1 ) { |
280 | offset = 1; | 279 | offset = 1; |
281 | } | 280 | } |
282 | if ( mViewManager ) | 281 | if ( mViewManager ) |
283 | if ( mViewManager->showsNextDays() ) | 282 | if ( mViewManager->showsNextDays() ) |
284 | offset = datesCount(); | 283 | offset = datesCount(); |
285 | selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); | 284 | selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); |
286 | } | 285 | } |
287 | 286 | ||
288 | void DateNavigator::emitSelected() | 287 | void DateNavigator::emitSelected() |
289 | { | 288 | { |
290 | emit datesSelected( mSelectedDates ); | 289 | emit datesSelected( mSelectedDates ); |
291 | } | 290 | } |
292 | 291 | ||
293 | //#include "datenavigator.moc" | 292 | //#include "datenavigator.moc" |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 10e4f1d..4cefb26 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -778,377 +778,378 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
778 | connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) ); | 778 | connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) ); |
779 | label->setFlat(true); | 779 | label->setFlat(true); |
780 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view")); | 780 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view")); |
781 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 781 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
782 | //label->setLineWidth(1); | 782 | //label->setLineWidth(1); |
783 | //label->setAlignment(AlignCenter); | 783 | //label->setAlignment(AlignCenter); |
784 | mWeekLabels.insert( i, label ); | 784 | mWeekLabels.insert( i, label ); |
785 | } | 785 | } |
786 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 786 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
787 | int row, col; | 787 | int row, col; |
788 | mCells.resize( mNumCells ); | 788 | mCells.resize( mNumCells ); |
789 | for( row = 0; row < mNumWeeks; ++row ) { | 789 | for( row = 0; row < mNumWeeks; ++row ) { |
790 | for( col = 0; col < mDaysPerWeek; ++col ) { | 790 | for( col = 0; col < mDaysPerWeek; ++col ) { |
791 | MonthViewCell *cell = new MonthViewCell( this ); | 791 | MonthViewCell *cell = new MonthViewCell( this ); |
792 | mCells.insert( row * mDaysPerWeek + col, cell ); | 792 | mCells.insert( row * mDaysPerWeek + col, cell ); |
793 | 793 | ||
794 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 794 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
795 | SLOT( defaultAction( Incidence * ) ) ); | 795 | SLOT( defaultAction( Incidence * ) ) ); |
796 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 796 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
797 | SIGNAL( newEventSignal( QDateTime ) ) ); | 797 | SIGNAL( newEventSignal( QDateTime ) ) ); |
798 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 798 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
799 | SIGNAL( showDaySignal( QDate ) ) ); | 799 | SIGNAL( showDaySignal( QDate ) ) ); |
800 | } | 800 | } |
801 | } | 801 | } |
802 | 802 | ||
803 | mContextMenu = eventPopup(); | 803 | mContextMenu = eventPopup(); |
804 | // updateConfig(); //useless here | 804 | // updateConfig(); //useless here |
805 | 805 | ||
806 | emit incidenceSelected( 0 ); | 806 | emit incidenceSelected( 0 ); |
807 | } | 807 | } |
808 | 808 | ||
809 | KOMonthView::~KOMonthView() | 809 | KOMonthView::~KOMonthView() |
810 | { | 810 | { |
811 | delete mContextMenu; | 811 | delete mContextMenu; |
812 | } | 812 | } |
813 | 813 | ||
814 | int KOMonthView::maxDatesHint() | 814 | int KOMonthView::maxDatesHint() |
815 | { | 815 | { |
816 | return mNumCells; | 816 | return mNumCells; |
817 | } | 817 | } |
818 | 818 | ||
819 | int KOMonthView::currentDateCount() | 819 | int KOMonthView::currentDateCount() |
820 | { | 820 | { |
821 | return mNumCells; | 821 | return mNumCells; |
822 | } | 822 | } |
823 | 823 | ||
824 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 824 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
825 | { | 825 | { |
826 | QPtrList<Incidence> selected; | 826 | QPtrList<Incidence> selected; |
827 | 827 | ||
828 | if ( mSelectedCell ) { | 828 | if ( mSelectedCell ) { |
829 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 829 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
830 | if ( incidence ) selected.append( incidence ); | 830 | if ( incidence ) selected.append( incidence ); |
831 | } | 831 | } |
832 | 832 | ||
833 | return selected; | 833 | return selected; |
834 | } | 834 | } |
835 | 835 | ||
836 | DateList KOMonthView::selectedDates() | 836 | DateList KOMonthView::selectedDates() |
837 | { | 837 | { |
838 | DateList selected; | 838 | DateList selected; |
839 | 839 | ||
840 | if ( mSelectedCell ) { | 840 | if ( mSelectedCell ) { |
841 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 841 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
842 | if ( qd.isValid() ) selected.append( qd ); | 842 | if ( qd.isValid() ) selected.append( qd ); |
843 | } | 843 | } |
844 | 844 | ||
845 | return selected; | 845 | return selected; |
846 | } | 846 | } |
847 | 847 | ||
848 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 848 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
849 | const QDate &td) | 849 | const QDate &td) |
850 | { | 850 | { |
851 | #ifndef KORG_NOPRINTER | 851 | #ifndef KORG_NOPRINTER |
852 | calPrinter->preview(CalPrinter::Month, fd, td); | 852 | calPrinter->preview(CalPrinter::Month, fd, td); |
853 | #endif | 853 | #endif |
854 | } | 854 | } |
855 | 855 | ||
856 | void KOMonthView::updateConfig() | 856 | void KOMonthView::updateConfig() |
857 | { | 857 | { |
858 | 858 | ||
859 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 859 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
860 | 860 | ||
861 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 861 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
862 | mWidthLongDayLabel = 0; | 862 | mWidthLongDayLabel = 0; |
863 | 863 | ||
864 | for (int i = 0; i < 7; i++) { | 864 | for (int i = 0; i < 7; i++) { |
865 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 865 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
866 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 866 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
867 | } | 867 | } |
868 | bool temp = mShowSatSunComp ; | 868 | bool temp = mShowSatSunComp ; |
869 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 869 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
870 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 870 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
871 | computeLayout(); | 871 | computeLayout(); |
872 | updateDayLabels(); | 872 | updateDayLabels(); |
873 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 873 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
874 | int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 874 | int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
875 | //resizeEvent( 0 ); | 875 | //resizeEvent( 0 ); |
876 | for (uint i = 0; i < mCells.count(); ++i) { | 876 | for (uint i = 0; i < mCells.count(); ++i) { |
877 | mCells[i]->updateConfig(); | 877 | mCells[i]->updateConfig(); |
878 | } | 878 | } |
879 | #ifdef DESKTOP_VERSION | 879 | #ifdef DESKTOP_VERSION |
880 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 880 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
881 | #endif | 881 | #endif |
882 | } | 882 | } |
883 | 883 | ||
884 | void KOMonthView::updateDayLabels() | 884 | void KOMonthView::updateDayLabels() |
885 | { | 885 | { |
886 | 886 | ||
887 | for (int i = 0; i < 7; i++) { | 887 | for (int i = 0; i < 7; i++) { |
888 | if (mWeekStartsMonday) { | 888 | if (mWeekStartsMonday) { |
889 | bool show = mShortDayLabels; | 889 | bool show = mShortDayLabels; |
890 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) | 890 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) |
891 | show = true; | 891 | show = true; |
892 | mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 892 | mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
893 | } else { | 893 | } else { |
894 | if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); | 894 | if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); |
895 | else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); | 895 | else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); |
896 | 896 | ||
897 | } | 897 | } |
898 | } | 898 | } |
899 | } | 899 | } |
900 | 900 | ||
901 | void KOMonthView::showDates(const QDate &start, const QDate &) | 901 | void KOMonthView::showDates(const QDate &start, const QDate &) |
902 | { | 902 | { |
903 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 903 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
904 | 904 | ||
905 | 905 | ||
906 | mStartDate = start; | 906 | mStartDate = start; |
907 | 907 | ||
908 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 908 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
909 | 909 | ||
910 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 910 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
911 | mStartDate = mStartDate.addDays( -1 ); | 911 | mStartDate = mStartDate.addDays( -1 ); |
912 | } | 912 | } |
913 | 913 | ||
914 | bool primary = false; | 914 | bool primary = false; |
915 | uint i; | 915 | uint i; |
916 | for( i = 0; i < mCells.size(); ++i ) { | 916 | for( i = 0; i < mCells.size(); ++i ) { |
917 | QDate date = mStartDate.addDays( i ); | 917 | QDate date = mStartDate.addDays( i ); |
918 | mCells[i]->setDate( date ); | 918 | mCells[i]->setDate( date ); |
919 | 919 | ||
920 | #ifndef KORG_NOPLUGINS | 920 | #ifndef KORG_NOPLUGINS |
921 | // add holiday, if present | 921 | // add holiday, if present |
922 | QString hstring(KOCore::self()->holiday(date)); | 922 | QString hstring(KOCore::self()->holiday(date)); |
923 | mCells[i]->setHoliday( hstring ); | 923 | mCells[i]->setHoliday( hstring ); |
924 | #endif | 924 | #endif |
925 | 925 | ||
926 | } | 926 | } |
927 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 927 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
928 | for( i = 0; i < 6; ++i ) { | 928 | for( i = 0; i < 6; ++i ) { |
929 | int wno; | 929 | int wno; |
930 | // remember, according to ISO 8601, the first week of the year is the | 930 | // remember, according to ISO 8601, the first week of the year is the |
931 | // first week that contains a thursday. Thus we must subtract off 4, | 931 | // first week that contains a thursday. Thus we must subtract off 4, |
932 | // not just 1. | 932 | // not just 1. |
933 | int dayOfYear = date.dayOfYear(); | 933 | int dayOfYear = date.dayOfYear(); |
934 | if (dayOfYear % 7 != 0) | 934 | if (dayOfYear % 7 != 0) |
935 | wno = dayOfYear / 7 + 1; | 935 | wno = dayOfYear / 7 + 1; |
936 | else | 936 | else |
937 | wno =dayOfYear / 7; | 937 | wno =dayOfYear / 7; |
938 | mWeekLabels[i]->setWeekNum( wno ); | 938 | mWeekLabels[i]->setWeekNum( wno ); |
939 | date = date.addDays( 7 ); | 939 | date = date.addDays( 7 ); |
940 | } | 940 | } |
941 | updateView(); | 941 | updateView(); |
942 | } | 942 | } |
943 | 943 | ||
944 | void KOMonthView::showEvents(QPtrList<Event>) | 944 | void KOMonthView::showEvents(QPtrList<Event>) |
945 | { | 945 | { |
946 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 946 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
947 | } | 947 | } |
948 | 948 | ||
949 | void KOMonthView::changeEventDisplay(Event *, int) | 949 | void KOMonthView::changeEventDisplay(Event *, int) |
950 | { | 950 | { |
951 | // this should be re-written to be much more efficient, but this | 951 | // this should be re-written to be much more efficient, but this |
952 | // quick-and-dirty-hack gets the job done for right now. | 952 | // quick-and-dirty-hack gets the job done for right now. |
953 | updateView(); | 953 | updateView(); |
954 | } | 954 | } |
955 | 955 | ||
956 | void KOMonthView::updateView() | 956 | void KOMonthView::updateView() |
957 | { | 957 | { |
958 | 958 | ||
959 | if ( !updatePossible ) | 959 | if ( !updatePossible ) |
960 | return; | 960 | return; |
961 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 961 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
962 | int i; | 962 | int i; |
963 | for( i = 0; i < mCells.count(); ++i ) { | 963 | for( i = 0; i < mCells.count(); ++i ) { |
964 | mCells[i]->updateCell(); | 964 | mCells[i]->updateCell(); |
965 | } | 965 | } |
966 | 966 | ||
967 | //qDebug("KOMonthView::updateView() "); | 967 | //qDebug("KOMonthView::updateView() "); |
968 | processSelectionChange(); | 968 | processSelectionChange(); |
969 | // qDebug("---------------------------------------------------------------------+ "); | 969 | // qDebug("---------------------------------------------------------------------+ "); |
970 | setFocus(); | 970 | mCells[0]->setFocus(); |
971 | } | 971 | } |
972 | 972 | ||
973 | void KOMonthView::resizeEvent(QResizeEvent * e) | 973 | void KOMonthView::resizeEvent(QResizeEvent * e) |
974 | { | 974 | { |
975 | computeLayout(); | 975 | computeLayout(); |
976 | } | 976 | } |
977 | void KOMonthView::computeLayout() | 977 | void KOMonthView::computeLayout() |
978 | { | 978 | { |
979 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". | 979 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". |
980 | // note this only changes the text if the requested size crosses the | 980 | // note this only changes the text if the requested size crosses the |
981 | // threshold between big enough to support the full name and not big | 981 | // threshold between big enough to support the full name and not big |
982 | // enough. | 982 | // enough. |
983 | 983 | ||
984 | int daysToShow = 7; | 984 | int daysToShow = 7; |
985 | bool combinedSatSun = false; | 985 | bool combinedSatSun = false; |
986 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 986 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
987 | daysToShow = 6; | 987 | daysToShow = 6; |
988 | combinedSatSun = true; | 988 | combinedSatSun = true; |
989 | } | 989 | } |
990 | int tWid = topLevelWidget()->size().width(); | 990 | int tWid = topLevelWidget()->size().width(); |
991 | int tHei = topLevelWidget()->size().height(); | 991 | int tHei = topLevelWidget()->size().height(); |
992 | 992 | ||
993 | int wid = size().width();//e | 993 | int wid = size().width();//e |
994 | int hei = size().height()-1; | 994 | int hei = size().height()-1; |
995 | 995 | ||
996 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 996 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
997 | return; | 997 | return; |
998 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 998 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
999 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 999 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1000 | int weeklabelwid = fm.width( "888" ); | 1000 | int weeklabelwid = fm.width( "888" ); |
1001 | wid -= weeklabelwid; | 1001 | wid -= weeklabelwid; |
1002 | 1002 | ||
1003 | int colWid = wid / daysToShow; | 1003 | int colWid = wid / daysToShow; |
1004 | int lastCol = wid - ( colWid*6 ); | 1004 | int lastCol = wid - ( colWid*6 ); |
1005 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1005 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1006 | int cellHei = (hei - dayLabelHei) /6; | 1006 | int cellHei = (hei - dayLabelHei) /6; |
1007 | int colModulo = wid % daysToShow; | 1007 | int colModulo = wid % daysToShow; |
1008 | int rowModulo = (hei- dayLabelHei) % 6; | 1008 | int rowModulo = (hei- dayLabelHei) % 6; |
1009 | //qDebug("rowmod %d ", rowModulo); | 1009 | //qDebug("rowmod %d ", rowModulo); |
1010 | int i; | 1010 | int i; |
1011 | int x,y,w,h; | 1011 | int x,y,w,h; |
1012 | x= 0; | 1012 | x= 0; |
1013 | y= 0; | 1013 | y= 0; |
1014 | w = colWid; | 1014 | w = colWid; |
1015 | h = dayLabelHei ; | 1015 | h = dayLabelHei ; |
1016 | for ( i = 0; i < 7; i++) { | 1016 | for ( i = 0; i < 7; i++) { |
1017 | if ( i == daysToShow-colModulo ) | 1017 | if ( i == daysToShow-colModulo ) |
1018 | ++w; | 1018 | ++w; |
1019 | if ( combinedSatSun ) { | 1019 | if ( combinedSatSun ) { |
1020 | if ( i >= daysToShow-1 ) { | 1020 | if ( i >= daysToShow-1 ) { |
1021 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1021 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
1022 | x -= w/2 ; | 1022 | x -= w/2 ; |
1023 | } | 1023 | } |
1024 | else | 1024 | else |
1025 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1025 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1026 | } else | 1026 | } else |
1027 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1027 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1028 | x += w; | 1028 | x += w; |
1029 | } | 1029 | } |
1030 | x= 0; | 1030 | x= 0; |
1031 | y= dayLabelHei; | 1031 | y= dayLabelHei; |
1032 | w = colWid; | 1032 | w = colWid; |
1033 | h = cellHei ; | 1033 | h = cellHei ; |
1034 | for ( i = 0; i < mCells.count(); ++i) { | 1034 | for ( i = 0; i < mCells.count(); ++i) { |
1035 | 1035 | ||
1036 | w = colWid; | 1036 | w = colWid; |
1037 | if ( ((i) % 7) >= 7-colModulo ) { | 1037 | if ( ((i) % 7) >= 7-colModulo ) { |
1038 | ++w; | 1038 | ++w; |
1039 | } | 1039 | } |
1040 | if ( i == (6-rowModulo)*7) | 1040 | if ( i == (6-rowModulo)*7) |
1041 | ++h; | 1041 | ++h; |
1042 | if ( combinedSatSun ) { | 1042 | if ( combinedSatSun ) { |
1043 | if ( (i)%7 >= daysToShow-1 ) { | 1043 | if ( (i)%7 >= daysToShow-1 ) { |
1044 | if ( (i)%7 == daysToShow-1 ) { | 1044 | if ( (i)%7 == daysToShow-1 ) { |
1045 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1045 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1046 | x -= w ;y += h/2; | 1046 | x -= w ;y += h/2; |
1047 | } else { | 1047 | } else { |
1048 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1048 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1049 | y -= h/2; | 1049 | y -= h/2; |
1050 | } | 1050 | } |
1051 | } else | 1051 | } else |
1052 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1052 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1053 | 1053 | ||
1054 | } | 1054 | } |
1055 | else | 1055 | else |
1056 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1056 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1057 | x += w; | 1057 | x += w; |
1058 | if ( x + w/2 > wid ) { | 1058 | if ( x + w/2 > wid ) { |
1059 | x = 0; | 1059 | x = 0; |
1060 | y += h; | 1060 | y += h; |
1061 | } | 1061 | } |
1062 | } | 1062 | } |
1063 | y= dayLabelHei; | 1063 | y= dayLabelHei; |
1064 | h = cellHei ; | 1064 | h = cellHei ; |
1065 | for ( i = 0; i < 6; i++) { | 1065 | for ( i = 0; i < 6; i++) { |
1066 | if ( i == (6-rowModulo)) | 1066 | if ( i == (6-rowModulo)) |
1067 | ++h; | 1067 | ++h; |
1068 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1068 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1069 | y += h; | 1069 | y += h; |
1070 | } | 1070 | } |
1071 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1071 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1072 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1072 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1073 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1073 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1074 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1074 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; |
1075 | updateDayLabels(); | 1075 | updateDayLabels(); |
1076 | bool forceUpdate = !updatePossible; | 1076 | bool forceUpdate = !updatePossible; |
1077 | updatePossible = true; | 1077 | updatePossible = true; |
1078 | if ( forceUpdate ) | 1078 | if ( forceUpdate ) |
1079 | updateView(); | 1079 | updateView(); |
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1082 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1083 | { | 1083 | { |
1084 | mContextMenu->showIncidencePopup(incidence); | 1084 | mContextMenu->showIncidencePopup(incidence); |
1085 | /* | 1085 | /* |
1086 | if( incidence && incidence->type() == "Event" ) { | 1086 | if( incidence && incidence->type() == "Event" ) { |
1087 | Event *event = static_cast<Event *>(incidence); | 1087 | Event *event = static_cast<Event *>(incidence); |
1088 | mContextMenu->showEventPopup(event); | 1088 | mContextMenu->showEventPopup(event); |
1089 | } else { | 1089 | } else { |
1090 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1090 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1091 | } | 1091 | } |
1092 | */ | 1092 | */ |
1093 | } | 1093 | } |
1094 | MonthViewCell * KOMonthView::selectedCell( ) | 1094 | MonthViewCell * KOMonthView::selectedCell( ) |
1095 | { | 1095 | { |
1096 | return mSelectedCell; | 1096 | return mSelectedCell; |
1097 | } | 1097 | } |
1098 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1098 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1099 | { | 1099 | { |
1100 | // qDebug("KOMonthView::setSelectedCell "); | 1100 | // qDebug("KOMonthView::setSelectedCell "); |
1101 | if ( mSelectedCell && mSelectedCell != cell ) { | 1101 | if ( mSelectedCell && mSelectedCell != cell ) { |
1102 | MonthViewCell * mvc = mSelectedCell; | 1102 | MonthViewCell * mvc = mSelectedCell; |
1103 | mSelectedCell = cell; | 1103 | mSelectedCell = cell; |
1104 | mvc->deselect(); | 1104 | mvc->deselect(); |
1105 | } else | 1105 | } else |
1106 | mSelectedCell = cell; | 1106 | mSelectedCell = cell; |
1107 | // if ( mSelectedCell ) | 1107 | // if ( mSelectedCell ) |
1108 | // mSelectedCell->select(); | 1108 | // mSelectedCell->select(); |
1109 | if ( !mSelectedCell ) | 1109 | if ( !mSelectedCell ) |
1110 | emit incidenceSelected( 0 ); | 1110 | emit incidenceSelected( 0 ); |
1111 | else | 1111 | else |
1112 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1112 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1113 | } | 1113 | } |
1114 | 1114 | ||
1115 | void KOMonthView::processSelectionChange() | 1115 | void KOMonthView::processSelectionChange() |
1116 | { | 1116 | { |
1117 | QPtrList<Incidence> incidences = selectedIncidences(); | 1117 | QPtrList<Incidence> incidences = selectedIncidences(); |
1118 | if (incidences.count() > 0) { | 1118 | if (incidences.count() > 0) { |
1119 | emit incidenceSelected( incidences.first() ); | 1119 | emit incidenceSelected( incidences.first() ); |
1120 | } else { | 1120 | } else { |
1121 | emit incidenceSelected( 0 ); | 1121 | emit incidenceSelected( 0 ); |
1122 | } | 1122 | } |
1123 | } | 1123 | } |
1124 | 1124 | ||
1125 | void KOMonthView::clearSelection() | 1125 | void KOMonthView::clearSelection() |
1126 | { | 1126 | { |
1127 | if ( mSelectedCell ) { | 1127 | if ( mSelectedCell ) { |
1128 | mSelectedCell->deselect(); | 1128 | mSelectedCell->deselect(); |
1129 | mSelectedCell = 0; | 1129 | mSelectedCell = 0; |
1130 | } | 1130 | } |
1131 | } | 1131 | } |
1132 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1132 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1133 | { | 1133 | { |
1134 | //qDebug("KOMonthView::keyPressEvent "); | ||
1134 | switch(e->key()) { | 1135 | switch(e->key()) { |
1135 | break; | ||
1136 | case Key_Up: | 1136 | case Key_Up: |
1137 | { | 1137 | { |
1138 | emit prevMonth(); | 1138 | emit prevMonth(); |
1139 | setFocus(); | 1139 | mCells[0]->setFocus(); |
1140 | } | 1140 | } |
1141 | e->accept(); | 1141 | e->accept(); |
1142 | break; | 1142 | break; |
1143 | case Key_Down: | 1143 | case Key_Down: |
1144 | { | 1144 | { |
1145 | emit nextMonth(); | 1145 | emit nextMonth(); |
1146 | setFocus(); | 1146 | mCells[0]->setFocus(); |
1147 | |||
1147 | } | 1148 | } |
1148 | e->accept(); | 1149 | e->accept(); |
1149 | break; | 1150 | break; |
1150 | default: | 1151 | default: |
1151 | e->ignore(); | 1152 | e->ignore(); |
1152 | break; | 1153 | break; |
1153 | } | 1154 | } |
1154 | } | 1155 | } |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 6da4799..4c03f9a 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -1,405 +1,403 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2001 | 4 | Copyright (c) 2001 |
5 | Cornelius Schumacher <schumacher@kde.org> | 5 | Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | As a special exception, permission is given to link this program | 21 | As a special exception, permission is given to link this program |
22 | with any edition of Qt, and distribute the resulting executable, | 22 | with any edition of Qt, and distribute the resulting executable, |
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | 27 | ||
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include "calendarview.h" | 36 | #include "calendarview.h" |
37 | #include "datenavigator.h" | 37 | #include "datenavigator.h" |
38 | #include "kotodoview.h" | 38 | #include "kotodoview.h" |
39 | #include "koagendaview.h" | 39 | #include "koagendaview.h" |
40 | #include "kodialogmanager.h" | 40 | #include "kodialogmanager.h" |
41 | #include "komonthview.h" | 41 | #include "komonthview.h" |
42 | #include "kolistview.h" | 42 | #include "kolistview.h" |
43 | #include "kowhatsnextview.h" | 43 | #include "kowhatsnextview.h" |
44 | #include "kojournalview.h" | 44 | #include "kojournalview.h" |
45 | #include "kotimespanview.h" | 45 | #include "kotimespanview.h" |
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "navigatorbar.h" | 47 | #include "navigatorbar.h" |
48 | #include "kdatenavigator.h" | 48 | #include "kdatenavigator.h" |
49 | 49 | ||
50 | #include "koviewmanager.h" | 50 | #include "koviewmanager.h" |
51 | //extern bool externFlagMonthviewBlockPainting; | 51 | //extern bool externFlagMonthviewBlockPainting; |
52 | 52 | ||
53 | //bool globalFlagBlockPainting = false; | 53 | //bool globalFlagBlockPainting = false; |
54 | int globalFlagBlockAgenda = 0; | 54 | int globalFlagBlockAgenda = 0; |
55 | int globalFlagBlockLabel = 0; | 55 | int globalFlagBlockLabel = 0; |
56 | int globalFlagBlockAgendaItemPaint = 1; | 56 | int globalFlagBlockAgendaItemPaint = 1; |
57 | int globalFlagBlockAgendaItemUpdate = 1; | 57 | int globalFlagBlockAgendaItemUpdate = 1; |
58 | 58 | ||
59 | 59 | ||
60 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 60 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
61 | QObject(), mMainView( mainView ) | 61 | QObject(), mMainView( mainView ) |
62 | { | 62 | { |
63 | mCurrentView = 0; | 63 | mCurrentView = 0; |
64 | 64 | ||
65 | mWhatsNextView = 0; | 65 | mWhatsNextView = 0; |
66 | mTodoView = 0; | 66 | mTodoView = 0; |
67 | mAgendaView = 0; | 67 | mAgendaView = 0; |
68 | mMonthView = 0; | 68 | mMonthView = 0; |
69 | mListView = 0; | 69 | mListView = 0; |
70 | mJournalView = 0; | 70 | mJournalView = 0; |
71 | mTimeSpanView = 0; | 71 | mTimeSpanView = 0; |
72 | mCurrentAgendaView = 0 ; | 72 | mCurrentAgendaView = 0 ; |
73 | mFlagShowNextxDays = false; | 73 | mFlagShowNextxDays = false; |
74 | } | 74 | } |
75 | 75 | ||
76 | KOViewManager::~KOViewManager() | 76 | KOViewManager::~KOViewManager() |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | KOrg::BaseView *KOViewManager::currentView() | 81 | KOrg::BaseView *KOViewManager::currentView() |
82 | { | 82 | { |
83 | return mCurrentView; | 83 | return mCurrentView; |
84 | } | 84 | } |
85 | 85 | ||
86 | void KOViewManager::readSettings(KConfig *config) | 86 | void KOViewManager::readSettings(KConfig *config) |
87 | { | 87 | { |
88 | config->setGroup("General"); | 88 | config->setGroup("General"); |
89 | QString view = config->readEntry("Current View"); | 89 | QString view = config->readEntry("Current View"); |
90 | if (view == "WhatsNext") showWhatsNextView(); | 90 | if (view == "WhatsNext") showWhatsNextView(); |
91 | else if (view == "Month") showMonthView(); | 91 | else if (view == "Month") showMonthView(); |
92 | else if (view == "List") showListView(); | 92 | else if (view == "List") showListView(); |
93 | else if (view == "Journal") showJournalView(); | 93 | else if (view == "Journal") showJournalView(); |
94 | else if (view == "TimeSpan") showTimeSpanView(); | 94 | else if (view == "TimeSpan") showTimeSpanView(); |
95 | else if (view == "Todo") showTodoView(); | 95 | else if (view == "Todo") showTodoView(); |
96 | else { | 96 | else { |
97 | showAgendaView(); | 97 | showAgendaView(); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | void KOViewManager::showDateView( int view, QDate date) | 102 | void KOViewManager::showDateView( int view, QDate date) |
103 | { | 103 | { |
104 | 104 | ||
105 | qDebug("date %d %s", view, date.toString().latin1()); | 105 | //qDebug("date %d %s", view, date.toString().latin1()); |
106 | #if 0 | 106 | #if 0 |
107 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); | 107 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); |
108 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next Week"),4 ); | 108 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next Week"),4 ); |
109 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Two Weeks"),5 ); | 109 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Two Weeks"),5 ); |
110 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Month"),6 ); | 110 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Month"),6 ); |
111 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); | 111 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); |
112 | #endif | 112 | #endif |
113 | if ( view == 3 ) { | 113 | if ( view == 3 ) { |
114 | mMainView->showDay( date ); | 114 | mMainView->showDay( date ); |
115 | } else if (view == 4 ) { | 115 | } else if (view == 4 ) { |
116 | mMainView->dateNavigator()->selectDates( date, 7 ); | 116 | mMainView->dateNavigator()->selectDates( date, 7 ); |
117 | } else if (view == 5 ) { | 117 | } else if (view == 5 ) { |
118 | mMainView->dateNavigator()->selectDates( date, 14); | 118 | mMainView->dateNavigator()->selectDates( date, 14); |
119 | } else if (view == 6 ) { | 119 | } else if (view == 6 ) { |
120 | showMonthView(); | 120 | showMonthView(); |
121 | mMainView->dateNavigator()->selectMonthByDate( date ); | 121 | mMainView->dateNavigator()->selectMonthByDate( date ); |
122 | mMainView->dateNavigator()->selectDate( date ); | 122 | mMainView->dateNavigator()->selectDate( date ); |
123 | } else if (view == 7 ) { | 123 | } else if (view == 7 ) { |
124 | mMainView->dateNavigator()->selectDate( date ); | 124 | mMainView->dateNavigator()->selectDate( date ); |
125 | showJournalView(); | 125 | showJournalView(); |
126 | } else if (view == 8 ) { | 126 | } else if (view == 8 ) { |
127 | globalFlagBlockAgenda = 1; | 127 | globalFlagBlockAgenda = 1; |
128 | if ( mCurrentAgendaView != 3 ) | 128 | if ( mCurrentAgendaView != 3 ) |
129 | mCurrentAgendaView = -1; | 129 | mCurrentAgendaView = -1; |
130 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 130 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
131 | globalFlagBlockAgenda = 2; | 131 | globalFlagBlockAgenda = 2; |
132 | mMainView->dateNavigator()->selectDates( date , | 132 | mMainView->dateNavigator()->selectDates( date , |
133 | KOPrefs::instance()->mNextXDays ); | 133 | KOPrefs::instance()->mNextXDays ); |
134 | mFlagShowNextxDays = true; | 134 | mFlagShowNextxDays = true; |
135 | mCurrentAgendaView = 3 ; | 135 | mCurrentAgendaView = 3 ; |
136 | } | 136 | } |
137 | 137 | ||
138 | #if 0 | 138 | #if 0 |
139 | dateNavigator()->blockSignals( true ); | 139 | dateNavigator()->blockSignals( true ); |
140 | dateNavigator()->selectDate( d ); | 140 | dateNavigator()->selectDate( d ); |
141 | dateNavigator()->blockSignals( false ); | 141 | dateNavigator()->blockSignals( false ); |
142 | mViewManager->showDayView(); | 142 | mViewManager->showDayView(); |
143 | #endif | 143 | #endif |
144 | 144 | ||
145 | } | 145 | } |
146 | 146 | ||
147 | 147 | ||
148 | 148 | ||
149 | void KOViewManager::writeSettings(KConfig *config) | 149 | void KOViewManager::writeSettings(KConfig *config) |
150 | { | 150 | { |
151 | config->setGroup("General"); | 151 | config->setGroup("General"); |
152 | 152 | ||
153 | QString view; | 153 | QString view; |
154 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 154 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
155 | else if (mCurrentView == mMonthView) view = "Month"; | 155 | else if (mCurrentView == mMonthView) view = "Month"; |
156 | else if (mCurrentView == mListView) view = "List"; | 156 | else if (mCurrentView == mListView) view = "List"; |
157 | else if (mCurrentView == mJournalView) view = "Journal"; | 157 | else if (mCurrentView == mJournalView) view = "Journal"; |
158 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 158 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
159 | else if (mCurrentView == mTodoView) view = "Todo"; | 159 | else if (mCurrentView == mTodoView) view = "Todo"; |
160 | else view = "Agenda"; | 160 | else view = "Agenda"; |
161 | 161 | ||
162 | config->writeEntry("Current View",view); | 162 | config->writeEntry("Current View",view); |
163 | 163 | ||
164 | if (mAgendaView) { | 164 | if (mAgendaView) { |
165 | mAgendaView->writeSettings(config); | 165 | mAgendaView->writeSettings(config); |
166 | } | 166 | } |
167 | if (mTimeSpanView) { | 167 | if (mTimeSpanView) { |
168 | mTimeSpanView->writeSettings(config); | 168 | mTimeSpanView->writeSettings(config); |
169 | } | 169 | } |
170 | if (mListView) { | 170 | if (mListView) { |
171 | mListView->writeSettings(config); | 171 | mListView->writeSettings(config); |
172 | } | 172 | } |
173 | if (mTodoView) { | 173 | if (mTodoView) { |
174 | mTodoView->saveLayout(config,"Todo View"); | 174 | mTodoView->saveLayout(config,"Todo View"); |
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
178 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 178 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
179 | { | 179 | { |
180 | 180 | ||
181 | //mFlagShowNextxDays = false; | 181 | //mFlagShowNextxDays = false; |
182 | //if(view == mCurrentView) return; | 182 | //if(view == mCurrentView) return; |
183 | if ( view == 0 ) { | 183 | if ( view == 0 ) { |
184 | view = mCurrentView; | 184 | view = mCurrentView; |
185 | if ( view == 0 ) | 185 | if ( view == 0 ) |
186 | return; | 186 | return; |
187 | } | 187 | } |
188 | bool full = fullScreen; | 188 | bool full = fullScreen; |
189 | if(view == mCurrentView && view != mWhatsNextView ) { | 189 | if(view == mCurrentView && view != mWhatsNextView ) { |
190 | if ( mCurrentAgendaView < 0 ) | 190 | if ( mCurrentAgendaView < 0 ) |
191 | return; | 191 | return; |
192 | full = mMainView->leftFrame()->isVisible(); | 192 | full = mMainView->leftFrame()->isVisible(); |
193 | } else { | 193 | } else { |
194 | mCurrentView = view; | 194 | mCurrentView = view; |
195 | |||
196 | // bool full = fullScreen; | 195 | // bool full = fullScreen; |
197 | bool isFull = !mMainView->leftFrame()->isVisible(); | 196 | bool isFull = !mMainView->leftFrame()->isVisible(); |
198 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 197 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
199 | full = true; | 198 | full = true; |
200 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 199 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
201 | full = false; | 200 | full = false; |
202 | } | 201 | } |
203 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 202 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
204 | //raiseCurrentView( full ); | 203 | //raiseCurrentView( full ); |
205 | mMainView->processIncidenceSelection( 0 ); | 204 | mMainView->processIncidenceSelection( 0 ); |
206 | mMainView->updateView(); | 205 | mMainView->updateView(); |
207 | raiseCurrentView( full ); | 206 | raiseCurrentView( full ); |
208 | mMainView->adaptNavigationUnits(); | 207 | mMainView->adaptNavigationUnits(); |
209 | } | 208 | } |
210 | 209 | ||
211 | void KOViewManager::raiseCurrentView( bool fullScreen ) | 210 | void KOViewManager::raiseCurrentView( bool fullScreen ) |
212 | { | 211 | { |
213 | //qDebug("raiseCurrentView "); | ||
214 | mCurrentAgendaView = 0; | 212 | mCurrentAgendaView = 0; |
215 | int wid = mMainView->width() ; | 213 | int wid = mMainView->width() ; |
216 | int hei = mMainView->height(); | 214 | int hei = mMainView->height(); |
217 | if ( mCurrentView == mMonthView ) { | 215 | if ( mCurrentView == mMonthView ) { |
218 | mMainView->navigatorBar()->show(); | 216 | mMainView->navigatorBar()->show(); |
219 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 217 | hei -= mMainView->navigatorBar()->sizeHint().height(); |
220 | //mMainView->navigatorBar()->hide(); | 218 | //mMainView->navigatorBar()->hide(); |
221 | } else { | 219 | } else { |
222 | mMainView->navigatorBar()->hide(); | 220 | mMainView->navigatorBar()->hide(); |
223 | } | 221 | } |
224 | if ( fullScreen ) { | 222 | if ( fullScreen ) { |
225 | mMainView->leftFrame()->hide(); | 223 | mMainView->leftFrame()->hide(); |
226 | } else { | 224 | } else { |
227 | mMainView->leftFrame()->show(); | 225 | mMainView->leftFrame()->show(); |
228 | if ( KOPrefs::instance()->mVerticalScreen ) | 226 | if ( KOPrefs::instance()->mVerticalScreen ) |
229 | hei -= mMainView->leftFrame()->height(); | 227 | hei -= mMainView->leftFrame()->height(); |
230 | else | 228 | else |
231 | wid -= mMainView->leftFrame()->width(); | 229 | wid -= mMainView->leftFrame()->width(); |
232 | } | 230 | } |
233 | emit signalFullScreen( !fullScreen ); | 231 | emit signalFullScreen( !fullScreen ); |
234 | if ( globalFlagBlockAgenda == 5 ) { | 232 | if ( globalFlagBlockAgenda == 5 ) { |
235 | globalFlagBlockAgenda = 4; | 233 | globalFlagBlockAgenda = 4; |
236 | globalFlagBlockAgendaItemPaint = 1; | 234 | globalFlagBlockAgendaItemPaint = 1; |
237 | } | 235 | } |
238 | mMainView->viewStack()->raiseWidget(mCurrentView); | 236 | mMainView->viewStack()->raiseWidget(mCurrentView); |
239 | if ( globalFlagBlockAgenda == 4 ) { | 237 | if ( globalFlagBlockAgenda == 4 ) { |
240 | if ( mCurrentView == mAgendaView ) { | 238 | if ( mCurrentView == mAgendaView ) { |
241 | //globalFlagBlockAgenda =1 ; | 239 | //globalFlagBlockAgenda =1 ; |
242 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 240 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
243 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 241 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
244 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 242 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
245 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 243 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
246 | qApp->processEvents(); | 244 | qApp->processEvents(); |
247 | //qDebug("qApp->processEvents() "); | 245 | //qDebug("qApp->processEvents() "); |
248 | globalFlagBlockAgenda = 0; | 246 | globalFlagBlockAgenda = 0; |
249 | mAgendaView->repaintAgenda(); | 247 | mAgendaView->repaintAgenda(); |
250 | 248 | ||
251 | } | 249 | } |
252 | globalFlagBlockAgenda = 0; | 250 | globalFlagBlockAgenda = 0; |
253 | } | 251 | } |
254 | emit signalAgendaView( mCurrentView == mAgendaView ); | 252 | emit signalAgendaView( mCurrentView == mAgendaView ); |
255 | //qDebug("raiseCurrentView ende "); | 253 | //qDebug("raiseCurrentView ende "); |
256 | 254 | ||
257 | } | 255 | } |
258 | 256 | ||
259 | void KOViewManager::updateView() | 257 | void KOViewManager::updateView() |
260 | { | 258 | { |
261 | // qDebug("KOViewManager::updateView() "); | 259 | // qDebug("KOViewManager::updateView() "); |
262 | // if we are updating mTodoView, we get endless recursion | 260 | // if we are updating mTodoView, we get endless recursion |
263 | if ( mTodoView == mCurrentView ) | 261 | if ( mTodoView == mCurrentView ) |
264 | return; | 262 | return; |
265 | if ( mCurrentView ) mCurrentView->updateView(); | 263 | if ( mCurrentView ) mCurrentView->updateView(); |
266 | 264 | ||
267 | } | 265 | } |
268 | 266 | ||
269 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 267 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
270 | { | 268 | { |
271 | // kdDebug() << "KOViewManager::updateView()" << endl; | 269 | // kdDebug() << "KOViewManager::updateView()" << endl; |
272 | 270 | ||
273 | if (mCurrentView) mCurrentView->showDates(start, end); | 271 | if (mCurrentView) mCurrentView->showDates(start, end); |
274 | 272 | ||
275 | if (mTodoView) mTodoView->updateView(); | 273 | if (mTodoView) mTodoView->updateView(); |
276 | } | 274 | } |
277 | 275 | ||
278 | 276 | ||
279 | void KOViewManager::updateWNview() | 277 | void KOViewManager::updateWNview() |
280 | { | 278 | { |
281 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 279 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
282 | mWhatsNextView->updateView(); | 280 | mWhatsNextView->updateView(); |
283 | 281 | ||
284 | } | 282 | } |
285 | void KOViewManager::showWhatsNextView() | 283 | void KOViewManager::showWhatsNextView() |
286 | { | 284 | { |
287 | if (!mWhatsNextView) { | 285 | if (!mWhatsNextView) { |
288 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 286 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
289 | "KOViewManager::WhatsNextView"); | 287 | "KOViewManager::WhatsNextView"); |
290 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 288 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
291 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 289 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
292 | addView(mWhatsNextView); | 290 | addView(mWhatsNextView); |
293 | connect(this, SIGNAL( printWNV() ), | 291 | connect(this, SIGNAL( printWNV() ), |
294 | mWhatsNextView, SLOT( printMe() ) ); | 292 | mWhatsNextView, SLOT( printMe() ) ); |
295 | } | 293 | } |
296 | globalFlagBlockAgenda = 1; | 294 | globalFlagBlockAgenda = 1; |
297 | showView(mWhatsNextView, true ); | 295 | showView(mWhatsNextView, true ); |
298 | //mWhatsNextView->updateView(); | 296 | //mWhatsNextView->updateView(); |
299 | 297 | ||
300 | } | 298 | } |
301 | 299 | ||
302 | void KOViewManager::showListView() | 300 | void KOViewManager::showListView() |
303 | { | 301 | { |
304 | if (!mListView) { | 302 | if (!mListView) { |
305 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 303 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
306 | addView(mListView); | 304 | addView(mListView); |
307 | 305 | ||
308 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 306 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
309 | mMainView, SLOT(showIncidence(Incidence *))); | 307 | mMainView, SLOT(showIncidence(Incidence *))); |
310 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 308 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
311 | mMainView, SLOT(editIncidence(Incidence *))); | 309 | mMainView, SLOT(editIncidence(Incidence *))); |
312 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 310 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
313 | mMainView, SLOT(deleteIncidence(Incidence *))); | 311 | mMainView, SLOT(deleteIncidence(Incidence *))); |
314 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 312 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
315 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 313 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
316 | connect( mListView, SIGNAL( signalNewEvent() ), | 314 | connect( mListView, SIGNAL( signalNewEvent() ), |
317 | mMainView, SLOT( newEvent() ) ); | 315 | mMainView, SLOT( newEvent() ) ); |
318 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 316 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
319 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 317 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
320 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 318 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
321 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 319 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
322 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 320 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
323 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 321 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
324 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 322 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
325 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 323 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
326 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 324 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
327 | } | 325 | } |
328 | // bool temp = mFlagShowNextxDays; | 326 | // bool temp = mFlagShowNextxDays; |
329 | //globalFlagBlockPainting = true; | 327 | //globalFlagBlockPainting = true; |
330 | globalFlagBlockAgenda = 1; | 328 | globalFlagBlockAgenda = 1; |
331 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { | 329 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { |
332 | mMainView->setBlockShowDates( true ); | 330 | mMainView->setBlockShowDates( true ); |
333 | mMainView->dateNavigator()->selectMonth(); | 331 | mMainView->dateNavigator()->selectMonth(); |
334 | mMainView->setBlockShowDates( false ); | 332 | mMainView->setBlockShowDates( false ); |
335 | } | 333 | } |
336 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 334 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
337 | //mFlagShowNextxDays = temp; | 335 | //mFlagShowNextxDays = temp; |
338 | } | 336 | } |
339 | 337 | ||
340 | void KOViewManager::showAgendaView( bool fullScreen ) | 338 | void KOViewManager::showAgendaView( bool fullScreen ) |
341 | { | 339 | { |
342 | 340 | ||
343 | mMainView->dialogManager()->hideSearchDialog(); | 341 | mMainView->dialogManager()->hideSearchDialog(); |
344 | // qDebug("KOViewManager::showAgendaView "); | 342 | // qDebug("KOViewManager::showAgendaView "); |
345 | bool full; | 343 | bool full; |
346 | full = fullScreen; | 344 | full = fullScreen; |
347 | if (!mAgendaView) { | 345 | if (!mAgendaView) { |
348 | full = false; | 346 | full = false; |
349 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 347 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
350 | addView(mAgendaView); | 348 | addView(mAgendaView); |
351 | #ifndef DESKTOP_VERSION | 349 | #ifndef DESKTOP_VERSION |
352 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 350 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
353 | #endif | 351 | #endif |
354 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 352 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
355 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 353 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
356 | 354 | ||
357 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 355 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
358 | 356 | ||
359 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); | 357 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); |
360 | 358 | ||
361 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), | 359 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), |
362 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); | 360 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); |
363 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 361 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
364 | mMainView, SLOT(newEvent(QDateTime))); | 362 | mMainView, SLOT(newEvent(QDateTime))); |
365 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 363 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
366 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 364 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
367 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 365 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
368 | mMainView, SLOT(newEvent(QDate))); | 366 | mMainView, SLOT(newEvent(QDate))); |
369 | 367 | ||
370 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 368 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
371 | mMainView, SLOT(editIncidence(Incidence *))); | 369 | mMainView, SLOT(editIncidence(Incidence *))); |
372 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 370 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
373 | mMainView, SLOT(showIncidence(Incidence *))); | 371 | mMainView, SLOT(showIncidence(Incidence *))); |
374 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 372 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
375 | mMainView, SLOT(deleteIncidence(Incidence *))); | 373 | mMainView, SLOT(deleteIncidence(Incidence *))); |
376 | 374 | ||
377 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 375 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
378 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 376 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
379 | 377 | ||
380 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 378 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
381 | mMainView, SLOT( toggleExpand() ) ); | 379 | mMainView, SLOT( toggleExpand() ) ); |
382 | 380 | ||
383 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | 381 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), |
384 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | 382 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); |
385 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 383 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
386 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 384 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
387 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 385 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
388 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 386 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
389 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 387 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
390 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 388 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
391 | SLOT( updateTodo( Todo *, int ) ) ); | 389 | SLOT( updateTodo( Todo *, int ) ) ); |
392 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 390 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
393 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 391 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
394 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 392 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
395 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 393 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
396 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 394 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
397 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 395 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
398 | mAgendaView->readSettings(); | 396 | mAgendaView->readSettings(); |
399 | mAgendaView->updateConfig(); | 397 | mAgendaView->updateConfig(); |
400 | } | 398 | } |
401 | 399 | ||
402 | showView( mAgendaView, full); | 400 | showView( mAgendaView, full); |
403 | 401 | ||
404 | } | 402 | } |
405 | 403 | ||