-rw-r--r-- | korganizer/calendarview.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index d6918d3..6eaac1c 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3485,263 +3485,267 @@ void CalendarView::processIncidenceSelection( Incidence *incidence ) | |||
3485 | return; | 3485 | return; |
3486 | } else { | 3486 | } else { |
3487 | if ( incidence && incidence->type() == "Todo" ) { | 3487 | if ( incidence && incidence->type() == "Todo" ) { |
3488 | emit todoSelected( true ); | 3488 | emit todoSelected( true ); |
3489 | Todo *event = static_cast<Todo *>( incidence ); | 3489 | Todo *event = static_cast<Todo *>( incidence ); |
3490 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3490 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3491 | emit organizerEventsSelected( true ); | 3491 | emit organizerEventsSelected( true ); |
3492 | } else { | 3492 | } else { |
3493 | emit organizerEventsSelected(false); | 3493 | emit organizerEventsSelected(false); |
3494 | } | 3494 | } |
3495 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3495 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3496 | KOPrefs::instance()->email() ) ) { | 3496 | KOPrefs::instance()->email() ) ) { |
3497 | emit groupEventsSelected( true ); | 3497 | emit groupEventsSelected( true ); |
3498 | } else { | 3498 | } else { |
3499 | emit groupEventsSelected(false); | 3499 | emit groupEventsSelected(false); |
3500 | } | 3500 | } |
3501 | return; | 3501 | return; |
3502 | } else { | 3502 | } else { |
3503 | emit todoSelected( false ); | 3503 | emit todoSelected( false ); |
3504 | emit organizerEventsSelected(false); | 3504 | emit organizerEventsSelected(false); |
3505 | emit groupEventsSelected(false); | 3505 | emit groupEventsSelected(false); |
3506 | } | 3506 | } |
3507 | return; | 3507 | return; |
3508 | } | 3508 | } |
3509 | 3509 | ||
3510 | /* if ( incidence && incidence->type() == "Todo" ) { | 3510 | /* if ( incidence && incidence->type() == "Todo" ) { |
3511 | emit todoSelected( true ); | 3511 | emit todoSelected( true ); |
3512 | } else { | 3512 | } else { |
3513 | emit todoSelected( false ); | 3513 | emit todoSelected( false ); |
3514 | }*/ | 3514 | }*/ |
3515 | } | 3515 | } |
3516 | 3516 | ||
3517 | 3517 | ||
3518 | void CalendarView::checkClipboard() | 3518 | void CalendarView::checkClipboard() |
3519 | { | 3519 | { |
3520 | #ifndef KORG_NODND | 3520 | #ifndef KORG_NODND |
3521 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { | 3521 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { |
3522 | emit pasteEnabled(true); | 3522 | emit pasteEnabled(true); |
3523 | } else { | 3523 | } else { |
3524 | emit pasteEnabled(false); | 3524 | emit pasteEnabled(false); |
3525 | } | 3525 | } |
3526 | #endif | 3526 | #endif |
3527 | } | 3527 | } |
3528 | 3528 | ||
3529 | void CalendarView::showDates(const DateList &selectedDates) | 3529 | void CalendarView::showDates(const DateList &selectedDates) |
3530 | { | 3530 | { |
3531 | // kdDebug() << "CalendarView::selectDates()" << endl; | 3531 | // kdDebug() << "CalendarView::selectDates()" << endl; |
3532 | 3532 | ||
3533 | 3533 | ||
3534 | if ( !mBlockShowDates ) { | 3534 | if ( !mBlockShowDates ) { |
3535 | if ( mViewManager->currentView() ) { | 3535 | if ( mViewManager->currentView() ) { |
3536 | updateView( selectedDates.first(), selectedDates.last() ); | 3536 | updateView( selectedDates.first(), selectedDates.last() ); |
3537 | } else { | 3537 | } else { |
3538 | mViewManager->showAgendaView(); | 3538 | mViewManager->showAgendaView(); |
3539 | } | 3539 | } |
3540 | } | 3540 | } |
3541 | 3541 | ||
3542 | QString selDates; | 3542 | QString selDates; |
3543 | selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); | 3543 | selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); |
3544 | if (selectedDates.first() < selectedDates.last() ) | 3544 | if (selectedDates.first() < selectedDates.last() ) |
3545 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 3545 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
3546 | else { | 3546 | else { |
3547 | QString addString; | 3547 | QString addString; |
3548 | if ( selectedDates.first() == QDateTime::currentDateTime().date() ) | 3548 | if ( selectedDates.first() == QDateTime::currentDateTime().date() ) |
3549 | addString = i18n("Today"); | 3549 | addString = i18n("Today"); |
3550 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) | 3550 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) |
3551 | addString = i18n("Tomorrow"); | 3551 | addString = i18n("Tomorrow"); |
3552 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) | 3552 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) |
3553 | addString = i18n("Yesterday"); | 3553 | addString = i18n("Yesterday"); |
3554 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) | 3554 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) |
3555 | addString = i18n("Day before yesterday"); | 3555 | addString = i18n("Day before yesterday"); |
3556 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) | 3556 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) |
3557 | addString = i18n("Day after tomorrow"); | 3557 | addString = i18n("Day after tomorrow"); |
3558 | if ( !addString.isEmpty() ) { | 3558 | if ( !addString.isEmpty() ) { |
3559 | topLevelWidget()->setCaption( addString+", " + selDates ); | 3559 | topLevelWidget()->setCaption( addString+", " + selDates ); |
3560 | return; | 3560 | return; |
3561 | } | 3561 | } |
3562 | } | 3562 | } |
3563 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 3563 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
3564 | 3564 | ||
3565 | } | 3565 | } |
3566 | 3566 | ||
3567 | QPtrList<CalFilter> CalendarView::filters() | 3567 | QPtrList<CalFilter> CalendarView::filters() |
3568 | { | 3568 | { |
3569 | return mFilters; | 3569 | return mFilters; |
3570 | 3570 | ||
3571 | } | 3571 | } |
3572 | void CalendarView::editFilters() | 3572 | void CalendarView::editFilters() |
3573 | { | 3573 | { |
3574 | // kdDebug() << "CalendarView::editFilters()" << endl; | 3574 | // kdDebug() << "CalendarView::editFilters()" << endl; |
3575 | 3575 | ||
3576 | CalFilter *filter = mFilters.first(); | 3576 | CalFilter *filter = mFilters.first(); |
3577 | while(filter) { | 3577 | while(filter) { |
3578 | kdDebug() << " Filter: " << filter->name() << endl; | 3578 | kdDebug() << " Filter: " << filter->name() << endl; |
3579 | filter = mFilters.next(); | 3579 | filter = mFilters.next(); |
3580 | } | 3580 | } |
3581 | 3581 | ||
3582 | mDialogManager->showFilterEditDialog(&mFilters); | 3582 | mDialogManager->showFilterEditDialog(&mFilters); |
3583 | } | 3583 | } |
3584 | void CalendarView::toggleFilter() | 3584 | void CalendarView::toggleFilter() |
3585 | { | 3585 | { |
3586 | showFilter(! mFilterView->isVisible()); | 3586 | showFilter(! mFilterView->isVisible()); |
3587 | } | 3587 | } |
3588 | 3588 | ||
3589 | KOFilterView *CalendarView::filterView() | 3589 | KOFilterView *CalendarView::filterView() |
3590 | { | 3590 | { |
3591 | return mFilterView; | 3591 | return mFilterView; |
3592 | } | 3592 | } |
3593 | void CalendarView::selectFilter( int fil ) | 3593 | void CalendarView::selectFilter( int fil ) |
3594 | { | 3594 | { |
3595 | mFilterView->setSelectedFilter( fil ); | 3595 | mFilterView->setSelectedFilter( fil ); |
3596 | } | 3596 | } |
3597 | void CalendarView::showFilter(bool visible) | 3597 | void CalendarView::showFilter(bool visible) |
3598 | { | 3598 | { |
3599 | if (visible) mFilterView->show(); | 3599 | if (visible) mFilterView->show(); |
3600 | else mFilterView->hide(); | 3600 | else mFilterView->hide(); |
3601 | } | 3601 | } |
3602 | void CalendarView::toggleFilerEnabled( ) | 3602 | void CalendarView::toggleFilerEnabled( ) |
3603 | { | 3603 | { |
3604 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); | 3604 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); |
3605 | if ( !mFilterView->filtersEnabled() ) | 3605 | if ( !mFilterView->filtersEnabled() ) |
3606 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); | 3606 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); |
3607 | 3607 | ||
3608 | } | 3608 | } |
3609 | void CalendarView::updateFilter() | 3609 | void CalendarView::updateFilter() |
3610 | { | 3610 | { |
3611 | CalFilter *filter = mFilterView->selectedFilter(); | 3611 | CalFilter *filter = mFilterView->selectedFilter(); |
3612 | if (filter) { | 3612 | if (filter) { |
3613 | QString mess; | ||
3613 | if (mFilterView->filtersEnabled()) { | 3614 | if (mFilterView->filtersEnabled()) { |
3614 | topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); | 3615 | mess = i18n("Filter selected: ")+filter->name(); |
3615 | filter->setEnabled(true); | 3616 | filter->setEnabled(true); |
3616 | } | 3617 | } |
3617 | else filter->setEnabled(false); | 3618 | else filter->setEnabled(false); |
3618 | mCalendar->setFilter(filter); | 3619 | mCalendar->setFilter(filter); |
3619 | updateView(); | 3620 | updateView(); |
3621 | if ( !mess.isEmpty() ) | ||
3622 | topLevelWidget()->setCaption( mess ); | ||
3623 | |||
3620 | } | 3624 | } |
3621 | } | 3625 | } |
3622 | 3626 | ||
3623 | void CalendarView::filterEdited() | 3627 | void CalendarView::filterEdited() |
3624 | { | 3628 | { |
3625 | mFilterView->updateFilters(); | 3629 | mFilterView->updateFilters(); |
3626 | updateFilter(); | 3630 | updateFilter(); |
3627 | writeSettings(); | 3631 | writeSettings(); |
3628 | } | 3632 | } |
3629 | 3633 | ||
3630 | 3634 | ||
3631 | void CalendarView::takeOverEvent() | 3635 | void CalendarView::takeOverEvent() |
3632 | { | 3636 | { |
3633 | Incidence *incidence = currentSelection(); | 3637 | Incidence *incidence = currentSelection(); |
3634 | 3638 | ||
3635 | if (!incidence) return; | 3639 | if (!incidence) return; |
3636 | 3640 | ||
3637 | incidence->setOrganizer(KOPrefs::instance()->email()); | 3641 | incidence->setOrganizer(KOPrefs::instance()->email()); |
3638 | incidence->recreate(); | 3642 | incidence->recreate(); |
3639 | incidence->setReadOnly(false); | 3643 | incidence->setReadOnly(false); |
3640 | 3644 | ||
3641 | updateView(); | 3645 | updateView(); |
3642 | } | 3646 | } |
3643 | 3647 | ||
3644 | void CalendarView::takeOverCalendar() | 3648 | void CalendarView::takeOverCalendar() |
3645 | { | 3649 | { |
3646 | // TODO: Create Calendar::allIncidences() function and use it here | 3650 | // TODO: Create Calendar::allIncidences() function and use it here |
3647 | 3651 | ||
3648 | QPtrList<Event> events = mCalendar->events(); | 3652 | QPtrList<Event> events = mCalendar->events(); |
3649 | for(uint i=0; i<events.count(); ++i) { | 3653 | for(uint i=0; i<events.count(); ++i) { |
3650 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3654 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3651 | events.at(i)->recreate(); | 3655 | events.at(i)->recreate(); |
3652 | events.at(i)->setReadOnly(false); | 3656 | events.at(i)->setReadOnly(false); |
3653 | } | 3657 | } |
3654 | 3658 | ||
3655 | QPtrList<Todo> todos = mCalendar->todos(); | 3659 | QPtrList<Todo> todos = mCalendar->todos(); |
3656 | for(uint i=0; i<todos.count(); ++i) { | 3660 | for(uint i=0; i<todos.count(); ++i) { |
3657 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3661 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3658 | todos.at(i)->recreate(); | 3662 | todos.at(i)->recreate(); |
3659 | todos.at(i)->setReadOnly(false); | 3663 | todos.at(i)->setReadOnly(false); |
3660 | } | 3664 | } |
3661 | 3665 | ||
3662 | QPtrList<Journal> journals = mCalendar->journals(); | 3666 | QPtrList<Journal> journals = mCalendar->journals(); |
3663 | for(uint i=0; i<journals.count(); ++i) { | 3667 | for(uint i=0; i<journals.count(); ++i) { |
3664 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3668 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3665 | journals.at(i)->recreate(); | 3669 | journals.at(i)->recreate(); |
3666 | journals.at(i)->setReadOnly(false); | 3670 | journals.at(i)->setReadOnly(false); |
3667 | } | 3671 | } |
3668 | 3672 | ||
3669 | updateView(); | 3673 | updateView(); |
3670 | } | 3674 | } |
3671 | 3675 | ||
3672 | void CalendarView::showIntro() | 3676 | void CalendarView::showIntro() |
3673 | { | 3677 | { |
3674 | kdDebug() << "To be implemented." << endl; | 3678 | kdDebug() << "To be implemented." << endl; |
3675 | } | 3679 | } |
3676 | 3680 | ||
3677 | QWidgetStack *CalendarView::viewStack() | 3681 | QWidgetStack *CalendarView::viewStack() |
3678 | { | 3682 | { |
3679 | return mRightFrame; | 3683 | return mRightFrame; |
3680 | } | 3684 | } |
3681 | 3685 | ||
3682 | QWidget *CalendarView::leftFrame() | 3686 | QWidget *CalendarView::leftFrame() |
3683 | { | 3687 | { |
3684 | return mLeftFrame; | 3688 | return mLeftFrame; |
3685 | } | 3689 | } |
3686 | 3690 | ||
3687 | DateNavigator *CalendarView::dateNavigator() | 3691 | DateNavigator *CalendarView::dateNavigator() |
3688 | { | 3692 | { |
3689 | return mNavigator; | 3693 | return mNavigator; |
3690 | } | 3694 | } |
3691 | 3695 | ||
3692 | KDateNavigator* CalendarView::dateNavigatorWidget() | 3696 | KDateNavigator* CalendarView::dateNavigatorWidget() |
3693 | { | 3697 | { |
3694 | return mDateNavigator; | 3698 | return mDateNavigator; |
3695 | } | 3699 | } |
3696 | void CalendarView::toggleDateNavigatorWidget() | 3700 | void CalendarView::toggleDateNavigatorWidget() |
3697 | { | 3701 | { |
3698 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; | 3702 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; |
3699 | if (!KOPrefs::instance()->mShowDateNavigator ) | 3703 | if (!KOPrefs::instance()->mShowDateNavigator ) |
3700 | mDateNavigator->hide(); | 3704 | mDateNavigator->hide(); |
3701 | else | 3705 | else |
3702 | mDateNavigator->show(); | 3706 | mDateNavigator->show(); |
3703 | } | 3707 | } |
3704 | void CalendarView::addView(KOrg::BaseView *view) | 3708 | void CalendarView::addView(KOrg::BaseView *view) |
3705 | { | 3709 | { |
3706 | mViewManager->addView(view); | 3710 | mViewManager->addView(view); |
3707 | } | 3711 | } |
3708 | 3712 | ||
3709 | void CalendarView::showView(KOrg::BaseView *view) | 3713 | void CalendarView::showView(KOrg::BaseView *view) |
3710 | { | 3714 | { |
3711 | mViewManager->showView(view, mLeftFrame->isVisible()); | 3715 | mViewManager->showView(view, mLeftFrame->isVisible()); |
3712 | } | 3716 | } |
3713 | 3717 | ||
3714 | Incidence *CalendarView::currentSelection() | 3718 | Incidence *CalendarView::currentSelection() |
3715 | { | 3719 | { |
3716 | return mViewManager->currentSelection(); | 3720 | return mViewManager->currentSelection(); |
3717 | } | 3721 | } |
3718 | void CalendarView::toggleAllDaySize() | 3722 | void CalendarView::toggleAllDaySize() |
3719 | { | 3723 | { |
3720 | /* | 3724 | /* |
3721 | if ( KOPrefs::instance()->mAllDaySize > 47 ) | 3725 | if ( KOPrefs::instance()->mAllDaySize > 47 ) |
3722 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; | 3726 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; |
3723 | else | 3727 | else |
3724 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; | 3728 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; |
3725 | */ | 3729 | */ |
3726 | viewManager()->agendaView()->toggleAllDay(); | 3730 | viewManager()->agendaView()->toggleAllDay(); |
3727 | } | 3731 | } |
3728 | void CalendarView::toggleExpand() | 3732 | void CalendarView::toggleExpand() |
3729 | { | 3733 | { |
3730 | // if ( mLeftFrame->isHidden() ) { | 3734 | // if ( mLeftFrame->isHidden() ) { |
3731 | // mLeftFrame->show(); | 3735 | // mLeftFrame->show(); |
3732 | // emit calendarViewExpanded( false ); | 3736 | // emit calendarViewExpanded( false ); |
3733 | // } else { | 3737 | // } else { |
3734 | // mLeftFrame->hide(); | 3738 | // mLeftFrame->hide(); |
3735 | // emit calendarViewExpanded( true ); | 3739 | // emit calendarViewExpanded( true ); |
3736 | // } | 3740 | // } |
3737 | //qDebug(" CalendarView::toggleExpand()"); | 3741 | //qDebug(" CalendarView::toggleExpand()"); |
3738 | globalFlagBlockAgenda = 1; | 3742 | globalFlagBlockAgenda = 1; |
3739 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); | 3743 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); |
3740 | globalFlagBlockAgenda = 5; | 3744 | globalFlagBlockAgenda = 5; |
3741 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); | 3745 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); |
3742 | //mViewManager->showView( 0, true ); | 3746 | //mViewManager->showView( 0, true ); |
3743 | } | 3747 | } |
3744 | 3748 | ||
3745 | void CalendarView::calendarModified( bool modified, Calendar * ) | 3749 | void CalendarView::calendarModified( bool modified, Calendar * ) |
3746 | { | 3750 | { |
3747 | setModified( modified ); | 3751 | setModified( modified ); |